コード例 #1
0
 public function viewAction()
 {
     if (defined('EMPTABCONFIGS')) {
         $empOrganizationTabs = explode(",", EMPTABCONFIGS);
         if (in_array('education_details', $empOrganizationTabs)) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginUserRole = $auth->getStorage()->read()->emprole;
                 $loginUserGroup = $auth->getStorage()->read()->group_id;
             }
             $userID = '';
             $empdata = array();
             $conText = "";
             $objName = 'educationdetails';
             $userid = $this->getRequest()->getParam('userid');
             $call = $this->_getParam('call');
             if ($call == 'ajaxcall') {
                 $this->_helper->layout->disableLayout();
                 $userID = $this->_getParam('unitId') != '' ? $this->_getParam('unitId') : $this->_getParam('userid');
                 $conText = $this->_getParam('context') != '' ? $this->_getParam('context') : $this->getRequest()->getParam('context');
             }
             if ($userid == '') {
                 $userid = $userID;
             }
             $Uid = $userid ? $userid : $userID;
             $educationdetailsModel = new Default_Model_Educationdetails();
             $employeeModal = new Default_Model_Employee();
             try {
                 if ($Uid && is_numeric($Uid) && $Uid > 0 && $Uid != $loginUserId) {
                     $usersModel = new Default_Model_Users();
                     $empdata = $employeeModal->getActiveEmployeeData($Uid);
                     $employeeData = $usersModel->getUserDetailsByIDandFlag($Uid);
                     if ($empdata == 'norows') {
                         $this->view->rowexist = "norows";
                         $this->view->empdata = "";
                     } else {
                         $this->view->rowexist = "rows";
                         if (!empty($empdata)) {
                             $view = Zend_Layout::getMvcInstance()->getView();
                             $objname = $this->_getParam('objname');
                             $refresh = $this->_getParam('refresh');
                             $dashboardcall = $this->_getParam('dashboardcall', null);
                             $data = array();
                             $searchQuery = '';
                             $searchArray = array();
                             $tablecontent = '';
                             if ($refresh == 'refresh') {
                                 if ($dashboardcall == 'Yes') {
                                     $perPage = DASHBOARD_PERPAGE;
                                 } else {
                                     $perPage = PERPAGE;
                                 }
                                 $sort = 'DESC';
                                 $by = 'e.modifieddate';
                                 $pageNo = 1;
                                 $searchData = '';
                                 $searchQuery = '';
                                 $searchArray = array();
                             } else {
                                 $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                                 $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'e.modifieddate';
                                 if ($dashboardcall == 'Yes') {
                                     $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                                 } else {
                                     $perPage = $this->_getParam('per_page', PERPAGE);
                                 }
                                 $pageNo = $this->_getParam('page', 1);
                                 $searchData = $this->_getParam('searchData');
                                 $searchData = rtrim($searchData, ',');
                             }
                             $dataTmp = $educationdetailsModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $userid, $conText);
                             array_push($data, $dataTmp);
                             $this->view->id = $userid;
                             $this->view->controllername = $objName;
                             $this->view->dataArray = $data;
                             $this->view->employeedata = $employeeData[0];
                             $this->view->call = $call;
                             $this->view->messages = $this->_helper->flashMessenger->getMessages();
                         }
                         $this->view->empdata = $empdata;
                     }
                 } else {
                     $this->view->rowexist = "norows";
                 }
             } catch (Exception $e) {
                 $this->view->rowexist = "norows";
             }
         } else {
             $this->_redirect('error');
         }
     } else {
         $this->_redirect('error');
     }
 }