Source for file LC_Page_Admin_Contents.php
Documentation is available at LC_Page_Admin_Contents.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_Contents.php 21232 2011-09-04 15:44:01Z Seasoft $
$this->tpl_mainpage = 'contents/index.tpl';
$this->tpl_subno = 'index';
$this->tpl_mainno = 'contents';
$this->tpl_maintitle = 'コンテンツ管理';
$this->tpl_subtitle = '新着情報管理';
$objDate = new SC_Date_Ex(ADMIN_NEWS_STARTYEAR);
$this->arrYear = $objDate->getYear();
$this->arrMonth = $objDate->getMonth();
$this->arrDay = $objDate->getDay();
$objDb = new SC_Helper_DB_Ex();
$objFormParam = new SC_FormParam_Ex();
$objFormParam->setParam($_POST);
$objFormParam->convParam();
$news_id = $objFormParam->getValue('news_id');
switch ($this->getMode()) {
$arrPost = $objFormParam->getHashArray();
if (SC_Utils_Ex::isBlank($this->arrErr)) {
// ニュースIDの値がPOSTされて来た場合は既存データの編集とみなし、
// ニュースIDが存在しない場合は新規登録を行う。
$member_id = $_SESSION['member_id'];
$this->tpl_onload = "window.alert('編集が完了しました');";
$this->arrForm = $arrPost;
list ($this->arrForm) = $this->getNews($news_id);
list ($this->arrForm['year'],$this->arrForm['month'],$this->arrForm['day']) = $this->splitNewsDate($this->arrForm['cast_news_date']);
SC_Response_Ex::reload(); //自分にリダイレクト(再読込による誤動作防止)
$term = $objFormParam->getValue('term');
$objDb->sfRankUp("dtb_news", "news_id", $news_id);
} else if ($term == 'down') {
$objDb->sfRankDown("dtb_news", "news_id", $news_id);
$this->objDisplay->reload();
if(SC_Utils_Ex::sfIsInt($input_pos)) {
$objDb->sfMoveRank("dtb_news", "news_id", $news_id, $input_pos);
$this->objDisplay->reload();
$this->tpl_news_id = $news_id;
$this->line_max = count($this->arrNews);
* 入力されたパラメーターのエラーチェックを行う。
* @param Object $objFormParam
$objErr = new SC_CheckError_Ex($objFormParam->getHashArray());
$objErr->arrErr = $objFormParam->checkError();
$objErr->doFunc(array("日付", 'year', 'month', 'day'), array("CHECK_DATE"));
* @param Object $objFormParam
$objFormParam->addParam("news_id", 'news_id');
$objFormParam->addParam("日付(年)", 'year', INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("日付(月)", 'month', INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("日付(日)", 'day', INT_LEN, 'n', array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("タイトル", 'news_title', MTEXT_LEN, 'KVa', array("EXIST_CHECK","MAX_LENGTH_CHECK","SPTAB_CHECK"));
$objFormParam->addParam('URL', 'news_url', URL_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
$objFormParam->addParam("本文", 'news_comment', LTEXT_LEN, 'KVa', array("MAX_LENGTH_CHECK"));
$objFormParam->addParam("別ウィンドウで開く", 'link_method', INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
$objFormParam->addParam("ランク移動", 'term', INT_LEN, 'n', array("NUM_CHECK", "MAX_LENGTH_CHECK"));
* @param Array $arrPost POSTデータの配列
* @param Integer $member_id 登録した管理者のID
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$rank_max = $rank_max + 1;
$news_id = $objQuery->nextVal('dtb_news_news_id');
$sqlval['news_id'] = $news_id;
$sqlval['news_date'] = $arrPost['news_date'];
$sqlval['news_title'] = $arrPost['news_title'];
$sqlval['creator_id'] = $member_id;
$sqlval['news_url'] = $arrPost['news_url'];
$sqlval['link_method'] = $arrPost['link_method'];
$sqlval['news_comment'] = $arrPost['news_comment'];
$sqlval['rank'] = $rank_max;
$sqlval['create_date'] = 'CURRENT_TIMESTAMP';
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$objQuery->insert($table, $sqlval);
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$sqlval['news_date'] = $arrPost['news_date'];
$sqlval['news_title'] = $arrPost['news_title'];
$sqlval['creator_id'] = $member_id;
$sqlval['news_url'] = $arrPost['news_url'];
$sqlval['news_comment'] = $arrPost['news_comment'];
$sqlval['link_method'] = $arrPost['link_method'];
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$arrValIn = array($arrPost['news_id']);
$objQuery->update($table, $sqlval, $where, $arrValIn);
* @param Array $arrPost POSTのグローバル変数
* @return string 登録日を示す文字列
$registDate = $arrPost['year'] . "/". $arrPost['month'] . "/". $arrPost['day'];
* チェックボックスの値が空の時は無効な値として1を格納する
* @param int $link_method
if(strlen($link_method) == 0){
* @param Integer news_id ニュースID
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$col = '*, cast(news_date as date) as cast_news_date';
$where = 'del_flg = 0 AND news_id = ?';
$arrval = array($news_id);
$objQuery->setOrder($order);
return $objQuery->select($col, $table, $where,$arrval);
* @param Integer $news_id
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$where = 'del_flg = 0 AND news_id = ?';
$arrval = array($news_id);
list ($rank) = $objQuery->select($col, $table, $where, $arrval);
* 削除する新着情報以降のrankを1つ繰り上げる。
* @param Integer $news_id
$objQuery = $objQuery = & SC_Query_Ex::getSingletonInstance();
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$where = 'del_flg = 0 AND rank > ?';
$arrValIn = array($rank);
$objQuery->update($table, $sqlval, $where, $arrValIn);
$sqlval['del_flg'] = '1';
$sqlval['update_date'] = 'CURRENT_TIMESTAMP';
$arrValIn = array($news_id);
$objQuery->update($table, $sqlval, $where, $arrValIn);
* ニュースの日付の値をフロントでの表示形式に合わせるために分割
* @param String $news_date
* @return Intger $max ランクの最大値の値
$objQuery = & SC_Query_Ex::getSingletonInstance();
$col = 'MAX(rank) as max';
list ($result) = $objQuery->select($col, $table, $where);
* @param Object $objFormParam
* @param Integer $news_id
$input_pos = $_POST[$key];
Documentation generated on Fri, 24 Feb 2012 14:01:08 +0900 by Seasoft
|