예제 #1
0
 public function editAction()
 {
     if ($this->getRequest()->getMethod() == 'POST') {
         if ($this->_getParam('button') == 'close') {
             $this->_redirect('user/');
         }
         $user = new Knowledgeroot_User($this->_getParam('id'));
         $user->setLogin($this->_getParam('login'));
         // check if password is changed
         if ($this->_getParam('password') != '' && $this->_getParam('password2') != '' && $this->_getParam('password') == $this->_getParam('password2')) {
             $user->setPassword($this->_getParam('password'));
         }
         $user->setFirstName($this->_getParam('firstname'));
         $user->setLastName($this->_getParam('lastname'));
         $user->setEmail($this->_getParam('email'));
         $user->setLanguage($this->_getParam('language'));
         $user->setTimezone($this->_getParam('timezone'));
         $user->setActive($this->_getParam('active'));
         $user->save();
         // remove existing group memberships
         Knowledgeroot_Group::deleteMemberFromGroups($user);
         // save group membership
         foreach (Knowledgeroot_Util::objectToArray(json_decode($this->_getParam('memberpanel_user'))) as $memberId => $value) {
             // we only can be a member of a group
             if ($memberId[0] == 'G') {
                 $id = substr($memberId, 2);
                 $group = new Knowledgeroot_Group($id);
                 $group->addMember($user);
             }
         }
         if ($this->_getParam('button') == 'save') {
             $this->_redirect('user/edit/' . $user->getId());
         } else {
             $this->_redirect('user/');
         }
     } else {
         $id = $this->_getParam('id');
         $user = new Knowledgeroot_User($id);
         $this->view->action = 'edit';
         $this->view->id = $user->getId();
         $this->view->login = $user->getLogin();
         $this->view->firstname = $user->getFirstName();
         $this->view->lastname = $user->getLastName();
         $this->view->email = $user->getEmail();
         $this->view->timezone = $user->getTimezone();
         $this->view->language = $user->getLanguage();
         $this->view->active = $user->getActive();
         $this->renderScript("user/user.phtml");
     }
 }
예제 #2
0
 public function editAction()
 {
     if ($this->getRequest()->getMethod() == 'POST') {
         if ($this->_getParam('button') == 'close') {
             $this->_redirect('group/');
         }
         $group = new Knowledgeroot_Group($this->_getParam('id'));
         $group->setName($this->_getParam('name'));
         $group->setDescription($this->_getParam('description'));
         $group->setActive($this->_getParam('active'));
         $group->save();
         // remove existing group memberships
         Knowledgeroot_Group::deleteMemberFromGroups($group);
         // save group membership
         foreach (Knowledgeroot_Util::objectToArray(json_decode($this->_getParam('memberpanel_group'))) as $memberId => $value) {
             // we only can be a member of a group
             if ($memberId[0] == 'G') {
                 $id = substr($memberId, 2);
                 $pgroup = new Knowledgeroot_Group($id);
                 $pgroup->addMember($group);
             }
         }
         Knowledgeroot_Group::deleteGroupMembers($group);
         // save members
         foreach (Knowledgeroot_Util::objectToArray(json_decode($this->_getParam('memberpanel_member'))) as $memberId => $value) {
             if ($memberId[0] == 'G') {
                 $id = substr($memberId, 2);
                 $mgroup = new Knowledgeroot_Group($id);
                 $group->addMember($mgroup);
             }
             if ($memberId[0] == 'U') {
                 $id = substr($memberId, 2);
                 $muser = new Knowledgeroot_User($id);
                 $group->addMember($muser);
             }
         }
         if ($this->_getParam('button') == 'save') {
             $this->_redirect('group/edit/' . $group->getId());
         } else {
             $this->_redirect('group/');
         }
     } else {
         $id = $this->_getParam('id');
         $group = new Knowledgeroot_Group($id);
         $this->view->action = 'edit';
         $this->view->id = $group->getId();
         $this->view->name = $group->getName();
         $this->view->description = $group->getDescription();
         $this->view->active = $group->getActive();
         $this->renderScript("group/group.phtml");
     }
 }
예제 #3
0
 /**
  * set acl for content
  *
  * @param array $acl
  */
 public function setAcl($acl)
 {
     if ($this->readOnly) {
         return;
     }
     $this->acl = Knowledgeroot_Util::objectToArray($acl);
 }
예제 #4
0
 public function setAcl($acl)
 {
     $this->acl = Knowledgeroot_Util::objectToArray($acl);
 }