Source for file LC_Page_Admin_Basis_Holiday.php
Documentation is available at LC_Page_Admin_Basis_Holiday.php
* This file is part of EC-CUBE
* Copyright(c) 2000-2011 LOCKON CO.,LTD. All Rights Reserved.
* http://www.lockon.co.jp/
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
require_once CLASS_EX_REALDIR . 'page_extends/admin/LC_Page_Admin_Ex.php';
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Admin_Basis_Holiday.php 21185 2011-08-11 10:37:10Z shutta $
$this->tpl_mainpage = 'basis/holiday.tpl';
$this->tpl_subno = 'holiday';
$this->tpl_maintitle = '基本情報管理';
$this->tpl_subtitle = '定休日管理';
$this->tpl_mainno = 'basis';
$objDb = new SC_Helper_DB_Ex();
$objDate = new SC_Date_Ex();
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$mode = $this->getMode();
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$objFormParam->convParam();
$holiday_id = $objFormParam->getValue('holiday_id');
if (!empty($this->arrErr['holiday_id'])) {
SC_Utils_Ex::sfDispException();
$post = $objFormParam->getHashArray();
$this->arrForm = $this->arrForm = $_POST;
if(count($this->arrErr) <= 0) {
if($post['holiday_id'] == "") {
$this->objDisplay->reload();
$this->tpl_holiday_id = $post['holiday_id'];
$objDb->sfDeleteRankRecord("dtb_holiday", "holiday_id", $post['holiday_id'], "", true);
$this->objDisplay->reload();
$this->arrForm['title'] = $arrHolidayData[0]['title'];
$this->arrForm['month'] = $arrHolidayData[0]['month'];
$this->arrForm['day'] = $arrHolidayData[0]['day'];
$this->tpl_holiday_id = $post['holiday_id'];
$objDb->sfRankDown("dtb_holiday", "holiday_id", $post['holiday_id']);
$this->objDisplay->reload();
$objDb->sfRankUp("dtb_holiday", "holiday_id", $post['holiday_id']);
$this->objDisplay->reload();
$this->tpl_holiday_id = $holiday_id;
$objQuery = & SC_Query_Ex::getSingletonInstance();
$where = "holiday_id = ?";
return $objQuery->select("title, month, day", "dtb_holiday", $where, array($holiday_id));
$objQuery = & SC_Query_Ex::getSingletonInstance();
$objQuery->setOrder("rank DESC");
return $objQuery->select("holiday_id, title, month, day", "dtb_holiday", $where);
$objQuery = & SC_Query_Ex::getSingletonInstance();
$sqlval['title'] = $arrData['title'];
$sqlval['month'] = $arrData['month'];
$sqlval['day'] = $arrData['day'];
$sqlval['creator_id'] = $member_id;
$sqlval['rank'] = $objQuery->max('rank', "dtb_holiday") + 1;
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$sqlval['create_date'] = 'CURRENT_TIMESTAMP';
$sqlval['holiday_id'] = $objQuery->nextVal('dtb_holiday_holiday_id');
$ret = $objQuery->insert("dtb_holiday", $sqlval);
$objQuery = & SC_Query_Ex::getSingletonInstance();
$sqlval['title'] = $arrData['title'];
$sqlval['month'] = $arrData['month'];
$sqlval['day'] = $arrData['day'];
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$where = "holiday_id = ?";
$ret = $objQuery->update("dtb_holiday", $sqlval, $where, array($arrData['holiday_id']));
$objFormParam->addParam('タイトル', 'title', STEXT_LEN, 'KVa', array("EXIST_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objFormParam->addParam('月', 'month', INT_LEN, 'n', array("SELECT_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objFormParam->addParam('日', 'day', INT_LEN, 'n', array("SELECT_CHECK","SPTAB_CHECK","MAX_LENGTH_CHECK"));
$objFormParam->addParam('定休日ID', 'holiday_id', INT_LEN, 'n', array('NUM_CHECK', 'MAX_LENGTH_CHECK'));
$objFormParam->convParam();
$arrErr = $objFormParam->checkError();
$post = $objFormParam->getHashArray();
if(!isset ($arrErr['date'])) {
$objQuery = & SC_Query_Ex::getSingletonInstance();
$where = "del_flg = 0 AND month = ? AND day = ?";
$arrval = array($post['month'], $post['day']);
if (!empty($post['holiday_id'])) {
$where .= " AND holiday_id <> ?";
$arrval[] = $post['holiday_id'];
$arrRet = $objQuery->select("count(holiday_id) as count", "dtb_holiday", $where, $arrval);
// 編集中のレコード以外に同じ日付が存在する場合
if ($arrRet[0]['count'] > 0) {
$arrErr['date'] = "※ 既に同じ日付の登録が存在します。<br>";
Documentation generated on Fri, 24 Feb 2012 14:01:02 +0900 by Seasoft
|