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


PHP Model_Users::addUser方法代码示例

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


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

示例1: addAction

 public function addAction()
 {
     $user = new Model_Users();
     $listlecturer = $user->findLecturer();
     $this->view->listlecturer = $listlecturer;
     $listRole = $user->findRole();
     $this->view->listRole = $listRole;
     if ($this->_request->isPost()) {
         $data = $this->_getParam('searchParam');
         $lecturer_id = $data['lecturer_id'];
         if (!empty($data['username']) && !empty($data['role_id'])) {
             $compareUser = $user->findOneUser($lecturer_id);
             if (empty($compareUser) == false) {
                 echo '<script type="text/javascript">alert("Tài khoản ' . $lecturer_id . ' đã tồn tại")</script>';
                 unset($data);
             } elseif (empty($compareUser) == true) {
                 $user->addUser($data);
                 $existUser = $user->findOneUser($lecturer_id);
                 $user_id = $existUser->user_id;
                 $user->addUserRole($user_id, $data['role_id']);
                 $this->redirect('giaovu/user/list');
             }
         } else {
             echo "<span style='color:red;'>Mời bạn nhập đầy đủ thông tin</span>";
         }
     }
 }
开发者ID:phamviet1510,项目名称:giaovu,代码行数:27,代码来源:UserController.php

示例2: signupAction

 public function signupAction()
 {
     $signupData = $this->getAllParams();
     $signupForm = new Form_SignupForm();
     if ($this->getRequest()->isPost() && $signupForm->isValid($signupData)) {
         $usersModel = new Model_Users();
         $userEmail = $signupData['Email'];
         $userPassword = $signupData['Password'];
         try {
             $usersModel->addUser($userEmail, $userPassword);
             $this->_addFlashMessage('The user have been successfully added. You can nou login!', BundlePhu_View_Helper_DisplayFlashMessages::SUCCESS_MESSAGE);
             $this->_redirect('/default/authentication/login');
         } catch (Exception $exception) {
             $this->_addFlashMessage('An error occurred. Please try again!', BundlePhu_View_Helper_DisplayFlashMessages::ERROR_MESSAGE);
         }
     }
     $this->view->signupForm = $signupForm;
 }
开发者ID:georgetutuianu,项目名称:licenta,代码行数:18,代码来源:AuthenticationController.php

示例3: addUserAction

 public function addUserAction()
 {
     $data = array();
     $error = false;
     $this->_helper->viewRenderer->setNoRender(true);
     $request = $this->getRequest()->getPost();
     //print_r($request);exit();
     $data['user_name'] = $request['user_name'];
     $data['user_firstname'] = $request['user_firstname'];
     $data['user_lastname'] = $request['user_lastname'];
     $data['user_email'] = $request['user_email'];
     $data['user_password'] = $request['user_password'];
     $data['user_role'] = $request['user_role'];
     $data['user_registered'] = date('Y-m-d H:i:s');
     $data['user_status'] = 1;
     if (Model_Users::getByUserName($data['user_name'])) {
         $error .= 'Username already exists' . '</br>';
     }
     if (Model_Users::getByEmail($data['user_email'])) {
         $error .= 'Email already exists' . '</br>';
     }
     if (!$error) {
         if (Model_Users::addUser($data)) {
             $this->view->success = "User details have been added successfully";
         } else {
             $this->view->error .= 'Unexpected error occured' . '</br>';
         }
     } else {
         $this->view->error = $error;
     }
     $this->view->activetab = 'add_user';
     self::indexAction();
     $this->render('index');
 }
开发者ID:rahulreghu,项目名称:shreeimpex,代码行数:34,代码来源:SettingsController.php


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