コード例 #1
0
ファイル: users.php プロジェクト: ClixLtd/pccupload
 public function action_create()
 {
     if (Input::method() == 'POST') {
         $val = Model_Api_User::validate('create');
         if ($val->run()) {
             $api_user = Model_Api_User::forge(array('id' => Input::post('id'), 'key' => Input::post('key'), 'status' => Input::post('status'), 'description' => Input::post('description'), 'ip' => Input::post('ip')));
             if ($api_user and $api_user->save()) {
                 Session::set_flash('success', 'Added api_user #' . $api_user->id . '.');
                 Response::redirect('api/users');
             } else {
                 Session::set_flash('error', 'Could not save api_user.');
             }
         } else {
             Session::set_flash('error', $val->error());
         }
     }
     $this->template->title = "Api_Users";
     $this->template->content = View::forge('api/users/create');
 }