Example #1
0
 public function viewAction()
 {
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'projects';
     $projectModel = new Timemanagement_Model_Projects();
     $projectTaskModel = new Timemanagement_Model_Projecttasks();
     $projectResourcesModel = new Timemanagement_Model_Projectresources();
     try {
         if (is_numeric($id) && $id > 0) {
             $auth = Zend_Auth::getInstance();
             if ($auth->hasIdentity()) {
                 $loginUserId = $auth->getStorage()->read()->id;
                 $loginuserRole = $auth->getStorage()->read()->emprole;
                 $loginuserGroup = $auth->getStorage()->read()->group_id;
             }
             $checkResourceExistsforProject = $projectResourcesModel->checkProjectResource($id, $loginUserId);
             if ($loginUserId == 1 || $checkResourceExistsforProject > 0) {
                 $data = $projectModel->getSingleProjectData($id);
                 if (!empty($data) && $data != "norows") {
                     $data_arr = array();
                     $call = $this->_getParam('call');
                     if ($call == 'ajaxcall') {
                         $this->_helper->layout->disableLayout();
                     }
                     $view = Zend_Layout::getMvcInstance()->getView();
                     $objname = $this->_getParam('objname');
                     $refresh = $this->_getParam('refresh');
                     $dashboardcall = $this->_getParam('dashboardcall');
                     //$data = array();
                     $searchQuery = '';
                     $searchArray = array();
                     $tablecontent = '';
                     if ($refresh == 'refresh') {
                         $sort = 'DESC';
                         $by = 'modified';
                         $perPage = DASHBOARD_PERPAGE;
                         $pageNo = 1;
                         $searchData = '';
                     } else {
                         $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
                         $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'modified';
                         $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                         $pageNo = $this->_getParam('page', 1);
                         $searchData = $this->_getParam('searchData');
                     }
                     $dataTmp = $projectTaskModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $id);
                     $dataTmp['emptyRoles'] = '';
                     $dataTmp['objectname'] = 'projecttasks';
                     $dataTmp['dataemptyFlag'] = '';
                     $dataTmp['menuName'] = 'Tasks';
                     $dataTmp['userid'] = '1';
                     $dataTmp['dashboardcall'] = 'Yes';
                     $dataTmp['projectId'] = $id;
                     array_push($data_arr, $dataTmp);
                     $dataResourceTmp = $projectResourcesModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $id);
                     $dataResourceTmp['emptyRoles'] = '';
                     $dataResourceTmp['objectname'] = 'projectresources';
                     $dataResourceTmp['dataemptyFlag'] = '';
                     $dataResourceTmp['menuName'] = 'Resources';
                     $dataResourceTmp['userid'] = '1';
                     $dataResourceTmp['dashboardcall'] = 'Yes';
                     $dataResourceTmp['projectId'] = $id;
                     array_push($data_arr, $dataResourceTmp);
                     $this->view->data_arr = $data_arr;
                     $this->view->controllername = $objName;
                     $this->view->data = $data;
                     $this->view->id = $id;
                     $this->view->ermsg = '';
                 } else {
                     $this->view->ermsg = 'norecord';
                 }
             } else {
                 $this->view->ermsg = 'nodata';
             }
         } else {
             $this->view->ermsg = 'nodata';
         }
     } catch (Exception $e) {
         $this->view->ermsg = 'nodata';
     }
 }
 public function indexAction()
 {
     $projectTaskModel = new Timemanagement_Model_Projecttasks();
     $call = $this->_getParam('call');
     if ($call == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $view = Zend_Layout::getMvcInstance()->getView();
     $objname = $this->_getParam('objname');
     $refresh = $this->_getParam('refresh');
     $dashboardcall = $this->_getParam('dashboardcall');
     $projectId = $this->_getParam('projectId');
     $data = array();
     $searchQuery = '';
     $searchArray = array();
     $tablecontent = '';
     if ($refresh == 'refresh') {
         if ($dashboardcall == 'Yes') {
             $perPage = DASHBOARD_PERPAGE;
         } else {
             $perPage = PERPAGE;
         }
         $sort = 'DESC';
         $by = 'modified';
         $pageNo = 1;
         $searchData = '';
         $searchQuery = '';
         $searchArray = '';
     } else {
         $sort = $this->_getParam('sort') != '' ? $this->_getParam('sort') : 'DESC';
         $by = $this->_getParam('by') != '' ? $this->_getParam('by') : 'modified';
         if ($dashboardcall == 'Yes') {
             $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
         } else {
             $perPage = $this->_getParam('per_page', PERPAGE);
         }
         $pageNo = $this->_getParam('page', 1);
         /** search from grid - START **/
         $searchData = $this->_getParam('searchData');
         $searchData = rtrim($searchData, ',');
         /** search from grid - END **/
     }
     $dataTmp = $projectTaskModel->getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $projectId);
     $dataTmp['projectId'] = $projectId;
     array_push($data, $dataTmp);
     $this->view->dataArray = $data;
     $this->view->call = $call;
     $this->view->messages = $this->_helper->flashMessenger->getMessages();
 }