Source for file LC_Page_Admin_System_Masterdata.php
Documentation is available at LC_Page_Admin_System_Masterdata.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_System_Masterdata.php 20970 2011-06-10 10:27:24Z Seasoft $
$this->tpl_mainpage = 'system/masterdata.tpl';
$this->tpl_subno = 'masterdata';
$this->tpl_mainno = 'system';
$this->tpl_maintitle = 'システム設定';
$this->tpl_subtitle = 'マスターデータ管理';
$this->arrMasterDataName = $this->getMasterDataNames(array("mtb_pref",
$masterData = new SC_DB_MasterData_Ex();
switch ($this->getMode()) {
$this->masterDataName = $this->checkMasterDataName($_POST, $this->arrMasterDataName);
$this->errorMessage = $this->checkUniqueID($_POST);
if (empty($this->errorMessage)) {
$this->tpl_onload = "window.alert('マスターデータの設定が完了しました。');";
$this->masterDataName = $this->checkMasterDataName($_POST, $this->arrMasterDataName);
$masterData->getDbMasterData($this->masterDataName);
* @param array $arrMasterDataName マスターデータテーブル名のリスト
* @return string $master_data_name 選択しているマスターデータのテーブル名
function checkMasterDataName(&$arrParams, &$arrMasterDataName) {
if (in_array($arrParams['master_data_name'], $arrMasterDataName)) {
$master_data_name = $arrParams['master_data_name'];
return $master_data_name;
SC_Utils_Ex::sfDispError("");
* @param array $ignores 取得しないマスターデータ名の配列
* @return array マスターデータ名の配列
function getMasterDataNames($ignores = array()) {
$dbFactory = SC_DB_DBFactory_Ex::getInstance();
$arrMasterDataName = $dbFactory->findTableNames("mtb_");
foreach ($arrMasterDataName as $val) {
foreach ($ignores as $ignore) {
unset ($arrMasterDataName[$i]);
return $arrMasterDataName;
* 重複した値が存在する場合はエラーメッセージを表示する.
* @return void|stringエラーが発生した場合はエラーメッセージを返す.
function checkUniqueID(&$arrParams) {
$arrId = $arrParams['id'];
for ($i = 0; $i < count($arrId); $i++ ) {
for ($j = $i + 1; $j < count($arrId); $j++ ) {
return $id . " が重複しているため登録できません.";
* @param array $arrParams $_POST値
* @param object $masterData SC_DB_MasterData_Ex()
* @param string $master_data_name 登録対象のマスターデータのテーブル名
foreach ($arrParams['id'] as $key => $val) {
$arrTmp[$val] = $arrParams['name'][$key];
$masterData->objQuery = & SC_Query_Ex::getSingletonInstance();
$masterData->objQuery->begin();
$masterData->deleteMasterData($master_data_name, false);
// TODO カラム名はメタデータから取得した方が良い
$masterData->registMasterData($master_data_name,
array('id', 'name', 'rank'),
$masterData->objQuery->commit();
Documentation generated on Fri, 24 Feb 2012 14:01:50 +0900 by Seasoft
|