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


PHP Users::setWhere方法代码示例

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


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

示例1: saveAction

 public function saveAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $usersModel = new Users();
     $data = $this->request->getPost();
     if (!isset($data['id']) || !isset($data['roles_id']) || !isset($data['user']) || !isset($data['password'])) {
         throw new \Exception('Неверный тип запроса!');
     }
     if ($data['action'] == 'add' && (!isset($data['lastname']) || !isset($data['firstname']) || !isset($data['secondname']) || !isset($data['org_name']))) {
         throw new \Exception('Неверный тип запроса!');
     }
     $data['id'] = (int) $data['id'];
     if (!$data['id'] && $data['action'] != 'add') {
         throw new \Exception('Неверный идентификатор пользователя!');
     }
     $data['roles_id'] = (int) $data['roles_id'];
     if ($data['roles_id'] == 0) {
         throw new \Exception('Не выбраны права пользователя!');
     }
     $data['user'] = trim($data['user']);
     if ($data['user'] == '') {
         throw new \Exception('Не заполнено обязательное поле Email!');
     }
     $data['password'] = trim($data['password']);
     if ($data['password'] == '' && $data['action'] != 'add') {
         unset($data['password']);
     }
     if (isset($data['password']) && mb_strlen($data['password']) < 6) {
         throw new \Exception('Пароль должен быть больше 6 символов!');
     }
     if ($data['action'] == 'add') {
         $data['lastname'] = trim($data['lastname']);
         if ($data['lastname'] == '') {
             throw new \Exception('Не заполнено обязательное поле Фамилия!');
         }
         $data['firstname'] = trim($data['firstname']);
         if ($data['firstname'] == '') {
             throw new \Exception('Не заполнено обязательное поле Имя!');
         }
         $data['secondname'] = trim($data['secondname']);
         if ($data['secondname'] == '') {
             throw new \Exception('Не заполнено обязательное поле Отчество!');
         }
         $data['org_name'] = trim($data['org_name']);
         if ($data['org_name'] == '') {
             throw new \Exception('Не заполнено обязательное поле Организация!');
         }
     }
     unset($data['action']);
     $data['id'] = $usersModel->save($data);
     $usersModel->setWhere(array('id' => $data['id']));
     $uData = $usersModel->select();
     $this->view->data = $uData[0];
     $rolesModel = new Roles();
     $this->view->roles = $rolesModel->select();
 }
开发者ID:BoesesGenie,项目名称:team-rex,代码行数:58,代码来源:UsersController.php

示例2: getformAction

 public function getformAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $project = false;
     if (!is_null($this->request->getPost('id'))) {
         $id = (int) $this->request->getPost('id');
         $projectsModel = new Projects();
         $project = $projectsModel->getProjectsDataForEdit($id);
         $usersModel = new Users();
         $usersModel->setWhere('`roles_id` IN(1,2)');
         $this->view->initiators = $usersModel->select();
         $usersModel->setWhere('`roles_id` IN(1,3)');
         $this->view->executors = $usersModel->select();
         $executorsModel = new Executors();
         $this->view->selectedExecutors = $executorsModel->getExecutorsAsArrayByProject($id);
         $statusModel = new Status();
         $this->view->statuses = $statusModel->select();
     }
     $this->view->project = $project;
 }
开发者ID:BoesesGenie,项目名称:team-rex,代码行数:22,代码来源:ProjectsController.php

示例3: savestatusAction

 public function savestatusAction()
 {
     if (!$this->isXmlHttpRequest()) {
         throw new \Exception('Неверный тип запроса!');
     }
     $data = $this->request->getPost();
     if (!isset($data['id']) || !isset($data['task_status_id'])) {
         throw new \Exception('Неверный тип запроса!');
     }
     $data['id'] = (int) $data['id'];
     $data['task_status_id'] = (int) $data['task_status_id'];
     $tasksModel = new Tasks();
     $tasksModel->save($data);
     $timelineModel = new Timeline();
     $timelineModel->endWork($data['id']);
     $task = $tasksModel->getTasksDataById((int) $data['id']);
     $to = array();
     $usersModel = new Users();
     $usersModel->setWhere(array('id' => 1));
     $result1 = $usersModel->select();
     $to[] = $result1[0]['user'];
     $usersModel->setWhere(array('id' => (int) $task['executors_id']));
     $result2 = $usersModel->select();
     if ($result2 && $result2[0]['user'] != $result1[0]['user']) {
         $to[] = $result2[0]['user'];
     }
     $usersModel->setWhere(array('id' => (int) $task['initiator']));
     $result3 = $usersModel->select();
     $to[] = $result3[0]['user'];
     $subject = 'Изменение статуса задачи';
     $message = 'По задаче "' . $task['name'];
     $message .= '" сменился статус на ' . $task['ts_name'] . "\n";
     $message .= 'По проекту: ' . ($task['p_name'] ? $task['p_name'] : 'Без проекта');
     Mail::instance()->send($to, $subject, $message);
 }
开发者ID:BoesesGenie,项目名称:team-rex,代码行数:35,代码来源:TasksController.php


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