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


PHP Application_Model_User::fetchAll方法代码示例

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


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

示例1: userAction

 public function userAction()
 {
     $user_model = new Application_Model_User();
     $users = $user_model->fetchAll();
     $this->view->users = $users;
     $review_model = new Application_Model_Review();
     $reviews = $review_model->fetchAll();
     $this->view->reviews = $reviews;
     $song_model = new Application_Model_Song();
     $songs = $song_model->fetchAll();
     $this->view->songs = $songs;
 }
开发者ID:sinaBaharlouei,项目名称:Itunes,代码行数:12,代码来源:ViewController.php

示例2: sendRequestNotification

 public function sendRequestNotification($requestId)
 {
     $request = new Application_Model_Request();
     $request = $request->find($requestId);
     if (false === $request) {
         return false;
     }
     $departmentId = $request->getDepartmentId();
     $dept = new Application_Model_Department();
     $dept = $dept->find($departmentId);
     if ($dept === false) {
         return false;
     }
     $user = new Application_Model_User();
     $users = $user->fetchAll("department_id='{$departmentId}' and status='active' and id ='{$dept->getDepartmentHeadId()}'");
     if (count($users) == 0) {
         return false;
     }
     $emails = array();
     foreach ($users as $_user) {
         $emails[$_user->getFirstName() . " " . $_user->getLastName()] = $_user->getEmail();
     }
     if (count($emails) == 0) {
         return false;
     }
     $user = new Application_Model_User();
     $requestedBy = $user->find($request->getRequestedBy());
     $from_email = $this->settingValue('admin_email');
     $from_name = $this->settingLable('admin_email');
     /*---Template-----*/
     $template = $this->getEmailTemplate('request_notification_email');
     $htmlBody = $template['body'];
     $htmlBody = str_replace("__REQUESTER_NAME__", $requestedBy->getFirstName() . " " . $requestedBy->getLastName(), $htmlBody);
     $htmlBody = str_replace("__REQUESTER_EMAIL__", $requestedBy->getEmail(), $htmlBody);
     $htmlBody = str_replace("__REQUESTER_EMP_CODE__", $requestedBy->getEmployeeCode(), $htmlBody);
     $htmlBody = str_replace("__REQUEST__", $request->getRequest(), $htmlBody);
     /*---------------------*/
     $subject = $template['subject'];
     $this->setBodyHtml($htmlBody);
     $this->setFrom($from_email, $from_name);
     $this->addTo($emails);
     $this->setSubject($subject);
     $this->send();
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:44,代码来源:Mail.php

示例3: autoFriendNameAction

 public function autoFriendNameAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     $userNs = new Zend_Session_Namespace('members');
     $userId = $userNs->userId;
     $friendM = new Application_Model_Friend();
     $frienddata = $friendM->fetchAll();
     $friendids = array();
     foreach ($frienddata as $friend) {
         $friendids[] = $friend->getFriendId();
     }
     $q = strtolower($this->_getParam('term'));
     if (!$q) {
         return;
     }
     $where = "status='active'";
     //$where = "first_name like '%{$q}%' ";
     $where .= " AND (CONCAT(first_name,' ',last_name ) LIKE '%{$q}%' OR username LIKE '%{$q}%')";
     $userM = new Application_Model_User();
     $res = $userM->fetchAll($where, null, 11);
     $result = array();
     foreach ($res as $row) {
         if (in_array($row->getId(), $friendids)) {
             //array_push($result, array("id"=>$row->getId(), "value" => $row->getFirstName()));
             $name = $row->getFirstName() . " " . $row->getLastName();
             array_push($result, array("id" => $row->getId(), "value" => $name));
         }
     }
     echo Zend_Json::encode($result);
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:31,代码来源:ProfileController-Backup-08-March-2011.php

示例4: example5Action

 /**
  * Pulling data from the database for user informat
  * 
  * @return void
  */
 public function example5Action()
 {
     $users = new Application_Model_User();
     $user = $users->fetchAll();
     $this->view->users = array();
     foreach ($user as $u) {
         $this->view->users[] = array('name' => $u->name, 'id' => $u->ID);
     }
     $this->view->success = true;
 }
开发者ID:notlikethis,项目名称:Agile-ExtJS-ZF,代码行数:15,代码来源:ExampleController.php

示例5: indexAction

 function indexAction()
 {
     $this->view->title = "User administration";
     $user = new Application_Model_User();
     $this->view->users = $user->fetchAll();
 }
开发者ID:spitfire471,项目名称:zend,代码行数:6,代码来源:UsersController.php

示例6: editAction

 /**
  * 编辑员工信息
  */
 public function editAction()
 {
     // 返回值数组
     $result = array('success' => true, 'info' => '编辑成功');
     $request = $this->getRequest()->getParams();
     $now = date('Y-m-d H:i:s');
     $user_session = new Zend_Session_Namespace('user');
     $user_id = $user_session->user_info['user_id'];
     $json = json_decode($request['json']);
     $updated = $json->updated;
     $inserted = $json->inserted;
     $deleted = $json->deleted;
     $employee = new Hra_Model_Employee();
     $user = new Application_Model_User();
     if (count($updated) > 0) {
         foreach ($updated as $val) {
             if ($employee->fetchAll("id != " . $val->id . " and email = '" . $val->email . "'")->count() > 0) {
                 $result['success'] = false;
                 $result['info'] = '更新失败,邮箱地址重复!';
                 echo Zend_Json::encode($result);
                 exit;
             } else {
                 if ($employee->fetchAll("id != " . $val->id . " and number = '" . $val->number . "'")->count() > 0) {
                     $result['success'] = false;
                     $result['info'] = '更新失败,工号重复!';
                     echo Zend_Json::encode($result);
                     exit;
                 } else {
                     $dept_manager_id = $val->dept_manager_id == '' ? null : $val->dept_manager_id;
                     $manager_id = $val->manager_id == '' ? null : $val->manager_id;
                     $dept_id = $val->dept_id == '' ? null : $val->dept_id;
                     $post_id = $val->post_id == '' ? null : $val->post_id;
                     $area_id = $val->area_id == '' ? null : $val->area_id;
                     $professional_qualifications_id = $val->professional_qualifications_id == '' ? null : $val->professional_qualifications_id;
                     $data = array('hide' => $val->hide, 'active' => $val->active, 'leader' => $val->leader, 'number' => $val->number, 'cname' => $val->cname, 'ename' => $val->ename, 'sex' => $val->sex, 'birthday' => $val->birthday, 'id_card' => $val->id_card, 'dept_id' => $dept_id, 'post_id' => $post_id, 'area_id' => $area_id, 'professional_qualifications_id' => $professional_qualifications_id, 'dept_manager_id' => $dept_manager_id, 'manager_id' => $manager_id, 'salary' => $val->salary, 'email' => $val->email, 'tel' => $val->tel, 'official_qq' => $val->official_qq, 'work_place' => $val->work_place, 'short_num' => $val->short_num, 'msn' => $val->msn, 'address' => $val->address, 'remark' => $val->remark, 'marital_status' => $val->marital_status, 'marry_day' => $val->marry_day, 'children_birthday' => $val->children_birthday, 'insurcode' => $val->insurcode, 'accumulation_fund_code' => $val->accumulation_fund_code, 'education' => $val->education, 'school' => $val->school, 'major' => $val->major, 'entry_date' => $val->entry_date, 'regularization_date' => $val->regularization_date, 'labor_contract_start' => $val->labor_contract_start, 'labor_contract_end' => $val->labor_contract_end, 'offical_address' => $val->offical_address, 'other_contact' => $val->other_contact, 'other_relationship' => $val->other_relationship, 'other_contact_way' => $val->other_contact_way, 'work_years' => $val->work_years, 'politics_status' => $val->politics_status, 'employment_type' => $val->employment_type, 'leave_date' => $val->leave_date, 'ext' => $val->ext, 'driving_license' => $val->driving_license, 'salary' => $val->salary, 'bank' => $val->bank, 'bank_num' => $val->bank_num, 'update_time' => $now, 'update_user' => $user_id);
                     $where = "id = " . $val->id;
                     try {
                         $employee->update($data, $where);
                     } catch (Exception $e) {
                         $result['success'] = false;
                         $result['info'] = $e->getMessage();
                         echo Zend_Json::encode($result);
                         exit;
                     }
                     if ($val->account == 1) {
                         if ($user->fetchAll("employee_id = " . $val->id)->count() > 0) {
                             $account_active = $val->account_active == true ? 1 : 0;
                             // 当员工系统账号已存在时,如需要改变账号状态,则更新系统账号状态信息
                             if ($user->fetchAll("active = " . $account_active . " and employee_id = " . $val->id)->count() == 0) {
                                 try {
                                     $user->update(array('active' => $account_active, 'update_user' => $user_id, 'update_time' => $now), "employee_id = " . $val->id);
                                 } catch (Exception $e) {
                                     $result['success'] = false;
                                     $result['info'] = $e->getMessage();
                                     echo Zend_Json::encode($result);
                                     exit;
                                 }
                             }
                         } else {
                             // 当员工系统账号不存在时,则添加新的系统账号信息
                             $data = array('employee_id' => $val->id, 'active' => $val->account_active, 'password' => md5($val->number . '123456'), 'create_time' => $now, 'create_user' => $user_id, 'update_time' => $now, 'update_user' => $user_id);
                             try {
                                 $newUserId = $user->insert($data);
                                 // 初始化用户角色为普通用户
                                 $roleMember = new Admin_Model_Member();
                                 try {
                                     $roleMember->insert(array('user_id' => $newUserId));
                                 } catch (Exception $e) {
                                     $result['success'] = false;
                                     $result['info'] = $e->getMessage();
                                     echo Zend_Json::encode($result);
                                     exit;
                                 }
                             } catch (Exception $e) {
                                 $result['success'] = false;
                                 $result['info'] = $e->getMessage();
                                 echo Zend_Json::encode($result);
                                 exit;
                             }
                         }
                     } else {
                         if ($user->fetchAll("employee_id = " . $val->id)->count() > 0) {
                             // 当员工系统账号已存在时,如需要改变账号状态,则更新系统账号状态信息
                             if ($user->fetchAll("active = " . $val->account_active . " and employee_id = " . $val->id)->count() == 0) {
                                 try {
                                     $user->update(array('active' => $val->account_active, 'update_user' => $user_id, 'update_time' => $now), "employee_id = " . $val->id);
                                 } catch (Exception $e) {
                                     $result['success'] = false;
                                     $result['info'] = $e->getMessage();
                                     echo Zend_Json::encode($result);
                                     exit;
                                 }
                             }
                         }
                     }
                 }
             }
//.........这里部分代码省略.........
开发者ID:xindalu,项目名称:evolve,代码行数:101,代码来源:EmployeeController.php

示例7: retrieveAction

 /**
  * Método utilizado para exibir todos os registros do banco de dados.
  * @method retrieveAction
  * @access public
  * @return array $data
  */
 public function retrieveAction()
 {
     $user = new Application_Model_User();
     $this->view->data = $user->fetchAll();
 }
开发者ID:rederlo,项目名称:zf_blog,代码行数:11,代码来源:UserController.php

示例8: userLikeThisAction

 public function userLikeThisAction()
 {
     $this->_helper->layout->setLayout('journal-layout-2column');
     //$item_id = $this->_getParam("blog_id");
     $item_id = $this->_getParam("item_id");
     $item_type = $this->_getParam("type");
     //$userNs = new Zend_Session_Namespace('members');
     //$this->view->userId = $userNs->userId;
     $item = false;
     $itemTypeText = "";
     if ($item_type != "") {
         if ($item_type == 'blog') {
             $blogM = new Application_Model_Blog();
             $this->view->blog = $item = $blogM->find($item_id);
             $itemTypeText = "Journal Post";
         }
         if ($item_type == 'status_comment' || $item_type == 'blog_comment') {
             $commentM = new Application_Model_Comment();
             $item = $commentM->find($item_id);
             $itemTypeText = "Comment";
             $item_type = "comment";
         }
         if ($item_type == 'status') {
             $wallM = new Application_Model_Wall();
             $item = $wallM->find($item_id);
             $itemTypeText = "Wall Post";
         }
         $this->view->itemTypeText = $itemTypeText;
     }
     //if item is not exists then redirect to Journal home page
     if (false === $item) {
         $this->_helper->redirector()->gotoUrl('/journal/index/');
         exit;
     }
     //Now get all positive votes of item
     //$where		= "item_id = $item_id AND vote=1 AND item_type='blog'";
     $where = "item_id = {$item_id} AND vote=1";
     if ($item_type == 'comment') {
         $where .= " AND (item_type='status_comment' OR item_type='blog_comment')";
     } else {
         $where .= " AND item_type='{$item_type}'";
     }
     $voteM = new Application_Model_Vote();
     $rawdata = $voteM->fetchAll($where);
     //Get all users ID voted on an item
     if (false !== $rawdata) {
         $user_array = array();
         foreach ($rawdata as $row) {
             $user_array[] = $row->getUserId();
         }
     }
     //get all users information from above User Ids
     $this->view->totalUsers = 0;
     if (count($user_array) > 0) {
         $usrstr = implode(",", $user_array);
         $userM = new Application_Model_User();
         $whereuser = "id IN ({$usrstr}) AND status='active'";
         $userData = $userM->fetchAll($whereuser, "first_name ASC");
         $this->view->userData = $userData;
         $settings = new Admin_Model_GlobalSettings();
         $page_size = $settings->settingValue('pagination_size');
         //$page_size = 1;
         $page = $this->_getParam('page', 1);
         $pageObj = new Base_Paginator();
         $paginator = $pageObj->fetchPageData($userM, $page, $page_size, $whereuser);
         $this->view->totalUsers = $pageObj->getTotalCount();
         $this->view->paginator = $paginator;
     }
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:69,代码来源:JournalController.php

示例9: getAllUsers

 public function getAllUsers($status = "")
 {
     $obj = new Application_Model_User();
     if ($status == "") {
         $entries = $obj->fetchAll();
     } else {
         $entries = $obj->fetchAll("status='active'");
     }
     $arrUserLevel = array('' => "Select");
     foreach ($entries as $entry) {
         $arrUserLevel[$entry->getId()] = $entry->getFirstName() . " " . $entry->getLastName() . " - [ Code:" . $entry->getEmployeeCode() . " ]";
     }
     return $arrUserLevel;
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:14,代码来源:User.php

示例10: exportAction

 public function exportAction()
 {
     $this->view->layout()->disableLayout();
     $this->_helper->viewRenderer->setNoRender(true);
     include_once LIBRARY_PATH . "/Base/Excel/PHPExcel.php";
     $objPHPExcel = new PHPExcel();
     $where = "1=1 AND status!='deleted'";
     $order = "addedon DESC";
     // Add some data
     $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A1', 'S. No.')->setCellValue('B1', 'Username')->setCellValue('C1', 'First Name')->setCellValue('D1', 'Surname')->setCellValue('E1', 'Email')->setCellValue('F1', 'Gender')->setCellValue('G1', 'Number of Friends')->setCellValue('H1', 'Created On');
     $model = new Application_Model_User();
     $users = $model->fetchAll($where, $order);
     if (count($users) > 0) {
         $i = 2;
         $sno = 1;
         foreach ($users as $_user) {
             //select users Numbers of friends
             $noOfFriends = 0;
             $friendM = new Application_Model_Friend();
             $userFriends = $friendM->countUserFriends($_user->getId());
             $noOfFriends = $userFriends["totalFriends"];
             //$country = $_user->findParentRow('Application_Model_DbTable_Country','Country');
             // $state  =  $_user->findParentRow('Application_Model_DbTable_State','State');
             $objPHPExcel->setActiveSheetIndex(0)->setCellValue('A' . $i, $sno)->setCellValue('B' . $i, $_user->getUsername())->setCellValue('C' . $i, $_user->getFirstName())->setCellValue('D' . $i, $_user->getLastName())->setCellValue('E' . $i, $_user->getEmail())->setCellValue('F' . $i, ucfirst($_user->getSex()))->setCellValue('G' . $i, $noOfFriends)->setCellValue('H' . $i, date("M j, Y", $_user->getAddedOn()));
             $i++;
             $sno++;
         }
     }
     // Rename sheet
     $objPHPExcel->getActiveSheet()->setTitle('Users');
     $objPHPExcel->getActiveSheet()->getColumnDimension('A')->setWidth(10);
     $objPHPExcel->getActiveSheet()->getColumnDimension('B')->setWidth(35);
     $objPHPExcel->getActiveSheet()->getColumnDimension('C')->setWidth(15);
     $objPHPExcel->getActiveSheet()->getColumnDimension('D')->setWidth(15);
     $objPHPExcel->getActiveSheet()->getColumnDimension('E')->setWidth(45);
     $objPHPExcel->getActiveSheet()->getColumnDimension('F')->setWidth(15);
     $objPHPExcel->getActiveSheet()->getColumnDimension('G')->setWidth(15);
     //$objPHPExcel->getActiveSheet()->getColumnDimension('H')->setWidth(25);
     //$objPHPExcel->getActiveSheet()->getColumnDimension('I')->setWidth(15);
     //$objPHPExcel->getActiveSheet()->getColumnDimension('J')->setWidth(15);
     //$objPHPExcel->getActiveSheet()->getColumnDimension('K')->setWidth(15);
     // Set active sheet index to the first sheet, so Excel opens this as the first sheet
     $objPHPExcel->setActiveSheetIndex(0);
     if ($this->_getParam('type') == 'xls') {
         // Redirect output to a client’s web browser (Excel5)
         header('Content-Type: application/vnd.ms-excel');
         header('Content-Disposition: attachment;filename="users.xls"');
         header('Cache-Control: max-age=0');
         $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
     } else {
         if ($this->_getParam('type') == 'pdf') {
             // Redirect output to a client’s web browser (Excel2007)
             header('Content-Type: application/pdf');
             header('Content-Disposition: attachment;filename="users.pdf"');
             header('Cache-Control: max-age=0');
             $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'PDF');
         } else {
             if ($this->_getParam('type') == 'csv') {
                 // Redirect output to a client’s web browser (Excel5)
                 header('Content-Type: application/vnd.ms-excel');
                 header('Content-Disposition: attachment;filename="users.csv"');
                 header('Cache-Control: max-age=0');
                 $objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'CSV');
             }
         }
     }
     $objWriter->save('php://output');
 }
开发者ID:riteshsahu1981,项目名称:we,代码行数:68,代码来源:UserController.php


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