public function create() { $moduleDB = new ModuleModelDB(); $fieldArr = $moduleDB->getFields(); $insertArr = array(); foreach ($fieldArr as $v) { if ($_POST[$v] !== null) { $insertArr[$v] = $_POST[$v]; } } $insertArr['monitors'] = Common::checkboxStrEncode($_POST['monitors']); $rs = $moduleDB->insert($insertArr); Log::write($this->adminUserName, $this->ip, $moduleDB->insertId(), self::$state . "__" . self::$action, $rs); $rs ? Message::showSucc('添加成功') : Message::showError('添加失败:' . implode(" ", $moduleDB->getErrorInfo())); }
* @author wangxin <*****@*****.**> * @time 2011/3/2 15:03 * @version Id: 0.9 */ require dirname(__FILE__) . "/global.php"; $moduleDB = new ModuleModelDB(); $sysmoduleDB = new SysmoduleModelDB(); $sysmoduleArr = $sysmoduleDB->getData("SELECT * FROM `" . $sysmoduleDB->getTableName() . "`"); $projectDB = new ProjectModelDB(); $projectArr = $projectDB->getData("SELECT * FROM `" . $projectDB->getTableName() . "`"); foreach ($projectArr as $v) { $moduleArr = $moduleDB->getData("SELECT * FROM `" . $moduleDB->getTableName() . "` WHERE `pid` = ?", array($v['id'])); $moduleIdArr = array(); foreach ($moduleArr as $vv) { $moduleIdArr[] = $vv['sys_mid']; } foreach ($sysmoduleArr as $vv) { if (!in_array($vv['id'], $moduleIdArr)) { $insertArr = array(); $insertArr['pid'] = $v['id']; $insertArr['sys_mid'] = $vv['id']; $insertArr['level'] = $vv['level']; $insertArr['sms_limit'] = $vv['sms_limit']; $insertArr['mail_limit'] = $vv['mail_limit']; $insertArr['sms_status'] = 1; $insertArr['mail_status'] = 1; $insertArr['create_time'] = time(); $moduleDB->insert($insertArr); } } }