public function getdatafromajaxcallAction() { $meetingroomModel = new Default_Model_Meetingroom(); $methodKey = $this->_getParam('methodKey', null); if ($methodKey == "1") { //Get Departments by ProjectID $projectid = $this->_getParam('projectid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Department'); if ($projectid != '') { $rows = $meetingroomModel->getDepartmentsByProject($projectid); foreach ($rows as $row) { $options_data .= sapp_Global::selectOptionBuilder($row['id'], $row['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "2") { $projectid = $this->_getParam('projectid', null); $prjIDS = $projectid; $options_data = ""; if (is_array($projectid)) { $prjIDS = implode(",", $projectid); } $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Resource'); if ($projectid != '') { $rows = $meetingroomModel->getEmployeesByBU($prjIDS); foreach ($rows as $row) { $options_data .= sapp_Global::selectOptionBuilder($row['id'], $row['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "3") { try { $meetingroomModel = new Default_Model_Meetingroom(); $roomid = $this->_getParam('roomid', null); $bookeddate = $this->_getParam('bookeddate', null); $rows = $meetingroomModel->getMeetingsByRoomAndDate($roomid, $bookeddate); $datatable = ""; $datatable .= sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Booked Meetings", $rows); $this->_helper->json(array('meetingtable' => $datatable)); } catch (Exception $e) { echo $e->getMessage(); } } } } }
public function getdatafromajaxcallAction() { $taskallocation_model = new Default_Model_Tasksallocation(); $methodKey = $this->_getParam('methodKey', null); if ($methodKey == "1") { //Get Project Tasks $projectid = $this->_getParam('projectid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Task'); if ($projectid != '') { $dept_data = $taskallocation_model->getProjectTasks($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "2") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Task Details", $taskallocation_model->getTaskDetails($taskid)))); } else { if ($methodKey == "3") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $taskActivityDetails = $taskallocation_model->getTaskActivityDetails($taskid); $this->_helper->json(array('options' => $this->getActivitesEditableGrid($taskActivityDetails))); //$this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Task Activity Details", $taskActivityDetails))); } else { if ($methodKey == "4") { //Get Project resources $projectid = $this->_getParam('projectid', null); $options_data = ""; //$options_data .= sapp_Global::selectOptionBuilder('0', 'Select Task'); if ($projectid != '') { $dept_data = $taskallocation_model->getEmployeesByProject($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } } } } }
public function addnewcategoryAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); /** ** Instantiate category form **/ $addCategoryForm = new Default_Form_Categories(); $this->view->form = $addCategoryForm; /** set form action parameter **/ $addCategoryForm->setAttrib('action', BASE_URL . 'categories/addnewcategory'); /** ** To populate existing categories in auto-search **/ $categoriesObj = $this->categoriesModel->getCategories('add'); $categoriesStr = ''; if (!empty($categoriesObj)) { for ($i = 0; $i < sizeof($categoriesObj); $i++) { $categoriesStr .= "'" . $categoriesObj[$i]['category'] . "',"; } $categoriesStr = trim($categoriesStr, ","); } $this->view->categoriesStr = $categoriesStr; /** ** Check if form post is initiated ** if yes, check if form is valid ** if yes, ** 1. capture form values ** 2. prepare data object ** 3. insert into database ** if no, ** 1. build error message object **/ if ($this->getRequest()->getPost()) { if ($addCategoryForm->isValid($this->_request->getPost())) { /** capture form values **/ $categoryName = $this->_request->getParam('category'); $categoryDesc = $this->_request->getParam('description'); /** prepare data to insert into database **/ $data = array('category' => $categoryName, 'description' => $categoryDesc, 'isused' => 0, 'isactive' => 1, 'modifiedby' => $this->loggedInUser, 'createdby' => $this->loggedInUser, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'createddate' => gmdate("Y-m-d H:i:s")); $res = $this->categoriesModel->addCategory($data); if ($res) { /** insert into log manager table **/ sapp_Global::logManager(POLICY_DOCS_CATEGORIES, 1, $this->loggedInUser, $res); $this->view->newCat = $res; } $categoriesData = $this->categoriesModel->getCategories('add'); $opt = ''; foreach ($categoriesData as $category) { $opt .= sapp_Global::selectOptionBuilder($category['id'], $category['category']); } $this->view->categoriesData = $opt; $this->view->eventact = 'added'; $this->view->popup = 'close'; } else { $validationMsgs = $addCategoryForm->getMessages(); foreach ($validationMsgs as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = 'categories'; $this->view->ermsg = ''; }
/** * This action is used to add/edit identity codes in popup */ public function addpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $prev_cntrl = $this->_getParam('prev_cntrl', null); $user_id = $this->_getParam('user_id', null); $IdentityCodesform = new Default_Form_identitycodes(); $IdentityCodesform->setAction(BASE_URL . 'identitycodes/addpopup/prev_cntrl/' . $prev_cntrl); $IdentityCodesModel = new Default_Model_Identitycodes(); $identity_data = ''; $IdentityCodesform->removeElement('vendor_code'); $IdentityCodesform->removeElement('staffing_code'); try { $identityCodesArr = $IdentityCodesModel->getIdentitycodesRecord(); if (count($identityCodesArr) > 0) { $id = $identityCodesArr[0]['id']; } else { $id = ''; } if ($id != '') { $id = abs($id); $data = $identityCodesArr; //print_r($data);exit; if (!empty($data)) { $IdentityCodesform->setDefault("employee_code", $data[0]["employee_code"]); $IdentityCodesform->setDefault("bg_code", $data[0]["backgroundagency_code"]); $IdentityCodesform->setDefault("users_code", $data[0]["users_code"]); $IdentityCodesform->setDefault("requisition_code", $data[0]["requisition_code"]); $IdentityCodesform->setDefault("id", $data[0]["id"]); $IdentityCodesform->submit->setLabel('Update'); $this->view->id = $id; $this->view->nodata = ''; } else { $this->view->nodata = 'norecord'; } } else { $IdentityCodesform->submit->setAttrib('value', 'Save'); } } catch (Exception $e) { $this->view->nodata = 'nodata'; } if (!sapp_Global::_isactivemodule(BGCHECKS)) { $IdentityCodesform->removeElement('bg_code'); } if (!sapp_Global::_isactivemodule(RESOURCEREQUISITION)) { $IdentityCodesform->removeElement('requisition_code'); } $this->view->form = $IdentityCodesform; if ($this->getRequest()->getPost()) { $result = $this->save($IdentityCodesform, 'from popup'); $this->view->msgarray = $result; if (isset($result['msg']) && $result['msg'] != '') { if ($prev_cntrl == 'usermanagement') { $identityCodesArr = $IdentityCodesModel->getIdentitycodesRecord(); $identityCodesArr = $identityCodesArr[0]; $identity_data .= sapp_Global::selectOptionBuilder($identityCodesArr['users_code'], "Users (" . $identityCodesArr['users_code'] . ")"); /* Removing the codes which are not included for first phase*/ //$identity_data = sapp_Global::selectOptionBuilder($identityCodesArr['staffing_code'], "Staffing (".$identityCodesArr['staffing_code'].")"); //$identity_data .= sapp_Global::selectOptionBuilder($identityCodesArr['vendors_code'], "Vendors (".$identityCodesArr['vendors_code'].")"); } else { if ($prev_cntrl == 'organisationinfo' || $prev_cntrl == 'employee') { $user_model = new Default_Model_Usermanagement(); if (isset($_POST['user_id']) && $_POST['user_id'] != '') { $user_id = $_POST['user_id']; } if ($user_id != 'new') { $user_data = $user_model->getUserDataById($user_id); $identity_data = $user_data['employeeId']; } else { $identity_codes = $IdentityCodesModel->getIdentitycodesRecord(); $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : ""; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } $identity_data = $emp_id; } } } } } $this->view->identity_data = $identity_data; $this->view->prev_cntrl = $prev_cntrl; $this->view->user_id = $user_id; }
public function addpopupAction() { $emptyFlag = NULL; $msgarray = array(); Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $jobtitleid = $this->_request->getParam('jobtitleid'); $visible = true; $controllername = 'positions'; $positionsform = new Default_Form_positions(); $positionsmodel = new Default_Model_Positions(); $jobtitlesmodel = new Default_Model_Jobtitles(); if ($jobtitleid == null) { $jobtitleidmodeldata = $jobtitlesmodel->getJobTitleList(); if (!empty($jobtitleidmodeldata)) { foreach ($jobtitleidmodeldata as $jobtitleidres) { $positionsform->jobtitleid->addMultiOption($jobtitleidres['id'], utf8_encode($jobtitleidres['jobtitlename'])); $this->view->notdisplayposition = 0; } } else { $msgarray['jobtitleid'] = 'Job titles are not configured yet.'; $emptyFlag++; } $this->view->emptyFlag = $emptyFlag; } else { $jobtitleidres = $jobtitlesmodel->getsingleJobTitleData($jobtitleid); $positionsform->jobtitleid->addMultiOption($jobtitleidres[0]['id'], utf8_encode($jobtitleidres[0]['jobtitlename'])); $positionsform->setDefault('jobtitleid', $jobtitleid); $this->view->notdisplayposition = $jobtitleid; } $positionsform->setAction(BASE_URL . 'positions/addpopup'); if ($this->getRequest()->getPost()) { if ($positionsform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $positionname = $this->_request->getParam('positionname'); $jobtitleidpop = $this->_request->getParam('jobtitleid'); $description = $this->_request->getParam('description'); $displayposition = $this->_request->getParam('display'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('positionname' => trim($positionname), 'jobtitleid' => $jobtitleidpop, 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $positionsmodel->SaveorUpdatePositionData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/positions'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $opt = ''; if ($displayposition == '0') { $this->view->positionlistArr = $opt; } else { $positionlistArr = $positionsmodel->getPositionList($displayposition); foreach ($positionlistArr as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['positionname']); } $this->view->positionlistArr = $opt; } $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $positionsform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $positionsform; $this->view->ermsg = ''; $this->view->disableselect = $visible; }
public function addpopupAction() { $msgarray = array(); $emptyFlag = ''; 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'); $controllername = 'expensecategory'; $expenseCategoryForm = new Timemanagement_Form_Expensecategory(); $expenseCategoryModel = new Timemanagement_Model_Expensecategories(); $clientsForm->setAction(BASE_URL . 'timemanagement/expensecategory/addpopup'); if ($this->getRequest()->getPost()) { if ($expenseCategoryForm->isValid($this->_request->getPost())) { $category = $this->_request->getParam('category'); $date = gmdate("Y-m-d H:i:s"); $data = array('category' => $category, 'created_by' => $loginUserId, 'created' => gmdate("Y-m-d H:i:s"), 'is_active' => 1); $where = ''; $Id = $expenseCategoryModel->SaveorUpdateExpenseCategoryData($data, $where); $expenseCategoryData = $expenseCategoryModel->fetchAll('is_active = 1', 'category')->toArray(); $opt = ''; foreach ($expenseCategoryData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['category']); } $this->view->expenseCategoryData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $expenseCategoryForm->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $expenseCategoryForm; $this->view->ermsg = ''; }
public function addnewstateAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $msgarray = array(); $controllername = 'states'; $statestring = ''; $id = $this->getRequest()->getParam('id'); $selectedcountryid = $this->_request->getParam('selectcountryid', null); $statesform = new Default_Form_states(); $statesmodel = new Default_Model_States(); $countriesModel = new Default_Model_Countries(); /* Changing the form */ $statesform->setAction(BASE_URL . 'states/addnewstate/selectcountryid/' . $selectedcountryid); $statesform->removeElement('state'); $statesform->addElement('text', 'state', array('label' => 'State', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter state name.'))))); /* END */ $countrieslistArr = $countriesModel->getTotalCountriesList(''); if (sizeof($countrieslistArr) > 0) { $statesform->countryid->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { if (isset($selectedcountryid)) { if ($countrieslistres['id'] == $selectedcountryid) { $statesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); $statesform->setDefault('countryid', $selectedcountryid); } } else { $statesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } } } else { $msgarray['countryid'] = 'Countries are not configured yet'; } if ($this->getRequest()->getPost()) { $errorflag = "true"; $msgarray = array(); $id = $this->_request->getParam('id'); $dbstate = ''; $dbcountryid = ''; $state = trim($this->_request->getParam('state')); $countryid = $this->_request->getParam('countryid'); if (isset($countryid) && $countryid != '') { $isDuplicateStateNameArr = $statesmodel->getDuplicateStateName($state, $countryid); if ($isDuplicateStateNameArr[0]['count'] > 0) { $errorflag = "false"; $msgarray['state'] = "State already exists."; } } else { $errorflag = "false"; $msgarray['countryid'] = "Please select country."; } if ($statesform->isValid($this->_request->getPost()) && $errorflag == "true") { $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $NewStateId = $statesmodel->SaveMainStateData($countryid, $state); $tableid = $NewStateId; $actionflag = 1; $menuidArr = $menumodel->getMenuObjID('/states'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); if (isset($selectedcountryid)) { $stateData = $statesmodel->getStatesList($selectedcountryid, ''); } else { $stateData = array(); } $opt = ''; foreach ($stateData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['state_name']); } $this->view->stateData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $statesform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } } } $this->view->ermsg = ''; $this->view->form = $statesform; $this->view->msgarray = $msgarray; $this->view->controllername = $controllername; }
/** * This function returns candidates and interviewers based on a particular requisition code. * @param integer $req_id = id of requisition * @param integer $loginUserGroup = id of group * @param integer $loginUserId = id of logged user * @return array Array of candidate options and interviewers options. */ public function getcandidates_forinterview($req_id, $loginUserGroup, $loginUserId) { $jobtitleModel = new Default_Model_Jobtitles(); $candsmodel = new Default_Model_Candidatedetails(); $reqData = $this->getRequisitionDataById($req_id); $candsData = $candsmodel->getnotscheduledcandidateData($req_id); $candStr = ''; $jobttlArr = array(); $jobtitle = ''; $managerStr = ""; if (!empty($candsData)) { foreach ($candsData as $cand) { $candStr .= sapp_Global::selectOptionBuilder($cand['id'], $cand['candidate_name']); } } else { $candStr = "nocandidates"; } if (!empty($reqData)) { $reqData['jobtitlename'] = ''; $jobttlArr = $jobtitleModel->getsingleJobTitleData($reqData['jobtitle']); if (!empty($jobttlArr) && $jobttlArr != 'norows') { $jobtitle = $jobttlArr[0]['jobtitlename']; $reqData['jobtitlename'] = $jobttlArr[0]['jobtitlename']; } $repmanData = $this->getReportingmanagers($loginUserGroup, $loginUserId, '', $reqData['department_id'], 'interviewer'); if (!empty($repmanData)) { foreach ($repmanData as $rep) { $managerStr .= sapp_Global::selectOptionBuilder($rep['id'], $rep['name'], $rep['profileimg']); } } else { $managerStr = "nomanagers"; } } return array('candidates' => $candStr, 'managers' => $managerStr, 'jobtitle' => $jobtitle); }
public function addemppopupAction() { $flag = 'true'; $controllername = 'employee'; $msgarray = array(); $emptyFlag = 0; Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $deptidforhead = $this->_getParam('deptidforhead', null); $report_opt = array(); $emp_form = new Default_Form_employee(); $user_model = new Default_Model_Usermanagement(); $role_model = new Default_Model_Roles(); $prefixModel = new Default_Model_Prefix(); $identity_code_model = new Default_Model_Identitycodes(); $jobtitlesModel = new Default_Model_Jobtitles(); $deptModel = new Default_Model_Departments(); $positionsmodel = new Default_Model_Positions(); $employeeModal = new Default_Model_Employee(); $usersModel2 = new Default_Model_Users(); $employmentstatusModel = new Default_Model_Employmentstatus(); $emp_form->setAction(BASE_URL . 'employee/addemppopup/deptidforhead/' . $deptidforhead); $emp_form->removeElement('department_id'); $emp_form->removeElement('modeofentry'); $identity_codes = $identity_code_model->getIdentitycodesRecord(); $emp_identity_code = isset($identity_codes[0]) ? $identity_codes[0]['employee_code'] : ""; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } else { $emp_id = ''; $msgarray['employeeId'] = 'Identity codes are not configured yet.'; $flag = 'false'; } $emp_form->employeeId->setValue($emp_id); $role_data = $role_model->getRolesList_Dept(); $emp_form->emprole->addMultiOptions(array('' => 'Select Role') + $role_data); if (empty($role_data)) { $msgarray['emprole'] = 'Roles are not configured yet.'; $flag = 'false'; } $prefixData = $prefixModel->getPrefixList(); $emp_form->prefix_id->addMultiOption('', 'Select Prefix'); if (!empty($prefixData)) { foreach ($prefixData as $prefixres) { $emp_form->prefix_id->addMultiOption($prefixres['id'], $prefixres['prefix']); } } else { $msgarray['prefix_id'] = 'Prefixes are not configured yet.'; //$flag = 'false'; } $jobtitleData = $jobtitlesModel->getJobTitleList(); if (!empty($jobtitleData)) { foreach ($jobtitleData as $jobtitleres) { $emp_form->jobtitle_id->addMultiOption($jobtitleres['id'], $jobtitleres['jobtitlename']); } } else { $msgarray['jobtitle_id'] = 'Job titles are not configured yet.'; $msgarray['position_id'] = 'Positions are not configured yet.'; //$flag = 'false'; } if (isset($_POST['jobtitle_id']) && $_POST['jobtitle_id'] != '') { $positionlistArr = $positionsmodel->getPositionList($_POST['jobtitle_id']); if (sizeof($positionlistArr) > 0) { $emp_form->position_id->addMultiOption('', 'Select Position'); foreach ($positionlistArr as $positionlistres) { $emp_form->position_id->addMultiOption($positionlistres['id'], $positionlistres['positionname']); } } } $employmentStatusData = $employmentstatusModel->getempstatusActivelist(); $emp_form->emp_status_id->addMultiOption('', 'Select Employment Status'); if (!empty($employmentStatusData)) { foreach ($employmentStatusData as $employmentStatusres) { $emp_form->emp_status_id->addMultiOption($employmentStatusres['workcodename'], $employmentStatusres['statusname']); } } else { $msgarray['emp_status_id'] = 'Employment status is not configured yet.'; $emptyFlag++; } $reportingManagerData = $usersModel2->getReportingManagerList_employees('', '', MANAGEMENT_GROUP); if (!empty($reportingManagerData)) { $report_opt = $reportingManagerData; if (isset($_POST['reporting_manager']) && $_POST['reporting_manager'] != '') { $emp_form->setDefault('reporting_manager', $_POST['reporting_manager']); } } else { $msgarray['reporting_manager'] = 'Reporting managers are not added yet.'; $flag = 'false'; } if ($this->getRequest()->getPost()) { if ($emp_form->isValid($this->_request->getPost()) && $flag == 'true') { $jobtitle_id = $this->_request->getParam('jobtitle_id', null); $position_id = $this->_request->getParam('position_id', null); $date_of_joining = sapp_Global::change_date($this->_request->getParam('date_of_joining', null), 'database'); $date_of_leaving = $this->_request->getParam('date_of_leaving', null); $date_of_leaving = sapp_Global::change_date($date_of_leaving, 'database'); $employeeId = $this->_getParam('employeeId', null); $emprole = $this->_getParam('emprole', null); $reporting_manager = $this->_getParam('reporting_manager', null); $emailaddress = $this->_getParam('emailaddress', null); $emppassword = sapp_Global::generatePassword(); $firstname = trim($this->_getParam('firstname', null)); $lastname = trim($this->_getParam('lastname', null)); $userfullname = $firstname . ' ' . $lastname; //$userfullname = trim($this->_request->getParam('userfullname',null)); $prefix_id = $this->_getParam('prefix_id', null); $user_id = $this->_getParam('user_id', null); $emp_status_id = $this->_getParam('emp_status_id', null); $user_data = array('emprole' => $emprole, 'firstname' => $firstname != '' ? $firstname : NULL, 'lastname' => $lastname != '' ? $lastname : NULL, 'userfullname' => $userfullname, 'emailaddress' => $emailaddress, 'jobtitle_id' => $jobtitle_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'emppassword' => md5($emppassword), 'employeeId' => $employeeId, 'modeofentry' => 'Direct', 'selecteddate' => $date_of_joining, 'userstatus' => 'old'); $emp_data = array('user_id' => $user_id, 'jobtitle_id' => $jobtitle_id, 'position_id' => $position_id, 'prefix_id' => $prefix_id, 'department_id' => $deptidforhead, 'reporting_manager' => $reporting_manager, 'date_of_joining' => $date_of_joining, 'date_of_leaving' => $date_of_leaving != '' ? $date_of_leaving : NULL, 'emp_status_id' => $emp_status_id, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $user_data['createdby'] = $loginUserId; $user_data['createddate'] = gmdate("Y-m-d H:i:s"); $user_data['isactive'] = 1; if ($emp_identity_code != '') { $emp_id = $emp_identity_code . str_pad($user_model->getMaxEmpId($emp_identity_code), 4, '0', STR_PAD_LEFT); } else { $emp_id = ''; } $user_data['employeeId'] = $emp_id; $user_id = $user_model->SaveorUpdateUserData($user_data, ''); $emp_data['user_id'] = $user_id; $emp_data['createdby'] = $loginUserId; $emp_data['createddate'] = gmdate("Y-m-d H:i:s"); $emp_data['isactive'] = 1; $employeeModal->SaveorUpdateEmployeeData($emp_data, ''); //end of saving into employee table. $tableid = $user_id; $actionflag = 1; $menuID = ORGANISATIONINFO; try { $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); } catch (Exception $e) { } $managementUsersData = $deptModel->getDeptHeads(); $opt = ''; foreach ($managementUsersData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['userfullname']); } $this->view->managementUsersData = $opt; /* Send Mail to the user */ $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $view = $this->getHelper('ViewRenderer')->view; $this->view->emp_name = $userfullname; $this->view->password = $emppassword; $this->view->emp_id = $employeeId; $this->view->base_url = $base_url; $text = $view->render('mailtemplates/newpassword.phtml'); $options['subject'] = APPLICATION_NAME . ' login Credentials'; $options['header'] = 'Greetings from Sentrifugo'; $options['toEmail'] = $emailaddress; $options['toName'] = $this->view->emp_name; $options['message'] = $text; $result = sapp_Global::_sendEmail($options); /* END */ $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $emp_form->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->msgarray = $msgarray; $this->view->report_opt = $report_opt; $this->view->controllername = $controllername; $this->view->emp_form = $emp_form; }
public function checkappraisalimplementationAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('savegroupedemployeesajax', 'json')->initContext(); $this->_helper->layout->disableLayout(); $result = array(); $model = new Default_Model_Appraisalinit(); $departmentsmodel = new Default_Model_Departments(); $businessunit_id = $this->_request->getParam('buid'); $enable_step = $this->_request->getParam("enable_step"); $output = $model->check_performance_implmentation($businessunit_id); if (!empty($output)) { $departmentlistArr = $model->getdeparmentsadmin($businessunit_id, $enable_step); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('', 'Select Department'); if (!empty($departmentlistArr)) { foreach ($departmentlistArr as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], utf8_encode($dept['deptname'])); } $result['msg'] = 'true'; } else { $result['msg'] = 'false'; } if ($output['performance_app_flag'] == 1) { $result['flag'] = 'buwise'; } else { $result['flag'] = 'deptwise'; } $result['result'] = $options_data; } else { $result['flag'] = 'notinitialized'; $result['msg'] = 'false'; $result['result'] = ''; } $this->_helper->_json($result); }
public function getgroupoptionsAction() { $bunit = $this->_getParam('bunit', null); $options = sapp_Global::selectOptionBuilder('', 'Select Group'); if ($bunit != '') { $emailcontacts_model = new Default_Model_Emailcontacts(); $group_data = $emailcontacts_model->getgroupoptions($bunit); if (count($group_data) > 0) { foreach ($group_data as $group) { $options .= sapp_Global::selectOptionBuilder($group['id'], $group['group_name']); } } } $this->_helper->json(array('options' => $options)); }
public function addpopupAction() { $screenFlag = ""; 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 ($this->getRequest()->getParam('screenflag')) { $screenFlag = $this->getRequest()->getParam('screenflag'); } $boxid = $this->_getParam('boxid', null); $fromcontroller = $this->_getParam('fromcontroller', null); $msgarray = array(); $controllername = 'employmentstatus'; $employmentstatusform = new Default_Form_employmentstatus(); $employmentstatusmodel = new Default_Model_Employmentstatus(); $employmentstatusform->setAction(BASE_URL . 'employmentstatus/addpopup'); $activeEmploymentStatusArr = $employmentstatusmodel->getEmploymentStatuslist(); $newarr = array(); $empstatusstr = ''; if (!empty($activeEmploymentStatusArr)) { for ($i = 0; $i < sizeof($activeEmploymentStatusArr); $i++) { $newarr1[] = $activeEmploymentStatusArr[$i]['workcodename']; } if ($screenFlag == 'add') { array_push($newarr1, 8, 9, 10); } $empstatusstr = implode(",", $newarr1); } if ($empstatusstr != '') { $statusArr = $employmentstatusmodel->getStatuslist($empstatusstr); } else { $statusArr = $employmentstatusmodel->getCompleteStatuslist(); } if (!empty($statusArr)) { $employmentstatusform->workcodename->addMultiOption('', 'Select Work Code'); for ($i = 0; $i < sizeof($statusArr); $i++) { if ($fromcontroller == 'requisition') { if (!in_array($statusArr[$i]['id'], array(5, 7, 8, 9, 10))) { $employmentstatusform->workcodename->addMultiOption($statusArr[$i]['id'], utf8_encode($statusArr[$i]['employemnt_status'])); } } else { $employmentstatusform->workcodename->addMultiOption($statusArr[$i]['id'], utf8_encode($statusArr[$i]['employemnt_status'])); } } } $this->view->statusArr = $statusArr; $this->view->ermsg = ''; if ($this->getRequest()->getPost()) { if ($employmentstatusform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $workcode = $this->_request->getParam('workcode'); $workcodename = $this->_request->getParam('workcodename'); $default_leaves = $this->_request->getParam('default_leaves'); $description = $this->_request->getParam('description'); $screenFlag = $this->getRequest()->getParam('screenflag'); $date = new Zend_Date(); $actionflag = ''; $tableid = ''; $data = array('workcode' => trim($workcode), 'workcodename' => trim($workcodename), 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $employmentstatusmodel->SaveorUpdateEmploymentStatusData($data, $where); $tableid = $Id; $menuID = EMPLOYMENTSTATUS; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; if (isset($_POST['fromcontroller']) && $_POST['fromcontroller'] != '') { $fromcontroller = $_POST['fromcontroller']; } if (isset($_POST['boxid']) && $_POST['boxid'] != '') { $boxid = $_POST['boxid']; } } else { $messages = $employmentstatusform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $opt = ''; if ($fromcontroller == '') { if ($screenFlag == 'edit') { $empstatusData = $employmentstatusmodel->getempstatuslist(); } if ($screenFlag == 'add') { $empstatusData = $employmentstatusmodel->getempstatusActivelist(); } if (!empty($empstatusData)) { foreach ($empstatusData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['workcodename'], $record['statusname']); } } } else { if ($fromcontroller == 'requisition') { $requi_model = new Default_Model_Requisition(); $empstatusData = $requi_model->getStatusOptionsForRequi(); foreach ($empstatusData as $stat_id => $stat_name) { $opt .= sapp_Global::selectOptionBuilder($stat_id, $stat_name); } } } $this->view->empstatusData = $opt; $this->view->screenFlag = $screenFlag; $this->view->controllername = $controllername; $this->view->form = $employmentstatusform; $this->view->ermsg = ''; $this->view->boxid = $boxid; $this->view->fromcontroller = $fromcontroller; }
public function getcompleteorgdataAction() { $ajaxContext = $this->_helper->getHelper('AjaxContext'); $ajaxContext->addActionContext('getcompleteorgdata', 'json')->initContext(); $this->_helper->layout->disableLayout(); $userid = $this->_request->getParam('userid'); $employeeModal = new Default_Model_Employee(); $positionsmodel = new Default_Model_Positions(); $orgheadsData = $employeeModal->getEmployeesForOrgHead($userid); $result['result'] = array(); $options_data = ''; $emp_data = $employeeModal->getsingleEmployeeData($userid); if (!empty($emp_data)) { $result['result'] = $emp_data[0]; $result['result']['date_of_joining'] = sapp_Global::change_date($emp_data[0]['date_of_joining'], ''); $positionlistArr = $positionsmodel->getPositionList($emp_data[0]['jobtitle_id']); foreach ($positionlistArr as $opt) { $options_data .= sapp_Global::selectOptionBuilder($opt['id'], ucwords(utf8_encode($opt['positionname']))); } $result['positionsdata'] = $options_data; } $this->_helper->_json($result); }
/** * This action is used to add compentency level in popups. */ public function addpopupAction() { 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'); $callval = $this->getRequest()->getParam('call'); $previname = $this->_getParam('previname', null); if ($callval == 'ajaxcall') { $this->_helper->layout->disableLayout(); } $objName = 'competencylevel'; $competencylevelform = new Default_Form_competencylevel(); $competencylevelform->setAction(BASE_URL . 'competencylevel/addpopup'); $competencylevelmodel = new Default_Model_Competencylevel(); try { $this->view->form = $competencylevelform; $this->view->controllername = $objName; } catch (Exception $e) { $this->view->ermsg = 'nodata'; } if ($this->getRequest()->getPost()) { if ($competencylevelform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $competencylevel = $this->_request->getParam('competencylevel'); $description = $this->_request->getParam('description'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('competencylevel' => trim($competencylevel), 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $competencylevelmodel->SaveorUpdateCompetencyLevelData($data, $where); $menuidArr = $menumodel->getMenuObjID('/competencylevel'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; $competencylevelArr = $competencylevelmodel->getCompetencylevelList(); $opt = ""; if (!empty($competencylevelArr)) { foreach ($competencylevelArr as $competencylevelres) { $opt .= sapp_Global::selectOptionBuilder($competencylevelres['id'], $competencylevelres['competencylevel']); } } $this->view->compdata = $opt; if (isset($_POST['previname']) && $_POST['previname'] != '') { $previname = $_POST['previname']; } } else { $messages = $competencylevelform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->previname = $previname; }
public function addnewcountryAction() { 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'); $callval = $this->getRequest()->getParam('call'); $controllername = 'countries'; $countriesform = new Default_Form_countries(); $countriesmodel = new Default_Model_Countries(); $countriesform->setAction(BASE_URL . 'countries/addnewcountry'); /* Changing the form */ $countriesform->removeElement('country'); $countriesform->removeElement('countrycode'); $countriesform->addElement('text', 'country', array('label' => 'Country', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter country name.'))))); $countriesform->country->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tbl_countries', 'field' => 'country_name'))); $countriesform->country->getValidator('Db_NoRecordExists')->setMessage('Country name already exists.'); $countriesform->addElement('text', 'countrycode', array('label' => 'Country code', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter country code.'))))); $countriesform->countrycode->addValidator(new Zend_Validate_Db_NoRecordExists(array('table' => 'tbl_countries', 'field' => 'country_code'))); $countriesform->countrycode->getValidator('Db_NoRecordExists')->setMessage('Country code already exists.'); /* END */ if ($this->getRequest()->getPost()) { $id = $this->_request->getParam('id'); $errorflag = "true"; $msgarray = array(); $dbcountry = ''; $dbcountryid = ''; $country = $this->_request->getParam('country'); $countrycode = $this->_request->getParam('countrycode'); $citizenship = $this->_request->getParam('citizenship'); $dbcountry = $country; if ($countriesform->isValid($this->_request->getPost()) && $errorflag == "true") { $date = new Zend_Date(); $actionflag = 1; $tableid = ''; $countryID = $countriesmodel->SaveMainCountryData($country, $countrycode); $tableid = $countryID; $menuID = COUNTRIES; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $countryData = $countriesmodel->getTotalCountriesList('isactive=1', 'country_name'); $opt = ''; foreach ($countryData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['country_name']); } $this->view->countryData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $countriesform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->ermsg = ''; $this->view->form = $countriesform; $this->view->controllername = $controllername; }
public function getrequestsAction() { $service_desk_id = $this->_getParam('service_desk_id', null); $service_desk_conf_id = $this->_getParam('service_desk_conf_id', null); $data = array(); $options = sapp_Global::selectOptionBuilder('', 'Select request', ''); if ($service_desk_id != '') { $sd_dept_model = new Default_Model_Servicedeskdepartment(); $data = $sd_dept_model->getRequestsById($service_desk_id); if (count($data) > 0) { foreach ($data as $opt) { $options .= sapp_Global::selectOptionBuilder($opt['id'], utf8_encode($opt['service_request_name']), ''); } } } $attachment = false; if ($service_desk_conf_id != '') { $sd_conf_model = new Default_Model_Servicedeskconf(); $sd_conf_data = $sd_conf_model->getServiceDeskConfbyID($service_desk_conf_id); if (count($sd_conf_data) > 0) { if ($sd_conf_data[0]['attachment'] == 1) { $attachment = true; } } } $this->_helper->json(array('options' => $options, 'datacount' => count($data), 'attachment' => $attachment)); }
public function addpopupAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $id = $this->_request->getParam('id'); $controllername = 'maritalstatus'; $maritalstatusform = new Default_Form_maritalstatus(); $maritalstatusmodel = new Default_Model_Maritalstatus(); $maritalstatusform->setAction(DOMAIN . 'maritalstatus/addpopup'); if ($this->getRequest()->getPost()) { if ($maritalstatusform->isValid($this->_request->getPost())) { $maritalcode = $this->_request->getParam('maritalcode'); $maritalstatusname = $this->_request->getParam('maritalstatusname'); $description = $this->_request->getParam('description'); $menumodel = new Default_Model_Menu(); $date = new Zend_Date(); $actionflag = ''; $tableid = ''; $data = array('maritalcode' => trim($maritalcode), 'maritalstatusname' => trim($maritalstatusname), 'description' => trim($description), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $maritalstatusmodel->SaveorUpdateMaritalStatusData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/maritalstatus'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $maritalstatusData = $maritalstatusmodel->fetchAll('isactive = 1', 'maritalstatusname')->toArray(); $opt = ''; foreach ($maritalstatusData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['maritalstatusname']); } $this->view->maritalstatusData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $maritalstatusform->populate($this->_request->getPost()); $messages = $maritalstatusform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $maritalstatusform; }
public function getapproversAction() { $report_id = $this->_getParam('report_id', null); $dept_id = $this->_getParam('dept_id', null); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $sess_vals = $auth->getStorage()->read(); $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $approver1_val = $this->_getParam('approver1_val', 0); $approver2_val = $this->_getParam('approver2_val', 0); $requi_model = new Default_Model_Requisition(); $options = $requi_model->getapprovers($report_id, $dept_id); if ($approver1_val == '0') { $opt_str = sapp_Global::selectOptionBuilder('', 'Select Approver -1'); } else { if ($approver2_val == '0') { $opt_str = sapp_Global::selectOptionBuilder('', 'Select Approver -2'); } else { $opt_str = sapp_Global::selectOptionBuilder('', 'Select Approver -3'); } } if (count($options) > 0) { foreach ($options as $opt) { if ($approver1_val != $opt['id'] && $approver2_val != $opt['id'] && $loginUserId != $opt['id']) { $opt_str .= sapp_Global::selectOptionBuilder($opt['id'], ucwords($opt['name']), $opt['profileimg']); } } } $this->_helper->_json(array('options' => $opt_str)); }
public function addpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $controllername = 'bgscreeningtype'; $msgarray = array(); $bgscreeningtypeform = new Default_Form_bgscreeningtype(); $bgscreeningtypeform->setAttrib('action', DOMAIN . 'bgscreeningtype/addpopup'); $this->view->form = $bgscreeningtypeform; if ($this->getRequest()->getPost()) { $id = $this->_request->getParam('id'); $type = $this->_request->getParam('type'); $bgscreeningtypemodel = new Default_Model_Bgscreeningtype(); $typeExistance = $bgscreeningtypemodel->checktypeduplicates($type, $id); $flag = 'true'; if ($typeExistance) { $msgarray['type'] = 'Screening type already exists.'; $flag = 'false'; } if ($bgscreeningtypeform->isValid($this->_request->getPost()) && $flag == 'true') { $id = $this->_request->getParam('id'); $type = $this->_request->getParam('type'); $description = $this->_request->getParam('description'); if (!$typeExistance) { $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('type' => $type, 'description' => $description, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $bgscreeningtypemodel->SaveorUpdateScreeningtype($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/bgscreeningtype'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $screeningData = $bgscreeningtypemodel->fetchAll('isactive = 1', 'type')->toArray(); $opt = ''; foreach ($screeningData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['type']); } $this->view->screeningData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $msgarray['message'] = 'Screening type already exists.'; $msgarray['msgtype'] = 'error'; } } else { $messages = $bgscreeningtypeform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } } } $this->view->controllername = $controllername; $this->view->msgarray = $msgarray; $this->view->messages = $msgarray; }
public function getprojectactivitiesAction() { $dept_model = new Default_Model_Createprojects(); $methodKey = $this->_getParam('methodKey', null); if ($methodKey == "1") { $bunit_id = $this->_getParam('bunitid', null); $options_data = ""; //$options_data .= sapp_Global::selectOptionBuilder('', 'Select Project Activity'); if ($bunit_id != '') { $dept_data = $dept_model->getProjectActivities($bunit_id); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "2") { $bunit_id = $this->_getParam('bunitid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Resource'); if ($bunit_id != '') { $dept_data = $dept_model->getEmployeesByBU($bunit_id); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "3") { $projectstatusid = $this->_getParam('projectstatusid', null); $options_data = $this->ProjectResultsByStatus($projectstatusid); $this->_helper->json(array('options' => $options_data)); } } } }
public function addpopupAction() { 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'); $controllername = 'timezone'; $timezoneform = new Default_Form_timezone(); $timezonemodel = new Default_Model_Timezone(); $timezoneform->setAction(BASE_URL . 'timezone/addpopup'); if ($this->getRequest()->getPost()) { if ($timezoneform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $timezones = $this->_request->getParam('timezone'); $description = $this->_request->getParam('description'); $date = new Zend_Date(); $actionflag = ''; $tableid = ''; if (is_array($timezones)) { $timezonesStr = implode(",", $timezones); } else { $timezonesStr = ''; } $count = count($timezones); $Id = $timezonemodel->savetimezonedetails($timezonesStr, $description, $loginUserId); $where = ''; $actionflag = 1; $tableid = $Id; $menuID = TIMEZONE; for ($i = 0; $i < $count; $i++) { $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $tableid = $tableid + 1; } $timezonesData = $timezonemodel->fetchAll('isactive = 1', 'timezone')->toArray(); $opt = ''; foreach ($timezonesData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['timezone'] . ' [' . $record['timezone_abbr'] . ']'); } $this->view->timezonesData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $timezoneform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $timezoneform; $this->view->ermsg = ''; }
public function addpopupAction() { 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'); $msgarray = array(); $controllername = 'appraisalcategory'; $appraisalCategoryForm = new Default_Form_Appraisalcategory(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); $appraisalCategoryForm->setAction(BASE_URL . 'appraisalcategory/addpopup'); if ($this->getRequest()->getPost()) { if ($appraisalCategoryForm->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $category_name = $this->_request->getParam('category_name'); $description = $this->_request->getParam('description'); $actionflag = ''; $tableid = ''; $data = array('category_name' => $category_name, 'description' => $description, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $appraisalCategoryModel->SaveorUpdateAppraisalCategoryData($data, $where); $tableid = $Id; $menuID = APPRAISALCATEGORIES; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $appraisalcategoryData = $appraisalCategoryModel->getAppraisalCategorysData(); $opt = ''; foreach ($appraisalcategoryData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], utf8_encode($record['category_name'])); } $this->view->departmentData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $appraisalCategoryForm->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $appraisalCategoryForm; $this->view->ermsg = ''; $this->render('form'); }
public function addpopupAction() { 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'); $msgarray = array(); $controllername = 'payfrequency'; $payfrequencyform = new Default_Form_payfrequency(); $payfrequencymodel = new Default_Model_Payfrequency(); $payfrequencyform->setAction(BASE_URL . 'payfrequency/addpopup'); if ($this->getRequest()->getPost()) { if ($payfrequencyform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $freqtype = $this->_request->getParam('freqtype'); $freqcode = $this->_request->getParam('freqcode'); $freqdescription = $this->_request->getParam('freqdescription'); $date = new Zend_Date(); $actionflag = ''; $tableid = ''; $data = array('freqtype' => trim($freqtype), 'freqcode' => trim($freqcode), 'freqdescription' => trim($freqdescription), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $payfrequencymodel->SaveorUpdatePayFrequencyData($data, $where); $tableid = $Id; $menuID = PAYFREQUENCY; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $frequencyData = $payfrequencymodel->fetchAll('isactive = 1', 'freqtype')->toArray(); $opt = ''; foreach ($frequencyData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['freqtype']); } $this->view->frequencyData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $payfrequencyform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $payfrequencyform; $this->view->ermsg = ''; }
public function getdeptsempAction() { $bu_id = $this->_getParam('bu_id', null); $options = ""; if (!empty($bu_id)) { $bu_id = implode(',', $bu_id); $dept_model = new Default_Model_Departments(); $dept_data = $dept_model->getDepartmentWithCodeList_bu($bu_id); if (!empty($dept_data)) { foreach ($dept_data as $dept) { $options .= sapp_Global::selectOptionBuilder($dept['id'], $dept['unitcode'] . " " . $dept['deptname']); } } } $this->_helper->json(array('options' => $options)); }
public function addpopupAction() { Zend_Layout::getMvcInstance()->setLayoutPath(APPLICATION_PATH . "/layouts/scripts/popup/"); $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserRole = $auth->getStorage()->read()->emprole; $loginuserGroup = $auth->getStorage()->read()->group_id; } $id = $this->getRequest()->getParam('id'); $msgarray = array(); $controllername = 'appraisalquestions'; $appraisalquestionsform = new Default_Form_Appraisalquestions(); $appraisalCategoryModel = new Default_Model_Appraisalcategory(); $msgarray = array(); $popConfigPermission = array(); if (sapp_Global::_checkprivileges(APPRAISALQUESTIONS, $loginuserGroup, $loginuserRole, 'add') == 'Yes') { array_push($popConfigPermission, 'appraisalquestions'); } $appraisalquestionsform->setAction(BASE_URL . 'appraisalquestions/addpopup'); if ($this->getRequest()->getPost()) { if ($appraisalquestionsform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $pa_category_id = $this->_request->getParam('pa_category_id'); $question = trim($this->_request->getParam('question')); $description = trim($this->_request->getParam('description')); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('pa_category_id' => $pa_category_id, 'question' => $question, 'description' => $description != '' ? $description : NULL, 'module_flag' => 1, 'modifiedby_role' => $loginuserRole, 'modifiedby_group' => $loginuserGroup, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby_role'] = $loginuserRole; $data['createdby_group'] = $loginuserGroup; $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $appraisalquestionsmodel->SaveorUpdateAppraisalQuestionData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/appraisalquestions'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $servicedeskdepartmentData = $servicedeskdepartmentmodel->getSDDepartmentData(); $opt = ''; foreach ($servicedeskdepartmentData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], utf8_encode($record['service_desk_name'])); } $this->view->departmentData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $appraisalquestionsform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $appraisalquestionsform; $this->view->ermsg = ''; $this->render('form'); }
public function getdatafromajaxcallAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginuserGroup = $auth->getStorage()->read()->group_id; } $taskallocation_model = new Default_Model_Tasksallocation(); $methodKey = $this->_getParam('methodKey', null); if ($methodKey == "1") { //Get Project Tasks $projectid = $this->_getParam('projectid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Task'); if ($projectid != '') { $dept_data = $taskallocation_model->getCurrentUserProjectTasks($projectid, $loginUserId, $loginuserGroup); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "2") { //Get Tasks Details for View $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Task Details", $taskallocation_model->getTaskDetails($taskid)))); } else { if ($methodKey == "3") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::implode2DArray($taskallocation_model->getTaskActivityDetails($taskid)))); } else { if ($methodKey == "4") { //Get Project resources $projectid = $this->_getParam('projectid', null); $options_data = ""; //$options_data .= sapp_Global::selectOptionBuilder('0', 'Select Resource'); if ($projectid != '') { $dept_data = $taskallocation_model->getEmployeesByProject($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "5") { //get TaskAllocated data based on Task and Activity $taskid = $this->_getParam('taskid', null); $taskactivityid = $this->_getParam('taskactivityid', null); $this->_helper->json(array('options' => sapp_Global::implode2DArray($taskallocation_model->getAllocatedTasks($taskid, $taskactivityid)))); } else { if ($methodKey == "6") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::implode2DArray($taskallocation_model->getTaskActivityMasterDetails($taskid)))); } else { if ($methodKey == "7") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Activity'); if ($taskid != '') { $dept_data = $taskallocation_model->getTaskActivityDetails($taskid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['activityid'], $dept['Activity']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "8") { //Get Tasks Planned Activities $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::implode2DArray($taskallocation_model->getTaskActivityAllocationByTaskID($taskid)))); } } } } } } } } }
public function addpopupAction() { $msgarray = array(); $emptyFlag = ''; 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'); $controllername = 'jobtitles'; $jobtitlesform = new Default_Form_jobtitles(); $jobtitlesmodel = new Default_Model_Jobtitles(); $payfrequencyModal = new Default_Model_Payfrequency(); $payfreqData = $payfrequencyModal->getActivePayFreqData(); $jobtitlesform->setAction(DOMAIN . 'jobtitles/addpopup'); if (sizeof($payfreqData) > 0) { foreach ($payfreqData as $payfreqres) { $jobtitlesform->jobpayfrequency->addMultiOption($payfreqres['id'], $payfreqres['freqtype']); } } else { $msgarray['jobpayfrequency'] = 'Pay frequency is not configured yet.'; $emptyFlag++; } $this->view->msgarray = $msgarray; $this->view->emptyFlag = $emptyFlag; if ($this->getRequest()->getPost()) { if ($jobtitlesform->isValid($this->_request->getPost())) { $id = $this->_request->getParam('id'); $jobtitlecode = $this->_request->getParam('jobtitlecode'); $jobtitlename = $this->_request->getParam('jobtitlename'); $jobdescription = $this->_request->getParam('jobdescription'); $minexperiencerequired = $this->_request->getParam('minexperiencerequired'); $jobpaygradecode = $this->_request->getParam('jobpaygradecode'); $jobpayfrequency = $this->_request->getParam('jobpayfrequency'); $comments = $this->_request->getParam('comments'); $date = new Zend_Date(); $menumodel = new Default_Model_Menu(); $actionflag = ''; $tableid = ''; $data = array('jobtitlecode' => trim($jobtitlecode), 'jobtitlename' => trim($jobtitlename), 'jobdescription' => trim($jobdescription), 'minexperiencerequired' => trim($minexperiencerequired), 'jobpaygradecode' => trim($jobpaygradecode), 'jobpayfrequency' => trim($jobpayfrequency), 'comments' => trim($comments), 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); if ($id != '') { $where = array('id=?' => $id); $actionflag = 2; } else { $data['createdby'] = $loginUserId; $data['createddate'] = gmdate("Y-m-d H:i:s"); $data['isactive'] = 1; $where = ''; $actionflag = 1; } $Id = $jobtitlesmodel->SaveorUpdateJobTitleData($data, $where); $tableid = $Id; $menuidArr = $menumodel->getMenuObjID('/jobtitles'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); $jobtitlesData = $jobtitlesmodel->fetchAll('isactive = 1', 'jobtitlename')->toArray(); $opt = ''; foreach ($jobtitlesData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['jobtitlename']); } $this->view->jobtitlesData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $jobtitlesform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $jobtitlesform; $this->view->ermsg = ''; }
public function addnewcityAction() { 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'); $selectedcountryid = $this->_request->getParam('selectcountryid'); $selectedstateid = $this->_request->getParam('selectstateid'); $msgarray = array(); $setDefaultString = ''; $citystring = ''; $controllername = 'cities'; $citiesform = new Default_Form_cities(); $citiesmodel = new Default_Model_Cities(); $countriesModel = new Default_Model_Countries(); $statesmodel = new Default_Model_States(); /* Changing the form */ $citiesform->setAction(BASE_URL . 'cities/addnewcity/selectcountryid/' . $selectedcountryid . '/selectstateid/' . $selectedstateid); $citiesform->removeElement('city'); $citiesform->addElement('text', 'city', array('label' => 'City', 'maxlength' => '20', 'required' => true, 'validators' => array(array('validator' => 'NotEmpty', 'options' => array('messages' => 'Please enter city name.'))))); /* END */ $countrieslistArr = $countriesModel->getTotalCountriesList(''); if (sizeof($countrieslistArr) > 0) { $citiesform->countryid->addMultiOption('', 'Select Country'); foreach ($countrieslistArr as $countrieslistres) { if ($selectedcountryid != '') { if ($countrieslistres['id'] == $selectedcountryid) { $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); $citiesform->setDefault('countryid', $selectedcountryid); } } else { $citiesform->countryid->addMultiOption($countrieslistres['id'], utf8_encode($countrieslistres['country_name'])); } $citiesform->countryid->setAttrib('onchange', 'displayParticularState_normal(this,"","state","city")'); } } else { $msgarray['countryid'] = 'Countries are not configured yet.'; } $countryid = $this->_request->getParam('countryid'); if (isset($selectedcountryid) && $selectedcountryid != '' || isset($countryid) && $countryid != '') { if ($countryid) { $statesmodeldata = $statesmodel->getStatesList($countryid, ''); } else { $statesmodeldata = $statesmodel->getStatesList($selectedcountryid, ''); } $citiesform->state->addMultiOption('', 'Select State'); foreach ($statesmodeldata as $res) { $citiesform->state->addMultiOption($res['id'], utf8_encode($res['state_name'])); if ($selectedstateid != '') { if ($res['id'] == $selectedstateid) { $setDefaultString = $res['id']; } } else { if ($countryid != '') { if ($res['id'] == $countryid) { $setDefaultString = $res['id']; } } } } $citiesform->setDefault('state', $setDefaultString); } else { $citiesform->state->addMultiOption('', 'Select State'); } if ($this->getRequest()->getPost()) { $id = $this->_request->getParam('id'); $errorflag = "true"; $msgarray = array(); $dbstate = ''; $dbcountryid = ''; $stateidstr = $this->_request->getParam('state'); $stateid = intval($stateidstr); $city = $this->_request->getParam('city'); if (isset($stateid)) { $isDuplicateCityNameArr = $citiesmodel->getDuplicateCityName($city, $stateid); if ($isDuplicateCityNameArr[0]['count'] > 0) { $errorflag = "false"; $msgarray['city'] = "City already exists."; } } else { $errorflag = "false"; $msgarray['state'] = "Please select state."; } if ($citiesform->isValid($this->_request->getPost()) && $errorflag == "true") { $menumodel = new Default_Model_Menu(); $city = $this->_request->getParam('city'); $actionflag = ''; $tableid = ''; $NewCityId = $citiesmodel->SaveMainCityData($stateid, $city); $actionflag = 1; $tableid = $NewCityId; $menuidArr = $menumodel->getMenuObjID('/cities'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $tableid); if (isset($selectedstateid) && isset($selectedcountryid)) { $cityData = $citiesmodel->getCitiesList($selectedstateid, 'city'); } else { $cityData = array(); } $opt = ''; foreach ($cityData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['city_name']); } $this->view->cityData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $citiesform->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } if (isset($countryid) && $countryid != 0 && $countryid != '') { $statesmodel = new Default_Model_States(); $statesmodeldata = $statesmodel->getBasicStatesList($countryid); foreach ($statesmodeldata as $res) { $citiesform->state->addMultiOption($res['state_id_org'] . '!@#' . utf8_encode($res['state']), utf8_encode($res['state'])); } if (isset($stateidstr) && $stateidstr != 0 && $stateidstr != '') { $citiesform->setDefault('state', $stateidstr); } } } } $this->view->controllername = $controllername; $this->view->ermsg = ''; $this->view->form = $citiesform; $this->view->msgarray = $msgarray; }
public function getdatafromajaxcallAction() { $dept_model = new Default_Model_Createtasks(); $methodKey = $this->_getParam('methodKey', null); if ($methodKey == "1") { //Get Project Activities based on Selected Project $projectid = $this->_getParam('projectid', null); $options_data = ""; if ($projectid != '') { $dept_data = $dept_model->getProjectActivities($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "2") { //get employees by Business Unit code $bunit_id = $this->_getParam('bunitid', null); $options_data = ""; if ($bunit_id != '') { $dept_data = $dept_model->getEmployeesByBU($bunit_id); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "3") { //get employees by project code $projectid = $this->_getParam('projectid', null); $options_data = ""; $options_data .= sapp_Global::selectOptionBuilder('0', 'Select Resource'); if ($projectid != '') { $dept_data = $dept_model->getEmployeesByProject($projectid); foreach ($dept_data as $dept) { $options_data .= sapp_Global::selectOptionBuilder($dept['id'], $dept['name']); } } $this->_helper->json(array('options' => $options_data)); } else { if ($methodKey == "4") { //get Project Details $projectid = $this->_getParam('projectid', null); $this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Project Details", $dept_model->getProjectDetails($projectid)))); } else { if ($methodKey == "5") { //get Project Existing Tasks $projectid = $this->_getParam('projectid', null); $this->_helper->json(array('options' => sapp_Global::_convertArrayToHTMLTable("leavecardtablegrid", "Existing Tasks", $dept_model->getProjectTaskDetails($projectid)))); } else { if ($methodKey == "6") { //get project activites data $projectid = $this->_getParam('projectid', null); $taskid = $this->_getParam('taskid', null); $this->_helper->json(array('options' => sapp_Global::implode2DArray($dept_model->getProjectActivitiesWithData($projectid, $taskid)))); } else { if ($methodKey == "7") { $taskstatusid = $this->_getParam('taskstatusid', null); $options_data = $this->TasksResultsByStatus($taskstatusid); $this->_helper->json(array('options' => $options_data)); } } } } } } } }
public function addpopupAction() { $msgarray = array(); $emptyFlag = ''; 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'); $controllername = 'clients'; $clientsForm = new Timemanagement_Form_Clients(); $clientsModel = new Timemanagement_Model_Clients(); $clientsForm->setAction(BASE_URL . 'timemanagement/clients/addpopup'); if ($this->getRequest()->getPost()) { if ($clientsForm->isValid($this->_request->getPost())) { $country_id = NULL; $state_id = NULL; $id = $this->_request->getParam('id'); $address = $this->_request->getParam('address'); $client_name = $this->_request->getParam('client_name'); if ($this->_request->getParam('country_id')) { $country_id = $this->_request->getParam('country_id'); } $email = $this->_request->getParam('email'); $phone_no = $this->_request->getParam('phone_no'); $poc = $this->_request->getParam('poc'); $fax = $this->_request->getParam('fax'); if ($this->_request->getParam('state_id')) { $state_id = $this->_request->getParam('state_id'); } $date = gmdate("Y-m-d H:i:s"); $data = array('address' => $address, 'client_name' => $client_name, 'country_id' => $country_id, 'email' => $email, 'phone_no' => $phone_no, 'poc' => $poc, 'fax' => $fax, 'state_id' => $state_id); $data['created_by'] = $loginUserId; $data['created'] = gmdate("Y-m-d H:i:s"); $data['modified'] = gmdate("Y-m-d H:i:s"); $data['is_active'] = 1; $where = ''; $Id = $clientsModel->saveOrUpdateClientsData($data, $where); $clientsData = $clientsModel->fetchAll('is_active = 1', 'client_name')->toArray(); $opt = ''; foreach ($clientsData as $record) { $opt .= sapp_Global::selectOptionBuilder($record['id'], $record['client_name']); } $this->view->clientsData = $opt; $this->view->eventact = 'added'; $close = 'close'; $this->view->popup = $close; } else { $messages = $clientsForm->getMessages(); foreach ($messages as $key => $val) { foreach ($val as $key2 => $val2) { $msgarray[$key] = $val2; break; } } $this->view->msgarray = $msgarray; } } $this->view->controllername = $controllername; $this->view->form = $clientsForm; $this->view->ermsg = ''; }