Esempio n. 1
0
 /**
  * This will fetch all the default task details based on the search paramerters passed with pagination.
  *
  * @param string $sort
  * @param string $by
  * @param number $perPage
  * @param number $pageNo
  * @param JSON $searchData
  * @param string $call
  * @param string $dashboardcall
  * @param string $a
  * @param string $b
  * @param string $c
  * @param string $d
  *
  * @return array
  */
 public function getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $a = '', $loginUserId = '', $tm_role = '', $d = '')
 {
     $searchQuery = $having = '';
     $searchArray = array();
     $data = array();
     if ($searchData != '' && $searchData != 'undefined') {
         $searchValues = json_decode($searchData);
         foreach ($searchValues as $key => $val) {
             if ($key == 'tm_role') {
                 $having = " tm_role ='" . $val . "' ";
             } else {
                 if ($key == 'empname') {
                     $searchQuery .= " e.userfullname like'%" . $val . "%' AND ";
                 } else {
                     $searchQuery .= " " . $key . " like '%" . $val . "%' AND ";
                 }
             }
             $searchArray[$key] = $val;
         }
         $searchQuery = rtrim($searchQuery, " AND");
     }
     $objName = 'projectresources';
     $projectModel = new Timemanagement_Model_Projects();
     $projectData = $projectModel->getSingleProjectData($a);
     $tableFields = array('empname' => 'Name', 'tm_role' => 'Role', 'viewtasks' => '');
     $tablecontent = $this->getProjectResourcesGridData($sort, $by, $pageNo, $perPage, $searchQuery, $a, $loginUserId, $having);
     $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'menuName' => 'Resources', 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'call' => $call, 'dashboardcall' => $dashboardcall, 'search_filters' => array('tm_role' => array('type' => 'select', 'filter_data' => array('' => 'All', 'Manager' => 'Manager', 'Employee' => 'Employee'))));
     return $dataTmp;
 }
Esempio n. 2
0
 /**
  * This will fetch all the default task details based on the search paramerters passed with pagination.
  *
  * @param string $sort
  * @param string $by
  * @param number $perPage
  * @param number $pageNo
  * @param JSON $searchData
  * @param string $call
  * @param string $dashboardcall
  * @param string $a
  * @param string $b
  * @param string $c
  * @param string $d
  *
  * @return array
  */
 public function getGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $a = '', $b = '', $c = '', $d = '')
 {
     $searchQuery = '';
     $searchArray = array();
     $data = array();
     $having = '';
     if ($searchData != '' && $searchData != 'undefined') {
         $searchValues = json_decode($searchData);
         foreach ($searchValues as $key => $val) {
             if ($key == 'actual_hrs') {
                 $having = " " . $key . " like '%" . $val . "%' ";
             } else {
                 $searchQuery .= " " . $key . " like '%" . $val . "%' AND ";
             }
             $searchArray[$key] = $val;
         }
         $searchQuery = rtrim($searchQuery, " AND");
     }
     $objName = 'projecttasks';
     $projectModel = new Timemanagement_Model_Projects();
     $projectData = $projectModel->getSingleProjectData($a);
     $tableFields = array('task' => 'Name', 'actual_hrs' => 'Actual Hours', 'viewresources' => '');
     $tablecontent = $this->getProjectTaskData($sort, $by, $pageNo, $perPage, $searchQuery, $a, $having);
     $dataTmp = array('sort' => $sort, 'by' => $by, 'pageNo' => $pageNo, 'perPage' => $perPage, 'tablecontent' => $tablecontent, 'objectname' => $objName, 'menuName' => 'Tasks', 'extra' => array(), 'tableheader' => $tableFields, 'jsGridFnName' => 'getAjaxgridData', 'jsFillFnName' => '', 'searchArray' => $searchArray, 'call' => $call, 'dashboardcall' => $dashboardcall);
     return $dataTmp;
 }
 public function viewAction()
 {
     $auth = Zend_Auth::getInstance();
     $loginUserId = 0;
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'employeeprojects';
     $projectModel = new Timemanagement_Model_Projects();
     $projectTaskModel = new Timemanagement_Model_Projecttasks();
     $projectResourcesModel = new Timemanagement_Model_Projectresources();
     try {
         if (is_numeric($id) && $id > 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') : 'tpe.modified';
                     $perPage = $this->_getParam('per_page', DASHBOARD_PERPAGE);
                     $pageNo = $this->_getParam('page', 1);
                     $searchData = $this->_getParam('searchData');
                 }
                 $dataTmp = $projectTaskModel->getEmpTaskGrid($sort, $by, $perPage, $pageNo, $searchData, $call, $dashboardcall, $id, $loginUserId);
                 $dataTmp['emptyRoles'] = '';
                 $dataTmp['objectname'] = 'employeeprojects';
                 $dataTmp['dataemptyFlag'] = '';
                 $dataTmp['menuName'] = 'Tasks';
                 $dataTmp['dashboardcall'] = 'Yes';
                 $dataTmp['projectId'] = $id;
                 array_push($data_arr, $dataTmp);
                 $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';
         }
     } catch (Exception $e) {
         $this->view->ermsg = 'nodata';
     }
 }
 public function addresourcesAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
         $projectResourcesModel = new Timemanagement_Model_Projectresources();
         if ($this->getRequest()->getPost()) {
             $type = $this->_getParam('type');
             $projectId = $this->_getParam('projectId');
             $projRes = $this->_getParam('projRes');
             $projRes_arr = array();
             if (isset($projRes) && $projRes != '') {
                 $projRes = trim($projRes, ",");
                 $projRes_arr = explode(",", $projRes);
             }
             foreach ($projRes_arr as $newres) {
                 $projectResourceData = array('project_id' => trim($projectId), 'emp_id' => trim($newres), 'created_by' => $loginUserId, 'created' => gmdate("Y-m-d H:i:s"), 'is_active' => 1, 'modified_by' => $loginUserId, 'modified' => gmdate("Y-m-d H:i:s"));
                 $result = $projectResourcesModel->SaveorUpdateProjectResourceData($projectResourceData, '');
             }
             $projectResourcesData = $projectData = array();
             try {
                 if (is_numeric($projectId) && $projectId > 0) {
                     $projectModel = new Timemanagement_Model_Projects();
                     $projectData = $projectModel->getSingleProjectData($projectId);
                     $projectResourcesData = $projectResourcesModel->getProjectResourcesData($projectId);
                     if ($projectResourcesData == 'norows') {
                         $this->view->rowexist = "norows";
                     } else {
                         if (!empty($projectResourcesData)) {
                             $this->view->rowexist = "rows";
                         }
                     }
                 }
             } catch (Exception $e) {
                 $this->view->ermsg = 'nodata';
             }
             $this->view->projectData = $projectData;
             $this->view->projectResourcesData = $projectResourcesData;
         }
     }
 }
Esempio n. 5
0
 public function addtasksAction()
 {
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
         $loginuserRole = $auth->getStorage()->read()->emprole;
         $loginuserGroup = $auth->getStorage()->read()->group_id;
         $taskModel = new Timemanagement_Model_Tasks();
         $projectTasksModel = new Timemanagement_Model_Projecttasks();
         $projectModel = new Timemanagement_Model_Projects();
         if ($this->getRequest()->getPost()) {
             $type = $this->_getParam('type');
             if ($type == 'new') {
                 $projectId = $this->_getParam('projectId');
                 $task_name = $this->_getParam('task_name');
                 $def_check = $this->_getParam('def_check');
                 $projectData = $projectModel->getSingleProjectData($projectId);
                 $newTaskData = array('task' => trim($task_name), 'is_default' => $def_check == 'true' ? '1' : '0', 'created_by' => $loginUserId, 'created' => gmdate("Y-m-d H:i:s"), 'is_active' => 1, 'modified_by' => $loginUserId, 'modified' => gmdate("Y-m-d H:i:s"));
                 $insertedTaskId = $taskModel->SaveorUpdateTaskData($newTaskData, '');
                 if (is_numeric($insertedTaskId) && $insertedTaskId > 0) {
                     $projectTaskData = array('project_id' => trim($projectId), 'task_id' => trim($insertedTaskId), 'created_by' => $loginUserId, 'created' => gmdate("Y-m-d H:i:s"), 'is_active' => 1, 'modified_by' => $loginUserId, 'modified' => gmdate("Y-m-d H:i:s"));
                     $result = $projectTasksModel->SaveorUpdateProjectTaskData($projectTaskData, '');
                 }
             } else {
                 if ($type == 'default') {
                     $projectId = $this->_getParam('projectId');
                     $taskids = $this->_getParam('taskids');
                     $defaultTaskIds = json_decode($taskids);
                     $projectData = $projectModel->getSingleProjectData($projectId);
                     if (count($defaultTaskIds) > 0) {
                         $projectTaskData = array();
                         foreach ($defaultTaskIds as $defTaskId) {
                             $projectTaskData = array('project_id' => trim($projectId), 'task_id' => trim($defTaskId), 'created_by' => $loginUserId, 'created' => gmdate("Y-m-d H:i:s"), 'is_active' => 1, 'modified_by' => $loginUserId, 'modified' => gmdate("Y-m-d H:i:s"));
                             $result = $projectTasksModel->SaveorUpdateProjectTaskData($projectTaskData, '');
                         }
                     }
                 } else {
                     if ($type == 'most') {
                         $projectId = $this->_getParam('projectId');
                         $taskids = $this->_getParam('taskids');
                         $mostTaskIds = json_decode($taskids);
                         $projectData = $projectModel->getSingleProjectData($projectId);
                         if (count($mostTaskIds) > 0) {
                             $projectTaskData = array();
                             foreach ($mostTaskIds as $mostTaskId) {
                                 $projectTaskData = array('project_id' => trim($projectId), 'task_id' => trim($mostTaskId), 'created_by' => $loginUserId, 'created' => gmdate("Y-m-d H:i:s"), 'is_active' => 1, 'modified_by' => $loginUserId, 'modified' => gmdate("Y-m-d H:i:s"));
                                 $result = $projectTasksModel->SaveorUpdateProjectTaskData($projectTaskData, '');
                             }
                         }
                     }
                 }
             }
             $projectTasksData = array();
             $projectTasksData = $projectTasksModel->getProjectTasksData($projectId);
             if ($projectTasksData == 'norows') {
                 $this->view->rowexist = "norows";
             } else {
                 if (!empty($projectTasksData)) {
                     $this->view->rowexist = "rows";
                 }
             }
             $this->view->projectTasksData = $projectTasksData;
             $this->view->projectId = $projectId;
         }
     }
 }