コード例 #1
0
ファイル: groups.php プロジェクト: roine/wawaw
 public function action_create()
 {
     if (!Sentry::user()->has_access('groups_create')) {
         self::no_access();
     }
     if (Input::method() == 'POST') {
         if (!Input::post('groupName')) {
             Session::set_flash('error', 'Please choose a name for the group');
         } else {
             $post = Input::post();
             $groupName = $post['groupName'];
             unset($post['groupName']);
             $permissions = json_encode($post, JSON_NUMERIC_CHECK);
             $updated = Model_Group::createGroup($groupName, $permissions);
             if ($updated) {
                 Session::set_flash('success', 'The group ' . $groupName . ' has been successfully created');
             }
             Response::redirect('groups');
         }
     }
     $var = self::access();
     View::set_global('var', $var);
     $this->template->title = 'Groups » Create';
     $this->template->h2 = 'Create a group';
     $this->template->js .= Asset::js(array('mylibs/jquery.validate.js', 'script.js'));
     $this->template->content = View::forge('groups/create');
 }