コード例 #1
0
ファイル: InspectorFactory.php プロジェクト: Eximagen/sochi
 /**
  *
  * @static
  * @param Inspector inspector
  * @param array $fields
  */
 public static function populate($inspector, $fields)
 {
     parent::populate($inspector, $fields);
     if (!$inspector instanceof Inspector) {
         static::throwException("El objecto no es un Inspector");
     }
     if (isset($fields['id_inspector'])) {
         $inspector->setIdInspector($fields['id_inspector']);
     }
     if (isset($fields['id_user'])) {
         $inspector->setIdUser($fields['id_user']);
     }
 }
コード例 #2
0
ファイル: UserController.php プロジェクト: Eximagen/sochi
 /**
  * 
  */
 public function updatePasswordAction()
 {
     if ($this->getRequest()->isPost()) {
         $id = $this->getRequest()->getParam('id_user');
         $user = UserQuery::create()->findByPKOrThrow($id, $this->i18n->_("It does not exist the User with id {$id}"));
         try {
             $this->getUserCatalog()->beginTransaction();
             $password = $this->getRequest()->getParam('password');
             $userParams['password'] = new Zend_Db_Expr("PASSWORD('{$password}')");
             UserFactory::populate($user, $userParams);
             $this->getUserCatalog()->update($user);
             $this->getUserCatalog()->commit();
             $this->setFlash('ok', $this->i18n->_("The password has been changed"));
         } catch (Exception $e) {
             $this->getUserCatalog()->rollBack();
             $this->setFlash('error', $this->i18n->_($e->getMessage()));
         }
     }
     $this->_redirect('index/index');
 }
コード例 #3
0
ファイル: UserCatalog.php プロジェクト: Eximagen/sochi
 /**
  *
  * makeBean
  * @param array $resultset
  * @return \Application\Model\Bean\User
  */
 protected function makeBean($resultset)
 {
     return UserFactory::createFromArray($resultset);
 }