/** * 构造函数 * * @param string $pTableName 表名 * @param int $pDBConfig 数据库配置偏移量 */ function __construct($pTableName, $pDBConfig = 0) { parent::__construct(); $this->mTableName = $pTableName; $this->mDBConfig = $pDBConfig; if (empty($this->mMappingTableObject) || !is_object($this->mMappingTableObject)) { $class_name = KISS_Util_Util::magicName($pTableName); if (class_exists($class_name)) { $this->mMappingTableObject = new KISS_ORM_BaseTableObjectProxy(new $class_name(), $this->mCurrentUser); } else { $this->mMappingTableObject = new KISS_ORM_BaseTableObjectProxy(new KISS_ORM_BaseTableObject($pTableName, $pDBConfig), $this->mCurrentUser); } } $this->_pageInit(); $this->_appInit(); }
private function config() { $config_path = $this->mRoot . $this->mPath['config']; parent::__construct(); if (isset($_GET['table']) && isset($_GET['config'])) { $config_file = $config_path . "/{$_GET['config']}_{$_GET['table']}.serialize"; if (!file_exists($config_file)) { $SqlCommand =& KISS_KDO_SqlCommand::getInstance(intval($_GET['config'])); $fields = $SqlCommand->ExecuteArrayQuery("show full fields from `{$_GET['table']}`"); foreach ($fields as $row) { $config[] = array('name' => $row['Field'], 'comment' => $row['Comment'], 'type' => 'text', 'insert' => '1', 'update' => '1', 'select' => '1', 'list' => '1', 'search' => '1'); } /*var_dump($fields); $this->mMappingTableObject = new BaseTableObject($_GET['table'],$_GET['config']); foreach($this->mMappingTableObject->mMapHash as $key => $value) { $config[] = array ( 'name' => $key,'comment' => $key,'type' => 'text','insert' => '1','update' => '1','select' => '1','list' => '1','search' => '1'); }*/ file_put_contents($config_file, serialize($config)); } if ($_SERVER['REQUEST_METHOD'] == "POST") { file_put_contents($config_file, serialize($_POST['table_config'])); } $table_config = unserialize(file_get_contents($config_file)); $this->mSmarty->assign('list', $table_config); $this->mSmarty->assign('_action', 'config'); $this->mSmarty->assign('types', array('text' => '单行文本', 'textarea' => '多行文本', 'file' => '文件', 'password' => '密码', 'select' => '列表', 'date' => '日期')); $this->mSmarty->assign('yesno', array('1' => '是', '0' => '否')); $this->mSmarty->display("tpl.config.htm"); } else { die("没有指定表名"); } }