public function viewpopupAction()
 {
     Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/");
     $auth = Zend_Auth::getInstance();
     if ($auth->hasIdentity()) {
         $loginUserId = $auth->getStorage()->read()->id;
     }
     $id = $this->getRequest()->getParam('id');
     if ($id == '') {
         $id = $loginUserId;
     }
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'empjobhistory';
     $empjobhistoryform = new Default_Form_empjobhistory();
     $empjobhistoryModel = new Default_Model_Empjobhistory();
     $employeeModel = new Default_Model_Employee();
     $positionModel = new Default_Model_Positions();
     $departmentModel = new Default_Model_Departments();
     $jobtitleModel = new Default_Model_Jobtitles();
     $empjobhistoryform->removeElement("submit");
     $elements = $empjobhistoryform->getElements();
     $clientsModel = new Timemanagement_Model_Clients();
     if (count($elements) > 0) {
         foreach ($elements as $key => $element) {
             if ($key != "Cancel" && $key != "Edit" && $key != "Delete" && $key != "Attachments") {
                 $element->setAttrib("disabled", "disabled");
             }
         }
     }
     if ($id) {
         $data = $empjobhistoryModel->getsingleEmpJobHistoryData($id);
         if (!empty($data)) {
             $positionheldArr = 'norows';
             if (is_numeric($data[0]['positionheld'])) {
                 $positionheldArr = $positionModel->getsinglePositionData($data[0]['positionheld']);
             }
             if ($positionheldArr != 'norows') {
                 $empjobhistoryform->positionheld->addMultiOption($positionheldArr[0]['id'], $positionheldArr[0]['positionname']);
             }
             $departmentArr = array();
             if (is_numeric($data[0]['department'])) {
                 $departmentArr = $departmentModel->getSingleDepartmentData($data[0]['department']);
             }
             if (!empty($departmentArr)) {
                 $empjobhistoryform->department->addMultiOption($departmentArr['id'], $departmentArr['deptname']);
             }
             $jobtitleArr = 'norows';
             if (is_numeric($data[0]['jobtitleid'])) {
                 $jobtitleArr = $jobtitleModel->getsingleJobTitleData($data[0]['jobtitleid']);
             }
             if ($jobtitleArr != 'norows') {
                 $empjobhistoryform->jobtitleid->addMultiOption($jobtitleArr[0]['id'], $jobtitleArr[0]['jobtitlename']);
             }
             $clientsArr = array();
             if (is_numeric($data[0]['client_id'])) {
                 $clientsArr = $clientsModel->getClientDetailsById($data[0]['client_id']);
             }
             if (!empty($clientsArr)) {
                 $empjobhistoryform->client->addMultiOption($clientsArr[0]['id'], $clientsArr[0]['client_name']);
             }
             $empjobhistoryform->populate($data[0]);
             if (isset($data[0]['start_date']) && $data[0]['start_date'] != '') {
                 $start_date = sapp_Global::change_date($data[0]['start_date'], 'view');
                 $empjobhistoryform->start_date->setValue($start_date);
             }
             if (isset($data[0]['end_date']) && $data[0]['end_date'] != '') {
                 $end_date = sapp_Global::change_date($data[0]['end_date'], 'view');
                 $empjobhistoryform->end_date->setValue($end_date);
             }
         }
         $this->view->controllername = $objName;
         $this->view->id = $id;
         $this->view->form = $empjobhistoryform;
     }
 }
Пример #2
0
 /**
  * This Action is used to view the client details based on the client id.
  *
  */
 public function viewAction()
 {
     $id = $this->getRequest()->getParam('id');
     $callval = $this->getRequest()->getParam('call');
     if ($callval == 'ajaxcall') {
         $this->_helper->layout->disableLayout();
     }
     $objName = 'clients';
     $clientsModel = new Timemanagement_Model_Clients();
     try {
         if (is_numeric($id) && $id > 0) {
             $data = $clientsModel->getClientDetailsById($id);
             if (!empty($data) && $data != "norows") {
                 $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';
     }
 }