コード例 #1
0
ファイル: GroupadminController.php プロジェクト: phpscr/usvn
 public function indexAction()
 {
     $table = new USVN_Db_Table_Groups();
     $this->view->groups = $table->fetchAll(null, "groups_name");
 }
コード例 #2
0
ファイル: UseradminController.php プロジェクト: phpscr/usvn
 public function updateAction()
 {
     $data = $this->getUserData($_POST);
     if (empty($data)) {
         $this->_redirect("/admin/user/new");
     }
     $user = null;
     /* some ugly hack of variable scope... */
     try {
         $table = new USVN_Db_Table_Users();
         $login = $this->getRequest()->getParam('login');
         $user = $table->fetchRow(array("users_login = ?" => $login));
         if ($user === null) {
             throw new USVN_Exception(sprintf(T_("User %s does not exist."), $login));
         }
         $user->setFromArray($data);
         $u = USVN_User::update($user, $data, isset($_POST['groups']) ? $_POST['groups'] : null);
         $u->save();
         $this->_redirect("/admin/user/");
     } catch (USVN_Exception $e) {
         $this->view->user = $user;
         $this->view->message = $e->getMessage();
         $table = new USVN_Db_Table_Groups();
         $this->view->groups = $table->fetchAll(null, 'groups_name');
         $this->render('edit');
     }
 }