当前位置: 首页>>代码示例>>PHP>>正文


PHP Model_Users::update方法代码示例

本文整理汇总了PHP中Model_Users::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Model_Users::update方法的具体用法?PHP Model_Users::update怎么用?PHP Model_Users::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model_Users的用法示例。


在下文中一共展示了Model_Users::update方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: put_index

 public function put_index($id, $username, $email, $password = null, $id_group = null)
 {
     // Force to edit the current user if they don't have the proper permissions
     if (!$this->_currentUser->hasPermission(Model_Groups::PERM_MANAGE_USERS)) {
         $id = $this->_currentUser->getId();
     }
     $user = Model_Users::getById($id);
     $propsUpdate = ['username' => $username, 'email' => $email];
     if ($id_group !== null && !empty($id_group) && $this->_currentUser->hasPermission(Model_Groups::PERM_MANAGE_USERS)) {
         $group = Model_Groups::getById($id_group);
         $propsUpdate['usergroup'] = $group;
     } else {
         $user->load('usergroup');
     }
     if ($password !== null && !empty($password)) {
         $propsUpdate['password'] = Library_String::hash(trim($password));
     }
     $user->setProps($propsUpdate);
     Model_Users::update($user);
     // Disconnect the user if they changed their own profile
     if ($id === $this->_currentUser->getId()) {
         $this->response->redirect('../login/out', 200);
     } else {
         $this->response->redirect('../users', 200);
     }
 }
开发者ID:adrien-gueret,项目名称:le-chomp-enchaine,代码行数:26,代码来源:edit.php

示例2: indexAction

 public function indexAction()
 {
     $form = self::getMyaccountSettingsForm();
     $populateData = array();
     $modelUsers = new Model_Users();
     $populateData['calendarView'] = $this->user['calendarView'];
     $populateData['notifications'] = $this->user['notifications'];
     $form->populate($populateData);
     $request = $this->getRequest();
     if ($this->_getParam('method')) {
         $what = null;
         if ($this->_getParam('calendarview')) {
             $what = 'Calendar view';
             $data['calendarView'] = $this->_getParam('value');
             $modelUsers->update($this->user->getId(), $data);
         } elseif ($this->_getParam('notifications')) {
             $what = 'Notifications';
             $data['notifications'] = $this->_getParam('value');
             $modelUsers->update($this->user->getId(), $data);
         } elseif ($this->_getParam('password')) {
             $what = 'Password';
             $form->changePassword();
             $request = $this->getRequest();
             if ($request->isPost()) {
                 $post = $request->getPost();
                 if ($form->isValid($post)) {
                     $values = $form->getValues();
                 } else {
                     echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'icon' => 'error', 'message' => $this->t->_($what . ' was not updated')));
                     exit;
                 }
             }
             $data['password'] = $values['password'];
             $modelUsers->update($this->user->getId(), $data);
         }
         echo Zend_Json::encode(array('success' => 1, 'title' => $this->t->_('Success Message'), 'message' => $this->t->_($what . ' was successfully updated')));
         exit;
     }
     $this->view->formSettings = $form;
 }
开发者ID:AlexanderMazaletskiy,项目名称:gym-Tracker-App,代码行数:40,代码来源:MyAccountController.php

示例3: loginAction

 public function loginAction()
 {
     if (vkNgine_Auth::isAuthenticated()) {
         header("location:/");
         exit;
     }
     $logger = Zend_Registry::get('logger');
     $form = $this->getLoginForm();
     $request = $this->getRequest();
     $this->view->error = false;
     if ($request->isPost()) {
         if ($form->isValid($request->getPost())) {
             $info = $form->getValues();
             $user = null;
             if (vkNgine_Public_Auth::attemptLogin($info)) {
                 $user = vkNgine_Auth::revalidate();
             } else {
                 $this->view->error = true;
             }
             $user = vkNgine_Auth::revalidate();
             $logger->log('LOGIN_REQUEST', print_r($info, true), vkNgine_Log::INFO, $user['userId']);
             if ($user != null) {
                 $modelUsers = new Model_Users();
                 $modelTrafficActivity = new vkNgine_Log_Activity();
                 $modelTrafficLogins = new vkNgine_Log_Logins();
                 $modelTrafficActivity->processActivity($user, $request, 'Logged in to Site');
                 $modelTrafficLogins->insertTrafficLogin($user->userId, $user->type);
                 $config = vkNgine_Config::getSystemConfig();
                 Zend_Session::rememberMe($config->settings->login->remember);
                 $modelUsers->update($user['userId'], array('lastLogin' => date('Y-m-d H:i:s')));
                 echo Zend_Json::encode(array('success' => 1, 'icon' => 'success', 'href' => '/'));
                 exit;
             } else {
                 echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Access denied!'), 'icon' => 'error'));
                 exit;
             }
         } else {
             echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Access denied!'), 'icon' => 'error'));
             exit;
         }
     }
     $this->view->form = $form;
 }
开发者ID:AlexanderMazaletskiy,项目名称:gym-Tracker-App,代码行数:43,代码来源:LoginController.php

示例4: update

 /**
  * update an admin user
  * 
  * @param int $userId
  * @param array $data
  */
 public function update($userId, $data)
 {
     if (!empty($data['level'])) {
         $modelUsersAdmins = new Admin_Model_Users_Admins();
         $modelUsersAdmins->update($userId, array('level' => $data['level']));
         unset($data['level']);
     }
     return parent::update($userId, $data);
 }
开发者ID:AlexanderMazaletskiy,项目名称:gym-Tracker-App,代码行数:15,代码来源:Users.php

示例5: resetpasswordAction

 public function resetpasswordAction()
 {
     if (vkNgine_Auth::isAuthenticated()) {
         $this->_redirect('/admin');
         exit;
     }
     $modelUsers = new Model_Users();
     $modelUsersTokens = new Model_Users_Tokens();
     $token = $this->_getParam('token');
     if (!$token) {
         $this->_redirect('/admin/auth/login');
     }
     $form = self::getResetPasswordForm();
     $request = $this->getRequest();
     if ($request->isPost()) {
         $post = $request->getPost();
         if ($form->isValid($post)) {
             $values = $form->getValues();
             $user = $modelUsers->fetchWithEmail($values['email']);
             $token = $modelUsersTokens->fetch($user, $values['token']);
             if ($token) {
                 $data = array('password' => $values['password']);
                 $modelUsers->update($user->getId(), $data);
                 $modelUsersTokens->delete($token['tokenId']);
                 echo Zend_Json::encode(array('success' => 1, 'title' => $this->t->_('Success Message'), 'message' => $this->t->_('Password was changed successfully'), 'icon' => 'success', 'href' => '/admin/auth/login'));
                 exit;
             } else {
                 echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Given token was not valid'), 'icon' => 'error'));
                 exit;
             }
         } else {
             echo Zend_Json::encode(array('title' => $this->t->_('Error Message'), 'message' => $this->t->_('Given token/email or password was not valid'), 'icon' => 'error'));
             exit;
         }
     }
     $this->view->form = $form->setTokenValue($token);
 }
开发者ID:AlexanderMazaletskiy,项目名称:gym-Tracker-App,代码行数:37,代码来源:AuthController.php

示例6: update

 /**
  * update a user
  * 
  * @params int $userId 
  * @params array $data
  */
 public function update($userId, $data)
 {
     // reset the admin's level
     if (!empty($data['level'])) {
         $modelUsersPublics = new Model_Users_Publics();
         $modelUsersPublics->update($userId, array('level' => $data['level']));
         unset($data['level']);
     }
     return parent::update($userId, $data);
 }
开发者ID:AlexanderMazaletskiy,项目名称:gym-Tracker-App,代码行数:16,代码来源:Users.php


注:本文中的Model_Users::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。