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-2010 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_PATH . "pages/LC_Page.php");
* @author LOCKON CO.,LTD.
* @version $Id: LC_Page_Admin_System_Masterdata.php 18734 2010-06-22 08:45:33Z nanasess $
$this->tpl_subnavi = 'system/subnavi.tpl';
$this->tpl_subno = 'masterdata';
$this->arrMasterDataName = $this->getMasterDataNames(array("mtb_pref",
$masterData = new SC_DB_MasterData_Ex();
if (!isset ($_POST["mode"])) $_POST["mode"] = "";
switch ($_POST["mode"]) {
$this->checkMasterDataName();
$this->errorMessage = $this->checkUniqueID();
if (empty($this->errorMessage)) {
foreach ($_POST['id'] as $key => $val) {
$arrData[$val] = $_POST['name'][$key];
$masterData->objQuery->begin();
$masterData->deleteMasterData($this->masterDataName, false);
// TODO カラム名はメタデータから取得した方が良い
$masterData->registMasterData($this->masterDataName,
array("id", "name", "rank"),
$masterData->objQuery->commit();
$this->tpl_onload = "window.alert('マスタデータの設定が完了しました。');";
$this->checkMasterDataName();
$masterData->getDbMasterData($this->masterDataName);
$objView->assignobj($this);
$objView->display(MAIN_FRAME);
function checkMasterDataName() {
if (in_array($_POST['master_data_name'], $this->arrMasterDataName)) {
$this->masterDataName = $_POST['master_data_name'];
SC_Utils_Ex::sfDispeError("");
* @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() {
for ($i = 0; $i < count($arrId); $i++ ) {
for ($j = $i + 1; $j < count($arrId); $j++ ) {
return $id . " が重複しているため登録できません.";
Documentation generated on Fri, 24 Feb 2012 13:59:11 +0900 by Seasoft
|