コード例 #1
0
 public function editAction()
 {
     $now = date('Y-m-d H:i:s');
     $adminUid = $this->request->getPost('admin_uid');
     if ($adminUid) {
         $adminUser = KxAdminUser::findFirst($adminUid);
         $adminUser->update_time = $now;
     } else {
         $adminUser = new KxAdminUser();
         $adminUser->status = 1;
         $adminUser->create_time = $now;
         $adminUser->update_time = $now;
     }
     $adminUser->username = $this->request->getPost('username');
     $adminUser->nickname = $this->request->getPost('nickname');
     $adminUser->email = $this->request->getPost('email');
     $adminUser->phone = $this->request->getPost('phone');
     $adminUser->role_id = intval($this->request->getPost('role_id'));
     if ($adminUser->save()) {
         parent::redirect('kxAdminUser/list');
     } else {
         var_dump($adminUser->getMessages());
         exit;
     }
 }
コード例 #2
0
 /**
  * @access Guest
  */
 public function infoAction()
 {
     $modelName = $this->request->get('model');
     $tableName = $this->request->get('table');
     $a = $this->db->fetchAll("SHOW FULL COLUMNS FROM {$tableName}");
     $data = array();
     $fields = array();
     foreach ($a as $i) {
         array_push($fields, $i);
     }
     $data['fields'] = $fields;
     parent::result($data);
 }
コード例 #3
0
 public function updateAction()
 {
     $name = $this->request->getPost('name');
     $enums = $this->request->getPost('enums');
     if (!$name) {
         parent::error(1, array('msg' => 'None name error'));
         return;
     }
     $classNamePath = self::getEnumPath();
     $jsonName = "{$classNamePath}/const/{$name}.json";
     file_put_contents($jsonName, json_encode($enums));
     $cmdLine = "--json={$jsonName}";
     $results = Python3::run('build_enum.py', $cmdLine);
     parent::result(array('file' => $jsonName, 'results' => $results));
 }
コード例 #4
0
 public function previewAction()
 {
     $p = $this->request->getPost();
     $prefix = $p['prefix'];
     $tableName = $p['table_name'];
     if ($prefix) {
         $tableName = "{$prefix}_{$tableName}";
     }
     $modelName = Strings::tableNameToModelName($tableName);
     $path = ApplicationConfig::getConfig('product')['path'] . '\\www';
     $this->createModelConfigFile($path, $modelName, $p);
     $configPath = ApplicationConfig::getConfigPath('config.json');
     $cmdLine = "--prefix={$prefix} --table={$tableName} --config=\"{$configPath}\"";
     $c = Python3::run("build_mvc.py", $cmdLine);
     $targetHost = ApplicationConfig::getConfig('product')['host'];
     $testListUrl = "{$targetHost}/{$modelName}";
     parent::result(array('model' => $modelName, 'files' => json_decode($c), 'cmd_line' => $cmdLine, 'test_list_url' => $testListUrl, 'build' => $c));
 }
コード例 #5
0
 /**
  * Test code for convertFileName from pattern
  */
 public function refreshAction()
 {
     parent::result(self::getAllUpload());
 }
コード例 #6
0
 private function showExampleViews($template, $data)
 {
     $views = [["name" => '示例', "template" => $template]];
     parent::showTabViews($views, "示例 - {$template}", $data);
 }
コード例 #7
0
 public function createAction()
 {
     $views = [["name" => '新建', "template" => "abforms/create"], ["name" => '预览', "template" => "abforms/preview"]];
     $data = array();
     parent::showTabViews($views, "Forms Creator", $data);
 }
コード例 #8
0
 public function loginAction()
 {
     $data = array();
     parent::showPage('common/login', $data);
 }
コード例 #9
0
 public function syncAction()
 {
     $entries = $_POST['entries'];
     $now = date('Y-m-d H:i:s');
     foreach ($entries as $entry) {
         $nodeId = $entry['node_id'];
         $name = trim($entry['name']);
         if ($nodeId == 0) {
             if (!empty($name)) {
                 $node = new KxAdminNode();
                 $node->controller = trim($entry['controller']);
                 $node->action = trim($entry['action']);
                 $node->name = $name;
                 $node->status = 1;
                 $node->create_time = $now;
                 $node->update_time = $now;
                 $node->save();
             }
         } else {
             $node = KxAdminNode::findFirst($nodeId);
             if ($node->name != $name) {
                 $node->name = $name;
                 $node->update_time = $now;
                 $node->save();
             }
         }
     }
     parent::result(array('post' => $entries));
 }
コード例 #10
0
 public function lockAction()
 {
     $loginAction = 'mainBoard/login';
     $data = ['loginAction' => $loginAction];
     parent::showPage('common/login', $data);
 }
コード例 #11
0
 /**
  * @param $id
  * Create a new Admin user
  */
 public function createAdminUserAction($id)
 {
     $data = array();
     $views = [['name' => '新增管理员', "template" => "kxadminrole/edit_admin_user"]];
     parent::showTabViews($views, '管理员角色管理', $data);
 }