예제 #1
0
 public function indexAction()
 {
     //        $options = $this->getFrontController()->getParam('bootstrap')->getApplication()->getOptions();
     $model = new Branch();
     $select = $model->select();
     $request = $this->getRequest();
     $page = $request->getParam('page', 1);
     $sort = $request->getParam('sort', 'web_name');
     $order = $request->getParam('order', 'asc');
     $select->where('ghost = false');
     $select->order($sort . ' ' . $order);
     //        $this->view->assign('paginator', new Base_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select)));
     //        $paginator->setCurrentPageNumber($page);
     //        $this->view->paginator = $paginator;
     $paginator = new Base_Paginator(new Zend_Paginator_Adapter_DbTableSelect($select));
     $paginator->setCurrentPageNumber($page);
     $this->view->paginator = $paginator;
     $this->view->headers = array('branch_name', 'web_name', 'type', 'id_status', 'city', 'province');
 }
예제 #2
0
파일: Branch.php 프로젝트: knatorski/SMS
 public function getBranchesInGroup($id)
 {
     $branch = new Branch();
     $select = $branch->select()->from('branch')->join('branch_branch_group', 'branch.id= branch_branch_group.id_branch', array())->where('branch_branch_group.id_branch_group = ?', $id)->where('branch.ghost = false and branch_branch_group.ghost = false')->order(array('branch.created_at', 'branch.id'))->setIntegrityCheck(false);
     return $select;
 }
 public function __construct()
 {
     $this->categories_list = Categories::select()->orderBy('category')->get();
     $this->branch_list = Branch::select()->orderBy('id')->get();
     $this->student_categories_list = StudentCategories::select()->orderBy('cat_id')->get();
 }
예제 #4
0
파일: User.php 프로젝트: knatorski/SMS
 public function getDataToUserReport()
 {
     $profileModel = new Profile();
     $select = $profileModel->select()->order('id_user');
     $profileDataArray = $profileModel->fetchAll($select)->toArray();
     $groupModel = new Group();
     $select = $groupModel->select();
     $groupDataArray = $groupModel->fetchAll($select)->toArray();
     foreach ($groupDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $groupDataArray = $tmp;
     unset($tmp);
     $branchModel = new Branch();
     $select = $branchModel->select();
     $branchDataArray = $branchModel->fetchAll($select)->toArray();
     foreach ($branchDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $branchDataArray = $tmp;
     unset($tmp);
     $userModel = new User();
     $select = $userModel->select();
     $userDataArray = $userModel->fetchAll($select)->toArray();
     foreach ($userDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $userDataArray = $tmp;
     unset($tmp);
     $roleModel = new Role();
     $select = $roleModel->select();
     $roleDataArray = $roleModel->fetchAll($select)->toArray();
     foreach ($roleDataArray as $key => $value) {
         $tmp[$value['id']] = $value;
     }
     $roleDataArray = $tmp;
     unset($tmp);
     $groupArray = array();
     foreach ($profileDataArray as $key => $value) {
         $data = $this->getAuthorizationsForProfile($value['id']);
         foreach ($data as $key2 => $values) {
             foreach ($values as $key3 => $privs) {
                 /* if ($privs['ghost'] === true) {
                     unset($data[$key2][$key3]);
                     continue;
                     }
                    */
                 $tmp = array('login' => '', 'surname' => '', 'first_name' => '', 'group' => '', 'role' => '', 'branch' => '', 'ghost' => '');
                 if ($key2 === 'group') {
                     $tmp['group'] = $groupDataArray[$privs['id_group']]['group_name'];
                 }
                 if ($key2 === 'role') {
                     $tmp['role'] = $roleDataArray[$privs['id_role']]['description'];
                 }
                 $tmp['login'] = $userDataArray[$value['id_user']]['login'];
                 $tmp['surname'] = $userDataArray[$value['id_user']]['surname'];
                 $tmp['first_name'] = $userDataArray[$value['id_user']]['first_name'];
                 $tmp['branch'] = $branchDataArray[$value['id_branch']]['branch_name'];
                 $tmp['ghost'] = $userDataArray['ghost'] ? 'NIEAKTYWNY' : 'AKTYWNY';
                 $groupArray[] = $tmp;
             }
         }
     }
     return $groupArray;
 }