コード例 #1
0
ファイル: Welcome.php プロジェクト: asvinicius/ccb
 public function noneedhelp($id = null)
 {
     $this->load->model('UserModel');
     $user = new UserModel();
     $data = $user->search($id);
     if ($data['help'] === '0') {
         return true;
     } else {
         redirect(base_url('help'));
     }
 }
コード例 #2
0
 public function search()
 {
     parent::checkLogin();
     $data = null;
     $user = new UserModel();
     $tables = $user->getTables();
     foreach ($tables as $item) {
         $item->tableName = substr($item->tableName, 10);
         $item->tableName = str_replace('_', '-', $item->tableName);
     }
     $BMIArr = array(0 => '肥胖', 1 => '超重', 2 => '低体重', '正常');
     $otherArr = array(0 => '不及格', 1 => '及格', 2 => '良好', 3 => '优秀');
     if (isset($_POST['send'])) {
         $model = new UserModel();
         $model->tableName = 'tice_data_' . str_replace('-', '_', $_POST['year']);
         $model->stuId = $_SESSION['ticeStuId'];
         $data = $model->search();
         //var_dump($data);
     }
     $config = new AttributesModel();
     $configArr = $config->getConfig();
     $pageArr = array(0 => 'site/searchColleage', 1 => 'site/searchColleage', 2 => 'site/searchColleage', 3 => 'site/searchPrimary');
     $this->render($pageArr[$configArr->schoolType], array('yearArr' => $tables, 'data' => $data, 'post' => isset($_POST['send']) ? true : false, 'BMIArr' => $BMIArr, 'otherArr' => $otherArr, 'searchYear' => isset($_POST['year']) ? $_POST['year'] : ''));
 }
コード例 #3
0
 /**
  * User management list.
  *
  * @since 2.0.0
  * @access public
  * @param mixed $Keywords Term or array of terms to filter list of users.
  * @param int $Page Page number.
  * @param string $Order Sort order for list.
  */
 public function index($Keywords = '', $Page = '', $Order = '')
 {
     $this->permission(array('Garden.Users.Add', 'Garden.Users.Edit', 'Garden.Users.Delete'), '', false);
     // Page setup
     $this->addJsFile('jquery.gardenmorepager.js');
     $this->addJsFile('user.js');
     $this->title(t('Users'));
     $this->setHighlightRoute('dashboard/user');
     Gdn_Theme::section('Moderation');
     // Form setup
     $this->Form->Method = 'get';
     // Input Validation.
     list($Offset, $Limit) = offsetLimit($Page, PagerModule::$DefaultPageSize);
     if (!$Keywords) {
         $Keywords = $this->Form->getFormValue('Keywords');
         if ($Keywords) {
             $Offset = 0;
         }
     }
     if (!is_string($Keywords)) {
         $Keywords = '';
     }
     // Put the Keyword back in the form
     if ($Keywords) {
         $this->Form->setFormValue('Keywords', $Keywords);
     }
     $UserModel = new UserModel();
     list($Offset, $Limit) = offsetLimit($Page, 30);
     // Determine our data filters.
     $Filter = $this->_getFilter();
     if ($Filter) {
         $Filter['Keywords'] = $Keywords;
     } else {
         $Filter = array('Keywords' => (string) $Keywords);
     }
     $Filter['Optimize'] = Gdn::userModel()->pastUserThreshold();
     // Sorting
     if (in_array($Order, array('DateInserted', 'DateFirstVisit', 'DateLastActive'))) {
         $Order = 'u.' . $Order;
         $OrderDir = 'desc';
     } else {
         $Order = 'u.Name';
         $OrderDir = 'asc';
     }
     // Get user list
     $this->UserData = $UserModel->search($Filter, $Order, $OrderDir, $Limit, $Offset);
     $this->setData('Users', $this->UserData);
     // Figure out our number of results and users.
     $showUserCount = $this->UserData->count();
     if (!Gdn::userModel()->pastUserThreshold()) {
         // Pfft, query that sucker however you want.
         $this->setData('RecordCount', $UserModel->searchCount($Filter));
     } else {
         // We have a user search, so at least set enough data for the Next pager.
         if ($showUserCount) {
             $this->setData('_CurrentRecords', $showUserCount);
         } else {
             // No search was done. Just give the total users overall. First, zero-out our pager.
             $this->setData('_CurrentRecords', 0);
             if (!Gdn::userModel()->pastUserMegaThreshold()) {
                 // Restoring this semi-optimized counter is our compromise to let non-mega sites know their exact total users.
                 $this->setData('UserCount', $UserModel->getCount());
             } else {
                 // Dang, yo. Get a table status guess instead of really counting.
                 $this->setData('UserEstimate', Gdn::userModel()->countEstimate());
             }
         }
     }
     // Add roles to the user data.
     RoleModel::setUserRoles($this->UserData->result());
     // Deliver json data if necessary
     if ($this->_DeliveryType != DELIVERY_TYPE_ALL && $this->_DeliveryMethod == DELIVERY_METHOD_XHTML) {
         $this->setJson('LessRow', $this->Pager->toString('less'));
         $this->setJson('MoreRow', $this->Pager->toString('more'));
         $this->View = 'users';
     }
     $this->render();
 }
コード例 #4
0
ファイル: User.php プロジェクト: asvinicius/ccb
 public function update()
 {
     if ($this->isLogged()) {
         $page = $this->getPage();
         $this->load->model('UserModel');
         $user = new UserModel();
         $data['id'] = $this->input->get('id');
         $data['name'] = mb_strtoupper($this->input->get('name'));
         $data['username'] = $this->input->get('username');
         $data['phone'] = $this->input->get('phone');
         $pass = $this->input->get('changepass');
         $confirmpass = $this->input->get('confirmpass');
         if (empty($pass)) {
             $pass = $this->input->get('password');
             $confirmpass = $pass;
             $data['password'] = $pass;
         } else {
             $data['password'] = md5($this->input->get('changepass'));
         }
         $data['role'] = $this->input->get('role');
         $data['status'] = $this->input->get('status');
         if ($pass === $confirmpass) {
             if (!$user->verifyusn($this->input->get('username'))) {
                 if ($user->update($data)) {
                     redirect(base_url('user/index/2'));
                 }
             } else {
                 $aux = $user->search($data['id']);
                 if ($aux['username'] === $data['username']) {
                     if ($user->update($data)) {
                         redirect(base_url('user/index/2'));
                     }
                 } else {
                     $savefail = array("class" => "danger", "message" => "Nome de usuário já existente no banco");
                     $data = $user->search($data['id']);
                     $msg = array("savefail" => $savefail, "user" => $data);
                     $this->load->view('template/super/header', $page);
                     $this->load->view('super/edituser', $msg);
                     $this->load->view('template/public/footer');
                 }
             }
         } else {
             $savefail = array("class" => "danger", "message" => "As senhas inseridas não são iguais");
             $data = $user->search($data['id']);
             $msg = array("savefail" => $savefail, "user" => $data);
             $this->load->view('template/super/header', $page);
             $this->load->view('super/edituser', $msg);
             $this->load->view('template/public/footer');
         }
     }
 }
コード例 #5
0
ファイル: user_ctrl.php プロジェクト: khanhdnhut/tours
 public function index()
 {
     if (in_array(Auth::getCapability(), array(CAPABILITY_ADMINISTRATOR))) {
         Model::autoloadModel('User');
         $model = new UserModel($this->db);
         $this->para = new stdClass();
         if (isset($_POST['type'])) {
             $this->para->type = $_POST['type'];
         }
         if (isset($_POST['role'])) {
             $this->para->role = $_POST['role'];
         }
         if (isset($_POST['orderby'])) {
             $this->para->orderby = $_POST['orderby'];
         }
         if (isset($_POST['order'])) {
             $this->para->order = $_POST['order'];
         }
         if (isset($_POST['page'])) {
             $this->para->page = $_POST['page'];
         }
         if (isset($_POST['s'])) {
             $this->para->s = $_POST['s'];
         }
         if (isset($_POST['paged'])) {
             $this->para->paged = $_POST['paged'];
         }
         if (isset($_POST['users'])) {
             $this->para->users = $_POST['users'];
         }
         if (isset($_POST['new_role'])) {
             $this->para->new_role = $_POST['new_role'];
         }
         if (isset($_POST['new_role2'])) {
             $this->para->new_role2 = $_POST['new_role2'];
         }
         if (isset($_POST['action'])) {
             $this->para->action = $_POST['action'];
         }
         if (isset($_POST['action2'])) {
             $this->para->action2 = $_POST['action2'];
         }
         if (isset($_POST['email_show'])) {
             $this->para->email_show = $_POST['email_show'];
         }
         if (isset($_POST['role_show'])) {
             $this->para->role_show = $_POST['role_show'];
         }
         if (isset($_POST['tours_show'])) {
             $this->para->tours_show = $_POST['tours_show'];
         }
         if (isset($_POST['users_per_page'])) {
             $this->para->users_per_page = $_POST['users_per_page'];
         }
         if (isset($_POST['adv_setting'])) {
             $this->para->adv_setting = $_POST['adv_setting'];
         }
         if (isset($this->para->adv_setting) && $this->para->adv_setting == "adv_setting") {
             $model->changeAdvSetting($this->para);
         }
         if (isset($this->para->type) && in_array($this->para->type, array("action", "action2", "new_role", "new_role2")) && isset($this->para->users)) {
             if (in_array($this->para->type, array("action", "action2"))) {
                 $model->executeAction($this->para);
             } else {
                 $model->changeRole($this->para);
             }
         }
         $model->search($this->view, $this->para);
         if (count((array) $this->para) > 0) {
             $this->view->ajax = TRUE;
             $this->view->renderAdmin(RENDER_VIEW_USER_INDEX, TRUE);
         } else {
             $this->view->renderAdmin(RENDER_VIEW_USER_INDEX);
         }
     } else {
         $this->login();
     }
 }