開発メモ

開発用のメモです。

EC CUBE 休日テーブル更新

<?php
$id = 0;
$this-> objQuery-> delete($table);
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "元日(1月1日)",
    'month' => 1,
    'day' => 1,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "成人の日(1月第2月曜日)",
    'month' => 1,
    'day' => date("d", strtotime('second monday of ' . date("Y-01-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "建国記念の日(2月11日)",
    'month' => 2,
    'day' => 11,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "春分の日(3月21日)",
    'month' => 3,
    'day' => 21,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "昭和の日(4月29日)",
    'month' => 4,
    'day' => 29,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "憲法記念日(5月3日)",
    'month' => 5,
    'day' => 3,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "みどりの日(5月4日)",
    'month' => 5,
    'day' => 4,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "こどもの日(5月5日)",
    'month' => 5,
    'day' => 5,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "海の日(7月第3月曜日)",
    'month' => 7,
    'day' => date("d", strtotime('third monday of ' . date("Y-07-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "敬老の日(9月第3月曜日)",
    'month' => 9,
    'day' => date("d", strtotime('third monday of ' . date("Y-09-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
if (date("d", strtotime('third monday of ' . date("Y-09-01")) == 21)) {
    $this-> objQuery-> insert($table, array(
        'holiday_id' => ++$id,
        'title' => "国民の休日(9月22日)",
        'month' => 9,
        'day' => 22,
        'rank' => $id - 1,
        'creator_id' => 0,
        'create_date' => "",
        'update_date' => "",
        'create_date' => "CURRENT_TIMESTAMP",
        'update_date' => "CURRENT_TIMESTAMP",
        'del_flg' => 0
    ));
}
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "秋分の日(9月23日)",
    'month' => 9,
    'day' => 23,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "体育の日(10月第2月曜日)",
    'month' => 10,
    'day' => date("d", strtotime('second monday of ' . date("Y-10-01"))),
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "文化の日(11月3日)",
    'month' => 11,
    'day' => 3,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "勤労感謝の日(11月23日)",
    'month' => 11,
    'day' => 23,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));
$this-> objQuery-> insert($table, array(
    'holiday_id' => ++$id,
    'title' => "天皇誕生日(12月23日)",
    'month' => 21,
    'day' => 23,
    'rank' => $id - 1,
    'creator_id' => 0,
    'create_date' => "",
    'update_date' => "",
    'create_date' => "CURRENT_TIMESTAMP",
    'update_date' => "CURRENT_TIMESTAMP",
    'del_flg' => 0
));

Smarty 最上、最下用リンクの作り方(section loop)

<!--{section name=cnt loop=$arrList}-->
<tr id="<!--{$arrList[cnt].category_id}-->" style="background:<!--{if $arrForm.category_id != $arrList[cnt].category_id}-->#ffffff<!--{else}--><!--{$smarty.const.SELECT_RGB}--><!--{/if}-->;" align="left">
    <td class="center">
        <!--{$arrList[cnt].category_id}-->
    </td>
    <td>
        <!--{if $arrList[cnt].level != $smarty.const.LEVEL_MAX}-->
        <a href="?" onclick="eccube.setModeAndSubmit('tree', 'parent_category_id', <!--{$arrList[cnt].category_id}-->); return false"><!--{$arrList[cnt].category_name|h}--></a>
        <!--{else}-->
        <!--{$arrList[cnt].category_name|h}-->
        <!--{/if}-->
    </td>
    <td class="center">
        <!--{if $arrForm.category_id != $arrList[cnt].category_id}-->
        <a href="?" onclick="eccube.setModeAndSubmit('pre_edit', 'category_id', <!--{$arrList[cnt].category_id}-->); return false;">編集</a>
        <!--{else}-->
        編集中
        <!--{/if}-->
    </td>
    <td class="center">
        <a href="?" onclick="eccube.setModeAndSubmit('delete', 'category_id', <!--{$arrList[cnt].category_id}-->); return false;">削除</a>
    </td>
    <td class="center">
        <a href="?" onclick="eccube.setModeAndSubmit('tree', 'parent_category_id', <!--{$child.category_id}-->); return false;">追加/確認</a>
    </td>
    <td class="center">
        <!--{* 移動 *}-->
        <!--{if $smarty.section.cnt.iteration != 1 && $smarty.section.cnt.iteration != 2}-->
        <a href="?" onclick="eccube.setModeAndSubmit('up2','category_id', <!--{$arrList[cnt].category_id}-->); return false;">再上</a>
        <!--{/if}-->
    </td>
    <td class="center">
        <!--{* 移動 *}-->
        <!--{if $smarty.section.cnt.iteration != 1}-->
        <a href="?" onclick="eccube.setModeAndSubmit('up','category_id', <!--{$arrList[cnt].category_id}-->); return false;">上へ</a>
        <!--{/if}-->
    </td>
    <td class="center">
        <!--{* 移動 *}-->
        <!--{if $smarty.section.cnt.iteration != $smarty.section.cnt.last}-->
        <a href="?" onclick="eccube.setModeAndSubmit('down','category_id', <!--{$arrList[cnt].category_id}-->); return false;">下へ</a>
        <!--{/if}-->
    </td>
    <td class="center">
        <!--{* 移動 *}-->
        <!--{if $smarty.section.cnt.iteration != $smarty.section.cnt.last && $smarty.section.cnt.index_next != $smarty.section.cnt.loop-1}-->
        <a href="?" onclick="eccube.setModeAndSubmit('down2','category_id', <!--{$arrList[cnt].category_id}-->); return false;">最下</a>
        <!--{/if}-->
    </td>

</tr>
<!--{/section}-->
Twitter: @asahina_alice