Example #1
0
 public function baseInit()
 {
     $branch = Zend_Auth::getInstance()->getIdentity()->id_branch;
     $db = Zend_Db_Table_Abstract::getDefaultAdapter();
     $userEvent = new Logic_UserEvent();
     $assignedUsers = $userEvent->showUsers($this->getAttrib('id_next_event'));
     $assignedUsers = $assignedUsers->toArray();
     $alreadyAssignedUsers = array();
     if (isset($assignedUsers)) {
         foreach ($assignedUsers as $assignedUser) {
             $alreadyAssignedUsers[] = $assignedUser['id_euser'];
         }
     }
     $users = new Logic_User();
     $select = $users->getUsersInBranch($branch);
     $doradcyList = array();
     $doradcy = $db->fetchAll($select);
     unset($select);
     $profileRole = new ProfileRole();
     $config = Zend_Registry::get('config');
     foreach ($doradcy as $key => $value) {
         $ru = $profileRole->fetchAll("id_profile = " . $value['profile_id'])->toArray();
         if ($value['role_count'] == 1 && $ru[0]['id_role'] == $config['role']['assistant']) {
             unset($doradcy[$key]);
         }
     }
     foreach ($doradcy as $key) {
         if (!in_array($key['id'], $alreadyAssignedUsers)) {
             $doradcyList[$key['id']] = $key['first_name'] . " " . $key['surname'];
         }
     }
     //        $doradcy = $users->query($doradcy);
     $this->addElement('select', 'user', array('label' => 'Wybierz doradcę:', 'required' => true, 'MultiOptions' => $this->addClearStart($doradcyList)));
     $this->submit();
     $this->cancel();
 }
Example #2
0
 public function showAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('id');
     $id = $this->_helper->IdConvert->hexToStr($id);
     $logic = new Logic_Branch();
     $logicUser = new Logic_User();
     $userModel = new User();
     $profileRole = new ProfileRole();
     $select = $logicUser->getUsersInBranch($id);
     $user_data = $userModel->fetchAll($select)->toArray();
     $config = Zend_Registry::get('config');
     foreach ($user_data as $key => $value) {
         $ru = $profileRole->fetchAll("id_profile = " . $value['profile_id'])->toArray();
         if ($value['role_count'] == 1 && $ru[0]['id_role'] == $config['role']['assistant']) {
             unset($user_data[$key]);
         }
     }
     $data = array();
     try {
         $data = $logic->showBranch($id);
         $headers = $data->getHeaderMappings();
         $this->view->advisers = count($user_data);
         $headers['advisers'] = array('title' => 'Ilość doradców', 'sort' => false);
     } catch (Logic_Branch_Exception $e) {
         $this->_helper->messenger->error();
         $this->_helper->redirector('index');
         return;
     }
     if ($data['map_image'] != "") {
         $data['map_image'] = '<img src="/static/img/' . $data['map_image'] . '" />';
     }
     $this->view->data = $data;
     $this->view->data_headers = $headers;
 }
Example #3
0
 public function showbranchusersAction()
 {
     $request = $this->getRequest();
     $id = $request->getParam('IdBranch');
     $logic = new Logic_User();
     $users = $logic->getUsersInBranch($id);
     $userList = new Base_Paginator(new Zend_Paginator_Adapter_DbTableSelect($users));
     foreach ($userList as $user) {
         $foundUsers[] = array('surname' => $user['surname'], 'firstname' => $user['first_name'], 'id' => $user['id']);
     }
     if (count($foundUsers) == 0) {
         $foundUsers[] = array('surname' => 'brak przypisanych pracowników', 'firstname' => '', 'id' => '');
     }
     $this->view->usersList = $foundUsers;
 }