示例#1
0
 /**
  *
  * @return void
  */
 public function editindexAction()
 {
     // call upload action from adminfiles
     //$this->view->action('upload', 'index', 'adminfiles', array('calledBy' => 'adminpeople','peopleId' => $this->view->id));
     $this->layout->currentModule = $this->_request->getModuleName();
     $modeEdit = false;
     if (isset($this->getRequest()->id)) {
         $this->setSubtitle2('Edit');
     } else {
         $this->setSubtitle2('Create');
     }
     $this->setSideBar('edit', 'people');
     // request id
     if (isset($this->view->id)) {
         // search user
         $sql = $this->_getQuery('people', 'AND users.id = ' . $this->view->id);
         $u = $this->_db->fetchAll($sql);
         // if user exist
         if (count($u) == 1) {
             $d = array();
             $modeEdit = true;
             // get the user
             $uDB = new Users();
             $usr = $uDB->find($u[0]['id']);
             $user = $usr[0];
             //$this->view->usersForm->populate($user->toArray());
             $this->view->avatar = $user->avatar;
         }
         // END - if user exist
     }
     // Set a custom form user on publicms if exist for the current instance
     $formclass = 'UsersFormOp';
     if ($this->view->moduleName == 'publicms' && !empty(Sydney_Tools::getConf('general')->form->profile) && @class_exists(Sydney_Tools::getConf('general')->form->profile)) {
         $formclass = Sydney_Tools::getConf('general')->form->profile;
     }
     Sydney_Form::setParams(array('request' => $this->r));
     $this->view->usersForm = new $formclass(null, $this->usersData['member_of_groups'], $modeEdit);
     if (isset($this->view->id)) {
         $usera = $user->toArray();
     }
     if ($modeEdit) {
         $this->view->usersForm->populate($usera);
     }
 }