Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- error_reporting(E_ALL ^ E_NOTICE);
- sfLoader::loadHelpers(array('Tag', 'Url'));
- include(sfConfig::get('sf_app_template_dir') . '/DBFragment.php');
- /**
- * main actions.
- *
- * @package myproject
- * @subpackage main
- * @author bob
- * @version SVN: $Id: actions.class.php 9301 2008-05-27 01:08:46Z dwhittle $
- */
- class mainActions extends sfActions {
- public function executeNoScript() {
- $module = 'main';
- $action = 'index';
- $link = link_to('Try again', $module . '/' . $action);
- $html = '<font face=arial>JavaScript must be enabled in order for you to use <i> Performance Evaluation System</i>. It seems JavaScript is either disabled or not supported by your browser.' . $link . '
- </font>';
- $html = '<br><br><br><br><br>
- <table border="0" style="border:1px solid #455F76;"><TR><TD style="color:#619B09; font-size:13px;">' . $html . '</TD></TR></table>';
- echo $html;
- die;
- }
- public function executeAjaxPager() {
- $this->pager = $this->getPager();
- }
- public function executeIndex(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- $role = $_SESSION['empRole'];
- if ($role == "admin") {
- $empId = $this->getUser()->getAttribute('empId');
- $team_members = GroupwareEmployeesPeer::getAllSubordinatesId($empId);
- $nc = new Criteria();
- $nc->add(PeDatesPeer::NAME, 'Dashboard');
- $resultset = PeDatesPeer::doSelect($nc);
- if ($resultset) {
- $dashboardDate = $resultset[0]->getYear();
- $DateArray = explode('-', $dashboardDate);
- $this->year = $DateArray[0];
- $this->startdate = $dashboardDate;
- }
- else {
- $this->year = Date("Y");
- $this->startdate = Date("Y-m-d");
- }
- $this->search_pattern = "%" . $this->year . "%";
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $team_members, CRITERIA::IN);
- $criteria->add(PeEmployeesPeer::STATUSID, 2);
- // $criteria->add(PeEmployeesPeer::ISSUEDATE, $this->search_pattern, CRITERIA::LIKE);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $this->startdate, Criteria::GREATER_EQUAL);
- $this->kids_count = PeEmployeesPeer::doCount($criteria);
- $c = new Criteria();
- $direct_teammembers = GroupwareEmployeesPeer::getSubordinatesId($empId);
- $c->add(PeEmployeesPeer::EMPID, $direct_teammembers, CRITERIA::IN);
- $c->add(PeEmployeesPeer::STATUSID, 4);
- // $c->add(PeEmployeesPeer::ISSUEDATE, $this->search_pattern, CRITERIA::LIKE);
- $c->add(PeEmployeesPeer::ISSUEDATE, $this->startdate, Criteria::GREATER_EQUAL);
- $this->kids_origin_count = PeEmployeesPeer::doCount($c);
- $PeAssignedadminPeer = new PeAssignedadminPeer;
- $c1 = new Criteria();
- $assigned_teammembers = PeAssignedadminPeer::getAssignedEmployeesId($empId);
- $c1->add(PeEmployeesPeer::EMPID, $assigned_teammembers, CRITERIA::IN);
- $c1->add(PeEmployeesPeer::STATUSID, 4);
- // $c1->add(PeEmployeesPeer::ISSUEDATE, $this->search_pattern, CRITERIA::LIKE);
- $c1->add(PeEmployeesPeer::ISSUEDATE, $this->startdate, Criteria::GREATER_EQUAL);
- $this->assignkids_count = PeEmployeesPeer::doCount($c1);
- $PeEmployeesPeer = new PeEmployeesPeer();
- $this->reevaluate = $PeEmployeesPeer->getReevaluatePE($team_members, $this->startdate);
- $this->acceptemployee = $PeEmployeesPeer->getAcceptanceEmp($team_members, $this->startdate);
- $this->accepetedbyemp = $PeEmployeesPeer->getAccepetedByEmp($team_members, $this->startdate);
- $this->accepetedbyadmin = $PeEmployeesPeer->getAccepetedByAdmin($team_members, $this->startdate);
- $this->escalatedtocore = $PeEmployeesPeer->getEscalatedToCore($team_members, $this->startdate);
- $this->approved = $PeEmployeesPeer->getCoreApprovedPE($team_members, $this->startdate);
- $this->monthlyPE = $PeEmployeesPeer->getMonthlyPE($team_members, $this->startdate);
- // To list monthly PE employee comments added count in dashboard refs #100211
- $this->monthlyPeAccepetedByEmp = $PeEmployeesPeer->getmonthlyPeAccepetedByEmp($team_members, $this->startdate);
- $this->getPeAdminNotification();
- }elseif (($role == "core") || ($role == "hr")) {
- $nc = new Criteria();
- $nc->add(PeDatesPeer::NAME, 'Dashboard');
- $resultset = PeDatesPeer::doSelect($nc);
- if ($resultset) {
- $dashboardDate = $resultset[0]->getYear();
- $DateArray = explode('-', $dashboardDate);
- $this->year = $DateArray[0];
- $this->startdate = $dashboardDate;
- }
- else {
- $this->year = Date("Y-m-d");
- }
- $PeEmployeesPeer = new PeEmployeesPeer();
- $this->staff_count = $PeEmployeesPeer->getStaffPE($this->startdate);
- $this->admin_staff_count = $PeEmployeesPeer->getStaffOriginalPE($this->startdate);
- $this->reevaluate = $PeEmployeesPeer->getReevaluatePE('', $this->startdate);
- $this->acceptemployee = $PeEmployeesPeer->getAcceptanceEmp('', $this->startdate);
- $this->accepetedbyemp = $PeEmployeesPeer->getAccepetedByEmp('', $this->startdate);
- $this->accepetedbyadmin = $PeEmployeesPeer->getAccepetedByAdmin('', $this->startdate);
- $this->escalatedtocore = $PeEmployeesPeer->getEscalatedToCore('', $this->startdate);
- $this->approved = $PeEmployeesPeer->getCoreApprovedPE('', $this->startdate);
- $this->monthlyPE = $PeEmployeesPeer->getMonthlyPE('', $this->startdate);
- // To list monthly PE employee comments added count in dashboard refs #100211
- $this->monthlyPeAccepetedByEmp = $PeEmployeesPeer->getmonthlyPeAccepetedByEmp('', $this->startdate);
- $this->getPeCoreNotification();
- }
- elseif (($role == 'staff') || ($role == 'qm')) {
- $this->getPeNotification();
- }
- }else
- $this->redirect('login/index');
- }
- /**
- * Executes View action
- *
- * @param sfRequest $request A request object
- */
- public function executeView(sfWebRequest $request) {
- $empId = $request->getParameter('Self') ? $request->getParameter('Self') : $request->getParameter('Original');
- if ($empId) {
- $date = $request->getParameter('date');
- $tmpDate = explode('-', $date);
- $issueYear = '%' . $tmpDate[0] . '%';
- // To check whether an original PE of status >=6 exist for this employee
- $newCriteria = new Criteria();
- $newCriteria->add(PeEmployeesPeer::EMPID, $empId);
- $newCriteria->add(PeEmployeesPeer::TYPE, ORIGINALCODE);
- $newCriteria->add(PeEmployeesPeer::ISSUEDATE, $issueYear, Criteria::LIKE);
- $resultSet = PeEmployeesPeer::doSelect($newCriteria);
- if (!empty($resultSet)) {
- $peIdStatus = $resultSet[0]->getStatusId();
- } else {
- // No original PE form exist for this year
- $peIdStatus = 1; // Default status
- }
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $issueYear, Criteria::LIKE);
- if ($request->getParameter('Self')) {
- $criteria->add(PeEmployeesPeer::TYPE, SELFCODE);
- } else {
- $criteria->add(PeEmployeesPeer::TYPE, ORIGINALCODE);
- }
- $criteria->addSelectColumn(PeEmployeesPeer::PEID);
- $result = PeEmployeesPeer::doSelect($criteria);
- if (!empty($result) && (($this->isCore() || $this->isHr()) || $peIdStatus >= 6 )) {
- $this->redirect('main/PeForm?view=' . $result[0]->getPeId());
- } else {
- $_SESSION['error_msg'] = 'Sorry, No PE form found!!!';
- $this->redirect('main/index');
- }
- }
- }
- //added by renjo to redirect to staff or admin form when MyPeform is clicked
- public function executeMyPeForm(sfWebRequest $request) {
- $empId = $_SESSION['empId'];
- $criteria = new Criteria();
- $criteria->add(PeChangeformPeer::EMPID, $empId);
- $results = PeChangeformPeer::doSelect($criteria);
- if ($results) {
- $formType = $results[0]->getFormType();
- if ($formType == STAFF)
- $this->redirect('main/StaffPEForm');
- else if ($formType == ADMIN)
- $this->redirect('main/AdminPEForm');
- }else if ($this->isAdmin()) {
- $this->redirect('main/AdminPEForm');
- } else if ($this->isStaff()) {
- $this->redirect('main/StaffPEForm');
- }
- }
- public function executePeForm(sfWebRequest $request) {
- $peEmployeesInstance = new PeEmployeesPeer();
- if ($this->getRequestParameter('edit')) {
- $peId = $this->getRequestParameter('edit');
- // ************************REDIRECTION TO NEW PE FORM********************
- if ($peId > MAX_OLD_2009) {
- $this->redirect('index/pe?edit=' . $peId);
- }
- // ***********************************************************************
- if ($this->isEditable($peId)) {
- $peOwner = $peEmployeesInstance->whosePEForm($peId);
- switch ($peOwner) {
- case '0':if ($this->getRequestParameter('status') == "monthlysave") {
- $_SESSION['status'] = "monthlysave";
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=monthly');
- } else if ($this->getRequestParameter('status') == "adminsave") {
- $_SESSION['status'] = "adminsave";
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=original');
- } else if ($this->getRequestParameter('value') == "staffSaved") {
- $this->redirect('main/AdminPEForm?edit=' . $peId);
- } elseif ($this->getRequestParameter('type') == "original") {
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=original');
- } else {
- $this->redirect('main/AdminPEForm?edit=' . $peId);
- }
- break;
- case '1':
- if ($this->getRequestParameter('status') == "adminsave") {
- $_SESSION['status'] = "adminsave";
- $this->redirect('main/QMPEForm?edit=' . $peId . '&type=original');
- } elseif ($this->getRequestParameter('type') == "original") {
- $this->redirect('main/QMPEForm?edit=' . $peId . '&type=original');
- } else {
- $this->redirect('main/QMPEForm?edit=' . $peId);
- }
- break;
- case '2':if ($this->getRequestParameter('status') == "monthlysave") {
- $_SESSION['status'] = "monthlysave";
- $this->redirect('main/StaffPEForm?edit=' . $peId . '&type=monthly');
- } else if ($this->getRequestParameter('status') == "adminsave") {//echo "in staff";die;
- $_SESSION['status'] = "adminsave";
- $this->redirect('main/StaffPEForm?edit=' . $peId . '&type=original');
- } else if ($this->getRequestParameter('value') == "staffSaved") {
- $this->redirect('main/StaffPEForm?edit=' . $peId);
- } elseif ($this->getRequestParameter('type') == "original") {
- $this->redirect('main/StaffPEForm?edit=' . $peId . '&type=original');
- } else {
- $this->redirect('main/StaffPEForm?edit=' . $peId);
- }
- break;
- default:
- $_SESSION['error_msg'] = 'No Such PE form Exists';
- $this->redirect('main/ListPEForm');
- break;
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('view')) {
- $peId = $this->getRequestParameter('view');
- // **************************REDIRECTION TO NEW PE FORM***************
- if ($peId > MAX_OLD_2009) {
- $this->redirect('index/pe?view=' . $peId);
- }
- // ********************************************************************
- $peOwner = $peEmployeesInstance->whosePEForm($peId);
- if ($this->isViewable($peId)) {
- switch ($peOwner) {
- case '0':
- $this->redirect('main/AdminPEForm?view=' . $peId);
- break;
- case '1':
- $this->redirect('main/QMPEForm?view=' . $peId);
- break;
- case '2':
- $this->redirect('main/StaffPEForm?view=' . $peId);
- break;
- default:
- $_SESSION['error_msg'] = 'No Such PE form Exists';
- $this->redirect('main/ListPEForm');
- break;
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to view the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('delete')) {
- $peId = $this->getRequestParameter('delete');
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result) {
- $takenById = $result[0]->getTakenBy();
- if ($takenById != $this->getUser()->getAttribute('empId') && !$this->coreCheck($takenById)) {
- $_SESSION['error_msg'] = 'Not authorized to delete the Pe form';
- $this->redirect('main/index');
- }
- }
- $this->redirect('main/deletePEForm?delete=' . $peId);
- } else {
- $_SESSION['error_msg'] = 'Unable to proccess your request';
- }
- }
- /**
- * Executes admin Form display action
- *
- * @param sfRequest $request A request object
- */
- public function executeAdminPEForm(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- if ($request->isMethod('post')) {
- $this->getPostedValues();
- }
- if ($this->getRequestParameter('edit') && (($this->getRequestParameter('type') == "original") || ($this->getRequestParameter('type') == "monthly"))) {
- $peId = $this->getRequestParameter('edit');
- if ($this->isEditable($peId)) {
- if ($this->isAdmin() || $this->isCore()) {
- if ($this->isAdmin()) {
- $currentAdmin = false;
- $hasAdminThisPeriod = false;
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $users = PeEmployeesPeer::doSelect($criteria);
- $empid = $users[0]->getEmpid();
- $takenBy = $users[0]->getTakenBy();
- $admin_id = $this->getUser()->getAttribute('empId');
- if ($takenBy != $admin_id) {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form as this PE form is not prepared by you';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empid);
- if ($admin_id == $searckkid_admin) {
- $directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $directadmin = true;
- } else {
- $directadmin = false;
- }
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $empid);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $newAdmin = $results->getNewAdmin();
- $compare = $this->betweenRangeCriteriaAssign($oldstartdate, $oldenddate);
- if ($compare == true) {
- $hasAdminThisPeriod = true;
- if ($admin_id == $newAdmin) {
- $currentAdmin = true;
- $hasAdminThisPeriod = false;
- break;
- }
- }
- }
- if (($currentAdmin == false && $directadmin == false) || $hasAdminThisPeriod == true) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as you are not the current evaluator of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- }
- } elseif ($this->isCore()) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result) {
- $takenById = $result[0]->getTakenBy();
- /* if($takenById != $this->getUser()->getAttribute('empId')){
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- //} */
- }
- }
- //added by renjo for Monthly PE
- if ($this->getRequestParameter('type') == "monthly")
- $this->peform = "monthly";
- else
- $this->peform = "original";
- $this->editPEForm($peId);
- }
- else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('edit')) {
- $peId = $this->getRequestParameter('edit');
- if ($this->isEditable($peId)) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $users = PeEmployeesPeer::doSelect($criteria);
- $empId = $users[0]->getEmpid();
- $this->peform = "self";
- $this->editPEForm($peId, $empId);
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('view')) {
- $peId = $this->getRequestParameter('view');
- if ($this->isViewable($peId)) {
- $PeEmployeesPeer = new PeEmployeesPeer;
- $empId = $PeEmployeesPeer->getEmpId($peId);
- if ($this->isAdmin() && $empId != $this->getUser()->getAttribute('empId')) {
- $currentAdmin = false;
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $directadmin = true;
- } else {
- $directadmin = false;
- }
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $empId);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $newAdmin = $results->getNewAdmin();
- $compare = $this->betweenRangeCriteriaAssign($oldstartdate, $oldenddate);
- if ($compare == true) {
- if ($admin_id == $newAdmin) {
- $currentAdmin = true;
- break;
- }
- }
- }
- if ($currentAdmin == false && $directadmin = false) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as you are not the current evaluator of the specified kid';
- $_SESSION['msg'] = '';
- $this->redirect('main/index');
- }
- }
- }
- $this->viewPEForm($peId);
- $PeEmployeesPeer = new PeEmployeesPeer;
- $empId = $PeEmployeesPeer->getEmpId($peId);
- $this->emp_count = $this->isStaffAndAdminSaved($empId);
- // To check whether the emloyee's direct admin is core or not
- $pestatus = $PeEmployeesPeer->getPestatusvalue($peId);
- $pestatus_id = $pestatus[0]->getStatusId();
- $pestatus_evaluator = $pestatus[0]->getTakenby();
- if ($pestatus_id == 6 && $empId == $this->getUser()->getAttribute('empId')) {
- $this->self = true;
- }
- if ($pestatus_id == 7 || $pestatus_id == 11) {
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $this->directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $this->directadmin = true;
- } else {
- $this->directadmin = false;
- }
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to view the Pe form';
- $this->redirect('main/index');
- }
- } else if ($this->getRequestParameter('peForm')) {
- $empId = $this->getRequestParameter('peForm');
- if ($_SESSION['empRole'] == 'core') {
- $year = "%" . date("Y") . "%";
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $year, Criteria::LIKE);
- $criteria->add(PeEmployeesPeer::STATUSID, 2, Criteria::GREATER_THAN);
- $criteria->add(PeEmployeesPeer::TYPE, 2, Criteria::NOT_EQUAL);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result && $result[0]->getTakenBy() != $this->getUser()->getAttribute('empId')) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as the admin is preparing a PE form of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- } elseif ($_SESSION['empRole'] == 'admin') {
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $directadmin = true;
- } else {
- $directadmin = false;
- }
- $hasAdminThisPeriod = false;
- $currentAdmin = false;
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $empId);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $newAdmin = $results->getNewAdmin();
- $compare = $this->betweenRangeCriteriaAssign($oldstartdate, $oldenddate);
- if ($compare == true) {
- $hasAdminThisPeriod = true;
- if ($admin_id == $newAdmin) {
- $currentAdmin = true;
- $hasAdminThisPeriod = false;
- break;
- }
- }
- }
- if (($currentAdmin == false && $directadmin == false) || $hasAdminThisPeriod == true) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as you are not the current evaluator of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- }
- }
- $this->getPreForm($empId, null, 'original');
- $peDetails[3] = $peDetails[4] = date('Y-m-d');
- $peDetails[5] = date("Y-m-d", strtotime("+1 years"));
- $this->getEmpSupervisor($empId);
- $this->peform = "original";
- $this->peDetails = $peDetails;
- $this->readonly = false;
- sfView::SUCCESS;
- } else {
- $empId = $this->getUser()->getAttribute('empId');
- $this->checkExpToSubmitPE($empId); /* checking wether the employee has sufficient experience to submit the PE */
- $empId = $this->getUser()->getAttribute('empId');
- $this->formType = "self";
- $this->getPreForm($empId, null, null);
- $this->getEmpSupervisor($empId);
- $this->emp = $this->getUser();
- $this->readonly = false;
- $peDetails[3] = $peDetails[4] = date('Y-m-d');
- $peDetails[5] = date("Y-m-d", strtotime("+1 years"));
- $this->peDetails = $peDetails;
- sfView::SUCCESS;
- }
- $c = new Criteria();
- $this->result_val = PeHelpAdminPeer::doSelect($c);
- $this->result_valSample = PeSampleAdminPeer::doSelect($c);
- $this->role = $this->getUser()->getAttribute('empRole');
- } else {
- $this->redirect('login/index');
- }
- }
- /**
- * Executes Staff Form display action
- *
- * @param sfRequest $request A request object
- */
- public function executeStaffPEForm(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- if ($request->isMethod('post')) {
- $this->getPostedValues();
- }
- if ($this->getRequestParameter('edit')) {
- $peId = $this->getRequestParameter('edit');
- if ($this->isEditable($peId)) {
- if ($this->getRequestParameter('edit') && ( ($this->getRequestParameter('type') == "original") || ($this->getRequestParameter('type') == "monthly"))) {
- if ($this->isAdmin() || $this->isCore()) {
- if ($this->isAdmin()) {
- $currentAdmin = false;
- $hasAdminThisPeriod = false;
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $users = PeEmployeesPeer::doSelect($criteria);
- $empid = $users[0]->getEmpid();
- $takenBy = $users[0]->getTakenBy();
- $admin_id = $this->getUser()->getAttribute('empId');
- if ($takenBy != $admin_id) {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form as this PE form is not prepared by you';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empid);
- if ($admin_id == $searckkid_admin) {
- $directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $directadmin = true;
- } else {
- $directadmin = false;
- }
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $empid);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $newAdmin = $results->getNewAdmin();
- $compare = $this->betweenRangeCriteriaAssign($oldstartdate, $oldenddate);
- if ($compare == true) {
- $hasAdminThisPeriod = true;
- if ($admin_id == $newAdmin) {
- $currentAdmin = true;
- $hasAdminThisPeriod = false;
- break;
- }
- }
- }
- if (($currentAdmin == false && $directadmin == false) || $hasAdminThisPeriod == true) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as you are not the current evaluator of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- }
- } elseif ($this->isCore()) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result) {
- $takenById = $result[0]->getTakenBy();
- // if($takenById != $this->getUser()->getAttribute('empId')){
- // $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- // $this->redirect('main/index');
- // }
- }
- }
- //added by renjo for monthly PE
- if ($this->getRequestParameter('type') == "monthly")
- $this->peform = "monthly";
- else
- $this->peform = "original";
- $this->editPEForm($peId, $empid);
- }
- else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } else if ($this->getRequestParameter('edit')) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $users = PeEmployeesPeer::doSelect($criteria);
- $empId = $users[0]->getEmpid();
- $this->peform = "self";
- $this->editPEForm($peId, $empId);
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('view')) {
- $peId = $this->getRequestParameter('view');
- if ($this->isViewable($peId)) {
- if ($this->isAdmin() && !$this->isSelf($peId, $this->getUser()->getAttribute('empId'))) {
- $currentAdmin = false;
- $PeEmployeesPeer = new PeEmployeesPeer;
- $empId = $PeEmployeesPeer->getEmpId($peId);
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $directadmin = true;
- } else {
- $directadmin = false;
- }
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $empId);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $newAdmin = $results->getNewAdmin();
- $compare = $this->betweenRangeCriteriaAssign($oldstartdate, $oldenddate);
- if ($compare == true) {
- if ($admin_id == $newAdmin) {
- $currentAdmin = true;
- break;
- }
- }
- }
- if ($currentAdmin == false && $directadmin == false) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as you are not the current evaluator of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- }
- }
- $this->viewPEForm($peId);
- $PeEmployeesPeer = new PeEmployeesPeer;
- $empId = $PeEmployeesPeer->getEmpId($peId);
- $this->emp_count = $this->isStaffAndAdminSaved($empId);
- // To check whether the emloyee's direct admin is core or not
- $pestatus = $PeEmployeesPeer->getPestatusvalue($peId);
- $pestatus_id = $pestatus[0]->getStatusId();
- $pestatus_evaluator = $pestatus[0]->getTakenby();
- if ($pestatus_id == 6 && $empId == $this->getUser()->getAttribute('empId')) {
- $this->self = true;
- }
- if ($pestatus_id == 7 || $pestatus_id == 11) {
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $this->directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $this->directadmin = true;
- } else {
- $this->directadmin = false;
- }
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to view the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('peForm')) {
- $empId = $this->getRequestParameter('peForm');
- if ($_SESSION['empRole'] == 'core') {
- $year = "%" . date("Y") . "%";
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $year, Criteria::LIKE);
- $criteria->add(PeEmployeesPeer::STATUSID, 2, Criteria::GREATER_THAN);
- $criteria->add(PeEmployeesPeer::TYPE, 2, Criteria::NOT_EQUAL);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result && $result[0]->getTakenBy() != $this->getUser()->getAttribute('empId')) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as the admin is preparing a PE form of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- } elseif ($_SESSION['empRole'] == 'admin') {
- $currentAdmin = false;
- $hasAdminThisPeriod = false;
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $directadmin = true;
- } else {
- $directadmin = false;
- }
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $empId);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $newAdmin = $results->getNewAdmin();
- $compare = $this->betweenRangeCriteriaAssign($oldstartdate, $oldenddate);
- if ($compare == true) {
- $hasAdminThisPeriod = true;
- if ($admin_id == $newAdmin) {
- $currentAdmin = true;
- $hasAdminThisPeriod = false;
- break;
- }
- }
- }
- if (($currentAdmin == false && $directadmin == false) || $hasAdminThisPeriod == true) {
- $_SESSION['error_msg'] = 'You are not authorized to do this operation as you are not the current evaluator of the specified kid';
- if (isset($_SESSION['msg'])) {
- unset($_SESSION['msg']);
- }
- $this->redirect('main/index');
- }
- }
- }
- if ($this->staffCheck($empId)) {
- $this->getPreForm($empId, null, 'original');
- $this->getEmpSupervisor($empId);
- $this->peform = "original";
- $peDetails[3] = $peDetails[4] = date('Y-m-d');
- $peDetails[5] = date("Y-m-d", strtotime("+1 years"));
- $this->peDetails = $peDetails;
- $this->readonly = false;
- sfView::SUCCESS;
- } else {
- $_SESSION['warning_msg'] = 'The selected person is not a Staff';
- $this->redirect('login/index');
- }
- } else {
- $empId = $this->getUser()->getAttribute('empId');
- $this->checkExpToSubmitPE($empId); /* checking wether the employee has sufficient experience to submit the PE */
- $empId = $this->getUser()->getAttribute('empId');
- $this->formType = "self";
- $this->getPreForm($empId, null, null);
- $this->getEmpSupervisor($empId);
- $this->emp = $this->getUser();
- $peDetails[3] = $peDetails[4] = date('Y-m-d');
- $peDetails[5] = date("Y-m-d", strtotime("+1 years"));
- $this->peDetails = $peDetails;
- $this->readonly = false;
- sfView::SUCCESS;
- }
- $c = new Criteria();
- $this->result_val = PeHelpStaffPeer::doSelect($c);
- $this->result_valSample = PeSampleStaffPeer::doSelect($c);
- $this->peid = $this->getRequestParameter('view');
- $this->role = $this->getUser()->getAttribute('empRole');
- } else {
- $this->redirect('login/index');
- }
- }
- //added by renjo to list all Monthly PE forms
- function executeMonthlyPE(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- $this->managementSkill = "false"; //To check whether management skill should be displayed or not in view form
- $empId = $this->getRequestParameter('view');
- $issueDate = $this->getRequestParameter('date');
- $tmpDate = explode('-', $issueDate);
- $this->issueYear = $tmpDate[0];
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $this->issueYear . "%", Criteria::LIKE);
- $criteria->add(PeEmployeesPeer::TYPE, MONTHLYCODE);
- $criteria->addAscendingOrderByColumn(PeEmployeesPeer::ISSUEDATE);
- $users = PeEmployeesPeer::doSelect($criteria);
- foreach ($users as $results) {
- $peId = $results->getPeId();
- $roleType = $results->getRoletype();
- $date = $results->getIssueDate();
- $tmpDate = explode('-', $date);
- $issueMonth = $tmpDate[1];
- $monthlyDetails[$issueMonth]['mark'] = $this->getPeDetails($peId, 1);
- $this->getPreForm(null, $peId, null);
- $monthlyDetails[$issueMonth]['accomp'] = $this->getAccomplishments($peId, 1);
- $monthlyDetails[$issueMonth]['respons'] = $this->getResponsibility($peId, 1);
- $monthlyDetails[$issueMonth]['qualqty'] = $this->getQualityQuantity($peId, 1);
- $monthlyDetails[$issueMonth]['commun'] = $this->getCommunication($peId, 1);
- $monthlyDetails[$issueMonth]['jobknge'] = $this->getJobKnowledge($peId, 1);
- //$this -> getQualityQuantity($peId);
- //$this -> getCommunication($peId);
- //$this -> getJobKnowledge($peId);
- if ($roleType != STAFF) {
- //echo $roleType."Management skill".$this->managementSkill;exit;
- $this->managementSkill = "true";
- $monthlyDetails[$issueMonth]['manageskill'] = $this->getManagementSkills($peId, 1);
- //$this -> getManagementSkills($peId);
- }
- $monthlyDetails[$issueMonth]['social'] = $this->getSocialEffectiveness($peId, 1);
- $monthlyDetails[$issueMonth]['satisf'] = $this->getSatisfaction($peId, 1);
- $monthlyDetails[$issueMonth]['leave'] = $this->getLeaveAttendance($peId, 1);
- $monthlyDetails[$issueMonth]['qms'] = $this->getQms($peId, 1);
- $monthlyDetails[$issueMonth]['otheract'] = $this->getOtherActivity($peId, 1);
- $monthlyDetails[$issueMonth]['empcomm'] = $this->getEmpComments($peId, 1);
- $monthlyDetails[$issueMonth]['devplan'] = $this->getDevelopmentPlan($peId, 1);
- $this->monthlyDetails = $monthlyDetails;
- }
- } else {
- $this->redirect('login/index');
- }
- }
- public function executeQMPEForm(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- if ($request->isMethod('post')) {
- $this->getPostedValues();
- }
- if ($this->getRequestParameter('edit') && $this->getRequestParameter('type') == "original") {
- $peId = $this->getRequestParameter('edit');
- if ($this->isEditable($peId)) {
- if ($this->isCore()) {
- $this->peform = "original";
- $this->editPEForm($peId);
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } else if ($this->getRequestParameter('edit')) {
- $peId = $this->getRequestParameter('edit');
- if ($this->isEditable($peId)) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $users = PeEmployeesPeer::doSelect($criteria);
- $empId = $users[0]->getEmpid();
- $this->peform = "self";
- $this->editPEForm($peId, $empId);
- } else {
- $_SESSION['error_msg'] = 'Not authorized to edit the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('view')) {
- $peId = $this->getRequestParameter('view');
- if ($this->isViewable($peId)) {
- $this->viewPEForm($peId);
- $PeEmployeesPeer = new PeEmployeesPeer;
- $empId = $PeEmployeesPeer->getEmpId($peId);
- $this->emp_count = $this->isStaffAndAdminSaved($empId);
- // To check whether the emloyee's direct admin is core or not
- $pestatus = $PeEmployeesPeer->getPestatusvalue($peId);
- $pestatus_id = $pestatus[0]->getStatusId();
- $pestatus_evaluator = $pestatus[0]->getTakenby();
- $this->evaluator = $empId;
- if ($pestatus_id == 7) {
- $admin_id = $this->getUser()->getAttribute('empId');
- $employeeInstance = new GroupwareEmployeesPeer();
- $searckkid_admin = $employeeInstance->getEmployeeAdminId($empId);
- if ($admin_id == $searckkid_admin) {
- $this->directadmin = true;
- } else if ($admin_id == $pestatus_evaluator) {
- $this->directadmin = true;
- } else {
- $this->directadmin = false;
- }
- }
- } else {
- $_SESSION['error_msg'] = 'Not authorized to view the Pe form';
- $this->redirect('main/index');
- }
- } elseif ($this->getRequestParameter('peForm')) {
- $empId = $this->getRequestParameter('peForm');
- if ($this->qmCheck($empId)) {
- $this->getPreForm($empId, null, 'original');
- $peDetails[3] = $peDetails[4] = date('Y-m-d');
- $peDetails[5] = date("Y-m-d", strtotime("+1 years"));
- $this->getEmpSupervisor($empId);
- $this->peform = "original";
- $this->peDetails = $peDetails;
- $this->readonly = false;
- sfView::SUCCESS;
- } else {
- $_SESSION['warning_msg'] = 'The selected person is not a QM';
- $this->redirect('login/index');
- }
- } else {
- $empId = $this->getUser()->getAttribute('empId');
- $this->checkExpToSubmitPE($empId); /* checking wether the employee has sufficient experience to submit the PE */
- $empId = $this->getUser()->getAttribute('empId');
- $this->getPreForm($empId, null, null);
- $this->getEmpSupervisor($empId);
- $this->emp = $this->getUser();
- $this->readonly = false;
- $peDetails[3] = $peDetails[4] = date('Y-m-d');
- $peDetails[5] = date("Y-m-d", strtotime("+1 years"));
- $this->peDetails = $peDetails;
- sfView::SUCCESS;
- }
- $c = new Criteria();
- $this->result_val = PeHelpQmPeer::doSelect($c);
- $this->result_valSample = PeSampleQmPeer::doSelect($c);
- $this->role = $this->getUser()->getAttribute('empRole');
- } else {
- $this->redirect('login/index');
- }
- }
- public function executeAssignAdmin(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- $this->getUser()->setAttribute('editAssignAdmin', '');
- if ($request->isMethod('post')) {
- if ($this->getRequestParameter('Cancel')) {
- $this->redirect('main/ViewAdmin');
- }
- $startdate = $this->getRequestParameter('startdate');
- if (!$startdate) {
- $startdate = $this->getRequestParameter('oldstartdate');
- }
- $endadate = $this->getRequestParameter('enddate');
- $nameOfAdmin = $this->getRequestParameter('admin');
- if (!is_numeric($nameOfAdmin)) {
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $tempNameOfAdmin = $groupwareEmployee->getEmployeeId($this->getRequestParameter('admin'));
- $nameOfAdmin = $tempNameOfAdmin[0];
- }
- if ($nameOfAdmin == '0') {
- $_SESSION['error_msg'] = 'The name of the admin is not entered';
- }
- $nameOfKid = $this->getRequestParameter('kids');
- if (!is_numeric($nameOfKid)) {
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $tempNameOfKid = $groupwareEmployee->getEmployeeId($this->getRequestParameter('kids'));
- $nameOfKid = $tempNameOfKid[0];
- }
- $groupwareEmployee = new GroupwareEmployeesPeer();
- if ($groupwareEmployee->getEmployeeAdminId($nameOfKid) == $nameOfAdmin) {
- $_SESSION['error_msg'] = GroupwareEmployeesPeer::getEmployeeName($nameOfKid) . ' is currently under direct supervision of ' . GroupwareEmployeesPeer::getEmployeeName($nameOfAdmin);
- }
- if ($nameOfKid == '0') {
- $_SESSION['error_msg'] = 'The name of the kid is not entered';
- }
- if ($startdate > $endadate) {
- $_SESSION['error_msg'] = 'End Date can never be before Start Date';
- }
- if ($_SESSION['error_msg'] != '') {
- $this->redirect('main/AssignAdmin');
- } else {
- $criteriaAssign = new Criteria();
- $criteriaAssign->add(PeAssignedAdminPeer::PETYPE, $this->getRequestParameter('peType'));
- if ($this->getRequestParameter('Update')) {
- $assignID = $this->getRequestParameter('editId');
- $criteriaAssign->add(PeAssignedAdminPeer::ASSIGNADMINID, $assignID, Criteria::NOT_EQUAL);
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $nameOfKid);
- // $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- }
- else
- $criteriaAssign->add(PeAssignedAdminPeer::EMPLOYEE, $nameOfKid);
- $resultSet = PeAssignedAdminPeer::doSelect($criteriaAssign);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $oldstartdate = $results->getStartDate();
- $oldenddate = $results->getEndDate();
- $peType = $results->getPetype();
- $compare = $this->betweenRangeCriteria($oldstartdate, $oldenddate, $startdate, $endadate);
- if (!$compare) {
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($nameOfKid);
- $_SESSION['error_msg'] = $kidName . ' has been assigned to another admin.Please delete the entry before assigning new admin';
- $this->redirect('main/ViewAdmin');
- }
- }
- }
- if ($this->getRequestParameter('Update')) {
- $assignID = $this->getRequestParameter('editId');
- $criteria = new Criteria();
- $criteria->add(PeAssignedAdminPeer::ASSIGNADMINID, $assignID);
- $criteria->add(PeAssignedAdminPeer::NEWADMIN, $nameOfAdmin);
- $criteria->add(PeAssignedAdminPeer::ENDDATE, $this->getRequestParameter('enddate'));
- $criteria->add(PeAssignedAdminPeer::ASSIGNEDBY, $this->getUser()->getAttribute('empId'));
- $criteria->add(PeAssignedAdminPeer::PETYPE, $this->getRequestParameter('peType'));
- PeAssignedAdminPeer::doUpdate($criteria);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $adminName = $groupwareEmployee->getEmployeeName($nameOfAdmin);
- $kidName = $groupwareEmployee->getEmployeeName($nameOfKid);
- $assignedBy = $groupwareEmployee->getEmployeeName($this->getUser()->getAttribute('empId'));
- $logs = new PelogsPeer();
- $assignedlog = $logs->getAssignedAdminLog($adminName, $kidName, $startdate, $endadate, $assignedBy);
- $_SESSION['msg'] = ' Entry updated successfully';
- $this->redirect('main/ViewAdmin');
- }
- /*
- * Bug: #9799
- * Summary: Unable to do admin assignments for monthly PE forms if there is anyPE form (yearly or monthly) added in the given month
- * Edited by: Miriam
- * Date: Nov 10, 2011
- * Modifications:-
- * added the following line:
- $currentPeId = 0;
- */
- $currentPeId = 0;
- if ($request->getPostParameter('peType') == MONTHLYCODE) {
- /* to check whether employeees Monthly PE form is already filled */
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $this->getRequestParameter('kids'));
- /*
- * Bug: #9799
- * Summary: Unable to do admin assignments for monthly PE forms if there isany PE form (yearly or monthly) added in the given month
- * Edited by: Miriam
- * Date: Nov 10, 2011
- * Modifications:-
- * removed the following line:
- $criteria->add(PeEmployeesPeer::STATUSID, 2, Criteria::GREATER_THAN);
- * added the following line:
- $criteria->add(PeEmployeesPeer::TYPE, 2, Criteria::EQUAL);
- */
- $criteria->add(PeEmployeesPeer::TYPE, 2, Criteria::EQUAL);
- $criteria->addDescendingOrderByColumn(PeEmployeesPeer::ISSUEDATE);
- $resultObject = PeEmployeesPeer::doSelect($criteria);
- if ($resultObject) {
- $issueDate = $resultObject[0]->getIssueDate();
- $tmpDate = explode('-', $issueDate);
- $issueMonth = $tmpDate[1];
- $assignDate = explode('-', $startdate);
- $assignMonth = $assignDate[1];
- /* Edited by Nevil on 2009-01-24. Added extra condition to check the count of array */
- if ($issueMonth == $assignMonth) {
- /*
- * Bug: #9799
- * Edited by: Miriam
- * Date: Nov 10, 2011
- * Modifications:-
- * removed the following lines:
- $peId = $resultObject[0]->getPeId();
- $_SESSION['warning_msg'] = 'This employee\'s Monthly PE form already saved or submitted.<br>Please delete it before asssigning a new Admin to the employee.';
- $this->redirect('main/deletePEForm?peId=' . $peId);
- * added the following line:
- $currentPeId = $resultObject[0]->getPeId();
- */
- $currentPeId = $resultObject[0]->getPeId();
- }
- }
- } else {
- /* to check whether employeees Original PE form is already filled */
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $this->getRequestParameter('kids'));
- $criteria->add(PeEmployeesPeer::STATUSID, 2, Criteria::GREATER_THAN);
- /**
- * @author Nazz
- * @BugId 9744
- */
- $criteria->add(PeEmployeesPeer::STATUSID, array(12,13), Criteria::NOT_IN);
- //Nazz End
- $criteria->addDescendingOrderByColumn(PeEmployeesPeer::ISSUEDATE);
- $resultObject = PeEmployeesPeer::doSelect($criteria);
- /* Edited BY Jayaraj */
- if ($resultObject) {
- //echo "<pre>";print_r($resultObject);die;
- $issueDate = $resultObject[0]->getIssueDate();
- $tmpDate = explode('-', $issueDate);
- $issueYear = $tmpDate[0];
- $assignDate = explode('-', $startdate);
- $assignYear = $assignDate[0];
- /* Edited by Nevil on 2009-01-24. Added extra condition to check the count of array */
- //echo $issueYear."asd".$assignYear;
- if ($issueYear == $assignYear) {
- /*
- * Bug: #9792, #9780, #9758
- * Summary: Unable to do admin assignments for yearly PE forms if there is any PE form added for the given year
- * Edited by: Miriam
- * Date: Nov 10, 2011
- * Modifications:-
- * removed the following lines:
- $peId = $resultObject[0]->getPeId();
- $_SESSION['warning_msg'] = 'This employee\'s original PE form already saved or submitted.<br>Please delete it before asssigning a new Admin to the employee.';
- $this->redirect('main/deletePEForm?peId=' . $peId);
- * added the following line:
- $currentPeId = $resultObject[0]->getPeId();
- */
- $currentPeId = $resultObject[0]->getPeId();
- }
- }
- }
- $criteria = new Criteria();
- $criteria->add(GroupwareEmployeesPeer::ID, $this->getRequestParameter('kids'));
- $resultObject = GroupwareEmployeesPeer::doSelect($criteria);
- foreach ($resultObject as $result)
- $oldadminId = $result->getSupervisor();
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $adminName = $groupwareEmployee->getEmployeeName($this->getRequestParameter('admin'));
- $kidName = $groupwareEmployee->getEmployeeName($this->getRequestParameter('kids'));
- $assignedBy = $groupwareEmployee->getEmployeeName($this->getUser()->getAttribute('empId'));
- $peadmin = new PEAssignedAdmin();
- $peadmin->setEmployee($this->getRequestParameter('kids'));
- $peadmin->setNewAdmin($this->getRequestParameter('admin'));
- $peadmin->setStartDate($this->getRequestParameter('startdate'));
- $peadmin->setEndDate($this->getRequestParameter('enddate'));
- $peadmin->setAssignedBy($this->getUser()->getAttribute('empId'));
- $peadmin->setOldAdmin($oldadminId);
- $peadmin->setPetype($this->getRequestParameter('peType')); // monthly or yearly
- $peadmin->save();
- $logs = new PelogsPeer();
- $assignedlog = $logs->getAssignedAdminLog($adminName, $kidName, $startdate, $endadate, $assignedBy);
- //to change the evaluator in the pe form
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $this->getRequestParameter('kids'));
- $criteria->add(PeEmployeesPeer::STATUSID, 3, Criteria::LESS_THAN);
- $resultObject = PeEmployeesPeer::doSelect($criteria);
- if (is_array($resultObject) && (count($resultObject) > 0)) {
- $PeId = $resultObject[0]->getPeId();
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $adminName = $groupwareEmployee->getEmployeeName($this->getRequestParameter('admin'));
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $PeId);
- $criteria->add(PeEmployeesPeer::TAKENBY, $adminName);
- PeEmployeesPeer::doUpdate($criteria);
- }
- /*
- * Bug: #9792, #9780, #9799, #9758
- * Edited by: Miriam
- * Date: Nov 10, 2011
- * Modifications:-
- * added the following lines:
- if($currentPeId) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $currentPeId);
- $criteria->add(PeEmployeesPeer::TAKENBY, $this->getRequestParameter('admin'));
- PeEmployeesPeer::doUpdate($criteria);
- }
- */
- if($currentPeId) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $currentPeId);
- $criteria->add(PeEmployeesPeer::TAKENBY, $this->getRequestParameter('admin'));
- PeEmployeesPeer::doUpdate($criteria);
- }
- $this->redirect('main/ViewAdmin');
- }
- } else if ($this->getRequestParameter('edit')) {
- $this->role = $this->getUser()->getAttribute('empRole');
- $this->getUser()->setAttribute('editAssignAdmin', 'true');
- $assignAdminId = $this->getRequestParameter('edit');
- $this->assignedID = $assignAdminId;
- if ($this->role == 'core' || $this->role == 'hr') {
- $criteria = new Criteria();
- $criteria->add(PeAssignedadminPeer::ASSIGNADMINID, $assignAdminId);
- $resultSet = PeAssignedadminPeer::doSelect($criteria);
- $employee = $resultSet[0]->getEmployee();
- $newAdmin = $resultSet[0]->getNewAdmin();
- $this->peType = $resultSet[0]->getPeType();
- $this->startDate = $resultSet[0]->getStartDate();
- $this->endDate = $resultSet[0]->getEndDate();
- $groupwareEmployees = new GroupwareEmployeesPeer();
- $this->noncore_user = $groupwareEmployees->getEmployeeName($employee);
- $this->newAdmin = $groupwareEmployees->getEmployeeName($newAdmin);
- $tmpDate = explode('-', $this->startDate);
- $issueYear = $tmpDate[0];
- $currentYear = '%' . date('Y') . '%';
- $nc = new Criteria();
- $nc->add(PeEmployeesPeer::EMPID, $employee);
- $nc->add(PeEmployeesPeer::TAKENBY, $newAdmin);
- $nc->add(PeEmployeesPeer::TYPE, 1);
- $nc->add(PeEmployeesPeer::ISSUEDATE, $currentYear, Criteria::LIKE);
- $results = PeEmployeesPeer::doSelect($nc);
- if ($results) {
- $this->adminlist = $groupwareEmployees->getEmployeeName($newAdmin);
- } else {
- $groupwareEmployees = new GroupwareEmployeesPeer();
- $this->noncore_users = $groupwareEmployees->getEmployeeAccounts();
- $this->adminlist = $groupwareEmployees->getAllAdmins();
- $this->corelist = $groupwareEmployees->getCoreMembers();
- }
- }
- } else {
- $this->role = $this->getUser()->getAttribute('empRole');
- if ($this->role == 'core' || $this->role == 'hr') {
- $groupwareEmployees = new GroupwareEmployeesPeer();
- $this->noncore_users = $groupwareEmployees->getEmployeeAccounts();
- $this->adminlist = $groupwareEmployees->getAllAdmins();
- $this->corelist = $groupwareEmployees->getCoreMembers();
- } else {
- $_SESSION['error_msg'] = 'You do not have privilege to assign admin';
- $this->redirect('main/index');
- }
- }
- }
- else
- $this->redirect('login/index');
- }
- public function executeViewAdmin(sfWebRequest $request) {
- if ($this->getRequestParameter('year'))
- $this->year = $this->getRequestParameter('year');
- else
- $this->year = date('Y');
- $GroupwareEmployeesPeer = new GroupwareEmployeesPeer;
- $this->current_empid = $this->getUser()->getAttribute('empId');
- $this->admin_name = $GroupwareEmployeesPeer->getEmployeeName($this->current_empid);
- $this->role = $this->getUser()->getAttribute('empRole');
- /* @bug : To give QM the permission to add PE form for employee
- * as per the request from HR
- * @author : John Varghese
- * @modified : Oct 4 2011
- * @work_done : removed the line $this->role != 'qm' from the code
- */
- //if (isset($_SESSION['empId']) && ($this->role != 'staff') && ($this->role != 'qm')) {
- if (isset($_SESSION['empId']) && ($this->role != 'staff')){
- if ($request->isMethod('post')) {
- $deleteid = $this->getRequestParameter('delete');
- $criteria = new Criteria();
- if ($deleteid) {
- foreach ($deleteid as $deletid) {
- /* @bug : To give QM the permission to add PE form for employee
- * as per the request from HR
- * @author : John Varghese
- * @modified : Oct 4 2011
- * @work_done : added aditional check for qm, this->role=="qm"
- */
- //if ($this->role == "admin")
- if ($this->role == "admin" || $this->role == "qm")
- $criteria->add(PeAssignedadminPeer::ASSIGNEDBY, $this->current_empid);
- $criteria->add(PeAssignedadminPeer::ASSIGNADMINID, $deletid);
- $resultObject = PeAssignedadminPeer::doSelect($criteria);
- if (is_array($resultObject) && (count($resultObject) > 0)) {
- $oldAdmin = $resultObject[0]->getOldAdmin();
- $empId = $resultObject[0]->getEmployee();
- $groupwareEmployees = new GroupwareEmployeesPeer();
- $oldAdminName = $groupwareEmployees->getEmployeeName($oldAdmin);
- $newAdmin = $resultObject[0]->getNewAdmin();
- $newAdminName = $groupwareEmployees->getEmployeeName($newAdmin);
- }
- $result = PeAssignedadminPeer::doDelete($criteria);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empId);
- $empName = $groupwareEmployee->getEmployeeName($this->current_empid);
- $logs = new PelogsPeer();
- $assignedlog = $logs->getDeletedAdminLog($newAdminName, $kidName, $empName);
- // to change the evaluator field as old admin
- $peEmployee = new PeEmployeesPeer();
- $peId = $peEmployee->getPeId($empId);
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $criteria->add(PeEmployeesPeer::TAKENBY, $oldAdminName);
- PeEmployeesPeer::doUpdate($criteria);
- if ($result == "1") {
- $_SESSION['msg'] = 'Successfully deleted the entry !!';
- } else {
- $_SESSION['error_msg'] = 'You dont have permission to delete this entry';
- }
- }
- }
- }
- $criteria = new Criteria();
- $year = "%" . $this->year . "%";
- $selectedYear = $this->year;
- $assignAdminArray = $this->checkRangeCriteria($selectedYear);
- $cton1 = $criteria->getNewCriterion(PeAssignedadminPeer::ASSIGNADMINID, $assignAdminArray, Criteria::IN);
- $cton2 = $criteria->getNewCriterion(PeAssignedadminPeer::STARTDATE, $year, CRITERIA::LIKE);
- $cton1->addOr($cton2);
- /* @bug : To give QM the permission to add PE form for employee
- * as per the request from HR
- * @author : John Varghese
- * @modified : Oct 4 2011
- * @work_done : added aditional check for qm role, this->role == "qm"
- */
- //if ($this->role == "admin") {
- if ($this->role == "admin" || $this->role == "qm") {
- $cton3 = $criteria->getNewCriterion(PeAssignedadminPeer::ASSIGNEDBY, $this->current_empid);
- $cton4 = $criteria->getNewCriterion(PeAssignedadminPeer::NEWADMIN, $this->current_empid);
- $cton3->addOr($cton4);
- $cton1->addAnd($cton3);
- }
- $criteria->add($cton1);
- if ($this->getRequestParameter('sort')) {
- if ($this->getRequestParameter('order') == 'desc') {
- $criteria->addDescendingOrderByColumn(PeAssignedadminPeer::translateFieldName($this->getRequestParameter('sort'), BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME));
- } else {
- $criteria->addAscendingOrderByColumn(PeAssignedadminPeer::translateFieldName($this->getRequestParameter('sort'), BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME));
- }
- } else {
- // sorted by date by default
- $criteria->addDescendingOrderByColumn(PeAssignedadminPeer::ASSIGNADMINID);
- }
- if($this->getRequestParameter('search_employee')) {
- $this->search_employee = $this->getRequestParameter('search_employee');
- $groupwareEmployeesPeer = new GroupwareEmployeesPeer();
- $employeeIds = $groupwareEmployeesPeer->getEmployeeId('%'.$this->search_employee.'%');
- $criteria->add(PeAssignedadminPeer::EMPLOYEE, $employeeIds, Criteria::IN);
- }
- $pager = new sfPropelPager('PEAssignedAdmin', PAGE);
- $pager->setCriteria($criteria);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- foreach ($pager->getResults() as $page) {
- $empid = $page->getEmployee();
- $name[$empid] = $GroupwareEmployeesPeer->getEmployeeName($empid);
- $assignedadminid = $page->getNewAdmin();
- $adminname[$assignedadminid] = $GroupwareEmployeesPeer->getEmployeeName($assignedadminid);
- $assignedbyid = $page->getAssignedBy();
- $assignedbyname[$assignedbyid] = $GroupwareEmployeesPeer->getEmployeeName($assignedbyid);
- }
- $this->employename = $name;
- $this->newadminname = $adminname;
- $this->assignedbyname = $assignedbyname;
- $this->role = $this->getUser()->getAttribute('empRole');
- }
- else
- $this->redirect('login/index');
- }
- public function executePeNotifications(sfWebRequest $request) {
- $number = $request->getParameter('page');
- if ($_SESSION['empRole'] == 'hr' || $_SESSION['empRole'] == 'core')
- $this->getPeCoreNotification($number);
- else if ($_SESSION['empRole'] == 'admin')
- $this->getPeAdminNotification($number);
- else if ($_SESSION['empRole'] == 'staff' || $_SESSION['empRole'] == 'qm')
- $this->getPeNotification($number);
- }
- public function executeCheckQc(sfWebRequest $request) {
- $type = $request->getParameter('type');
- $this->type = $type;
- }
- /**
- * Function (executeAddPEForm) for admin to fill staff PE Forms
- * author:sony
- */
- public function executeAddPEForm(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- if ($request->isMethod('post')) {
- $empId = $request->getParameter('employee_id');
- if ($empId == 0) {
- $_SESSION['msg'] = 'Please select an employee';
- $this->redirect('main/addPEForm');
- }
- // to check whether employee filled Self pe form.
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $resultObject = PeEmployeesPeer::doCount($criteria);
- if ($resultObject == 0)
- $_SESSION['msg'] = 'The employee hasn\'t submitted the self PE Form yet !!';
- if ($request->getParameter('peform_type') == 'admin') {
- $_SESSION['peFormType'] = 'admin';
- $this->redirect('main/AdminPEForm?peForm=' . $empId);
- } elseif ($request->getParameter('peform_type') == 'staff') {
- $_SESSION['peFormType'] = 'staff';
- $this->redirect('main/StaffPEForm?peForm=' . $empId);
- } elseif ($request->getParameter('peform_type') == 'admin_monthly') {
- $_SESSION['msg'] = null;
- $year = $this->getRequestParameter("date[year]");
- $month = $this->getRequestParameter("date[month]");
- $day = $this->getRequestParameter("date[day]");
- if ($month < 10)
- $month = "0" . $month;
- if ($day < 10)
- $day = "0" . $day;
- $issuedate = $year . "-" . $month . "-" . $day;
- $this->isSubmittedThisMonth($empId, $issuedate);
- $peId = $this->setMonthlyPEform($empId, $issuedate, ADMIN);
- $_SESSION['peFormType'] = 'admin_monthly';
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=monthly');
- }
- elseif ($request->getParameter('peform_type') == 'staff_monthly') {
- $_SESSION['msg'] = null;
- $year = $this->getRequestParameter("date[year]");
- $month = $this->getRequestParameter("date[month]");
- $day = $this->getRequestParameter("date[day]");
- if ($month < 10)
- $month = "0" . $month;
- if ($day < 10)
- $day = "0" . $day;
- $issuedate = $year . "-" . $month . "-" . $day;
- $this->isSubmittedThisMonth($empId, $issuedate);
- $_SESSION['peFormType'] = 'staff_monthly';
- $peId = $this->setMonthlyPEform($empId, $issuedate, STAFF);
- $this->redirect('main/StaffPEForm?edit=' . $peId . '&type=monthly');
- }
- elseif ($request->getParameter('peform_type') == 'qm') {
- $_SESSION['peFormType'] = 'qm';
- $this->redirect('main/QMPEForm?peForm=' . $empId);
- }
- } else {
- /* @bug : To give QM the permission to add PE form for employee
- * as per the request from HR
- * @author : John Varghese
- * @modified : Oct 4 2011
- * @work_done : added the condition to check for qm, this->isQm()
- */
- //if ($this->isCore()) {
- if ($this->isCore() || $this->isQm() || $this->isHr()){
- $employeeInstance = new GroupwareEmployeesPeer();
- $peFormTypes = array('2' => ' Admin PE Form ', '3' => ' Staff PE Form ', '4' => ' Admin Monthly PE Form ', '5' => ' Staff Monthly PE Form ');
- $staff = $employeeInstance->getEmployeeAccounts();
- foreach ($staff as $results) {
- $staffName[$results->getId()] = $results->getName();
- }
- $adminlist = $employeeInstance->getAllAdmins();
- foreach ($adminlist as $admin) {
- $adminName[$admin->getId()] = $admin->getName();
- }
- $optgroup_array = array('-- Select a Staff --', 'Staff' => $staffName, 'Admin' => $adminName);
- $this->optgroup_array = $optgroup_array;
- $this->peFormTypes = $peFormTypes;
- } elseif ($this->isAdmin()) {
- $adminId = $this->getUser()->getAttribute('empId');
- $peFormTypes = array('3' => ' Staff PE Form ', '2' => ' Admin PE Form ', '4' => ' Admin Monthly PE Form ', '5' => ' Staff Monthly PE Form ');
- $optgroup_array = array(); // Array to store staff list
- $teamMembersName = GroupwareEmployeesPeer::getSubordinates($adminId); //To get Subordinates
- $assignedMembersName = PeAssignedadminPeer::getAssignedEmployeesName($adminId); //To get Assigned Employees
- count($assignedMembersName);
- if (is_array($assignedMembersName))
- $optgroup_array = array('-- Select a Staff --', 'Staff' => $teamMembersName, 'Assigned Staff' => $assignedMembersName);
- else
- $optgroup_array = array('-- Select a Staff --', 'Staff' => $teamMembersName);
- $this->peFormTypes = $peFormTypes;
- $this->optgroup_array = $optgroup_array;
- }
- else {
- $_SESSION['error_msg'] = 'You Don\'t have access for this operation';
- $this->redirect('main\index');
- }
- }
- }
- else
- $this->redirect('login/index');
- }
- public function executeSuggestion(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- if ($request->isMethod('post')) {
- $this->getPostedValues();
- }
- } else {
- $this->redirect('login/index');
- }
- }
- function updatePEForm($peStatus) {
- $this->updateEmployee($this->getRequestParameter('update'), $peStatus);
- $this->updateAccomplishments($this->getRequestParameter('accomId'));
- $this->updateResponsibilities($this->getRequestParameter('respId'));
- $this->updateCommunication($this->getRequestParameter('commId'));
- $this->updateQualityQuantity($this->getRequestParameter('qqId'));
- $this->updateJobKnowledge($this->getRequestParameter('jobId'));
- $this->updateManagementSkills($this->getRequestParameter('skillId'));
- $this->updateSocialEffectiveness($this->getRequestParameter('socialId'));
- $this->updateSatisfaction($this->getRequestParameter('satisfactionId'));
- $this->updateLeaveAttendance($this->getRequestParameter('laId'));
- $this->updateQms($this->getRequestParameter('qmsId'));
- $this->updateOtherActivity($this->getRequestParameter('otherId'));
- $this->updateEmpComments($this->getRequestParameter('empCommId'));
- $this->updateDevelopmentPlan($this->getRequestParameter('devId'));
- return true;
- }
- function setPEForm($peStatus, $peform=null, $empid=null) {
- $role = $this->getUser()->getAttribute('empRole');
- // To check whether Employee already Submitted PE Form in the year.
- $peId = $this->isSubmittedThisYear($peform, $empid);
- if ($peId) {
- if ($this->isAdminSaved($peId) || $this->isStaffSaved($peId)) {
- $this->redirect('main/PeForm?edit=' . $peId . '');
- } else {
- $_SESSION['error_msg'] = 'You have already filled a PE Form this year';
- $this->redirect('main/ListPEForm');
- }
- } else {
- $peId = $this->setEmployee($peStatus, $peform, $empid);
- $this->setAccomplishments($peId);
- $this->setResponsibilities($peId);
- $this->setCommunication($peId);
- $this->setQualityQuantity($peId);
- $this->setJobKnowledge($peId);
- $formType = PeChangeformPeer::getFormType($this->getUser()->getAttribute('empId'));
- if ($role != "staff" || $formType == 'admin') {
- $this->setManagementSkills($peId);
- }
- $this->setManagementSkills($peId);
- $this->setSocialEffectiveness($peId);
- $this->setSatisfaction($peId);
- $this->setLeaveAttendance($peId);
- $this->setQms($peId);
- $this->setOtherActivity($peId);
- $this->setEmpComments($peId);
- $this->setDevelopmentPlan($peId);
- return true;
- }
- }
- function editPEForm($peId, $empid=null) {
- $role = $this->getUser()->getAttribute('empRole');
- $this->getPreForm(null, $peId, null);
- $this->emp = $this->getUser();
- $this->getPeDetails($peId);
- $this->getAccomplishments($peId);
- $this->getResponsibility($peId);
- $this->getQualityQuantity($peId);
- $this->getCommunication($peId);
- $this->getJobKnowledge($peId);
- $formType = PeChangeformPeer::getFormType($this->getUser()->getAttribute('empId'));
- if ($role != "staff" || $formType == 'admin') {
- $this->setManagementSkills($peId);
- }
- $this->getManagementSkills($peId);
- $this->getSocialEffectiveness($peId);
- $this->getSocialEffectiveness($peId);
- $this->getSatisfaction($peId);
- $this->getLeaveAttendance($peId);
- $this->getQms($peId);
- $this->getOtherActivity($peId);
- $this->getEmpComments($peId);
- $this->getDevelopmentPlan($peId);
- $this->getSuggestions($peId);
- $this->empid = $empid;
- $this->readonly = false;
- if ($this->getRequestParameter('type') == "original") {
- if ($_SESSION['status'] == "adminsave") {
- $this->editStatus = true;
- } else {
- $this->editStatus = false;
- }
- $_SESSION['status'] = null;
- } else {
- $this->editStatus = true;
- }
- return true;
- }
- function viewPEForm($peId) {
- $role = $this->getUser()->getAttribute('empRole');
- $this->getPreForm(null, $peId, null);
- $this->emp = $this->getUser();
- $this->getPeDetails($peId);
- $this->getAccomplishments($peId);
- $this->getResponsibility($peId);
- $this->getQualityQuantity($peId);
- $this->getCommunication($peId);
- $this->getJobKnowledge($peId);
- // if($role!="staff")
- $this->getManagementSkills($peId);
- $this->getSocialEffectiveness($peId);
- $this->getSocialEffectiveness($peId);
- $this->getSatisfaction($peId);
- $this->getLeaveAttendance($peId);
- $this->getQms($peId);
- $this->getOtherActivity($peId);
- $this->getEmpComments($peId);
- $this->getDevelopmentPlan($peId);
- $this->getSuggestions($peId);
- $this->readonly = true;
- $this->editStatus = false;
- return true;
- }
- // ********** Function TO LIST PEForms *********************
- public function executeListPEForm() {
- if (isset($_SESSION['empId'])) {
- $current_empid = $this->getUser()->getAttribute('empId');
- $newcriteria = new Criteria();
- $newcriteria->add(GroupwareEmployeesPeer::ID, $current_empid);
- $this->user_det = GroupwareEmployeesPeer::doSelect($newcriteria);
- $criteria = new Criteria();
- //************ code down TO SORT in order *****************************
- if ($this->getRequestParameter('sort')) {
- if ($this->getRequestParameter('order') == 'desc') {
- $criteria->addDescendingOrderByColumn(PeEmployeesPeer::translateFieldName($this->getRequestParameter('sort'), BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME));
- } else {
- $criteria->addAscendingOrderByColumn(PeEmployeesPeer::translateFieldName($this->getRequestParameter('sort'), BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME));
- }
- } else {
- // sorted by PeId by default
- $criteria->addDescendingOrderByColumn(PeEmployeesPeer::PEID);
- }
- //************ code up TO SORT in order *****************************
- $criteria->add(PeEmployeesPeer::EMPID, $current_empid);
- $criteria->setDistinct(true);
- $pager = new sfPropelPager('PeEmployees', PAGE);
- $pager->setCriteria($criteria);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- /**
- * Modified by Eby Paul on 30-11-2013
- * To correct the pagination issues #47208
- * When clicking the next page of the pagination it was showing all the PE forms of all employees
- */
- /****************Eby Paul Starts**********************/
- $pager->getNbResults();
- $pager->getFirstIndice();
- $pager->getLastIndice();
- /*****************Eby Paul Ends**********************/
- $this->role = $this->getUser()->getAttribute('empRole');
- // ******* TO GET THE DETAILS OF THE STATUS TABLE ***************//
- $criteria = new Criteria();
- $resultObject = PeStatusPeer::doSelect($criteria);
- foreach ($resultObject as $result) {
- $statusArray[$result->getstatusId()] = $result->getStatus();
- }
- $this->statusInfo = $statusArray;
- }
- else
- $this->redirect('login/index');
- }
- /* * ***************Function to save an employees PE from ************************** */
- function setEmployee($peStatus, $perform=null, $empid=null) {
- $role = $this->getUser()->getAttribute('empRole');
- if ($_SESSION['peFormType']) {
- $type = ORIGINALCODE;
- if ($_SESSION['peFormType'] == 'admin')
- $emproletype = ADMIN;
- elseif ($_SESSION['peFormType'] == 'staff')
- $emproletype = STAFF;
- elseif ($_SESSION['peFormType'] == 'qm')
- $emproletype = QM;
- $emp_id = $empid;
- $_SESSION['peFormType'] = null;
- }
- elseif ($perform == "original") {
- $emp_id = $this->getRequestParameter('empId');
- $GroupwareTeamsPeer = new GroupwareTeamsPeer();
- $teamAdmins = $GroupwareTeamsPeer->getTeamAdmins();
- $GroupwareEmployeesPeer = new GroupwareEmployeesPeer();
- $empName = $GroupwareEmployeesPeer->getEmployeeUserName($emp_id);
- $nc = new Criteria();
- $nc->add(GroupwareAccountsPeer::ACCOUNT_LID, $empName);
- $nc->addJoin(GroupwareAccountsPeer::ACCOUNT_ID, GroupwareAclPeer::ACL_ACCOUNT);
- $results = GroupwareAclPeer ::doSelect($nc);
- foreach ($results as $user) {
- $roleId = $user->getAclLocation();
- }
- if (in_array($emp_id, $teamAdmins)) {
- $emproletype = ADMIN;
- } elseif (qmRoleId == $roleId) {
- $emproletype = QM;
- } else {
- $emproletype = STAFF;
- }
- $type = ORIGINALCODE;
- $peStatuscode = $peStatus;
- } else {
- $type = SELFCODE;
- $peStatuscode = $peStatus;
- $emproletype = $this->getEmployeeRoleType();
- $emp_id = $this->getRequestParameter('empId');
- }
- $criteria = new Criteria();
- $criteria->add(GroupwareTeamMembersPeer::EMPID, $emp_id);
- $team = GroupwareTeamMembersPeer::doSelect($criteria);
- $employee = new PeEmployees();
- $employee->setEmpId($emp_id);
- if ($team) {
- if ($role != 'qm' && $emproletype != QM)
- $employee->setTeamid($team[0]->getTeamId());
- }
- $employee->setIssueDate($this->getRequestParameter('issue_date'));
- $employee->setReviewDate($this->getRequestParameter('review_date'));
- $employee->setNextReviewDate($this->getRequestParameter('next_date'));
- $employee->setStatusId($peStatus);
- $employee->setTotalMark($this->getRequestParameter('grant_total'));
- $employee->setType($type);
- $employee->setRoletype($emproletype);
- $total = $this->getRequestParameter('grant_total');
- // to calculate Employee Percentage
- if ($emproletype == 0)
- $percentage = ($total / ADMIN_TOTAL) * 100;
- elseif ($emproletype == 1)
- $percentage = ($total / QM_TOTAL) * 100;
- elseif ($emproletype == 2)
- $percentage = ($total / STAFF_TOTAL) * 100;
- $employee->setPercentage($percentage);
- $employee->setImmediateSupervisor($this->getRequestParameter('immediateSupervisor'));
- $employee->setNextSupervisor($this->getRequestParameter('nextSupervisor'));
- $employee->setTakenBy($this->getRequestParameter('takenBy'));
- $employee->save();
- $peId = $employee->getPeId();
- return $peId;
- }
- /* * ***************Function to save an employees Monthly PE form ************************** */
- public function setMonthlyPEform($emp_id=null, $issuedate=null, $emproletype=null) {
- $criteria = new Criteria();
- $criteria->add(GroupwareTeamMembersPeer::EMPID, $emp_id);
- $team = GroupwareTeamMembersPeer::doSelect($criteria);
- $employee = new PeEmployees();
- $employee->setEmpId($emp_id);
- if ($team) {
- if ($role != 'qm' && $emproletype != QM)
- $employee->setTeamid($team[0]->getTeamId());
- }
- $employee->setIssueDate($issuedate);
- $employee->setReviewDate($issuedate);
- $employee->setNextReviewDate($issuedate);
- $employee->setStatusId(12);
- $employee->setType(2);
- $GroupwareTeamsPeer = new GroupwareTeamsPeer();
- $teamAdmins = $GroupwareTeamsPeer->getTeamAdmins();
- $employee->setRoletype($emproletype);
- $employeeDetails = $this->getEmpSupervisorforMonthly($emp_id);
- $employee->setImmediateSupervisor($employeeDetails["supervisor"]);
- $employee->setNextSupervisor($employeeDetails["nextsupervisor"]);
- $employee->setTakenBy($employeeDetails["takenby"]);
- $employee->save();
- $peId = $employee->getPeId();
- $this->setAccomplishments($peId);
- $this->setResponsibilities($peId);
- $this->setCommunication($peId);
- $this->setQualityQuantity($peId);
- $this->setJobKnowledge($peId);
- $this->setManagementSkills($peId);
- $this->setSocialEffectiveness($peId);
- $this->setSatisfaction($peId);
- $this->setLeaveAttendance($peId);
- $this->setQms($peId);
- $this->setOtherActivity($peId);
- $this->setEmpComments($peId);
- $this->setDevelopmentPlan($peId);
- return $peId;
- }
- //added by renjo for executing leave bug report function
- public function executeBugReport(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- $this->role = $this->getUser()->getAttribute('empRole');
- if ($this->role == 'hr' && !$this->getRequestParameter('commit')) {
- $_SESSION['msg'] = 'Please select the staff to add leave bug report';
- }
- if ($this->role == 'core') {
- $_SESSION['msg'] = 'Please select an employee to view leave bug report';
- }
- if ($this->role == 'admin') {
- $_SESSION['msg'] = 'Please select an employee to view leave bug report';
- }
- if (isset($_SESSION['pageempId']) && !$this->getRequestParameter('page') && !$this->getRequestParameter('Cancel')) {
- if ($this->getUser()->getAttribute('CancelStatus') != 'true') {
- $_SESSION['temppageempId'] = '';
- $_SESSION['temppageemprole'] = '';
- $this->getUser()->getAttributeHolder()->remove('selectAllEmployee');
- }
- }
- $this->getUser()->getAttributeHolder()->remove('CancelStatus');
- $this->role = $this->getUser()->getAttribute('empRole');
- if ($this->role == 'staff' || $this->role == 'qm') {
- $this->empId = $this->getUser()->getAttribute('empId');
- $this->getUser()->setAttribute('bugrole2', 'employee');
- $c = new Criteria();
- $c->add(PeBugEmployeePeer::EMPID, $this->empId);
- $pager = new sfPropelPager('PeBugEmployee', PAGE);
- $pager->setCriteria($c);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- }
- if ($this->role == 'admin') {
- $this->getUser()->getAttributeHolder()->remove('bugrole1');
- $this->getUser()->getAttributeHolder()->remove('bugrole2');
- $empId = $this->getUser()->getAttribute('empId');
- //$teamMembersId=$this->getUser()->getAttribute('teamMembers');
- $this->adminId = $empId;
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $this->adminName = $groupwareEmployee->getEmployeeName($empId);
- // to get employee name from employee IDs
- $this->teamMembersName = GroupwareEmployeesPeer::getSubordinates($empId);
- //$this->teamMembersName = $employeeInstance -> getEmployeeNameValue($teamMembersId);
- if ($request->isMethod('post') || $this->getRequestParameter('page')) {
- if ($this->getRequestParameter('page')) {
- }
- $nameOfEmployee = $this->getRequestParameter('employee_id');
- $roleOfEmployee = $this->getRequestParameter('role');
- if ($nameOfEmployee == 0 && ($roleOfEmployee == 'Employee')) {
- $this->getUser()->setAttribute('selectAllEmployee', 'employee');
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- if ($nameOfEmployee == 0 && $roleOfEmployee == 'Supervisor') {
- $this->getUser()->setAttribute('selectAllEmployee', 'supervisor');
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- if (!$nameOfEmployee && isset($_SESSION['pageempId'])) {
- $nameOfEmployee = $_SESSION['pageempId'];
- }
- $criteria = new Criteria();
- $criteria->add(GroupwareTeamsPeer::ADMIN_ID, $nameOfEmployee);
- $result = GroupwareTeamsPeer::doSelect($criteria);
- $roleOfEmployee = $this->getRequestParameter('role');
- if (!$roleOfEmployee && isset($_SESSION['pageemprole'])) {
- $roleOfEmployee = $_SESSION['pageemprole'];
- }
- if ($_SESSION['error_msg'] != '') {
- } else {
- if ($result && $roleOfEmployee == 'Supervisor') {
- $this->supervisorId = $this->getRequestParameter('employee_id');
- if (!$this->supervisorId) {
- $this->supervisorId = $_SESSION['pageempId'];
- } else {
- $_SESSION['pageempId'] = $this->supervisorId;
- $_SESSION['temppageempId'] = $this->supervisorId;
- }
- $_SESSION['pageemprole'] = 'Supervisor';
- $_SESSION['temppageemprole'] = 'Supervisor';
- $this->getUser()->setAttribute('bugrole1', 'supervisor');
- $this->getUser()->setAttribute('bugempId', $this->supervisorId);
- $nc = new Criteria();
- $nc->add(PeBugSupervisorPeer::SUPERVISORID, $this->supervisorId);
- $pager = new sfPropelPager('PeBugSupervisor', PAGE);
- $pager->setCriteria($nc);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->setParameter('pageempId', $this->supervisorId);
- $pager->setParameter('pageemprole', 'Supervisor');
- $pager->init();
- $this->pager = $pager;
- } else if (!$result && $roleOfEmployee == 'Supervisor') {
- $_SESSION['error_msg'] = 'The selected person is not a supervisor';
- } else {
- $this->empId = $this->getRequestParameter('employee_id');
- $this->getUser()->setAttribute('bugempId', $this->empId);
- $this->getUser()->setAttribute('bugrole2', 'employee');
- if (!$this->empId) {
- $this->empId = $_SESSION['pageempId'];
- } else {
- $_SESSION['pageempId'] = $this->empId;
- $_SESSION['temppageempId'] = $this->empId;
- }
- $_SESSION['pageemprole'] = 'Employee';
- $_SESSION['temppageemprole'] = 'Employee';
- $nc = new Criteria();
- $nc->add(PeBugEmployeePeer::EMPID, $this->empId);
- $pager = new sfPropelPager('PeBugEmployee', PAGE);
- $pager->setCriteria($nc);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->setParameter('pageempId', $this->empId);
- $pager->setParameter('pageemprole', 'Employee');
- $pager->init();
- $this->pager = $pager;
- }
- }
- }
- }
- if ($this->role == 'core' || $this->role == 'hr') {
- if ($this->getRequestParameter('Cancel')) {
- $this->getUser()->setAttribute('CancelStatus', 'true');
- $this->redirect('main/BugReport');
- }
- $groupwareEmployees = new GroupwareEmployeesPeer();
- $this->noncore_users = $groupwareEmployees->getEmployeeAccounts();
- $this->adminlist = $groupwareEmployees->getAllAdmins();
- $this->corelist = $groupwareEmployees->getCoreMembers();
- $this->getUser()->getAttributeHolder()->remove('bugrole1');
- $this->getUser()->getAttributeHolder()->remove('bugrole2');
- //
- if ($request->isMethod('post') || $this->getRequestParameter('page')) {
- if ($this->getRequestParameter('page')) {
- }
- $nameOfEmployee = $this->getRequestParameter('employee');
- $roleOfEmployee = $this->getRequestParameter('role');
- if ($nameOfEmployee == 0 && ($roleOfEmployee == 'Employee')) {
- $this->getUser()->setAttribute('selectAllEmployee', 'employee');
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- if ($nameOfEmployee == 0 && $roleOfEmployee == 'Supervisor') {
- $this->getUser()->setAttribute('selectAllEmployee', 'supervisor');
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- if (!$nameOfEmployee && isset($_SESSION['pageempId'])) {
- $nameOfEmployee = $_SESSION['pageempId'];
- }
- $criteria = new Criteria();
- $criteria->add(GroupwareTeamsPeer::ADMIN_ID, $nameOfEmployee);
- $result = GroupwareTeamsPeer::doSelect($criteria);
- $roleOfEmployee = $this->getRequestParameter('role');
- if (!$roleOfEmployee && isset($_SESSION['pageemprole'])) {
- $roleOfEmployee = $_SESSION['pageemprole'];
- }
- if ($_SESSION['error_msg'] != '') {
- } else {
- if ($result && $roleOfEmployee == 'Supervisor') {
- $this->supervisorId = $this->getRequestParameter('employee');
- if (!$this->supervisorId) {
- $this->supervisorId = $_SESSION['pageempId'];
- } else {
- $_SESSION['pageempId'] = $this->supervisorId;
- $_SESSION['temppageempId'] = $this->supervisorId;
- }
- $_SESSION['pageemprole'] = 'Supervisor';
- $_SESSION['temppageemprole'] = 'Supervisor';
- $this->getUser()->setAttribute('bugrole1', 'supervisor');
- $this->getUser()->setAttribute('bugempId', $this->supervisorId);
- $nc = new Criteria();
- $nc->add(PeBugSupervisorPeer::SUPERVISORID, $this->supervisorId);
- $pager = new sfPropelPager('PeBugSupervisor', PAGE);
- $pager->setCriteria($nc);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->setParameter('pageempId', $this->supervisorId);
- $pager->setParameter('pageemprole', 'Supervisor');
- $pager->init();
- $this->pager = $pager;
- } else if (!$result && $roleOfEmployee == 'Supervisor') {
- $_SESSION['error_msg'] = 'The selected person is not a supervisor';
- } else {
- $this->empId = $this->getRequestParameter('employee');
- $this->getUser()->setAttribute('bugempId', $this->empId);
- $this->getUser()->setAttribute('bugrole2', 'employee');
- if (!$this->empId) {
- $this->empId = $_SESSION['pageempId'];
- } else {
- $_SESSION['pageempId'] = $this->empId;
- $_SESSION['temppageempId'] = $this->empId;
- }
- $_SESSION['pageemprole'] = 'Employee';
- $_SESSION['temppageemprole'] = 'Employee';
- $nc = new Criteria();
- $nc->add(PeBugEmployeePeer::EMPID, $this->empId);
- $pager = new sfPropelPager('PeBugEmployee', PAGE);
- $pager->setCriteria($nc);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->setParameter('pageempId', $this->empId);
- $pager->setParameter('pageemprole', 'Employee');
- $pager->init();
- $this->pager = $pager;
- }
- }
- }
- }
- }
- else
- $this->redirect('login/index');
- }
- //code for executing bug report form
- public function executeBugReportForm(sfWebRequest $request) {
- $this->role = $this->getUser()->getAttribute('empRole');
- if (isset($_SESSION['empId']) && ($this->role == 'hr')) {
- if ($request->isMethod('post')) {
- $bugNo = $this->getRequestParameter('bugno');
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- //echo "hello";exit;
- $c = new Criteria();
- $c->add(PeBugSupervisorPeer::BUGNO, $bugNo);
- $resultSet = PeBugSupervisorPeer::doSelect($c);
- if ($resultSet) {
- $_SESSION['error_msg'] = 'The entered Bug Number already exists.Please re-enter';
- }
- $teammemberId = $request->getParameter('employee_id');
- if ($teammemberId == 0) {
- $_SESSION['error_msg'] = 'Please select an employee';
- }
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $nc = new Criteria();
- $nc->add(PeBugEmployeePeer::BUGNO, $bugNo);
- $results = PeBugEmployeePeer::doSelect($nc);
- if ($results) {
- $_SESSION['error_msg'] = 'The entered Bug Number already exists.Please re-enter';
- }
- }
- $emp_Id = $this->getUser()->getAttribute('bugempId');
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $EmployeeName = $groupwareEmployee->getEmployeeName($emp_Id);
- $teammemberName = $groupwareEmployee->getEmployeeName($teammemberId);
- $emp_instance = new GroupwareEmployeesPeer();
- $admin_Id = $emp_instance->getEmployeeAdminId($emp_Id);
- $leaveType = $this->getRequestParameter('leavetype');
- if ($leaveType == '0') {
- $_SESSION['error_msg'] = 'Please select leave type';
- }
- $leaveDate = $this->getRequestParameter('leaveDate');
- $appliedDate = $this->getRequestParameter('appliedDate');
- $approvalDate = $this->getRequestParameter('approvalDate');
- if ($bugNo == 0 || $leaveDate == 0 || $appliedDate == 0 || $approvalDate == 0) {
- $_SESSION['error_msg'] = 'Please do not leave any field blank';
- }
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $reason = $this->getRequestParameter('reason');
- if (!$reason) {
- $_SESSION['error_msg'] = 'Please enter the reason';
- }
- }
- if ($_SESSION['error_msg'] != '') {
- } else {
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $bug_sup = new PeBugSupervisor();
- $bug_sup->setBugNo($bugNo);
- $bug_sup->setSupervisorName($EmployeeName);
- $bug_sup->setStaffName($teammemberName);
- $bug_sup->setSupervisorId($emp_Id);
- $bug_sup->setStaffId($teammemberId);
- $bug_sup->setLeaveType($leaveType);
- $bug_sup->setLeaveDate($leaveDate);
- $bug_sup->setAppliedDate($appliedDate);
- $bug_sup->setApprovalDate($approvalDate);
- $bug_sup->setLeaveReason($reason);
- $bug_sup->save();
- $_SESSION['msg'] = 'Bug Report added successfully';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($emp_Id);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $approveEmployeeLog = $logs->getBugSupervisorLog($kidName, $empName, $bugNo);
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $emp_instance = new GroupwareEmployeesPeer();
- $supervisor = $emp_instance->getEmployeeAdmin($emp_Id);
- $bug_emp = new PeBugEmployee();
- $bug_emp->setBugNo($bugNo);
- $bug_emp->setEmpId($emp_Id);
- $bug_emp->setTeamMember($EmployeeName);
- $bug_emp->setSupervisor($supervisor);
- $bug_emp->setLeaveType($leaveType);
- $bug_emp->setLeaveDate($leaveDate);
- $bug_emp->setAppliedDate($appliedDate);
- $bug_emp->setApprovalDate($approvalDate);
- $bug_emp->save();
- $_SESSION['msg'] = 'Bug Report added successfully';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($emp_Id);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $approveEmployeeLog = $logs->getBugEmployeeLog($kidName, $empName, $bugNo);
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- }
- }
- }else
- $this->redirect('login/index');
- }
- public function executeViewBugReport(sfWebRequest $request) {
- if (isset($_SESSION['empId'])) {
- if ($this->getRequestParameter('view')) {
- $bugId = $this->getRequestParameter('view');
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $c = new Criteria();
- $c->add(PeBugSupervisorPeer::BUGID, $bugId);
- $this->bug_list = PeBugSupervisorPeer::doSelect($c);
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $c = new Criteria();
- $c->add(PeBugEmployeePeer::BUGID, $bugId);
- $this->bug_list = PeBugEmployeePeer::doSelect($c);
- }
- }
- if ($this->getRequestParameter('delete')) {
- $delId = $this->getRequestParameter('delete');
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $nc = new Criteria();
- $nc->add(PeBugSupervisorPeer::BUGID, $delId);
- $results = PeBugSupervisorPeer::doSelect($nc);
- foreach ($results as $bugs) {
- $emp_Id = $bugs->getSupervisorId();
- $bugNo = $bugs->getBugNo();
- }
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($emp_Id);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $logs->getDeleteBugSupervisorLog($kidName, $empName, $bugNo);
- $c = new Criteria();
- $c->add(PeBugSupervisorPeer::BUGID, $delId);
- $this->bug_list = PeBugSupervisorPeer::doDelete($c);
- $_SESSION['msg'] = 'Bug Report deleted successfully';
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $nc = new Criteria();
- $nc->add(PeBugEmployeePeer::BUGID, $delId);
- $results = PeBugEmployeePeer::doSelect($nc);
- foreach ($results as $bugs) {
- $emp_Id = $bugs->getEmpId();
- $bugNo = $bugs->getBugNo();
- }
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($emp_Id);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $logs->getDeleteBugEmployeeLog($kidName, $empName, $bugNo);
- $c = new Criteria();
- $c->add(PeBugEmployeePeer::BUGID, $delId);
- $this->bug_list = PeBugEmployeePeer::doDelete($c);
- $_SESSION['msg'] = 'Bug Report deleted successfully';
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- }
- }
- }
- public function executeEditBugReport(sfWebRequest $request) {
- $this->role = $this->getUser()->getAttribute('empRole');
- if (isset($_SESSION['empId']) && ($this->role == 'hr')) {
- if ($this->getRequestParameter('edit')) {
- $bugeditId = $this->getRequestParameter('edit');
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $c = new Criteria();
- $c->add(PeBugSupervisorPeer::BUGID, $bugeditId);
- $this->bug_list = PeBugSupervisorPeer::doSelect($c);
- foreach ($this->bug_list as $resultsupervisor) {
- $emp_Id = $resultsupervisor->getSupervisorId();
- }
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $c = new Criteria();
- $c->add(PeBugEmployeePeer::BUGID, $bugeditId);
- $this->bug_list = PeBugEmployeePeer::doSelect($c);
- foreach ($this->bug_list as $resultemployee) {
- $emp_Id = $resultemployee->getEmpId();
- }
- }
- }
- if ($this->getRequestParameter('Cancel')) {
- $this->redirect('main/BugReport');
- }
- if ($request->isMethod('post')) {
- $bugNo = $this->getRequestParameter('bugno');
- $bugId = $this->getRequestParameter('bugNumber');
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $c = new Criteria();
- $c->add(PeBugSupervisorPeer::BUGID, $bugId);
- $this->bug_list = PeBugSupervisorPeer::doSelect($c);
- foreach ($this->bug_list as $resultsupervisor) {
- $emp_Id = $resultsupervisor->getSupervisorId();
- $tempBugNo = $resultsupervisor->getBugNo();
- }
- if ($bugNo != $tempBugNo) {
- $c = new Criteria();
- $c->add(PeBugSupervisorPeer::BUGNO, $bugNo);
- $resultSet = PeBugSupervisorPeer::doSelect($c);
- if ($resultSet) {
- $_SESSION['error_msg'] = 'The entered Bug Number already exists.Please re-enter';
- }
- }
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $c = new Criteria();
- $c->add(PeBugEmployeePeer::BUGID, $bugId);
- $this->bug_list = PeBugEmployeePeer::doSelect($c);
- foreach ($this->bug_list as $resultemployee) {
- $emp_Id = $resultemployee->getEmpId();
- $tempBugNo = $resultemployee->getBugNo();
- }
- if ($bugNo != $tempBugNo) {
- $nc = new Criteria();
- $nc->add(PeBugEmployeePeer::BUGNO, $bugNo);
- $results = PeBugEmployeePeer::doSelect($nc);
- if ($results) {
- $_SESSION['error_msg'] = 'The entered Bug Number already exists.Please re-enter';
- }
- }
- }
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $EmployeeName = $groupwareEmployee->getEmployeeName($emp_Id);
- $teammemberId = $request->getParameter('employee_id');
- $teammemberName = $groupwareEmployee->getEmployeeName($teammemberId);
- $emp_instance = new GroupwareEmployeesPeer();
- $admin_Id = $emp_instance->getEmployeeAdminId($emp_Id);
- $leaveType = $this->getRequestParameter('leavetype');
- if ($leaveType == '0') {
- $_SESSION['error_msg'] = 'Please select leave type';
- }
- $leaveDate = $this->getRequestParameter('leaveDate');
- $appliedDate = $this->getRequestParameter('appliedDate');
- $approvalDate = $this->getRequestParameter('approvalDate');
- if ($bugNo == 0 || $leaveDate == 0 || $appliedDate == 0 || $approvalDate == 0) {
- $_SESSION['error_msg'] = 'Please do not leave any field blank';
- }
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $reason = $this->getRequestParameter('reason');
- if (!$reason) {
- $_SESSION['error_msg'] = 'Please enter the reason';
- }
- }
- if ($_SESSION['error_msg'] != '') {
- } else {
- if ($this->getUser()->getAttribute('bugrole1') == 'supervisor') {
- $criteria = new Criteria();
- $criteria->add(PeBugSupervisorPeer::BUGID, $bugId);
- $criteria->add(PeBugSupervisorPeer::BUGNO, $bugNo);
- $criteria->add(PeBugSupervisorPeer::SUPERVISORID, $emp_Id);
- $criteria->add(PeBugSupervisorPeer::STAFFID, $teammemberId);
- $criteria->add(PeBugSupervisorPeer::LEAVETYPE, $leaveType);
- $criteria->add(PeBugSupervisorPeer::LEAVEDATE, $leaveDate);
- $criteria->add(PeBugSupervisorPeer::APPLIEDDATE, $appliedDate);
- $criteria->add(PeBugSupervisorPeer::APPROVALDATE, $approvalDate);
- $criteria->add(PeBugSupervisorPeer::LEAVEREASON, $reason);
- PeBugSupervisorPeer::doUpdate($criteria);
- $_SESSION['msg'] = 'Bug Report updated successfully';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($emp_Id);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $logs->getEditBugSupervisorLog($kidName, $empName, $bugNo);
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- } else if ($this->getUser()->getAttribute('bugrole2') == 'employee') {
- $criteria = new Criteria();
- $criteria->add(PeBugEmployeePeer::BUGID, $bugId);
- $criteria->add(PeBugEmployeePeer::BUGNO, $bugNo);
- $criteria->add(PeBugEmployeePeer::EMPID, $emp_Id);
- $criteria->add(PeBugEmployeePeer::LEAVETYPE, $leaveType);
- $criteria->add(PeBugEmployeePeer::LEAVEDATE, $leaveDate);
- $criteria->add(PeBugEmployeePeer::APPLIEDDATE, $appliedDate);
- $criteria->add(PeBugEmployeePeer::APPROVALDATE, $approvalDate);
- PeBugEmployeePeer::doUpdate($criteria);
- $_SESSION['msg'] = 'Bug Report updated successfully';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($emp_Id);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $logs->getEditBugEmployeeLog($kidName, $empName, $bugNo);
- $this->redirect('main/ListBugReports?year=' . Date("Y"));
- }
- }
- }
- }else
- $this->redirect('login/index');
- }
- public function executeListBugReports(sfWebRequest $request) {
- $this->role = $this->getUser()->getAttribute('empRole');
- if (isset($_SESSION['empId']) && ($this->role == 'hr' || $this->role == 'core')) {
- if ($this->role == 'core') {
- $_SESSION['msg'] = 'Please select an employee to view leave bug report';
- }
- $groupwareAccounts = new GroupwareEmployeesPeer();
- $this->noncore_users = $groupwareAccounts->getEmployeeAccounts(); //defined in/lib/model/GroupwareAccountsPeer.php
- $this->adminlist = $groupwareAccounts->getAllAdmins();
- $nc = new Criteria();
- $nc->add(GroupwareEmployeesPeer::GRADE, array('MEG'), Criteria::IN);
- $this->corelist = GroupwareEmployeesPeer::doSelect($nc);
- if ($this->getUser()->getAttribute('selectAllEmployee') == 'employee') {
- if ($this->getRequestParameter('year'))
- $year = $this->getRequestParameter('year');
- else
- $year=Date("Y");
- $this->year = $year;
- $this->getUser()->setAttribute('bugrole2', 'employee');
- $_SESSION['temppageemprole'] = 'Employee';
- $pager = new sfPropelPager('PeBugEmployee', PAGE);
- $nc1 = new Criteria();
- $nc1->add(PeBugEmployeePeer::LEAVEDATE, $year . "%", Criteria::LIKE);
- $pager->setCriteria($nc1);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- }else if ($this->getUser()->getAttribute('selectAllEmployee') == 'supervisor') {
- $this->getUser()->setAttribute('bugrole1', 'supervisor');
- $_SESSION['temppageemprole'] = 'Supervisor';
- $pager = new sfPropelPager('PeBugSupervisor', PAGE);
- if ($this->getRequestParameter('year'))
- $year = $this->getRequestParameter('year');
- else
- $year=Date("Y");
- $this->year = $year;
- $nc1 = new Criteria();
- $nc1->add(PeBugSupervisorPeer::LEAVEDATE, $year . "%", Criteria::LIKE);
- $pager->setCriteria($nc1);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- }
- }
- if (isset($_SESSION['empId']) && ($this->role == 'admin')) {
- if ($this->role == 'admin') {
- $_SESSION['msg'] = 'Please select an employee to view leave bug report';
- }
- $empId = $this->getUser()->getAttribute('empId');
- $this->adminId = $empId;
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $this->adminName = $groupwareEmployee->getEmployeeName($empId);
- // to get employee name from employee IDs
- //$teamMembersId=$this->getUser()->getAttribute('teamMembers');
- $this->teamMembersName = GroupwareEmployeesPeer::getSubordinates($empId);
- //$employeeInstance = new GroupwareEmployeesPeer();
- //$this->teamMembersName = $employeeInstance -> getEmployeeNameValue($teamMembersId);
- if ($this->getUser()->getAttribute('selectAllEmployee') == 'employee') {
- $this->getUser()->setAttribute('bugrole2', 'employee');
- $_SESSION['temppageemprole'] = 'Employee';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $supervisorName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- if ($this->getRequestParameter('year'))
- $year = $this->getRequestParameter('year');
- else
- $year=Date("Y");
- $this->year = $year;
- $nc = new Criteria();
- $nc->add(PeBugEmployeePeer::SUPERVISOR, $supervisorName);
- $nc->add(PeBugEmployeePeer::LEAVEDATE, $year . "%", Criteria::LIKE);
- $pager = new sfPropelPager('PeBugEmployee', PAGE);
- $pager->setCriteria($nc);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- }else if ($this->getUser()->getAttribute('selectAllEmployee') == 'supervisor') {
- if ($this->getRequestParameter('year'))
- $year = $this->getRequestParameter('year');
- else
- $year=Date("Y");
- $this->year = $year;
- $this->getUser()->setAttribute('bugrole1', 'supervisor');
- $_SESSION['temppageemprole'] = 'Supervisor';
- $nc = new Criteria();
- $nc->add(PeBugSupervisorPeer::LEAVEDATE, $year . "%", Criteria::LIKE);
- $nc->add(PeBugSupervisorPeer::SUPERVISORID, $_SESSION['empId']);
- $pager = new sfPropelPager('PeBugSupervisor', PAGE);
- $pager->setCriteria($nc);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- }
- }
- }
- //end of leave bug report
- /* * ************ Function to save employee accomplishments into PE_Accomplishments table ******************** */
- public function executeAccessLogs(sfWebRequest $request) {
- if ($_SESSION['empRole'] == 'hr' || $_SESSION['empRole'] == 'core') {
- if ($this->getRequestParameter('delete')) {
- $id = $this->getRequestParameter('delete');
- $accounts = new PeAccessLogsPeer();
- $accounts->unBlockIP($id);
- $_SESSION['msg'] = 'The record has been deleted successfully.';
- }
- } else {
- $this->redirect('login/index');
- }
- }
- public function executeAutoSave(sfWebRequest $request) {
- $success = $this->validateMark();
- if ($success == false) {
- $this->msg = "Unable to save the Form";
- } else {
- if ($this->getRequestParameter('perform') == "original") {
- $peStatus = 3;
- } else {
- $peStatus = 1;
- }
- if ($this->getRequestParameter('update') || isset($_SESSION['autoSave'])) {
- if ($this->getRequestParameter('update')) {
- $peId = $this->getRequestParameter('update');
- $accomId = $this->getRequestParameter('accomId');
- $respId = $this->getRequestParameter('respId');
- $qqId = $this->getRequestParameter('qqId');
- $commId = $this->getRequestParameter('commId');
- $jobId = $this->getRequestParameter('jobId');
- $mngId = $this->getRequestParameter('skillId');
- $socialId = $this->getRequestParameter('socialId');
- $satId = $this->getRequestParameter('satisfactionId');
- $lecId = $this->getRequestParameter('laId');
- $qmsId = $this->getRequestParameter('qmsId');
- $otherId = $this->getRequestParameter('otherId');
- $empId = $this->getRequestParameter('empCommId');
- $devId = $this->getRequestParameter('devId');
- } else {
- $peId = $_SESSION['autoSave'];
- $Accomcriteria = new Criteria();
- $Accomcriteria->add(AccomplishmentsPeer::PEID, $peId);
- $Accomcriteria->addSelectColumn(AccomplishmentsPeer::ACCOMID);
- $resultSet = AccomplishmentsPeer::doSelect($Accomcriteria);
- $accomId = $resultSet[0]->getAccomId();
- $Respcriteria = new Criteria();
- $Respcriteria->add(ResponsibilitiesPeer::PEID, $peId);
- $Respcriteria->addSelectColumn(ResponsibilitiesPeer::RESPID);
- $resultSet = ResponsibilitiesPeer::doSelect($Respcriteria);
- $respId = $resultSet[0]->getRespId();
- $Qltycriteria = new Criteria();
- $Qltycriteria->add(QualityQuantityPeer::PEID, $peId);
- $Qltycriteria->addSelectColumn(QualityQuantityPeer::QQID);
- $resultSet = QualityQuantityPeer::doSelect($Qltycriteria);
- $qqId = $resultSet[0]->getQqId();
- $Commcriteria = new Criteria();
- $Commcriteria->add(CommunicationPeer::PEID, $peId);
- $Commcriteria->addSelectColumn(CommunicationPeer::COMMID);
- $resultSet = CommunicationPeer::doSelect($Commcriteria);
- $commId = $resultSet[0]->getCommId();
- $Jobcriteria = new Criteria();
- $Jobcriteria->add(JobKnowledgePeer::PEID, $peId);
- $Jobcriteria->addSelectColumn(JobKnowledgePeer::JOBID);
- $resultSet = JobKnowledgePeer::doSelect($Jobcriteria);
- $jobId = $resultSet[0]->getJobId();
- $Mngcriteria = new Criteria();
- $Mngcriteria->add(ManagementSkillsPeer::PEID, $peId);
- $Mngcriteria->addSelectColumn(ManagementSkillsPeer::SKILLID);
- $resultSet = ManagementSkillsPeer::doSelect($Mngcriteria);
- $mngId = $resultSet[0]->getSkillId();
- $Socialcriteria = new Criteria();
- $Socialcriteria->add(SocialEffectivenessPeer::PEID, $peId);
- $Socialcriteria->addSelectColumn(SocialEffectivenessPeer::SOCIALID);
- $resultSet = SocialEffectivenessPeer::doSelect($Socialcriteria);
- $socialId = $resultSet[0]->getSocialId();
- $Satcriteria = new Criteria();
- $Satcriteria->add(SatisfactionPeer::PEID, $peId);
- $Satcriteria->addSelectColumn(SatisfactionPeer::ID);
- $resultSet = SatisfactionPeer::doSelect($Satcriteria);
- $satId = $resultSet[0]->getId();
- $Levcriteria = new Criteria();
- $Levcriteria->add(LeaveAttendancePeer::PEID, $peId);
- $Levcriteria->addSelectColumn(LeaveAttendancePeer::LAID);
- $resultSet = LeaveAttendancePeer::doSelect($Levcriteria);
- $lecId = $resultSet[0]->getLaId();
- $Qmscriteria = new Criteria();
- $Qmscriteria->add(QmsPeer::PEID, $peId);
- $Qmscriteria->addSelectColumn(QmsPeer::ID);
- $resultSet = QmsPeer::doSelect($Qmscriteria);
- $qmsId = $resultSet[0]->getId();
- $Othercriteria = new Criteria();
- $Othercriteria->add(OtherActivityPeer::PEID, $peId);
- $Othercriteria->addSelectColumn(OtherActivityPeer::ACTIVITYID);
- $resultSet = OtherActivityPeer::doSelect($Othercriteria);
- $otherId = $resultSet[0]->getActivityId();
- $Empcriteria = new Criteria();
- $Empcriteria->add(EmpCommentsPeer::PEID, $peId);
- $Empcriteria->addSelectColumn(EmpCommentsPeer::ID);
- $resultSet = EmpCommentsPeer::doSelect($Empcriteria);
- $empId = $resultSet[0]->getId();
- $Devcriteria = new Criteria();
- $Devcriteria->add(DevelopmentPlanPeer::PEID, $peId);
- $Devcriteria->addSelectColumn(DevelopmentPlanPeer::DEVID);
- $resultSet = DevelopmentPlanPeer::doSelect($Devcriteria);
- $devId = $resultSet[0]->getDevId();
- }
- $this->updateEmployee($peId, $peStatus);
- $this->updateAccomplishments($accomId);
- $this->updateResponsibilities($respId);
- $this->updateCommunication($commId);
- $this->updateQualityQuantity($qqId);
- $this->updateJobKnowledge($jobId);
- $this->updateManagementSkills($mngId);
- $this->updateSocialEffectiveness($socialId);
- $this->updateSatisfaction($satId);
- $this->updateLeaveAttendance($lecId);
- $this->updateQms($qmsId);
- $this->updateOtherActivity($otherId);
- $this->updateEmpComments($empId);
- $this->updateDevelopmentPlan($devId);
- } else {
- $peform = $this->getRequestParameter('perform');
- $empid = $this->getRequestParameter('empId');
- $peId = $this->setEmployee($peStatus, $peform, $empid);
- $this->setAccomplishments($peId);
- $this->setResponsibilities($peId);
- $this->setCommunication($peId);
- $this->setQualityQuantity($peId);
- $this->setJobKnowledge($peId);
- $this->setManagementSkills($peId);
- $this->setManagementSkills($peId);
- $this->setSocialEffectiveness($peId);
- $this->setSatisfaction($peId);
- $this->setLeaveAttendance($peId);
- $this->setQms($peId);
- $this->setOtherActivity($peId);
- $this->setEmpComments($peId);
- $this->setDevelopmentPlan($peId);
- $_SESSION['autoSave'] = $peId;
- }
- $this->msg = 'Autosaving the PE form ';
- }
- }
- public function executeAccessLogsResult(sfWebRequest $request) {
- if ($_SESSION['empRole'] == 'hr' || $_SESSION['empRole'] == 'core') {
- if ($this->getRequestParameter('page')) {
- if (isset($_SESSION['accessLogUsername']))
- $username = $_SESSION['accessLogUsername'];
- if (isset($_SESSION['accessLogIp']))
- $ip = $_SESSION['accessLogIp'];
- }
- else {
- $_SESSION['accessLogUsername'] = '';
- $_SESSION['accessLogIp'] = '';
- }
- $c = new Criteria();
- $c->addAscendingOrderByColumn(PeAccessLogsPeer::USERNAME);
- $peAccess = PeAccessLogsPeer::doSelect($c);
- foreach ($peAccess as $results) {
- $accessArray[] = $results->getUsername();
- }
- $accessArr = array_unique($accessArray);
- $this->accessArr = $accessArr;
- if ($this->getRequestParameter('username')) {
- $usernameId = $this->getRequestParameter('username');
- $username = $accessArr[$usernameId];
- $_SESSION['accessLogUsername'] = $username;
- }
- if ($this->getRequestParameter('ip')) {
- $ip = $this->getRequestParameter('ip');
- $_SESSION['accessLogIp'] = $ip;
- }
- $this->getAccessLogs($ip, $username);
- } else {
- $this->redirect('login/index');
- }
- }
- function getAccessLogs($ip=null, $username=null) {
- $i = 0;
- $c = new Criteria();
- $c->addAscendingOrderByColumn(PeAccessLogsPeer::USERNAME);
- $peAccess = PeAccessLogsPeer::doSelect($c);
- foreach ($peAccess as $results) {
- $accessArray[] = $results->getUsername();
- }
- $accessArr = array_unique($accessArray);
- $this->accessArr = $accessArr;
- $criteria = new Criteria();
- $criteria->addDescendingOrderByColumn(PeAccessLogsPeer::LASTLOGIN);
- if ($username != null && $ip != null) {
- $criteria->add(PeAccessLogsPeer::IP, $ip);
- $criteria->add(PeAccessLogsPeer::USERNAME, $username);
- } else if ($username == null && $ip != null) {
- $criteria->add(PeAccessLogsPeer::IP, $ip);
- } else if ($ip == null && $username != null) {
- $criteria->add(PeAccessLogsPeer::USERNAME, $username);
- }
- $pager = new sfPropelPager('PeAccessLogs', PAGE);
- $pager->setCriteria($criteria);
- $pager->setPage($this->getRequestParameter('page', 1));
- $pager->init();
- $this->pager = $pager;
- }
- function setAccomplishments($peId) {
- $accomplishment = new Accomplishments();
- $accomplishment->setPeId($peId);
- $accomplishment->setAccomOne($this->getRequestParameter('accom1'));
- $accomplishment->setAccomTwo($this->getRequestParameter('accom2'));
- $accomplishment->setAccomThree($this->getRequestParameter('accom3'));
- $accomplishment->setAccomOneMark($this->getRequestParameter('accom_mark1'));
- $accomplishment->setAccomTwoMark($this->getRequestParameter('accom_mark2'));
- $accomplishment->setAccomThreeMark($this->getRequestParameter('accom_mark3'));
- $accomplishment->setAccomComments($this->getRequestParameter('accom_comment'));
- $accomplishment->setAccomMark($this->getRequestParameter('accom_total'));
- $accomplishment->save();
- }
- function setResponsibilities($peId) {
- $responsibility = new Responsibilities();
- $responsibility->setPeId($peId);
- $responsibility->setRespOne($this->getRequestParameter('resp1'));
- $responsibility->setRespTwo($this->getRequestParameter('resp2'));
- $responsibility->setRespThree($this->getRequestParameter('resp3'));
- $responsibility->setRespOneMark($this->getRequestParameter('resp_mark1'));
- $responsibility->setRespTwoMark($this->getRequestParameter('resp_mark2'));
- $responsibility->setRespThreeMark($this->getRequestParameter('resp_mark3'));
- $responsibility->setRespComments($this->getRequestParameter('resp_comment'));
- $responsibility->setRespMark($this->getRequestParameter('resp_total'));
- $responsibility->save();
- }
- function setQualityQuantity($peId) {
- $quality_quantity = new QualityQuantity();
- $quality_quantity->setPeId($peId);
- $quality_quantity->setIfQC($this->getRequestParameter('qc'));
- $quality_quantity->setAvgQC($this->getRequestParameter('avg_qc'));
- $quality_quantity->setAvgLastQC($this->getRequestParameter('avg_last_qc'));
- $quality_quantity->setQualityMark($this->getRequestParameter('quality_mark'));
- $quality_quantity->setQualityRating($this->getRequestParameter('quality_rating'));
- $quality_quantity->setQualityGoals($this->getRequestParameter('quality_goal'));
- $quality_quantity->setIfNC($this->getRequestParameter('if_nc'));
- $quality_quantity->setNC($this->getRequestParameter('nc'));
- $quality_quantity->setTicketPerShift($this->getRequestParameter('tkt_shift'));
- $quality_quantity->setQuantityMark($this->getRequestParameter('quantity_mark'));
- $quality_quantity->setQuantityRating($this->getRequestParameter('quantity_rating'));
- $quality_quantity->setQuantityGoals($this->getRequestParameter('quantity_goal'));
- $quality_quantity->setQqMark($this->getRequestParameter('quantity_mark') + $this->getRequestParameter('quality_mark'));
- $quality_quantity->save();
- }
- function setCommunication($peId) {
- $communication = new Communication();
- $communication->setPeId($peId);
- $communication->setWritten($this->getRequestParameter('written'));
- $communication->setSpoken($this->getRequestParameter('spoken'));
- $communication->setWithAdmin($this->getRequestParameter('with_admin'));
- $communication->setWithClients($this->getRequestParameter('with_clients'));
- $communication->setWrittenMark($this->getRequestParameter('comm_mark1'));
- $communication->setSpokenMark($this->getRequestParameter('comm_mark2'));
- $communication->setWithAdminMark($this->getRequestParameter('comm_mark3'));
- $communication->setWithClientsMark($this->getRequestParameter('comm_mark4'));
- $communication->setWrittenExpect($this->getRequestParameter('written_expect'));
- $communication->setSpokenExpect($this->getRequestParameter('spoken_expect'));
- $communication->setWithAdminExpect($this->getRequestParameter('with_admin_expect'));
- $communication->setWithClientsExpect($this->getRequestParameter('with_clients_expect'));
- $communication->setCommMark($this->getRequestParameter('comm_total'));
- $communication->setCommGoals($this->getRequestParameter('comm_goal'));
- $communication->save();
- }
- function setJobKnowledge($peId) {
- $job = new JobKnowledge();
- $job->setPeId($peId);
- $job->setTechOne($this->getRequestParameter('tech1'));
- $job->setTechTwo($this->getRequestParameter('tech2'));
- $job->setTechThree($this->getRequestParameter('tech3'));
- $job->setTechFour($this->getRequestParameter('tech4'));
- $job->setTechFive($this->getRequestParameter('tech5'));
- $job->setTechSix($this->getRequestParameter('tech6'));
- $job->setTechSeven($this->getRequestParameter('tech7'));
- $job->setTechEight($this->getRequestParameter('tech8'));
- $job->setTechOneMark($this->getRequestParameter('tech_mark1'));
- $job->setTechTwoMark($this->getRequestParameter('tech_mark2'));
- $job->setTechThreeMark($this->getRequestParameter('tech_mark3'));
- $job->setTechFourMark($this->getRequestParameter('tech_mark4'));
- $job->setTechFiveMark($this->getRequestParameter('tech_mark5'));
- $job->setTechSixMark($this->getRequestParameter('tech_mark6'));
- $job->setTechSevenMark($this->getRequestParameter('tech_mark7'));
- $job->setTechEightMark($this->getRequestParameter('tech_mark8'));
- $job->setTechOneExpect($this->getRequestParameter('tech1_expect'));
- $job->setTechTwoExpect($this->getRequestParameter('tech2_expect'));
- $job->setTechThreeExpect($this->getRequestParameter('tech3_expect'));
- $job->setTechFourExpect($this->getRequestParameter('tech4_expect'));
- $job->setTechFiveExpect($this->getRequestParameter('tech5_expect'));
- $job->setTechSixExpect($this->getRequestParameter('tech6_expect'));
- $job->setTechSevenExpect($this->getRequestParameter('tech7_expect'));
- $job->setTechEightExpect($this->getRequestParameter('tech8_expect'));
- $job->setJobMark($this->getRequestParameter('tech_total'));
- $job->setJobComments($this->getRequestParameter('tech_comment'));
- $job->setJobGoals($this->getRequestParameter('tech_goal'));
- $job->save();
- }
- function setManagementSkills($peId) {
- $management = new ManagementSkills();
- $management->setPeId($peId);
- $management->setLeadership($this->getRequestParameter('leadership'));
- $management->setDelegation($this->getRequestParameter('delegation'));
- $management->setJudgement($this->getRequestParameter('decision'));
- $management->setAdministration($this->getRequestParameter('administration'));
- $management->setPerformance($this->getRequestParameter('performance'));
- $management->setpersonal($this->getRequestParameter('personal'));
- $management->setLeadershipMark($this->getRequestParameter('skill_mark1'));
- $management->setDelegationMark($this->getRequestParameter('skill_mark2'));
- $management->setJudgementMark($this->getRequestParameter('skill_mark3'));
- $management->setAdministrationMark($this->getRequestParameter('skill_mark4'));
- $management->setPerformanceMark($this->getRequestParameter('skill_mark6'));
- $management->setpersonalMark($this->getRequestParameter('skill_mark5'));
- $management->setLeadershipExpect($this->getRequestParameter('leadership_expect'));
- $management->setDelegationExpect($this->getRequestParameter('delegation_expect'));
- $management->setJudgementExpect($this->getRequestParameter('decision_expect'));
- $management->setAdministrationExpect($this->getRequestParameter('administration_expect'));
- $management->setPerformanceExpect($this->getRequestParameter('performance_expect'));
- $management->setpersonalExpect($this->getRequestParameter('personal_expect'));
- $management->setSkillMark($this->getRequestParameter('skill_total'));
- $management->save();
- }
- function setSocialEffectiveness($peId) {
- $social = new SocialEffectiveness();
- $social->setPeId($peId);
- $social->setDependable($this->getRequestParameter('dependability'));
- $social->setCreative($this->getRequestParameter('creativity'));
- $social->setOrganize($this->getRequestParameter('organize'));
- $social->setWithOthers($this->getRequestParameter('with_others'));
- $social->setAdaptable($this->getRequestParameter('adaptable'));
- $social->setSkillImprove($this->getRequestParameter('improve'));
- $social->setDependableMark($this->getRequestParameter('social_mark1'));
- $social->setCreativeMark($this->getRequestParameter('social_mark2'));
- $social->setOrganizeMark($this->getRequestParameter('social_mark3'));
- $social->setWithOthersMark($this->getRequestParameter('social_mark4'));
- $social->setAdaptableMark($this->getRequestParameter('social_mark5'));
- $social->setSkillImproveMark($this->getRequestParameter('social_mark6'));
- $social->setDependableExpect($this->getRequestParameter('dependability_expect'));
- $social->setCreativeExpect($this->getRequestParameter('creativity_expect'));
- $social->setOrganizeExpect($this->getRequestParameter('organize_expect'));
- $social->setWithOthersExpect($this->getRequestParameter('with_others_expect'));
- $social->setAdaptableExpect($this->getRequestParameter('adaptable_expect'));
- $social->setSkillImproveExpect($this->getRequestParameter('improve_expect'));
- $social->setSocialMark($this->getRequestParameter('social_total'));
- $social->setTeamMeetingMark($this->getRequestParameter('social_mark7'));
- $social->setTimelyCompletionMark($this->getRequestParameter('social_mark8'));
- $social->setSocialComments($this->getRequestParameter('social_comments'));
- $social->save();
- }
- function setSatisfaction($peId) {
- $satisfaction = new Satisfaction();
- $satisfaction->setPeId($peId);
- $satisfaction->setComments($this->getRequestParameter('customer_comments'));
- $satisfaction->setGoals($this->getRequestParameter('customer_goals'));
- $satisfaction->setTotalMark($this->getRequestParameter('cus_total'));
- $satisfaction->save();
- }
- function setLeaveAttendance($peId) {
- $leave_attendance = new LeaveAttendance();
- $leave_attendance->setPeId($peId);
- $leave_attendance->setAttendanceMark($this->getRequestParameter('attendance_total'));
- $leave_attendance->setLeaveSelfMark($this->getRequestParameter('leave_mark1'));
- $leave_attendance->setLeaveTeamMark($this->getRequestParameter('leave_mark2'));
- $leave_attendance->setLeaveMark($this->getRequestParameter('leave_total'));
- $leave_attendance->setAttendanceComments($this->getRequestParameter('attendance_comment'));
- $leave_attendance->setLeaveComments($this->getRequestParameter('leave_comment'));
- $leave_attendance->save();
- }
- function setQms($peId) {
- $qms = new Qms();
- $qms->setPeId($peId);
- $qms->setItfMember($this->getRequestParameter('itf'));
- $qms->setIntenalAuditor($this->getRequestParameter('internal'));
- $qms->setIsoAwareness($this->getRequestParameter('iso'));
- $qms->setTotalMark($this->getRequestParameter('qms_total'));
- $qms->setComments($this->getRequestParameter('qms_comment'));
- $qms->setItfmark($this->getRequestParameter('qms_mark1'));
- $qms->setInternalauditormark($this->getRequestParameter('qms_mark2'));
- $qms->setIsoawarenessmark($this->getRequestParameter('qms_mark3'));
- $qms->save();
- }
- function setOtherActivity($peId) {
- $other = new OtherActivity();
- $other->setPeId($peId);
- $other->setGroupOne($this->getRequestParameter('group1'));
- $other->setGroupTwo($this->getRequestParameter('group2'));
- $other->setGroupThree($this->getRequestParameter('group3'));
- $other->setGroupOneMark($this->getRequestParameter('group_mark1'));
- $other->setGroupTwoMark($this->getRequestParameter('group_mark2'));
- $other->setGroupThreeMark($this->getRequestParameter('group_mark3'));
- $other->setGroupMark($this->getRequestParameter('group_total'));
- $other->setSeminarMark($this->getRequestParameter('indvl_mark1'));
- $other->setKbEntryMark($this->getRequestParameter('indvl_mark2'));
- $other->setWorkshopMark($this->getRequestParameter('indvl_mark3'));
- $other->setActivityComments($this->getRequestParameter('other_comment'));
- $other->setIndvidualMark($this->getRequestParameter('indvl_total'));
- $other->save();
- }
- function setEmpComments($peId) {
- $negative = new EmpComments();
- $negative->setPeId($peId);
- $negative->setNegComments($this->getRequestParameter('negative_comment'));
- $negative->setNegMark($this->getRequestParameter('negative_mark'));
- $negative->setEmpComments($this->getRequestParameter('emp_comment'));
- $negative->save();
- }
- function setDevelopmentPlan($peId) {
- $development = new DevelopmentPlan();
- $development->setPeId($peId);
- $development->setBookOne($this->getRequestParameter('dev_book1'));
- $development->setBookTwo($this->getRequestParameter('dev_book2'));
- $development->setBookThree($this->getRequestParameter('dev_book3'));
- $development->setBookFour($this->getRequestParameter('dev_book4'));
- $development->setBookFive($this->getRequestParameter('dev_book5'));
- $development->setSeminarOne($this->getRequestParameter('dev_seminar1'));
- $development->setSeminarTwo($this->getRequestParameter('dev_seminar2'));
- $development->setSeminarThree($this->getRequestParameter('dev_seminar3'));
- $development->setSeminarFour($this->getRequestParameter('dev_seminar4'));
- $development->setSeminarFive($this->getRequestParameter('dev_seminar5'));
- $development->setArticleOne($this->getRequestParameter('dev_write1'));
- $development->setArticleTwo($this->getRequestParameter('dev_write2'));
- $development->setArticleThree($this->getRequestParameter('dev_write3'));
- $development->setArticleFour($this->getRequestParameter('dev_write4'));
- $development->setArticleFive($this->getRequestParameter('dev_write5'));
- $development->setWorkshopOne($this->getRequestParameter('dev_workshop1'));
- $development->setWorkshopTwo($this->getRequestParameter('dev_workshop2'));
- $development->setWorkshopThree($this->getRequestParameter('dev_workshop3'));
- $development->setWorkshopFour($this->getRequestParameter('dev_workshop4'));
- $development->setWorkshopFive($this->getRequestParameter('dev_workshop5'));
- $development->setDevelopComments($this->getRequestParameter('develop_comment'));
- $development->save();
- }
- //Server-side Validation for All forms.......
- function validation() {
- $arguments = array('quality_rating',
- 'quantity_rating',
- 'quality_goal',
- 'quantity_goal',
- 'tech_comment',
- 'tech_goal',
- 'customer_comments',
- 'customer_goals',
- 'attendance_comment',
- 'leave_comment',
- 'qms_comment',
- 'other_comment',
- 'negative_comment',
- 'comm_goal',
- // 'emp_comment'
- );
- foreach ($arguments as $argument) {
- if (trim($this->getRequestParameter($argument)) == '')
- return false;
- }
- return true;
- }
- //Server-side Validation for mark field
- function validateMark() {
- $resp_total = 0;
- $comm_total = 0;
- $tech_total = 0;
- $social_total = 0;
- $qms_total = 0;
- $group_total = 0;
- $indvl_total = 0;
- $skill_total = 0;
- $leave_total = 0;
- $accom_total = 0;
- for ($i = 1; $i <= 3; $i++) {
- if ($this->getRequestParameter('accom_mark' . $i) > ACCOM_MAX_MARK) {
- $_SESSION['error_msg'] = 'Accomplishment mark is greater than the maximum mark';
- return false;
- }
- $accom_mark[] = $this->getRequestParameter('accom_mark' . $i);
- }
- sort($accom_mark);
- $accom_total = $accom_mark[2] + $accom_mark[3];
- if ($this->getRequestParameter('accom_total') != $accom_total) {
- $_SESSION['error_msg'] = 'Accomplishment total mark is incorrect';
- return false;
- }
- for ($i = 1; $i <= 3; $i++) {
- if ($this->getRequestParameter('resp_mark' . $i) > RESP_MAX_MARK) {
- $_SESSION['error_msg'] = 'Responsibility mark is greater than the maximum mark';
- return false;
- }
- $resp_total += $this->getRequestParameter('resp_mark' . $i);
- }
- if ($this->getRequestParameter('resp_total') != $resp_total) {
- $_SESSION['error_msg'] = 'Responsibility total mark is incorrect';
- return false;
- }
- if ($this->getRequestParameter('quality_mark') > QUALITY_QUANTITY_TOTAL || $this->getRequestParameter('quantity_mark') > QUALITY_QUANTITY_TOTAL) {
- $_SESSION['error_msg'] = 'Quality/Quantity mark is incorrect';
- return false;
- }
- for ($i = 1; $i <= 4; $i++) {
- if ($this->getRequestParameter('comm_mark' . $i) > COMM_MAX_MARK) {
- $_SESSION['error_msg'] = 'Communication mark is greater than the maximum mark';
- return false;
- }
- $comm_total += $this->getRequestParameter('comm_mark' . $i);
- }
- if ($this->getRequestParameter('comm_total') != $comm_total) {
- $_SESSION['error_msg'] = 'Communication total mark is incorrect';
- return false;
- }
- //$ tech_marks = array('tech_mark1' ,
- for ($i = 1; $i <= 8; $i++) {
- if ($this->getRequestParameter('tech_mark' . $i) > JOB_MAX_MARK) {
- $_SESSION['error_msg'] = 'Job knowledge mark is greater the the maximum mark';
- return false;
- }
- $tech_total += $this->getRequestParameter('tech_mark' . $i);
- }
- if ($this->getRequestParameter('tech_total') != $tech_total) {
- $_SESSION['error_msg'] = 'Job knowlwdge total mark is incorrect';
- return false;
- }
- for ($i = 1; $i <= 8; $i++) {
- if ($this->getRequestParameter('social_mark' . $i) > SOCIAL_MAX_MARK) {
- $_SESSION['error_msg'] = 'Social effectiveness mark is greater than the maximum mark';
- return false;
- }
- $social_total += $this->getRequestParameter('social_mark' . $i);
- }
- if ($this->getRequestParameter('social_total') != $social_total) {
- $_SESSION['error_msg'] = 'Social effectiveness total mark is incorrect';
- return false;
- }
- if ($this->getRequestParameter('cus_total') > CUS_TOTAL) {
- $_SESSION['error_msg'] = 'Customer delight mark is incorrect';
- return false;
- }
- if ($this->getRequestParameter('attendance_total') > ATTENDANCE_TOTAL) {
- $_SESSION['error_msg'] = 'Attendance mark is incorrect';
- return false;
- }
- for ($i = 1; $i <= 3; $i++) {
- if ($this->getRequestParameter('qms_mark' . $i) > QMS_MAX_MARK) {
- $_SESSION['error_msg'] = 'QMS mark is greater than the maximum mark';
- return false;
- }
- $qms_total += $this->getRequestParameter('qms_mark' . $i);
- }
- if ($this->getRequestParameter('qms_total') != $qms_total) {
- $_SESSION['error_msg'] = 'QMS total mark is incorrect';
- return false;
- }
- for ($i = 1; $i <= 3; $i++) {
- if ($this->getRequestParameter('group_mark' . $i) > GROUP_MAX_MARK) {
- $_SESSION['error_msg'] = 'Other activities mark is incorrect';
- return false;
- }
- $group_total += $this->getRequestParameter('group_mark' . $i);
- }
- if ($this->getRequestParameter('group_total') != $group_total) {
- $_SESSION['error_msg'] = 'Other activities mark is incorrect';
- return false;
- }
- for ($i = 2; $i <= 3; $i++) {
- if ($this->getRequestParameter('indvl_mark' . $i) > IND_MAX_MARK) {
- $_SESSION['error_msg'] = 'Other activities mark is incorrect';
- return false;
- }
- $indvl_total += $this->getRequestParameter('indvl_mark' . $i);
- }
- if ($this->getRequestParameter('indvl_mark1') > IND_SEMINAR_MARK) {
- $_SESSION['error_msg'] = 'Other activities mark is incorrect';
- return false;
- }
- $indvl_total += $this->getRequestParameter('indvl_mark1');
- if ($this->getRequestParameter('indvl_total') != $indvl_total) {
- $_SESSION['error_msg'] = 'Other activities mark is incorrect';
- return false;
- }
- if ($this->getRequestParameter('skill_total')) {
- for ($i = 1; $i <= 6; $i++) {
- if ($this->getRequestParameter('skill_mark' . $i) > SKILL_MAX_MARK) {
- $_SESSION['error_msg'] = 'Management skill mark is incorrect';
- return false;
- }
- $skill_total += $this->getRequestParameter('skill_mark' . $i);
- }
- if ($this->getRequestParameter('skill_total') != $skill_total) {
- $_SESSION['error_msg'] = 'Management skill mark is incorrect';
- return false;
- }
- }
- if ($this->getRequestParameter('leave_mark1') || $this->getRequestParameter('leave_mark2')) {
- if ($this->getRequestParameter('leave_mark1') > LEAVE_MAX_MARK || $this->getRequestParameter('leave_mark2') > LEAVE_MAX_MARK) {
- $_SESSION['error_msg'] = 'Leave management mark is incorrect';
- }
- $leave_total = $this->getRequestParameter('leave_mark1') + $this->getRequestParameter('leave_mark2');
- } else {
- $leave_total = LEAVE_MAX_MARK;
- }
- if ($this->getRequestParameter('leave_total') > $leave_total) {
- $_SESSION['error_msg'] = 'Leave management mark is incorrect';
- return false;
- }
- $grant_total = $this->getRequestParameter('resp_total') + $this->getRequestParameter('quality_mark') + $this->getRequestParameter('quantity_mark') + $this->getRequestParameter('comm_total') +
- $this->getRequestParameter('tech_total') + $this->getRequestParameter('social_total') +
- $this->getRequestParameter('cus_total') + $this->getRequestParameter('attendance_total') + $this->getRequestParameter('qms_total') + $this->getRequestParameter('group_total') +
- $this->getRequestParameter('indvl_total') + $this->getRequestParameter('skill_total') + $this->getRequestParameter('leave_total');
- $negative_mark = $this->getRequestParameter('negative_mark');
- if ($negative_mark < 0) {
- $_SESSION['error_msg'] = 'Negative mark is incorrect';
- }
- $grant_total -= $negative_mark;
- if ($this->getRequestParameter('grant_total') != $grant_total) {
- return false;
- }
- return true;
- }
- //********* Function to GET the PREPEFORM FOR AN EMPLOYEE*****************//
- function getPreForm($empId = null, $peId = null, $peform=null) {
- if ($peId) {
- $peEmployeeinstance = new PeEmployeesPeer();
- $empId = $peEmployeeinstance->getEmpId($peId);
- } else {
- //Checking whether PE Form is already Submitted Thai Year..
- $peId = $this->isSubmittedThisYear($peform, $empId);
- if ($peId) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- $peStatusId = $result[0]->getStatusId();
- if ($peStatusId == 3)
- $this->redirect('main/PeForm?edit=' . $peId . '&status=adminsave');
- else
- $this->redirect('main/PeForm?edit=' . $peId);
- }
- }
- $employeeDetails['empId'] = $empId;
- $groupwareEmployeeInstance = new GroupwareEmployeesPeer();
- $employeeAccounts = $groupwareEmployeeInstance->getEmployeeAccounts($empId);
- foreach ($employeeAccounts as $employee) {
- $employeeDetails['empName'] = $employee->getName();
- $employeeDetails['empJobTitle'] = $employee->getTitle();
- }
- $employeeDetails['empSupervisor'] = $groupwareEmployeeInstance->getEmployeeAdmin($empId);
- $employeeDetails['empTeam'] = $groupwareEmployeeInstance->getEmployeeTeam($empId);
- $employeeDetails['empExp'] = $groupwareEmployeeInstance->getEmployeeExperience($empId);
- $this->employeeDetails = $employeeDetails;
- }
- //************* functions to GET PEFORM values of an EMPLOYEE**********************
- function getPeDetails($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $resultSet = PeEmployeesPeer::doSelectStmt($criteria);
- $peDetailsTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 17; $i++) {
- $peDetails[$i + 1] = $peDetailsTemp[$i];
- }
- // $_SESSION['pestatusId'] = $peDetails[6]; // To use in executeView for More button View Self/original Pe from
- /* TO get employee Supervisor value from */
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $this->immediateSupervisorId = $peDetails[14];
- $this->immediateSupervisor = $groupwareEmployee->getEmployeeName($peDetails[14]);
- $this->nextSupervisorId = $peDetails[15];
- $this->nextSupervisor = $groupwareEmployee->getEmployeeName($peDetails[15]);
- $this->takenById = $peDetails[16];
- $this->takenBy = $groupwareEmployee->getEmployeeName($peDetails[16]);
- $this->peDetails = $peDetails;
- if ($key != null)
- return $peDetails[8];
- }
- function getAccomplishments($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(AccomplishmentsPeer::PEID, $peId);
- $resultSet = AccomplishmentsPeer::doSelectStmt($criteria);
- $accomplishmentsTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 9; $i++) {
- $accomplishments[$i + 1] = $accomplishmentsTemp[$i];
- }
- $this->accomplishment = $accomplishments;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $accomplishments;
- }
- function getResponsibility($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(ResponsibilitiesPeer::PEID, $peId);
- $resultSet = ResponsibilitiesPeer::doSelectStmt($criteria);
- $responsibilitiesTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 9; $i++) {
- $responsibilities[$i + 1] = $responsibilitiesTemp[$i];
- }
- $this->responsibilities = $responsibilities;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $responsibilities;
- }
- function getQualityQuantity($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(QualityQuantityPeer::PEID, $peId);
- $resultSet = QualityQuantityPeer::doSelectStmt($criteria);
- $qualityQuantityTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 14; $i++) {
- $qualityQuantity[$i + 1] = $qualityQuantityTemp[$i];
- }
- $this->qualityQuantity = $qualityQuantity;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $qualityQuantity;
- }
- function getCommunication($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(CommunicationPeer::PEID, $peId);
- $resultSet = CommunicationPeer::doSelectStmt($criteria);
- $communicationTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 15; $i++) {
- $communication[$i + 1] = $communicationTemp[$i];
- }
- $this->communication = $communication;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $communication;
- }
- function getJobKnowledge($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(JobKnowledgePeer::PEID, $peId);
- $resultSet = JobKnowledgePeer::doSelectStmt($criteria);
- $jobsTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 30; $i++) {
- $jobs[$i + 1] = $jobsTemp[$i];
- }
- $this->job = $jobs;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $jobs;
- }
- function getManagementSkills($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(ManagementSkillsPeer::PEID, $peId);
- $resultSet = ManagementSkillsPeer::doSelectStmt($criteria);
- $managementTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 20; $i++) {
- $management[$i + 1] = $managementTemp[$i];
- }
- $this->management = $management;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $management;
- }
- function getSocialEffectiveness($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(SocialEffectivenessPeer::PEID, $peId);
- $resultSet = SocialEffectivenessPeer::doSelectStmt($criteria);
- $socialTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 23; $i++) {
- $social[$i + 1] = $socialTemp[$i];
- }
- $this->social = $social;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $social;
- }
- function getSatisfaction($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(SatisfactionPeer::PEID, $peId);
- $resultSet = SatisfactionPeer::doSelectStmt($criteria);
- $satisfactionTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 4; $i++) {
- $satisfaction[$i + 1] = $satisfactionTemp[$i];
- }
- $this->satisfaction = $satisfaction;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $satisfaction;
- }
- function getLeaveAttendance($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(LeaveAttendancePeer::PEID, $peId);
- $resultSet = LeaveAttendancePeer::doSelectStmt($criteria);
- $leaveAttendanceTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 8; $i++) {
- $leaveAttendance[$i + 1] = $leaveAttendanceTemp[$i];
- }
- $this->leaveAttendance = $leaveAttendance;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $leaveAttendance;
- }
- function getQms($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(QmsPeer::PEID, $peId);
- $resultSet = QmsPeer::doSelectStmt($criteria);
- $qmsTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 9; $i++) {
- $qms[$i + 1] = $qmsTemp[$i];
- }
- $this->qms = $qms;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $qms;
- }
- function getOtherActivity($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(OtherActivityPeer::PEID, $peId);
- $resultSet = OtherActivityPeer::doSelectStmt($criteria);
- $otherTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 13; $i++) {
- $other[$i + 1] = $otherTemp[$i];
- }
- $this->others = $other;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $other;
- }
- function getEmpComments($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(EmpCommentsPeer::PEID, $peId);
- $resultSet = EmpCommentsPeer::doSelectStmt($criteria);
- $empCommentsTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 4; $i++) {
- $empComments[$i + 1] = $empCommentsTemp[$i];
- }
- $this->empComments = $empComments;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $empComments;
- }
- function getDevelopmentPlan($peId, $key=null) {
- $criteria = new Criteria();
- $criteria->add(DevelopmentPlanPeer::PEID, $peId);
- $resultSet = DevelopmentPlanPeer::doSelectStmt($criteria);
- $developmentTemp = $resultSet->fetch(PDO::FETCH_NUM);
- for ($i = 0; $i <= 22; $i++) {
- $development[$i + 1] = $developmentTemp[$i];
- }
- $this->development = $development;
- //added by renjo to check if PE form is monthly
- if ($key != null)
- return $development;
- }
- // Update functions.............
- function updateEmployee($peId, $peStatus) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $this->getRequestParameter('issue_date'));
- $criteria->add(PeEmployeesPeer::REVIEWDATE, $this->getRequestParameter('review_date'));
- $criteria->add(PeEmployeesPeer::NEXTREVIEWDATE, $this->getRequestParameter('next_date'));
- $criteria->add(PeEmployeesPeer::TOTALMARK, $this->getRequestParameter('grant_total'));
- $criteria->add(PeEmployeesPeer::STATUSID, $peStatus);
- $total = $this->getRequestParameter('grant_total');
- // to calculate Employee Percentage
- $emproletype = $this->getRequestParameter('roleType');
- if ($emproletype == 0)
- $percentage = ($total / ADMIN_TOTAL) * 100;
- elseif ($emproletype == 1)
- $percentage = ($total / QM_TOTAL) * 100;
- elseif ($emproletype == 2)
- $percentage = ($total / STAFF_TOTAL) * 100;
- $percentage = round($percentage, 2);
- $criteria->add(PeEmployeesPeer::PERCENTAGE, $percentage);
- PeEmployeesPeer::doUpdate($criteria);
- }
- function updateAccomplishments($accomId) {
- $criteria = new Criteria();
- $criteria->add(AccomplishmentsPeer::ACCOMID, $accomId);
- $criteria->add(AccomplishmentsPeer::ACCOMONE, $this->getRequestParameter('accom1'));
- $criteria->add(AccomplishmentsPeer::ACCOMTWO, $this->getRequestParameter('accom2'));
- $criteria->add(AccomplishmentsPeer::ACCOMTHREE, $this->getRequestParameter('accom3'));
- $criteria->add(AccomplishmentsPeer::ACCOMONEMARK, $this->getRequestParameter('accom_mark1'));
- $criteria->add(AccomplishmentsPeer::ACCOMTWOMARK, $this->getRequestParameter('accom_mark2'));
- $criteria->add(AccomplishmentsPeer::ACCOMTHREEMARK, $this->getRequestParameter('accom_mark3'));
- $criteria->add(AccomplishmentsPeer::ACCOMCOMMENTS, $this->getRequestParameter('accom_comment'));
- $criteria->add(AccomplishmentsPeer::ACCOMMARK, $this->getRequestParameter('accom_total'));
- AccomplishmentsPeer::DoUpdate($criteria);
- }
- function updateResponsibilities($respId) {
- $criteria = new Criteria();
- $criteria->add(ResponsibilitiesPeer::RESPID, $respId);
- $criteria->add(ResponsibilitiesPeer::RESPONE, $this->getRequestParameter('resp1'));
- $criteria->add(ResponsibilitiesPeer::RESPTWO, $this->getRequestParameter('resp2'));
- $criteria->add(ResponsibilitiesPeer::RESPTHREE, $this->getRequestParameter('resp3'));
- $criteria->add(ResponsibilitiesPeer::RESPONEMARK, $this->getRequestParameter('resp_mark1'));
- $criteria->add(ResponsibilitiesPeer::RESPTWOMARK, $this->getRequestParameter('resp_mark2'));
- $criteria->add(ResponsibilitiesPeer::RESPTHREEMARK, $this->getRequestParameter('resp_mark3'));
- $criteria->add(ResponsibilitiesPeer::RESPCOMMENTS, $this->getRequestParameter('resp_comment'));
- $criteria->add(ResponsibilitiesPeer::RESPMARK, $this->getRequestParameter('resp_total'));
- ResponsibilitiesPeer::DoUpdate($criteria);
- }
- function updateQualityQuantity($qqId) {
- $criteria = new Criteria();
- $criteria->add(QualityQuantityPeer::QQID, $qqId);
- $criteria->add(QualityQuantityPeer::IFQC, $this->getRequestParameter('qc'));
- $criteria->add(QualityQuantityPeer::AVGQC, $this->getRequestParameter('avg_qc'));
- $criteria->add(QualityQuantityPeer::AVGLASTQC, $this->getRequestParameter('avg_last_qc'));
- $criteria->add(QualityQuantityPeer::QUALITYMARK, $this->getRequestParameter('quality_mark'));
- $criteria->add(QualityQuantityPeer::QUALITYRATING, $this->getRequestParameter('quality_rating'));
- $criteria->add(QualityQuantityPeer::QUALITYGOALS, $this->getRequestParameter('quality_goal'));
- $criteria->add(QualityQuantityPeer::IFNC, $this->getRequestParameter('if_nc'));
- $criteria->add(QualityQuantityPeer::NC, $this->getRequestParameter('nc'));
- $criteria->add(QualityQuantityPeer::TICKETPERSHIFT, $this->getRequestParameter('tkt_shift'));
- $criteria->add(QualityQuantityPeer::QUANTITYMARK, $this->getRequestParameter('quantity_mark'));
- $criteria->add(QualityQuantityPeer::QUANTITYRATING, $this->getRequestParameter('quantity_rating'));
- $criteria->add(QualityQuantityPeer::QUANTITYGOALS, $this->getRequestParameter('quantity_goal'));
- $criteria->add(QualityQuantityPeer::QQMARK, $this->getRequestParameter('quantity_mark') + $this->getRequestParameter('quality_mark'));
- QualityQuantityPeer::doUpdate($criteria);
- }
- function UpdateCommunication($commId) {
- $criteria = new Criteria();
- $criteria->add(CommunicationPeer::COMMID, $commId);
- $criteria->add(CommunicationPeer::WRITTEN, $this->getRequestParameter('written'));
- $criteria->add(CommunicationPeer::SPOKEN, $this->getRequestParameter('spoken'));
- $criteria->add(CommunicationPeer::WITHADMIN, $this->getRequestParameter('with_admin'));
- $criteria->add(CommunicationPeer::WITHCLIENTS, $this->getRequestParameter('with_clients'));
- $criteria->add(CommunicationPeer::WRITTENMARK, $this->getRequestParameter('comm_mark1'));
- $criteria->add(CommunicationPeer::SPOKENMARK, $this->getRequestParameter('comm_mark2'));
- $criteria->add(CommunicationPeer::WITHADMINMARK, $this->getRequestParameter('comm_mark3'));
- $criteria->add(CommunicationPeer::WITHCLIENTSMARK, $this->getRequestParameter('comm_mark4'));
- $criteria->add(CommunicationPeer::WRITTENEXPECT, $this->getRequestParameter('written_expect'));
- $criteria->add(CommunicationPeer::SPOKENEXPECT, $this->getRequestParameter('spoken_expect'));
- $criteria->add(CommunicationPeer::WITHADMINEXPECT, $this->getRequestParameter('with_admin_expect'));
- $criteria->add(CommunicationPeer::WITHCLIENTSEXPECT, $this->getRequestParameter('with_clients_expect'));
- $criteria->add(CommunicationPeer::COMMMARK, $this->getRequestParameter('comm_total'));
- $criteria->add(CommunicationPeer::COMMGOALS, $this->getRequestParameter('comm_goal'));
- CommunicationPeer::doUpdate($criteria);
- }
- function updateJobKnowledge($jobId) {
- $criteria = new Criteria();
- $criteria->add(JobKnowledgePeer::JOBID, $jobId);
- $criteria->add(JobKnowledgePeer::TECHONE, $this->getRequestParameter('tech1'));
- $criteria->add(JobKnowledgePeer::TECHTWO, $this->getRequestParameter('tech2'));
- $criteria->add(JobKnowledgePeer::TECHTHREE, $this->getRequestParameter('tech3'));
- $criteria->add(JobKnowledgePeer::TECHFOUR, $this->getRequestParameter('tech4'));
- $criteria->add(JobKnowledgePeer::TECHFIVE, $this->getRequestParameter('tech5'));
- $criteria->add(JobKnowledgePeer::TECHSIX, $this->getRequestParameter('tech6'));
- $criteria->add(JobKnowledgePeer::TECHSEVEN, $this->getRequestParameter('tech7'));
- $criteria->add(JobKnowledgePeer::TECHEIGHT, $this->getRequestParameter('tech8'));
- $criteria->add(JobKnowledgePeer::TECHONEMARK, $this->getRequestParameter('tech_mark1'));
- $criteria->add(JobKnowledgePeer::TECHTWOMARK, $this->getRequestParameter('tech_mark2'));
- $criteria->add(JobKnowledgePeer::TECHTHREEMARK, $this->getRequestParameter('tech_mark3'));
- $criteria->add(JobKnowledgePeer::TECHFOURMARK, $this->getRequestParameter('tech_mark4'));
- $criteria->add(JobKnowledgePeer::TECHFIVEMARK, $this->getRequestParameter('tech_mark5'));
- $criteria->add(JobKnowledgePeer::TECHSIXMARK, $this->getRequestParameter('tech_mark6'));
- $criteria->add(JobKnowledgePeer::TECHSEVENMARK, $this->getRequestParameter('tech_mark7'));
- $criteria->add(JobKnowledgePeer::TECHEIGHTMARK, $this->getRequestParameter('tech_mark8'));
- $criteria->add(JobKnowledgePeer::TECHONEEXPECT, $this->getRequestParameter('tech1_expect'));
- $criteria->add(JobKnowledgePeer::TECHTWOEXPECT, $this->getRequestParameter('tech2_expect'));
- $criteria->add(JobKnowledgePeer::TECHTHREEEXPECT, $this->getRequestParameter('tech3_expect'));
- $criteria->add(JobKnowledgePeer::TECHFOUREXPECT, $this->getRequestParameter('tech4_expect'));
- $criteria->add(JobKnowledgePeer::TECHFIVEEXPECT, $this->getRequestParameter('tech5_expect'));
- $criteria->add(JobKnowledgePeer::TECHSIXEXPECT, $this->getRequestParameter('tech6_expect'));
- $criteria->add(JobKnowledgePeer::TECHSEVENEXPECT, $this->getRequestParameter('tech7_expect'));
- $criteria->add(JobKnowledgePeer::TECHEIGHTEXPECT, $this->getRequestParameter('tech8_expect'));
- $criteria->add(JobKnowledgePeer::JOBMARK, $this->getRequestParameter('tech_total'));
- $criteria->add(JobKnowledgePeer::JOBCOMMENTS, $this->getRequestParameter('tech_comment'));
- $criteria->add(JobKnowledgePeer::JOBGOALS, $this->getRequestParameter('tech_goal'));
- JobKnowledgePeer::doUpdate($criteria);
- }
- function updateManagementSkills($skillId) {
- $criteria = new Criteria();
- $criteria->add(ManagementSkillsPeer::SKILLID, $skillId);
- $criteria->add(ManagementSkillsPeer::LEADERSHIP, $this->getRequestParameter('leadership'));
- $criteria->add(ManagementSkillsPeer::DELEGATION, $this->getRequestParameter('delegation'));
- $criteria->add(ManagementSkillsPeer::JUDGEMENT, $this->getRequestParameter('decision'));
- $criteria->add(ManagementSkillsPeer::ADMINISTRATION, $this->getRequestParameter('administration'));
- $criteria->add(ManagementSkillsPeer::PERSONAL, $this->getRequestParameter('personal'));
- $criteria->add(ManagementSkillsPeer::PERFORMANCE, $this->getRequestParameter('performance'));
- $criteria->add(ManagementSkillsPeer::LEADERSHIPMARK, $this->getRequestParameter('skill_mark1'));
- $criteria->add(ManagementSkillsPeer::DELEGATIONMARK, $this->getRequestParameter('skill_mark2'));
- $criteria->add(ManagementSkillsPeer::JUDGEMENTMARK, $this->getRequestParameter('skill_mark3'));
- $criteria->add(ManagementSkillsPeer::ADMINISTRATIONMARK, $this->getRequestParameter('skill_mark4'));
- $criteria->add(ManagementSkillsPeer::PERSONALMARK, $this->getRequestParameter('skill_mark5'));
- $criteria->add(ManagementSkillsPeer::PERFORMANCEMARK, $this->getRequestParameter('skill_mark6'));
- $criteria->add(ManagementSkillsPeer::LEADERSHIPEXPECT, $this->getRequestParameter('leadership_expect'));
- $criteria->add(ManagementSkillsPeer::DELEGATIONEXPECT, $this->getRequestParameter('delegation_expect'));
- $criteria->add(ManagementSkillsPeer::JUDGEMENTEXPECT, $this->getRequestParameter('decision_expect'));
- $criteria->add(ManagementSkillsPeer::ADMINISTRATIONEXPECT, $this->getRequestParameter('administration_expect'));
- $criteria->add(ManagementSkillsPeer::PERSONALEXPECT, $this->getRequestParameter(''));
- $criteria->add(ManagementSkillsPeer::PERFORMANCEEXPECT, $this->getRequestParameter('performance_expect'));
- $criteria->add(ManagementSkillsPeer::PERSONALEXPECT, $this->getRequestParameter('personal_expect'));
- $criteria->add(ManagementSkillsPeer::SKILLMARK, $this->getRequestParameter('skill_total'));
- ManagementSkillsPeer::doUpdate($criteria);
- }
- function updateSocialEffectiveness($socialId) {
- $criteria = new Criteria();
- $criteria->add(SocialEffectivenessPeer::SOCIALID, $socialId);
- $criteria->add(SocialEffectivenessPeer::DEPENDABLE, $this->getRequestParameter('dependability'));
- $criteria->add(SocialEffectivenessPeer::CREATIVE, $this->getRequestParameter('creativity'));
- $criteria->add(SocialEffectivenessPeer::ORGANIZE, $this->getRequestParameter('organize'));
- $criteria->add(SocialEffectivenessPeer::WITHOTHERS, $this->getRequestParameter('with_others'));
- $criteria->add(SocialEffectivenessPeer::ADAPTABLE, $this->getRequestParameter('adaptable'));
- $criteria->add(SocialEffectivenessPeer::SKILLIMPROVE, $this->getRequestParameter('improve'));
- $criteria->add(SocialEffectivenessPeer::DEPENDABLEMARK, $this->getRequestParameter('social_mark1'));
- $criteria->add(SocialEffectivenessPeer::CREATIVEMARK, $this->getRequestParameter('social_mark2'));
- $criteria->add(SocialEffectivenessPeer::ORGANIZEMARK, $this->getRequestParameter('social_mark3'));
- $criteria->add(SocialEffectivenessPeer::WITHOTHERSMARK, $this->getRequestParameter('social_mark4'));
- $criteria->add(SocialEffectivenessPeer::ADAPTABLEMARK, $this->getRequestParameter('social_mark5'));
- $criteria->add(SocialEffectivenessPeer::SKILLIMPROVEMARK, $this->getRequestParameter('social_mark6'));
- $criteria->add(SocialEffectivenessPeer::DEPENDABLEEXPECT, $this->getRequestParameter('dependability_expect'));
- $criteria->add(SocialEffectivenessPeer::CREATIVEEXPECT, $this->getRequestParameter('creativity_expect'));
- $criteria->add(SocialEffectivenessPeer::ORGANIZEEXPECT, $this->getRequestParameter('organize_expect'));
- $criteria->add(SocialEffectivenessPeer::WITHOTHERSEXPECT, $this->getRequestParameter('with_others_expect'));
- $criteria->add(SocialEffectivenessPeer::ADAPTABLEEXPECT, $this->getRequestParameter('adaptable_expect'));
- $criteria->add(SocialEffectivenessPeer::SKILLIMPROVEEXPECT, $this->getRequestParameter('adaptable_expect'));
- $criteria->add(SocialEffectivenessPeer::SKILLIMPROVEEXPECT, $this->getRequestParameter('improve_expect'));
- $criteria->add(SocialEffectivenessPeer::TEAMMEETINGMARK, $this->getRequestParameter('social_mark7'));
- $criteria->add(SocialEffectivenessPeer::TIMELYCOMPLETIONMARK, $this->getRequestParameter('social_mark8'));
- $criteria->add(SocialEffectivenessPeer::SOCIALCOMMENTS, $this->getRequestParameter('social_comments'));
- $criteria->add(SocialEffectivenessPeer::SOCIALMARK, $this->getRequestParameter('social_total'));
- SocialEffectivenessPeer::doUpdate($criteria);
- }
- function updateSatisfaction($satisfactionId) {
- $criteria = new Criteria();
- $criteria->add(SatisfactionPeer::ID, $satisfactionId);
- $criteria->add(SatisfactionPeer::COMMENTS, $this->getRequestParameter('customer_comments'));
- $criteria->add(SatisfactionPeer::GOALS, $this->getRequestParameter('customer_goals'));
- $criteria->add(SatisfactionPeer::TOTALMARK, $this->getRequestParameter('cus_total'));
- SatisfactionPeer::doUpdate($criteria);
- }
- function updateLeaveAttendance($laId) {
- $criteria = new Criteria();
- $criteria->add(LeaveAttendancePeer::LAID, $laId);
- $criteria->add(LeaveAttendancePeer::ATTENDANCEMARK, $this->getRequestParameter('attendance_total'));
- $criteria->add(LeaveAttendancePeer::LEAVESELFMARK, $this->getRequestParameter('leave_mark1'));
- $criteria->add(LeaveAttendancePeer::LEAVETEAMMARK, $this->getRequestParameter('leave_mark2'));
- $criteria->add(LeaveAttendancePeer::LEAVEMARK, $this->getRequestParameter('leave_total'));
- $criteria->add(LeaveAttendancePeer::ATTENDANCECOMMENTS, $this->getRequestParameter('attendance_comment'));
- $criteria->add(LeaveAttendancePeer::LEAVECOMMENTS, $this->getRequestParameter('leave_comment'));
- LeaveAttendancePeer::doUpdate($criteria);
- }
- function UpdateQms($qmsId) {
- $criteria = new Criteria();
- $criteria->add(QMSPeer::ID, $qmsId);
- $criteria->add(QMSPeer::ITFMEMBER, $this->getRequestParameter('itf'));
- $criteria->add(QMSPeer::INTENALAUDITOR, $this->getRequestParameter('internal'));
- $criteria->add(QMSPeer::ISOAWARENESS, $this->getRequestParameter('iso'));
- $criteria->add(QMSPeer::TOTALMARK, $this->getRequestParameter('qms_total'));
- $criteria->add(QMSPeer::COMMENTS, $this->getRequestParameter('qms_comment'));
- $criteria->add(QMSPeer::ITFMARK, $this->getRequestParameter('qms_mark1'));
- $criteria->add(QMSPeer::INTERNALAUDITORMARK, $this->getRequestParameter('qms_mark2'));
- $criteria->add(QMSPeer::ISOAWARENESSMARK, $this->getRequestParameter('qms_mark3'));
- QMSPeer::doUpdate($criteria);
- }
- function updateOtherActivity($activityId) {
- $criteria = new Criteria();
- $criteria->add(OtherActivityPeer::ACTIVITYID, $activityId);
- $criteria->add(OtherActivityPeer::GROUPONE, $this->getRequestParameter('group1'));
- $criteria->add(OtherActivityPeer::GROUPTWO, $this->getRequestParameter('group2'));
- $criteria->add(OtherActivityPeer::GROUPTHREE, $this->getRequestParameter('group3'));
- $criteria->add(OtherActivityPeer::GROUPONEMARK, $this->getRequestParameter('group_mark1'));
- $criteria->add(OtherActivityPeer::GROUPTWOMARK, $this->getRequestParameter('group_mark2'));
- $criteria->add(OtherActivityPeer::GROUPTHREEMARK, $this->getRequestParameter('group_mark3'));
- $criteria->add(OtherActivityPeer::GROUPMARK, $this->getRequestParameter('group_total'));
- $criteria->add(OtherActivityPeer::SEMINARMARK, $this->getRequestParameter('indvl_mark1'));
- $criteria->add(OtherActivityPeer::KBENTRYMARK, $this->getRequestParameter('indvl_mark2'));
- $criteria->add(OtherActivityPeer::WORKSHOPMARK, $this->getRequestParameter('indvl_mark3'));
- $criteria->add(OtherActivityPeer::ACTIVITYCOMMENTS, $this->getRequestParameter('other_comment'));
- $criteria->add(OtherActivityPeer::INDVIDUALMARK, $this->getRequestParameter('indvl_total'));
- OtherActivityPeer::doUpdate($criteria);
- }
- function updateEmpComments($empCommId) {
- $criteria = new Criteria();
- $criteria->add(EmpCommentsPeer::ID, $empCommId);
- $criteria->add(EmpCommentsPeer::NEGCOMMENTS, $this->getRequestParameter('negative_comment'));
- $criteria->add(EmpCommentsPeer::NEGMARK, $this->getRequestParameter('negative_mark'));
- $criteria->add(EmpCommentsPeer::EMPCOMMENTS, $this->getRequestParameter('emp_comment'));
- EmpCommentsPeer::doUpdate($criteria);
- }
- function updateDevelopmentPlan($devId) {
- $criteria = new Criteria();
- $criteria->add(DevelopmentPlanPeer::DEVID, $devId);
- $criteria->add(DevelopmentPlanPeer::BOOKONE, $this->getRequestParameter('dev_book1'));
- $criteria->add(DevelopmentPlanPeer::BOOKTWO, $this->getRequestParameter('dev_book2'));
- $criteria->add(DevelopmentPlanPeer::BOOKTHREE, $this->getRequestParameter('dev_book3'));
- $criteria->add(DevelopmentPlanPeer::BOOKFOUR, $this->getRequestParameter('dev_book4'));
- $criteria->add(DevelopmentPlanPeer::BOOKFIVE, $this->getRequestParameter('dev_book5'));
- $criteria->add(DevelopmentPlanPeer::SEMINARONE, $this->getRequestParameter('dev_seminar1'));
- $criteria->add(DevelopmentPlanPeer::SEMINARTWO, $this->getRequestParameter('dev_seminar2'));
- $criteria->add(DevelopmentPlanPeer::SEMINARTHREE, $this->getRequestParameter('dev_seminar3'));
- $criteria->add(DevelopmentPlanPeer::SEMINARFOUR, $this->getRequestParameter('dev_seminar4'));
- $criteria->add(DevelopmentPlanPeer::SEMINARFIVE, $this->getRequestParameter('dev_seminar5'));
- $criteria->add(DevelopmentPlanPeer::ARTICLEONE, $this->getRequestParameter('dev_write1'));
- $criteria->add(DevelopmentPlanPeer::ARTICLETWO, $this->getRequestParameter('dev_write2'));
- $criteria->add(DevelopmentPlanPeer::ARTICLETHREE, $this->getRequestParameter('dev_write3'));
- $criteria->add(DevelopmentPlanPeer::ARTICLEFOUR, $this->getRequestParameter('dev_write4'));
- $criteria->add(DevelopmentPlanPeer::ARTICLEFIVE, $this->getRequestParameter('dev_write5'));
- $criteria->add(DevelopmentPlanPeer::WORKSHOPONE, $this->getRequestParameter('dev_workshop1'));
- $criteria->add(DevelopmentPlanPeer::WORKSHOPTWO, $this->getRequestParameter('dev_workshop2'));
- $criteria->add(DevelopmentPlanPeer::WORKSHOPTHREE, $this->getRequestParameter('dev_workshop3'));
- $criteria->add(DevelopmentPlanPeer::WORKSHOPFOUR, $this->getRequestParameter('dev_workshop4'));
- $criteria->add(DevelopmentPlanPeer::WORKSHOPFIVE, $this->getRequestParameter('dev_workshop5'));
- $criteria->add(DevelopmentPlanPeer::DEVELOPCOMMENTS, $this->getRequestParameter('develop_comment'));
- DevelopmentPlanPeer::doUpdate($criteria);
- }
- function isCore() {
- if ($this->getUser()->getAttribute('empRole') == 'core')
- return true;
- else
- return false;
- }
- function isAdmin() {
- if ($this->getUser()->getAttribute('empRole') == 'admin')
- return true;
- else
- return false;
- }
- function isQm() {
- if ($this->getUser()->getAttribute('empRole') == 'qm')
- return true;
- else
- return false;
- }
- function isHr() {
- if ($this->getUser()->getAttribute('empRole') == 'hr')
- return true;
- else
- return false;
- }
- function isStaff() {
- if ($this->getUser()->getAttribute('empRole') == 'staff')
- return true;
- else
- return false;
- }
- function isAllowed($peId) {
- $teamMembers = $this->getUser()->getAttribute('teamMembers');
- //$teamMembers=GroupwareEmployeesPeer::getAllSubordinatesId($this->getUser()->getAttribute('empId'));
- if (empty($teamMembers)) {
- $teamMembers[] = $this->getUser()->getAttribute('empId');
- }
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $results = PeEmployeesPeer::doSelect($criteria);
- if ($results) {
- $currEmpId = $results[0]->getEmpId();
- if (in_array($currEmpId, $teamMembers))
- return true;
- else
- return false;
- }
- else {
- $_SESSION['error_msg'] = 'No Such PE Form found';
- $this->redirect('main/index');
- }
- }
- function isSelf($peId=null, $empId=null) {
- $PeEmployees = new PeEmployeesPeer();
- $self = $PeEmployees->isEmpIdExists($peId, $empId);
- if ($self)
- $this->getUser()->setAttribute('isSelf', true);
- return $self;
- }
- // To check whether Employee already Submitted PE Form in the year.
- function isSubmittedThisYear($peform=null, $empid=null) {
- $criteria = new Criteria();
- if ($peform == "original") {
- $empId = $empid;
- $criteria->add(PeEmployeesPeer::TYPE, ORIGINALCODE);
- } else if ($empid) {
- $empId = $empid;
- if ($empId == $this->getUser()->getAttribute('empId')) {
- $criteria->add(PeEmployeesPeer::TYPE, SELFCODE);
- }
- $criteria1 = new Criteria();
- $criteria1->add(PeEmployeesPeer::EMPID, $empId);
- $criteria1->add(PeEmployeesPeer::STATUSID, array(1, 2), Criteria::IN);
- $criteria1->addDescendingOrderByColumn(PeEmployeesPeer::ISSUEDATE);
- $resultObject = PeEmployeesPeer::doSelect($criteria1);
- if ($resultObject) {
- $issueDate = $resultObject[0]->getIssueDate();
- $tmpDate = explode('-', $issueDate);
- $issueYear = $tmpDate[0];
- $currentYear = date('Y');
- if ($currentYear != $issueYear) {
- return false;
- }
- }
- } else {
- $empId = $this->getUser()->getAttribute('empId');
- $criteria->add(PeEmployeesPeer::TYPE, SELFCODE);
- }
- $criteria->addDescendingOrderByColumn(PeEmployeesPeer::ISSUEDATE);
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $resultObject = PeEmployeesPeer::doSelect($criteria);
- if ($resultObject) {
- $issueDate = $resultObject[0]->getIssueDate();
- $peId = $resultObject[0]->getPeId();
- $peStatusId = $resultObject[0]->getStatusId();
- }
- $tmpDate = explode('-', $issueDate);
- $issueYear = $tmpDate[0];
- $currentYear = date('Y');
- if ($currentYear == $issueYear) {
- if ($peStatusId == 1 || $peStatusId == 3)
- return $peId;
- else {
- $_SESSION['warning_msg'] = 'The selected person has already submitted a PE Form this year';
- $this->redirect('main/index');
- }
- }
- else
- return false;
- }
- // To check whether Employee has already Submitted Monthly PE Form this month.
- function isSubmittedThisMonth($empid=null, $date=null) {
- $tmpDate = explode('-', $date);
- $year_month = $tmpDate[0] . "-" . $tmpDate[1];
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empid);
- $criteria->add(PeEmployeesPeer::ISSUEDATE, $year_month . "%", Criteria::LIKE);
- $criteria->add(PeEmployeesPeer::TYPE, MONTHLYCODE);
- $resultObject = PeEmployeesPeer::doSelect($criteria);
- if ($resultObject) {
- $status = $resultObject[0]->getStatusId();
- $peId = $resultObject[0]->getPeId();
- if ($status == 12) {
- $_SESSION['warning_msg'] = 'The selected person has already saved a PE Form this month';
- $this->redirect('main/PeForm?edit=' . $peId . '&status=monthlysave');
- }
- else
- $_SESSION['warning_msg'] = 'The selected person has already submitted a PE Form this month';
- $this->redirect('main/addPEForm');
- }
- return true;
- }
- function setPeHelpAdmin() {
- $pehelpadmin = new PeHelpAdmin();
- $pehelpadmin->setEmpInfoHelp($this->getRequestParameter('eihelp'));
- $pehelpadmin->setAccomHelp($this->getRequestParameter('achelp'));
- $pehelpadmin->setAddResponsHelp($this->getRequestParameter('arhelp'));
- $pehelpadmin->setQualityHelp($this->getRequestParameter('qlwhelp'));
- $pehelpadmin->setQuantityHelp($this->getRequestParameter('qnwhelp'));
- $pehelpadmin->setCommnHelp($this->getRequestParameter('cmnhelp'));
- $pehelpadmin->setJobKnowHelp($this->getRequestParameter('jkhelp'));
- $pehelpadmin->setMgmntSkillHelp($this->getRequestParameter('mshelp'));
- $pehelpadmin->setSocialEfectHelp($this->getRequestParameter('sehelp'));
- $pehelpadmin->setCustDelightHelp($this->getRequestParameter('cdhelp'));
- $pehelpadmin->setAttendencePunctualHelp($this->getRequestParameter('aphelp'));
- $pehelpadmin->setLeaveMgmntHelp($this->getRequestParameter('lmhelp'));
- $pehelpadmin->setQmsHelp($this->getRequestParameter('qmshelp'));
- $pehelpadmin->setOtherActivityHelp($this->getRequestParameter('oahelp'));
- $pehelpadmin->setObjnotacheivedHelp($this->getRequestParameter('onahelp'));
- $pehelpadmin->setEmpCommentHelp($this->getRequestParameter('echelp'));
- $pehelpadmin->setDevolopeHelp($this->getRequestParameter('dphelp'));
- $pehelpadmin->save();
- return true;
- }
- function updatePeHelpAdmin($helpid) {
- $criteria = new Criteria();
- $criteria->add(PeHelpAdminPeer::HELPADMINID, $helpid);
- if ($this->getRequestParameter('eihelp') != "")
- $criteria->add(PeHelpAdminPeer::EMPINFOHELP, $this->getRequestParameter('eihelp'));
- if ($this->getRequestParameter('achelp') != "")
- $criteria->add(PeHelpAdminPeer::ACCOMHELP, $this->getRequestParameter('achelp'));
- if ($this->getRequestParameter('arhelp') != "")
- $criteria->add(PeHelpAdminPeer::ADDRESPONSHELP, $this->getRequestParameter('arhelp'));
- if ($this->getRequestParameter('qlwhelp') != "")
- $criteria->add(PeHelpAdminPeer::QUALITYHELP, $this->getRequestParameter('qlwhelp'));
- if ($this->getRequestParameter('qnwhelp') != "")
- $criteria->add(PeHelpAdminPeer::QUANTITYHELP, $this->getRequestParameter('qnwhelp'));
- if ($this->getRequestParameter('cmnhelp') != "")
- $criteria->add(PeHelpAdminPeer::COMMNHELP, $this->getRequestParameter('cmnhelp'));
- if ($this->getRequestParameter('jkhelp') != "")
- $criteria->add(PeHelpAdminPeer::JOBKNOWHELP, $this->getRequestParameter('jkhelp'));
- if ($this->getRequestParameter('mshelp') != "")
- $criteria->add(PeHelpAdminPeer::MGMNTSKILLHELP, $this->getRequestParameter('mshelp'));
- if ($this->getRequestParameter('sehelp') != "")
- $criteria->add(PeHelpAdminPeer::SOCIALEFECTHELP, $this->getRequestParameter('sehelp'));
- if ($this->getRequestParameter('cdhelp') != "")
- $criteria->add(PeHelpAdminPeer::CUSTDELIGHTHELP, $this->getRequestParameter('cdhelp'));
- if ($this->getRequestParameter('aphelp') != "")
- $criteria->add(PeHelpAdminPeer::ATTENDENCEPUNCTUALHELP, $this->getRequestParameter('aphelp'));
- if ($this->getRequestParameter('lmhelp') != "")
- $criteria->add(PeHelpAdminPeer::LEAVEMGMNTHELP, $this->getRequestParameter('lmhelp'));
- if ($this->getRequestParameter('qmshelp') != "")
- $criteria->add(PeHelpAdminPeer::QMSHELP, $this->getRequestParameter('qmshelp'));
- if ($this->getRequestParameter('oahelp') != "")
- $criteria->add(PeHelpAdminPeer::OTHERACTIVITYHELP, $this->getRequestParameter('oahelp'));
- if ($this->getRequestParameter('onahelp') != "")
- $criteria->add(PeHelpAdminPeer::OBJNOTACHEIVEDHELP, $this->getRequestParameter('onahelp'));
- if ($this->getRequestParameter('echelp') != "")
- $criteria->add(PeHelpAdminPeer::EMPCOMMENTHELP, $this->getRequestParameter('echelp'));
- if ($this->getRequestParameter('dphelp') != "")
- $criteria->add(PeHelpAdminPeer::DEVOLOPEHELP, $this->getRequestParameter('dphelp'));
- PeHelpAdminPeer::doUpdate($criteria);
- return true;
- }
- function setPeHelpStaff() {
- $pehelpstaff = new PeHelpStaff();
- $pehelpstaff->setEmpInfoHelp($this->getRequestParameter('eihelp'));
- $pehelpstaff->setAccomHelp($this->getRequestParameter('achelp'));
- $pehelpstaff->setAddResponsHelp($this->getRequestParameter('arhelp'));
- $pehelpstaff->setQualityHelp($this->getRequestParameter('qlwhelp'));
- $pehelpstaff->setQuantityHelp($this->getRequestParameter('qnwhelp'));
- $pehelpstaff->setCommnHelp($this->getRequestParameter('cmnhelp'));
- $pehelpstaff->setJobKnowHelp($this->getRequestParameter('jkhelp'));
- $pehelpstaff->setSocialEfectHelp($this->getRequestParameter('sehelp'));
- $pehelpstaff->setCustDelightHelp($this->getRequestParameter('cdhelp'));
- $pehelpstaff->setAttendencePunctualHelp($this->getRequestParameter('aphelp'));
- $pehelpstaff->setLeaveMgmntHelp($this->getRequestParameter('lmhelp'));
- $pehelpstaff->setQmsHelp($this->getRequestParameter('qmshelp'));
- $pehelpstaff->setOtherActivityHelp($this->getRequestParameter('oahelp'));
- $pehelpstaff->setObjnotacheivedHelp($this->getRequestParameter('onahelp'));
- $pehelpstaff->setEmpCommentHelp($this->getRequestParameter('echelp'));
- $pehelpstaff->setDevolopeHelp($this->getRequestParameter('dphelp'));
- $pehelpstaff->save();
- return true;
- }
- function updatePeHelpStaff($helpid) {
- $criteria = new Criteria();
- $criteria->add(PeHelpStaffPeer::HELPSTAFID, $helpid);
- if ($this->getRequestParameter('eihelp') != "")
- $criteria->add(PeHelpStaffPeer::EMPINFOHELP, $this->getRequestParameter('eihelp'));
- if ($this->getRequestParameter('achelp') != "")
- $criteria->add(PeHelpStaffPeer::ACCOMHELP, $this->getRequestParameter('achelp'));
- if ($this->getRequestParameter('arhelp') != "")
- $criteria->add(PeHelpStaffPeer::ADDRESPONSHELP, $this->getRequestParameter('arhelp'));
- if ($this->getRequestParameter('qlwhelp') != "")
- $criteria->add(PeHelpStaffPeer::QUALITYHELP, $this->getRequestParameter('qlwhelp'));
- if ($this->getRequestParameter('qnwhelp') != "")
- $criteria->add(PeHelpStaffPeer::QUANTITYHELP, $this->getRequestParameter('qnwhelp'));
- if ($this->getRequestParameter('cmnhelp') != "")
- $criteria->add(PeHelpStaffPeer::COMMNHELP, $this->getRequestParameter('cmnhelp'));
- if ($this->getRequestParameter('jkhelp') != "")
- $criteria->add(PeHelpStaffPeer::JOBKNOWHELP, $this->getRequestParameter('jkhelp'));
- if ($this->getRequestParameter('sehelp') != "")
- $criteria->add(PeHelpStaffPeer::SOCIALEFECTHELP, $this->getRequestParameter('sehelp'));
- if ($this->getRequestParameter('cdhelp') != "")
- $criteria->add(PeHelpStaffPeer::CUSTDELIGHTHELP, $this->getRequestParameter('cdhelp'));
- if ($this->getRequestParameter('aphelp') != "")
- $criteria->add(PeHelpStaffPeer::ATTENDENCEPUNCTUALHELP, $this->getRequestParameter('aphelp'));
- if ($this->getRequestParameter('lmhelp') != "")
- $criteria->add(PeHelpStaffPeer::LEAVEMGMNTHELP, $this->getRequestParameter('lmhelp'));
- if ($this->getRequestParameter('qmshelp') != "")
- $criteria->add(PeHelpStaffPeer::QMSHELP, $this->getRequestParameter('qmshelp'));
- if ($this->getRequestParameter('oahelp') != "")
- $criteria->add(PeHelpStaffPeer::OTHERACTIVITYHELP, $this->getRequestParameter('oahelp'));
- if ($this->getRequestParameter('onahelp') != "")
- $criteria->add(PeHelpStaffPeer::OBJNOTACHEIVEDHELP, $this->getRequestParameter('onahelp'));
- if ($this->getRequestParameter('echelp') != "")
- $criteria->add(PeHelpStaffPeer::EMPCOMMENTHELP, $this->getRequestParameter('echelp'));
- if ($this->getRequestParameter('dphelp') != "")
- $criteria->add(PeHelpStaffPeer::DEVOLOPEHELP, $this->getRequestParameter('dphelp'));
- PeHelpStaffPeer::doUpdate($criteria);
- return true;
- }
- function setPeHelpQm() {
- $pehelpadmin = new PeHelpQm();
- $pehelpadmin->setEmpInfoHelp($this->getRequestParameter('eihelp'));
- $pehelpadmin->setAccomHelp($this->getRequestParameter('achelp'));
- $pehelpadmin->setAddResponsHelp($this->getRequestParameter('arhelp'));
- $pehelpadmin->setQualityHelp($this->getRequestParameter('qlwhelp'));
- $pehelpadmin->setQuantityHelp($this->getRequestParameter('qnwhelp'));
- $pehelpadmin->setCommnHelp($this->getRequestParameter('cmnhelp'));
- $pehelpadmin->setJobKnowHelp($this->getRequestParameter('jkhelp'));
- $pehelpadmin->setMgmntSkillHelp($this->getRequestParameter('mshelp'));
- $pehelpadmin->setSocialEfectHelp($this->getRequestParameter('sehelp'));
- $pehelpadmin->setCustDelightHelp($this->getRequestParameter('cdhelp'));
- $pehelpadmin->setAttendencePunctualHelp($this->getRequestParameter('aphelp'));
- $pehelpadmin->setLeaveMgmntHelp($this->getRequestParameter('lmhelp'));
- $pehelpadmin->setQmsHelp($this->getRequestParameter('qmshelp'));
- $pehelpadmin->setOtherActivityHelp($this->getRequestParameter('oahelp'));
- $pehelpadmin->setObjnotacheivedHelp($this->getRequestParameter('onahelp'));
- $pehelpadmin->setEmpCommentHelp($this->getRequestParameter('echelp'));
- $pehelpadmin->setDevolopeHelp($this->getRequestParameter('dphelp'));
- $pehelpadmin->save();
- return true;
- }
- function updatePeHelpQm($helpid) {
- $criteria = new Criteria();
- $criteria->add(PeHelpQmPeer::HELPQMID, $helpid);
- if ($this->getRequestParameter('eihelp') != "")
- $criteria->add(PeHelpQmPeer::EMPINFOHELP, $this->getRequestParameter('eihelp'));
- if ($this->getRequestParameter('achelp') != "")
- $criteria->add(PeHelpQmPeer::ACCOMHELP, $this->getRequestParameter('achelp'));
- if ($this->getRequestParameter('arhelp') != "")
- $criteria->add(PeHelpQmPeer::ADDRESPONSHELP, $this->getRequestParameter('arhelp'));
- if ($this->getRequestParameter('qlwhelp') != "")
- $criteria->add(PeHelpQmPeer::QUALITYHELP, $this->getRequestParameter('qlwhelp'));
- if ($this->getRequestParameter('qnwhelp') != "")
- $criteria->add(PeHelpQmPeer::QUANTITYHELP, $this->getRequestParameter('qnwhelp'));
- if ($this->getRequestParameter('cmnhelp') != "")
- $criteria->add(PeHelpQmPeer::COMMNHELP, $this->getRequestParameter('cmnhelp'));
- if ($this->getRequestParameter('jkhelp') != "")
- $criteria->add(PeHelpQmPeer::JOBKNOWHELP, $this->getRequestParameter('jkhelp'));
- if ($this->getRequestParameter('mshelp') != "")
- $criteria->add(PeHelpQmPeer::MGMNTSKILLHELP, $this->getRequestParameter('mshelp'));
- if ($this->getRequestParameter('sehelp') != "")
- $criteria->add(PeHelpQmPeer::SOCIALEFECTHELP, $this->getRequestParameter('sehelp'));
- if ($this->getRequestParameter('cdhelp') != "")
- $criteria->add(PeHelpQmPeer::CUSTDELIGHTHELP, $this->getRequestParameter('cdhelp'));
- if ($this->getRequestParameter('aphelp') != "")
- $criteria->add(PeHelpQmPeer::ATTENDENCEPUNCTUALHELP, $this->getRequestParameter('aphelp'));
- if ($this->getRequestParameter('lmhelp') != "")
- $criteria->add(PeHelpQmPeer::LEAVEMGMNTHELP, $this->getRequestParameter('lmhelp'));
- if ($this->getRequestParameter('qmshelp') != "")
- $criteria->add(PeHelpQmPeer::QMSHELP, $this->getRequestParameter('qmshelp'));
- if ($this->getRequestParameter('oahelp') != "")
- $criteria->add(PeHelpQmPeer::OTHERACTIVITYHELP, $this->getRequestParameter('oahelp'));
- if ($this->getRequestParameter('onahelp') != "")
- $criteria->add(PeHelpQmPeer::OBJNOTACHEIVEDHELP, $this->getRequestParameter('onahelp'));
- if ($this->getRequestParameter('echelp') != "")
- $criteria->add(PeHelpQmPeer::EMPCOMMENTHELP, $this->getRequestParameter('echelp'));
- if ($this->getRequestParameter('dphelp') != "")
- $criteria->add(PeHelpQmPeer::DEVOLOPEHELP, $this->getRequestParameter('dphelp'));
- PeHelpQmPeer::doUpdate($criteria);
- return true;
- }
- function setPeSampleAdmin() {
- $pesampleadmin = new PeSampleAdmin();
- $pesampleadmin->setEmpInfoHelp($this->getRequestParameter('eisample'));
- $pesampleadmin->setAccomHelp($this->getRequestParameter('acsample'));
- $pesampleadmin->setAddResponsHelp($this->getRequestParameter('arsample'));
- $pesampleadmin->setQualityHelp($this->getRequestParameter('qlwsample'));
- $pesampleadmin->setQuantityHelp($this->getRequestParameter('qnwsample'));
- $pesampleadmin->setCommnHelp($this->getRequestParameter('cmnsample'));
- $pesampleadmin->setJobKnowHelp($this->getRequestParameter('jksample'));
- $pesampleadmin->setMgmntSkillHelp($this->getRequestParameter('mssample'));
- $pesampleadmin->setSocialEfectHelp($this->getRequestParameter('sesample'));
- $pesampleadmin->setCustDelightHelp($this->getRequestParameter('cdsample'));
- $pesampleadmin->setAttendencePunctualHelp($this->getRequestParameter('apsample'));
- $pesampleadmin->setLeaveMgmntHelp($this->getRequestParameter('lmsample'));
- $pesampleadmin->setQmsHelp($this->getRequestParameter('qmssample'));
- $pesampleadmin->setOtherActivityHelp($this->getRequestParameter('oasample'));
- $pesampleadmin->setObjnotacheivedHelp($this->getRequestParameter('onasample'));
- $pesampleadmin->setEmpCommentHelp($this->getRequestParameter('ecsample'));
- $pesampleadmin->setDevolopeHelp($this->getRequestParameter('dpsample'));
- $pesampleadmin->save();
- return true;
- }
- function updatePeSampleAdmin($sampleid) {
- $criteria = new Criteria();
- $criteria->add(PeSampleAdminPeer::SAMPLEADMINID, $sampleid);
- if ($this->getRequestParameter('eisample') != "")
- $criteria->add(PeSampleAdminPeer::EMPINFOHELP, $this->getRequestParameter('eisample'));
- if ($this->getRequestParameter('acsample') != "")
- $criteria->add(PeSampleAdminPeer::ACCOMHELP, $this->getRequestParameter('acsample'));
- if ($this->getRequestParameter('arsample') != "")
- $criteria->add(PeSampleAdminPeer::ADDRESPONSHELP, $this->getRequestParameter('arsample'));
- if ($this->getRequestParameter('qlwsample') != "")
- $criteria->add(PeSampleAdminPeer::QUALITYHELP, $this->getRequestParameter('qlwsample'));
- if ($this->getRequestParameter('qnwsample') != "")
- $criteria->add(PeSampleAdminPeer::QUANTITYHELP, $this->getRequestParameter('qnwsample'));
- if ($this->getRequestParameter('cmnsample') != "")
- $criteria->add(PeSampleAdminPeer::COMMNHELP, $this->getRequestParameter('cmnsample'));
- if ($this->getRequestParameter('jksample') != "")
- $criteria->add(PeSampleAdminPeer::JOBKNOWHELP, $this->getRequestParameter('jksample'));
- if ($this->getRequestParameter('mssample') != "")
- $criteria->add(PeSampleAdminPeer::MGMNTSKILLHELP, $this->getRequestParameter('mssample'));
- if ($this->getRequestParameter('sesample') != "")
- $criteria->add(PeSampleAdminPeer::SOCIALEFECTHELP, $this->getRequestParameter('sesample'));
- if ($this->getRequestParameter('cdsample') != "")
- $criteria->add(PeSampleAdminPeer::CUSTDELIGHTHELP, $this->getRequestParameter('cdsample'));
- if ($this->getRequestParameter('apsample') != "")
- $criteria->add(PeSampleAdminPeer::ATTENDENCEPUNCTUALHELP, $this->getRequestParameter('apsample'));
- if ($this->getRequestParameter('lmsample') != "")
- $criteria->add(PeSampleAdminPeer::LEAVEMGMNTHELP, $this->getRequestParameter('lmsample'));
- if ($this->getRequestParameter('qmssample') != "")
- $criteria->add(PeSampleAdminPeer::QMSHELP, $this->getRequestParameter('qmssample'));
- if ($this->getRequestParameter('oasample') != "")
- $criteria->add(PeSampleAdminPeer::OTHERACTIVITYHELP, $this->getRequestParameter('oasample'));
- if ($this->getRequestParameter('onasample') != "")
- $criteria->add(PeSampleAdminPeer::OBJNOTACHEIVEDHELP, $this->getRequestParameter('onasample'));
- if ($this->getRequestParameter('ecsample') != "")
- $criteria->add(PeSampleAdminPeer::EMPCOMMENTHELP, $this->getRequestParameter('ecsample'));
- if ($this->getRequestParameter('dpsample') != "")
- $criteria->add(PeSampleAdminPeer::DEVOLOPEHELP, $this->getRequestParameter('dpsample'));
- PeSampleAdminPeer::doUpdate($criteria);
- return true;
- }
- function setPeSampleStaff() {
- $pesamplestaff = new PeSampleStaff();
- $pesamplestaff->setEmpInfoHelp($this->getRequestParameter('eisample'));
- $pesamplestaff->setAccomHelp($this->getRequestParameter('acsample'));
- $pesamplestaff->setAddResponsHelp($this->getRequestParameter('arsample'));
- $pesamplestaff->setQualityHelp($this->getRequestParameter('qlwsample'));
- $pesamplestaff->setQuantityHelp($this->getRequestParameter('qnwsample'));
- $pesamplestaff->setCommnHelp($this->getRequestParameter('cmnsample'));
- $pesamplestaff->setJobKnowHelp($this->getRequestParameter('jksample'));
- $pesamplestaff->setSocialEfectHelp($this->getRequestParameter('sesample'));
- $pesamplestaff->setCustDelightHelp($this->getRequestParameter('cdsample'));
- $pesamplestaff->setAttendencePunctualHelp($this->getRequestParameter('apsample'));
- $pesamplestaff->setLeaveMgmntHelp($this->getRequestParameter('lmsample'));
- $pesamplestaff->setQmsHelp($this->getRequestParameter('qmssample'));
- $pesamplestaff->setOtherActivityHelp($this->getRequestParameter('oasample'));
- $pesamplestaff->setObjnotacheivedHelp($this->getRequestParameter('onasample'));
- $pesamplestaff->setEmpCommentHelp($this->getRequestParameter('ecsample'));
- $pesamplestaff->setDevolopeHelp($this->getRequestParameter('dpsample'));
- $pesamplestaff->save();
- return true;
- }
- function updatePeSampleStaff($sampleid) {
- $criteria = new Criteria();
- $criteria->add(PeSampleStaffPeer::SAMPLESTAFID, $sampleid);
- if ($this->getRequestParameter('eisample') != "")
- $criteria->add(PeSampleStaffPeer::EMPINFOHELP, $this->getRequestParameter('eisample'));
- if ($this->getRequestParameter('acsample') != "")
- $criteria->add(PeSampleStaffPeer::ACCOMHELP, $this->getRequestParameter('acsample'));
- if ($this->getRequestParameter('arsample') != "")
- $criteria->add(PeSampleStaffPeer::ADDRESPONSHELP, $this->getRequestParameter('arsample'));
- if ($this->getRequestParameter('qlwsample') != "")
- $criteria->add(PeSampleStaffPeer::QUALITYHELP, $this->getRequestParameter('qlwsample'));
- if ($this->getRequestParameter('qnwsample') != "")
- $criteria->add(PeSampleStaffPeer::QUANTITYHELP, $this->getRequestParameter('qnwsample'));
- if ($this->getRequestParameter('cmnsample') != "")
- $criteria->add(PeSampleStaffPeer::COMMNHELP, $this->getRequestParameter('cmnsample'));
- if ($this->getRequestParameter('jksample') != "")
- $criteria->add(PeSampleStaffPeer::JOBKNOWHELP, $this->getRequestParameter('jksample'));
- if ($this->getRequestParameter('sesample') != "")
- $criteria->add(PeSampleStaffPeer::SOCIALEFECTHELP, $this->getRequestParameter('sesample'));
- if ($this->getRequestParameter('cdsample') != "")
- $criteria->add(PeSampleStaffPeer::CUSTDELIGHTHELP, $this->getRequestParameter('cdsample'));
- if ($this->getRequestParameter('apsample') != "")
- $criteria->add(PeSampleStaffPeer::ATTENDENCEPUNCTUALHELP, $this->getRequestParameter('apsample'));
- if ($this->getRequestParameter('lmsample') != "")
- $criteria->add(PeSampleStaffPeer::LEAVEMGMNTHELP, $this->getRequestParameter('lmsample'));
- if ($this->getRequestParameter('qmssample') != "")
- $criteria->add(PeSampleStaffPeer::QMSHELP, $this->getRequestParameter('qmssample'));
- if ($this->getRequestParameter('oasample') != "")
- $criteria->add(PeSampleStaffPeer::OTHERACTIVITYHELP, $this->getRequestParameter('oasample'));
- if ($this->getRequestParameter('onasample') != "")
- $criteria->add(PeSampleStaffPeer::OBJNOTACHEIVEDHELP, $this->getRequestParameter('onasample'));
- if ($this->getRequestParameter('ecsample') != "")
- $criteria->add(PeSampleStaffPeer::EMPCOMMENTHELP, $this->getRequestParameter('ecsample'));
- if ($this->getRequestParameter('dpsample') != "")
- $criteria->add(PeSampleStaffPeer::DEVOLOPEHELP, $this->getRequestParameter('dpsample'));
- PeSampleStaffPeer::doUpdate($criteria);
- return true;
- }
- function setPeSampleQm() {
- $pesampleadmin = new PeSampleQm();
- $pesampleadmin->setEmpInfoHelp($this->getRequestParameter('eisample'));
- $pesampleadmin->setAccomHelp($this->getRequestParameter('acsample'));
- $pesampleadmin->setAddResponsHelp($this->getRequestParameter('arsample'));
- $pesampleadmin->setQualityHelp($this->getRequestParameter('qlwsample'));
- $pesampleadmin->setQuantityHelp($this->getRequestParameter('qnwsample'));
- $pesampleadmin->setCommnHelp($this->getRequestParameter('cmnsample'));
- $pesampleadmin->setJobKnowHelp($this->getRequestParameter('jksample'));
- $pesampleadmin->setMgmntSkillHelp($this->getRequestParameter('mssample'));
- $pesampleadmin->setSocialEfectHelp($this->getRequestParameter('sesample'));
- $pesampleadmin->setCustDelightHelp($this->getRequestParameter('cdsample'));
- $pesampleadmin->setAttendencePunctualHelp($this->getRequestParameter('apsample'));
- $pesampleadmin->setLeaveMgmntHelp($this->getRequestParameter('lmsample'));
- $pesampleadmin->setQmsHelp($this->getRequestParameter('qmssample'));
- $pesampleadmin->setOtherActivityHelp($this->getRequestParameter('oasample'));
- $pesampleadmin->setObjnotacheivedHelp($this->getRequestParameter('onasample'));
- $pesampleadmin->setEmpCommentHelp($this->getRequestParameter('ecsample'));
- $pesampleadmin->setDevolopeHelp($this->getRequestParameter('dpsample'));
- $pesampleadmin->save();
- return true;
- }
- function updatePeSampleQm($sampleid) {
- $criteria = new Criteria();
- $criteria->add(PeSampleQmPeer::SAMPLEQMID, $sampleid);
- if ($this->getRequestParameter('eisample') != "")
- $criteria->add(PeSampleQmPeer::EMPINFOHELP, $this->getRequestParameter('eisample'));
- if ($this->getRequestParameter('acsample') != "")
- $criteria->add(PeSampleQmPeer::ACCOMHELP, $this->getRequestParameter('acsample'));
- if ($this->getRequestParameter('arsample') != "")
- $criteria->add(PeSampleQmPeer::ADDRESPONSHELP, $this->getRequestParameter('arsample'));
- if ($this->getRequestParameter('qlwsample') != "")
- $criteria->add(PeSampleQmPeer::QUALITYHELP, $this->getRequestParameter('qlwsample'));
- if ($this->getRequestParameter('qnwsample') != "")
- $criteria->add(PeSampleQmPeer::QUANTITYHELP, $this->getRequestParameter('qnwsample'));
- if ($this->getRequestParameter('cmnsample') != "")
- $criteria->add(PeSampleQmPeer::COMMNHELP, $this->getRequestParameter('cmnsample'));
- if ($this->getRequestParameter('jksample') != "")
- $criteria->add(PeSampleQmPeer::JOBKNOWHELP, $this->getRequestParameter('jksample'));
- if ($this->getRequestParameter('mssample') != "")
- $criteria->add(PeSampleQmPeer::MGMNTSKILLHELP, $this->getRequestParameter('mssample'));
- if ($this->getRequestParameter('sesample') != "")
- $criteria->add(PeSampleQmPeer::SOCIALEFECTHELP, $this->getRequestParameter('sesample'));
- if ($this->getRequestParameter('cdsample') != "")
- $criteria->add(PeSampleQmPeer::CUSTDELIGHTHELP, $this->getRequestParameter('cdsample'));
- if ($this->getRequestParameter('apsample') != "")
- $criteria->add(PeSampleQmPeer::ATTENDENCEPUNCTUALHELP, $this->getRequestParameter('apsample'));
- if ($this->getRequestParameter('lmsample') != "")
- $criteria->add(PeSampleQmPeer::LEAVEMGMNTHELP, $this->getRequestParameter('lmsample'));
- if ($this->getRequestParameter('qmssample') != "")
- $criteria->add(PeSampleQmPeer::QMSHELP, $this->getRequestParameter('qmssample'));
- if ($this->getRequestParameter('oasample') != "")
- $criteria->add(PeSampleQmPeer::OTHERACTIVITYHELP, $this->getRequestParameter('oasample'));
- if ($this->getRequestParameter('onasample') != "")
- $criteria->add(PeSampleQmPeer::OBJNOTACHEIVEDHELP, $this->getRequestParameter('onasample'));
- if ($this->getRequestParameter('ecsample') != "")
- $criteria->add(PeSampleQmPeer::EMPCOMMENTHELP, $this->getRequestParameter('ecsample'));
- if ($this->getRequestParameter('dpsample') != "")
- $criteria->add(PeSampleQmPeer::DEVOLOPEHELP, $this->getRequestParameter('dpsample'));
- PeSampleQmPeer::doUpdate($criteria);
- return true;
- }
- function getEmployeeRoleType() {
- $formType = PeChangeformPeer::getFormType($this->getUser()->getAttribute('empId'));
- if ($formType != null) {
- switch ($formType) {
- case 'admin':
- return ADMIN;
- break;
- case 'qm':
- return QM;
- break;
- case 'staff':
- return STAFF;
- break;
- }
- } else {
- if ($this->isAdmin()) {
- return 0;
- } elseif ($this->isQm())
- return 1;
- elseif ($this->isStaff()) {
- return 2;
- }
- else
- return false;
- }
- }
- function updatePeStatus($peStatus) {
- $peId = $this->getRequestParameter('peId');
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $criteria->add(PeEmployeesPeer::STATUSID, $peStatus);
- $updationStatus = PeEmployeesPeer::doUpdate($criteria);
- if ($updationStatus)
- return true;
- else
- return false;
- }
- function getPostedValues() {
- switch ($this->getRequestParameter('commit')) {
- case 'Add' :
- if ($this->isCore()) {
- $PeId = $this->getRequestParameter('peId');
- $this->setSuggestions($PeId);
- }
- $this->redirect('main/PeForm?view=' . $PeId);
- break;
- case 'Save':
- $success = $this->validateMark();
- if ($success == false) {
- $empId = $this->getRequestParameter('empId');
- $this->getPreForm($empId);
- $this->emp = $this->getUser();
- $this->readonly = false;
- break;
- }
- //added bby renjo for monthly PE
- if ($this->getRequestParameter('perform') == "monthly")
- $peStatus = 12;
- else if ($this->getRequestParameter('perform') == "original")
- $peStatus = 3;
- else
- $peStatus = 1;
- if ($this->getRequestParameter('update')) {
- if ($this->updatePEForm($peStatus)) {
- $peform = $this->getRequestParameter('perform');
- $empid = $this->getRequestParameter('empId');
- $_SESSION['msg'] = 'Successfully saved the PEForm !!';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- //if($this->getRequestParameter('perform')=="monthly")
- $peId = $this->getRequestParameter('update');
- //else
- //$peId=$this -> isSubmittedThisYear($peform,$empid);
- //echo $this->getRequestParameter('update');die;
- $logs = new PelogsPeer();
- if ($peStatus == 12)
- $savedEmployeeLog = $logs->getSavedEmployeeFormLog($peId, $kidName, $peform, $empName, 12);
- else
- $savedEmployeeLog=$logs->getSavedEmployeeFormLog($peId, $kidName, $peform, $empName);
- //added by renjo for monthly PE
- if ($peStatus == 12)
- $this->redirect('main/PeForm?edit=' . $peId . '&status=monthlysave');
- else if ($peStatus == 1)
- $this->redirect('main/PeForm?edit=' . $peId . '&value=staffSaved');
- else {
- $this->redirect('main/PeForm?edit=' . $peId . '&status=adminsave');
- }
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- }
- else {
- $peform = $this->getRequestParameter('perform');
- $empid = $this->getRequestParameter('empId');
- if ($this->setPEForm($peStatus, $peform, $empid)) { // INSERT VALUES TO DATABASE (NEW PE FORM)
- $_SESSION['msg'] = 'Successfully saved your PEForm !!';
- $empId = $this->getRequestParameter('empId');
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $peId = $this->isSubmittedThisYear($peform, $empid);
- $logs = new PelogsPeer();
- $savedEmployeeLog = $logs->getSavedEmployeeFormLog($peId, $kidName, $peform, $empName);
- if ($peStatus == 1)
- $this->redirect('main/PeForm?edit=' . $peId . '&value=staffSaved');
- else
- $this->redirect('main/PeForm?edit=' . $peId . '&status=adminsave');
- }
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- $this->redirect('main/index');
- }
- break;
- case 'SavePE':
- $peId = $this->getRequestParameter('update');
- $success = $this->validateMark();
- if ($success == false) {
- $this->redirect('main/PeForm?edit=' . $peId);
- }
- $peStatus = 5;
- if ($this->getRequestParameter('update')) {
- if ($this->updatePEForm($peStatus))
- $_SESSION['msg'] = 'Successfully saved the PEForm !!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- }
- $this->redirect('main/PeForm?edit=' . $peId);
- $peStatus = 5;
- $peId = $this->getRequestParameter('update');
- if ($this->getRequestParameter('update')) {
- if ($this->updatePEForm($peStatus)) {
- $_SESSION['msg'] = 'Successfully saved the PEForm !!';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empId);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $savedEmployeeLog = $logs->getSavedEmployeeFormLog($peId, $kidName, '', $empName);
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- }
- $this->redirect('main/PeForm?edit=' . $peId);
- break;
- case 'Submit':
- //added by renjo for monthl PE (to remove validation)
- if ($this->getRequestParameter('monthlypestatus') == 13) {
- $cmnt = $this->getRequestParameter('empCommId');
- $this->updateEmpComments($cmnt);
- $this->updatePEForm(13);
- $_SESSION['msg'] = 'Successfully added the comments !!';
- $this->redirect('main/index');
- } else if ($this->getRequestParameter('perform') == "monthly") {
- $peStatus = 13;
- $peId = $this->getRequestParameter('update');
- if ($this->updatePEForm($peStatus)) {
- $_SESSION['msg'] = 'Successfully submitted the PEForm !!';
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- }else {
- $success = $this->validateMark();
- if ($success == false) {
- $empId = $this->getRequestParameter('empId');
- $this->getPreForm($empId);
- $this->emp = $this->getUser();
- $this->readonly = false;
- break;
- }
- if ($this->getRequestParameter('perform') == "original")
- $peStatus = 4;
- else
- $peStatus = 2;
- $validated = $this->validation();
- if ($validated) {
- if ($this->getRequestParameter('update')) {
- $peform = $this->getRequestParameter('perform');
- $empid = $this->getRequestParameter('empId');
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $peId = $this->isSubmittedThisYear($peform, $empid);
- $logs = new PelogsPeer();
- $submittedEmployeeLog = $logs->getSubmittedEmployeeFormLog($peId, $kidName, $peform, $empName);
- if ($this->updatePEForm($peStatus)) {
- $_SESSION['msg'] = 'Successfully submitted the PEForm !!';
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- }
- else {
- $peform = $this->getRequestParameter('perform');
- $empid = $this->getRequestParameter('empId');
- if ($empid == $_SESSION['empId']) {
- $type = 0;
- }
- if ($peform == 'original')
- $type = 1;
- else if ($peform == 'self')
- $type = 0;
- if ($this->setPEForm($peStatus, $peform, $empid)) { // INSERT VALUES TO DATABASE (NEW PE FORM)
- $_SESSION['msg'] = 'Successfully submitted the PEForm !!';
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::EMPID, $empid);
- $criteria->add(PeEmployeesPeer::TYPE, $type);
- $peidStatus = PeEmployeesPeer::doSelect($criteria);
- foreach ($peidStatus as $results) {
- $peId = $results->getPeId();
- }
- $logs = new PelogsPeer();
- $submittedEmployeeLog = $logs->getSubmittedEmployeeFormLog($peId, $kidName, $peform, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- $this->redirect('main/index');
- }
- }
- else {
- $_SESSION['error_msg'] = "Please fill all the mandatory fields";
- $empId = $this->getRequestParameter('empId');
- $this->getPreForm($empId);
- $this->emp = $this->getUser();
- $this->readonly = false;
- }
- }
- break;
- case 'Revision':
- if ($this->isCore()) {
- $PeId = $this->getRequestParameter('peId');
- $this->setSuggestions($PeId);
- }
- $peStatus = 5;
- if ($this->updatePeStatus($peStatus)) {
- $_SESSION['msg'] = ' PE form successfully sent for revision !!!';
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $revisionEmployeeLog = $logs->getRevisionEmployeeFormLog($PeId, $kidName, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- break;
- case 'Approve':
- if ($this->isCore()) {
- $PeId = $this->getRequestParameter('peId');
- $this->setSuggestions($PeId);
- }
- $peStatus = 11;
- if ($this->updatePeStatus($peStatus)) {
- $_SESSION['msg'] = 'Successfully Approved the PEForm !!';
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $approveEmployeeLog = $logs->getApproveEmployeeFormLog($PeId, $kidName, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- break;
- case 'Complete':
- $peStatus = 6;
- if ($this->updatePeStatus($peStatus)) {
- $_SESSION['msg'] = 'Successfully completed the PE discussion.';
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $approveEmployeeLog = $logs->getApproveEmployeeFormLog($PeId, $kidName, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- break;
- case 'Edit':
- if ($this->isCore() || $this->isAdmin()) {
- $peId = $this->getRequestParameter('peId');
- $this->redirect('main/PeForm?edit=' . $peId);
- }
- break;
- case 'Accept':
- // Updating employee comments
- $cmnt = $this->getRequestParameter('empCommId');
- $this->updateEmpComments($cmnt);
- $peStatus = 7;
- if ($this->updatePeStatus($peStatus)) {
- $_SESSION['msg'] = 'Successfully Accepted the PEForm !!';
- $PeId = $this->getRequestParameter('peId');
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $acceptEmployeeLog = $logs->getAcceptEmployeeFormLog($PeId, $kidName);
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- break;
- case 'Save Help':
- if ($this->isCore() || $this->isHr()) {
- if (!$this->hasHelp()) {
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- }
- $helptype = $this->getRequestParameter('helptype');
- if ($helptype == "admin") {
- $readonlyStatus = $this->getRequestParameter('readonlyStatus');
- if ($this->getRequestParameter('update'))
- $peId = $this->getRequestParameter('update');
- else if ($this->getRequestParameter('peId'))
- $peId = $this->getRequestParameter('peId');
- $c = new Criteria();
- $result_count = PeHelpAdminPeer::doCount($c);
- if ($result_count > 0) {
- $helpid = $this->getRequestParameter('helpid');
- if ($this->updatePeHelpAdmin($helpid))
- $_SESSION['msg'] = 'Successfully updated the Help information for admin !!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- if ($this->isHr()) {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId);
- }else {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=original');
- }
- }else {
- if ($this->setPeHelpAdmin())
- $_SESSION['msg'] = 'Successfully inserted the Help information for admin !!';
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- if ($this->isHr()) {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId);
- }else {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=original');
- }
- //$this -> redirect('main/index');
- }
- }
- elseif ($helptype == "staff") {
- $c = new Criteria();
- $result_count = PeHelpStaffPeer::doCount($c);
- if ($result_count > 0) {
- $helpid = $this->getRequestParameter('helpid');
- if ($this->updatePeHelpStaff($helpid))
- $_SESSION['msg'] = 'Successfully updated the Help information for staff !!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- }else {
- $helpid = $this->getRequestParameter('helpid');
- if ($this->setPeHelpStaff())
- $_SESSION['msg'] = 'Successfully inserted the Help information for staff !!';
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- }
- }elseif ($helptype == "qm") {
- $c = new Criteria();
- $result_count = PeHelpQmPeer::doCount($c);
- if ($result_count > 0) {
- $helpid = $this->getRequestParameter('helpid');
- if ($this->updatePeHelpQm($helpid))
- $_SESSION['msg'] = 'Successfully updated the Help information !!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- //$this -> redirect('main/index');
- }else {
- if ($this->setPeHelpQm())
- $_SESSION['msg'] = 'Successfully inserted the Help information !!';
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- //$this -> redirect('main/index');
- }
- }
- }
- break;
- case 'Save Sample':
- if ($this->isCore() || $this->isHr()) {
- if (!$this->hasSample()) {
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- }
- $sampletype = $this->getRequestParameter('sampletype');
- if ($sampletype == "admin") {
- $readonlyStatus = $this->getRequestParameter('readonlyStatus');
- $helptype = $this->getRequestParameter('helptype');
- if ($this->getRequestParameter('update'))
- $peId = $this->getRequestParameter('update');
- else if ($this->getRequestParameter('peId'))
- $peId = $this->getRequestParameter('peId');
- $c = new Criteria();
- $result_count = PeSampleAdminPeer::doCount($c);
- if ($result_count > 0) {
- $sampleid = $this->getRequestParameter('sampleid');
- if ($this->updatePeSampleAdmin($sampleid))
- $_SESSION['msg'] = 'Successfully updated the Sample Form information for admin!!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- //$this -> redirect('main/index');
- if ($this->isHr()) {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId);
- }else {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=original');
- }
- }else {
- if ($this->setPeSampleAdmin())
- $_SESSION['msg'] = 'Successfully inserted the Sample Form information for admin !!';
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- //$this -> redirect('main/index');
- if ($this->isHr()) {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId);
- }else {
- if ($readonlyStatus)
- $this->redirect('main/AdminPEForm?view=' . $peId);
- else
- $this->redirect('main/AdminPEForm?edit=' . $peId . '&type=original');
- }
- }
- }
- elseif ($sampletype == "staff") {
- $c = new Criteria();
- $result_count = PeSampleStaffPeer::doCount($c);
- if ($result_count > 0) {
- $sampleid = $this->getRequestParameter('sampleid');
- if ($this->updatePeSampleStaff($sampleid))
- $_SESSION['msg'] = 'Successfully updated the Sample Form information for staff !!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- // $this -> redirect('main/index');
- }else {
- if ($this->setPeSampleStaff())
- $_SESSION['msg'] = 'Successfully inserted the Sample Form information for staff !!';
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- // $this -> redirect('main/index');
- }
- }elseif ($sampletype == "qm") {
- $c = new Criteria();
- $result_count = PeSampleQmPeer::doCount($c);
- if ($result_count > 0) {
- $sampleid = $this->getRequestParameter('sampleid');
- if ($this->updatePeSampleQm($sampleid))
- $_SESSION['msg'] = 'Successfully updated the Sample Form information !!';
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- // $this -> redirect('main/index');
- }else {
- if ($this->setPeSampleQm())
- $_SESSION['msg'] = 'Successfully inserted the Sample Form information !!';
- else
- $_SESSION['error_msg'] = 'Your insertion failed !!!!';
- // $this -> redirect('main/index');
- }
- }
- }
- break;
- case 'Re-Submit':
- $success = $this->validateMark();
- if ($success == false) {
- $PeId = $this->getRequestParameter('update');
- $this->redirect('main/PeForm?edit=' . $PeId);
- break;
- }
- if ($this->isCore() || $this->isAdmin()) {
- $peStatus = 4;
- $validated = $this->validation();
- if ($validated) {
- if ($this->updatePEForm($peStatus)) {
- $_SESSION['msg'] = 'Successfully re-submitted the PE Form !!';
- $PeId = $this->getRequestParameter('peId');
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $resubmitEmployeeLog = $logs->getReSubmitEmployeeFormLog($PeId, $kidName, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Operation failed !!!!';
- $this->redirect('main/index');
- }
- }
- break;
- case 'Certify':
- if ($this->isCore() || $this->isAdmin()) {
- $peStatus = 8;
- if ($this->updatePeStatus($peStatus)) {
- $_SESSION['msg'] = 'Successfully Certified the PEForm !!';
- $PeId = $this->getRequestParameter('peId');
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $certifyEmployeeLog = $logs->getCertifyEmployeeFormLog($PeId, $kidName, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Operation failed !!!!';
- $this->redirect('main/index');
- }
- break;
- case 'Finalize':
- if ($this->isCore() || $this->isAdmin()) {
- $peStatus = 10;
- if ($this->updatePeStatus($peStatus)) {
- $_SESSION['msg'] = 'Successfully Finalized the PEForm !!';
- $PeId = $this->getRequestParameter('peId');
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $finalizeEmployeeLog = $logs->getfinalizeEmployeeFormLog($PeId, $kidName, $empName);
- }
- else
- $_SESSION['error_msg'] = 'Operation failed !!!!';
- $this->redirect('main/index');
- }
- break;
- case 'Save Changes':
- if ($this->isHr()) {
- $peStatus = 10;
- if ($this->getRequestParameter('edit'))
- $PeId = $this->getRequestParameter('edit');
- else if ($this->getRequestParameter('update'))
- $PeId = $this->getRequestParameter('update');
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($PeId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- if ($this->updatePEForm($peStatus)) {
- $logs = new PelogsPeer();
- $logs->getUpdatedByHrFormLog($PeId, $kidName, $empName);
- $_SESSION['msg'] = 'Successfully made changes to PE Form !!';
- $this->redirect('main/PeForm?edit=' . $PeId);
- }
- else
- $_SESSION['error_msg'] = 'Your updation failed !!!!';
- $this->redirect('main/index');
- }else
- $_SESSION['error_msg'] = 'Your updation has failed !!!!';
- $this->redirect('main/index');
- }
- }
- public function executeDeletePEForm(sfWebRequest $request) {
- if ($this->getRequestParameter('peId')) {
- $this->peId = $this->getRequestParameter('peId');
- } else {
- $peId = $this->getRequestparameter('delete');
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result) {
- $peEmpId = $result[0]->getEmpId();
- $peStatusId = $result[0]->getStatusId();
- $petakenBy = $result[0]->getTakenBy();
- }
- if ($peEmpId == $_SESSION['empId'] && ($peStatusId == 3)) {
- $_SESSION['error_msg'] = "You are not authorized to delete the PEForm";
- $this->redirect('main/index');
- }
- if ($this->isCore() && $petakenBy != $_SESSION['empId'] && $peStatusId == 3 && !$this->getRequestparameter('forAdminAssigning') && !$this->coreCheck($petakenBy)) {
- $_SESSION['error_msg'] = "You are not authorized to delete the PEForm";
- $this->redirect('main/index');
- }
- $peEmployeeInstance = new PeEmployeesPeer();
- $empId = $peEmployeeInstance->getEmpId($peId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empId);
- if (($this->isSelf($peId, $empId) && $this->isStaffSaved($peId)) || ($this->isAdmin() && $this->isAdminSaved($peId)) || $this->getRequestparameter('forAdminAssigning') || ($this->isCore() && $this->isAdminSaved($peId)) || ($this->isAdmin() && $this->isMonthlySaved($peId)) || ($this->isCore() && $this->isMonthlySaved($peId))) {
- if ($this->isSelf($peId, $empId) && $this->isStaffSaved($peId)) {
- $logs = new PelogsPeer();
- $deleteEmployeeLog = $logs->getDeletePELog($peId, $kidName);
- } else if ($this->isAdmin() && $this->isAdminSaved($peId) || $this->isCore() && $this->isAdminSaved($peId)) {
- $peEmployee = new PeEmployeesPeer();
- $empid = $peEmployee->getEmpId($peId);
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $kidName = $groupwareEmployee->getEmployeeName($empid);
- $empName = $groupwareEmployee->getEmployeeName($_SESSION['empId']);
- $logs = new PelogsPeer();
- $approveEmployeeLog = $logs->getDeletePEAdminLog($peId, $kidName, $empName);
- } else if ($this->getRequestparameter('forAdminAssigning')) {
- }
- $this->deleteAccomplishments($peId);
- $this->deleteResponsibilities($peId);
- $this->deleteCommunication($peId);
- $this->deleteSatisfaction($peId);
- $this->deleteDevelopmentPlan($peId);
- $this->deleteJobKnowledge($peId);
- $this->deleteLeaveAttendance($peId);
- $this->deleteManagementSkills($peId);
- $this->deleteOtherActivity($peId);
- $this->deleteQMS($peId);
- $this->deleteQualityQuantity($peId);
- $this->deleteSocialEffectiveness($peId);
- $this->deleteEmpComments($peId);
- $this->deletePeEmployees($peId);
- $_SESSION['msg'] = 'Successfully Deleted the PE Form';
- $this->redirect('main/index');
- } else {
- $_SESSION['error_msg'] = 'You are not authorised to delete the PE Form';
- $this->redirect('main/index');
- }
- }
- }
- function deleteAccomplishments($peId) {
- $criteria = new Criteria();
- $criteria->add(AccomplishmentsPeer::PEID, $peId);
- AccomplishmentsPeer::doDelete($criteria);
- }
- function deleteResponsibilities($peId) {
- $criteria = new Criteria();
- $criteria->add(ResponsibilitiesPeer::PEID, $peId);
- ResponsibilitiesPeer::doDelete($criteria);
- }
- function deleteCommunication($peId) {
- $criteria = new Criteria();
- $criteria->add(CommunicationPeer::PEID, $peId);
- CommunicationPeer::doDelete($criteria);
- }
- function deleteSatisfaction($peId) {
- $criteria = new Criteria();
- $criteria->add(SatisfactionPeer::PEID, $peId);
- SatisfactionPeer::doDelete($criteria);
- }
- function deleteDevelopmentPlan($peId) {
- $criteria = new Criteria();
- $criteria->add(DevelopmentPlanPeer::PEID, $peId);
- DevelopmentPlanPeer::doDelete($criteria);
- }
- function deleteJobKnowledge($peId) {
- $criteria = new Criteria();
- $criteria->add(JobKnowledgePeer::PEID, $peId);
- JobKnowledgePeer::doDelete($criteria);
- }
- function deleteLeaveAttendance($peId) {
- $criteria = new Criteria();
- $criteria->add(LeaveAttendancePeer::PEID, $peId);
- LeaveAttendancePeer::doDelete($criteria);
- }
- function deleteManagementSkills($peId) {
- $criteria = new Criteria();
- $criteria->add(ManagementSkillsPeer::PEID, $peId);
- ManagementSkillsPeer::doDelete($criteria);
- }
- function deleteOtherActivity($peId) {
- $criteria = new Criteria();
- $criteria->add(OtherActivityPeer::PEID, $peId);
- OtherActivityPeer::doDelete($criteria);
- }
- function deleteQMS($peId) {
- $criteria = new Criteria();
- $criteria->add(QMSPeer::PEID, $peId);
- QMSPeer::doDelete($criteria);
- }
- function deleteQualityQuantity($peId) {
- $criteria = new Criteria();
- $criteria->add(QualityQuantityPeer::PEID, $peId);
- QualityQuantityPeer::doDelete($criteria);
- }
- function deleteSocialEffectiveness($peId) {
- $criteria = new Criteria();
- $criteria->add(SocialEffectivenessPeer::PEID, $peId);
- SocialEffectivenessPeer::doDelete($criteria);
- }
- function deleteEmpComments($peId) {
- $criteria = new Criteria();
- $criteria->add(EmpCommentsPeer::PEID, $peId);
- EmpCommentsPeer::doDelete($criteria);
- }
- function deletePeEmployees($peId) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- PeEmployeesPeer::doDelete($criteria);
- }
- function isStaffSaved($peId) {
- $peEmployeesInstance = new PeEmployeesPeer();
- $status = $peEmployeesInstance->getPeStatus($peId, 'saved');
- return $status;
- }
- function isAdminSaved($peId) {
- $peEmployeesInstance = new PeEmployeesPeer();
- $status = $peEmployeesInstance->getPeStatus($peId, 'AdminSaved');
- return $status;
- }
- function isMonthlySaved($peId) {
- $peEmployeesInstance = new PeEmployeesPeer();
- $status = $peEmployeesInstance->getPeStatus($peId, 'MonthlySaved');
- return $status;
- }
- function isStaffAndAdminSaved($empId) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::STATUSID, 2);
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $statuscount = PeEmployeesPeer::doCount($criteria);
- if ($statuscount) {
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::STATUSID, 3, Criteria::GREATER_EQUAL);
- $criteria->add(PeEmployeesPeer::EMPID, $empId);
- $status_count = PeEmployeesPeer::doCount($criteria);
- }
- return $status_count;
- }
- // Function to display the Pe Notification for each employee's home page
- function getPeNotification($number =null) {
- $i = 0;
- $displayCount = PAGE;
- if ($this->isStaff() || $this->isQm()) {
- $empId = $this->getUser()->getAttribute('empId');
- $customCriteria = ' WHERE pe1.empId in(' . $empId . ') ';
- } else {
- $customCriteria = '';
- }
- // $customCriteria .= ' AND
- // pe1.STATUSID = (SELECT
- // MAX(pe2.STATUSID)
- // FROM
- // PE_Employees pe2
- // WHERE
- // pe1.EMPID=pe2.EMPID
- // )';
- $criteria = new Criteria();
- $con = Propel::getConnection();
- $sql = 'SELECT
- COUNT(*) AS NO
- FROM
- PE_Employees pe1
- JOIN PE_Dates ped
- ON (pe1.REVIEWDATE >= ped.YEAR AND ped.NAME = \'Dashboard\')
- ' . $customCriteria . '
- ORDER BY
- pe1.ISSUEDATE DESC';
- $stmt = $con->prepare($sql);
- $stmt->execute();
- if ($results = $stmt->fetch()) {
- $noOfPeForms = $results['NO'];
- if ($noOfPeForms % $displayCount == 0)
- $this->noOfNotifications = $noOfPeForms / $displayCount;
- else {
- $reminder = $noOfPeForms % $displayCount;
- $noOfPeForms = $noOfPeForms - $reminder;
- $this->noOfNotifications = ($noOfPeForms / $displayCount) + 1;
- }
- }
- if ($number <= $this->noOfNotifications && $number != 0) {
- $this->flag = true;
- } else {
- $this->flag = false;
- }
- $sql = 'SELECT
- pe1.PEID,pe1.EMPID,pe1.STATUSID,pe1.ISSUEDATE
- FROM
- PE_Employees pe1
- JOIN PE_Dates ped
- ON (pe1.REVIEWDATE >= ped.YEAR AND ped.NAME = \'Dashboard\')
- ' . $customCriteria . '
- ORDER BY
- pe1.ISSUEDATE DESC';
- $stmt = $con->prepare($sql);
- $stmt->execute();
- $criteriaTwo = new Criteria();
- $resultObject = PeStatusPeer::doSelect($criteriaTwo);
- if ($resultObject) {
- foreach ($resultObject as $result) {
- $peStatusArray[$result->getStatusId()] = $result->getStatus();
- }
- }
- while ($results = $stmt->fetch()) {
- $GroupWareEmployeeInstance = new GroupwareEmployeesPeer();
- $EmployeeName = $GroupWareEmployeeInstance->getEmployeeName($results['EMPID']);
- $links = link_to($EmployeeName, 'main/PeForm?view=' . $results['PEID']);
- $htmls .= '<tr>';
- $htmls .= '<td><b>' . $links . '</b></td>';
- $htmls .= '<td>' . $results['ISSUEDATE'] . '</td>';
- $htmls .= '<td><span>' . $peStatusArray[$results['STATUSID']] . '</span></td>';
- $htmls .= '</tr>';
- $i++;
- if ($number == null && $i == $displayCount)
- break;
- else if ($number != null && $i <= $displayCount * ($number - 1)) {
- $htmls = '';
- } else if ($i >= $displayCount * $number && $number != null) {
- break;
- }
- }
- $this->html = $htmls;
- }
- function getPeAdminNotification($number =null) {
- $i = 0;
- if ($this->isAdmin()) {
- $displayCount = PAGE;
- // $teamMembers = $this->getUser()->getAttribute('teamMembers');
- $teamMembers = GroupwareEmployeesPeer::getAllSubordinatesId($this->getUser()->getAttribute('empId'));
- $teamMembers[] = $this->getUser()->getAttribute('empId');
- $members = implode(',', $teamMembers);
- //echo "<pre>";print_r($members);die;
- $customCriteria = ' WHERE pe1.empId in(' . $members . ') ';
- $adminName = $this->getUser()->getAttribute('empName');
- $criteria = new Criteria();
- $con = Propel::getConnection();
- // $customCriteria .= 'and
- // pe1.STATUSID = (SELECT
- // MAX(pe2.STATUSID)
- // FROM
- // PE_Employees pe2
- // WHERE
- // pe1.EMPID=pe2.EMPID
- // ) && pe1.STATUSID!=1';
- /* Code to find the number of records */
- $sql = 'SELECT
- COUNT(*) AS NO
- FROM
- PE_Employees pe1
- JOIN PE_Dates ped
- ON (pe1.REVIEWDATE >= ped.YEAR AND ped.NAME = \'Dashboard\')
- ' . $customCriteria . '
- ORDER BY
- pe1.ISSUEDATE DESC';
- $stmt = $con->prepare($sql);
- $stmt->execute();
- if ($results = $stmt->fetch()) {
- $noOfPeForms = $results['NO'];
- if ($noOfPeForms % $displayCount == 0)
- $this->noOfNotifications = $noOfPeForms / $displayCount;
- else {
- $reminder = $noOfPeForms % $displayCount;
- $noOfPeForms = $noOfPeForms - $reminder;
- $this->noOfNotifications = ($noOfPeForms / $displayCount) + 1;
- }
- }
- if ($number <= $this->noOfNotifications && $number != 0) {
- $this->flag = true;
- } else {
- $this->flag = false;
- }
- $sql = 'SELECT
- pe1.PEID,pe1.EMPID,pe1.STATUSID,pe1.ISSUEDATE
- FROM
- PE_Employees pe1
- JOIN PE_Dates ped
- ON (pe1.REVIEWDATE >= ped.YEAR AND ped.NAME = \'Dashboard\')
- ' . $customCriteria . '
- ORDER BY
- pe1.ISSUEDATE DESC';
- $stmt = $con->prepare($sql);
- $stmt->execute();
- // $stmt->execute();
- $criteriaTwo = new Criteria();
- $resultObject = PeStatusPeer::doSelect($criteriaTwo);
- if ($resultObject) {
- foreach ($resultObject as $result) {
- $peStatusArray[$result->getStatusId()] = $result->getStatus();
- }
- }
- while ($results = $stmt->fetch()) {
- $GroupWareEmployeeInstance = new GroupwareEmployeesPeer();
- $EmployeeName = $GroupWareEmployeeInstance->getEmployeeName($results['EMPID']);
- switch ($results['STATUSID']) {
- case '1':$links = $EmployeeName;
- break;
- case '2':
- $links = '<b><i>'.link_to($EmployeeName, 'main/PeForm?view=' . $results['PEID']).'</i></b>';
- break;
- default :
- $links = '<b><i>'.link_to($EmployeeName, 'main/PeForm?view=' . $results['PEID']).'</i></b>';
- }
- $htmls .= '<tr>';
- $htmls .= '<td>' . $links . '</td>';
- $htmls .= '<td>' . $results['ISSUEDATE'] . '</td>';
- $htmls .= '<td><span>' . $peStatusArray[$results['STATUSID']] . '</span></td>';
- $htmls .= '</tr>';
- $i++;
- if ($number == null && $i == $displayCount)
- break;
- else if ($number != null && $i <= $displayCount * ($number - 1)) {
- $htmls = '';
- } else if ($i >= $displayCount * $number && $number != null) {
- break;
- }
- }
- $this->html = $htmls;
- }
- }
- function getPeCoreNotification($number=null) {
- if ($this->isCore() || $this->isHr()) {
- $i = 0;
- $c = 1;
- $customCriteria = '';
- $displayCount = PAGE;
- $criteria = new Criteria();
- $con = Propel::getConnection();
- // $customCriteria = 'WHERE
- // pe1.STATUSID = (SELECT
- // MAX(pe2.STATUSID)
- // FROM
- // PE_Employees pe2
- // WHERE
- // pe1.EMPID=pe2.EMPID
- // )&& pe1.STATUSID !=3 && pe1.STATUSID !=1';
- $sql = 'SELECT
- COUNT(*) AS NO
- FROM
- PE_Employees pe1
- JOIN PE_Dates ped
- ON (pe1.REVIEWDATE >= ped.YEAR AND ped.NAME = \'Dashboard\')
- ' . $customCriteria . '
- ORDER BY
- pe1.ISSUEDATE DESC';
- $stmt = $con->prepare($sql);
- $stmt->execute();
- if ($results = $stmt->fetch()) {
- $noOfPeForms = $results['NO'];
- if ($noOfPeForms % $displayCount == 0)
- $this->noOfNotifications = $noOfPeForms / $displayCount;
- else {
- $reminder = $noOfPeForms % $displayCount;
- $noOfPeForms = $noOfPeForms - $reminder;
- $this->noOfNotifications = ($noOfPeForms / $displayCount) + 1;
- }
- }
- if ($number <= $this->noOfNotifications && $number != 0) {
- $this->flag = true;
- } else {
- $this->flag = false;
- }
- $sql = 'SELECT
- pe1.PEID,pe1.EMPID,pe1.STATUSID,pe1.ISSUEDATE
- FROM
- PE_Employees pe1
- JOIN PE_Dates ped
- ON (pe1.REVIEWDATE >= ped.YEAR AND ped.NAME = \'Dashboard\')
- ' . $customCriteria . '
- ORDER BY
- pe1.ISSUEDATE DESC';
- $stmt = $con->prepare($sql);
- $stmt->execute();
- $criteriaTwo = new Criteria();
- $resultObject = PeStatusPeer::doSelect($criteriaTwo);
- if ($resultObject) {
- foreach ($resultObject as $result) {
- $peStatusArray[$result->getStatusId()] = $result->getStatus();
- }
- }
- while ($results = $stmt->fetch()) {
- $GroupWareEmployeeInstance = new GroupwareEmployeesPeer();
- $EmployeeName = $GroupWareEmployeeInstance->getEmployeeName($results['EMPID']);
- $htmls .= '<tr>';
- if(!in_array($results['STATUSID'], array('1', '3', '12'))) {
- $htmls .= '<td><b><i>' . link_to($EmployeeName, 'main/PeForm?view=' . $results['PEID']) . '</i></b></td>';
- } else {
- $htmls .= '<td>' . $EmployeeName . '</td>';
- }
- $htmls .= '<td>' . $results['ISSUEDATE'] . '</td>';
- $htmls .= '<td><span>' . $peStatusArray[$results['STATUSID']] . '</span></td>';
- $htmls .= '</tr>';
- $i++;
- if ($number == null && $i == $displayCount)
- break;
- else if ($number != null && $i <= $displayCount * ($number - 1)) {
- $htmls = '';
- } else if ($i >= $displayCount * $number && $number != null) {
- break;
- }
- }
- $this->html = $htmls;
- }
- }
- function setSuggestions($PeId) {
- $suggestion = $this->getRequestParameter('suggestion');
- foreach ($suggestion as $suggestions) {
- if ($suggestions != '') {
- $pesuggestions = new PeSuggestions();
- $pesuggestions->setPeId($PeId);
- $pesuggestions->setSuggestion($suggestions);
- $pesuggestions->save();
- }
- }
- return true;
- }
- //function to get suggestions
- function getSuggestions($PeId) {
- $c = new Criteria();
- $c->add(PeSuggestionsPeer::PEID, $PeId);
- $emplsuggestion = PeSuggestionsPeer::doSelect($c);
- foreach ($emplsuggestion as $result) {
- $empl_sugg[] = $result->getSuggestion();
- }
- $this->empsugg = $empl_sugg;
- }
- function isEditable($peId) {
- $empId = $this->getUser()->getAttribute('empId');
- $empName = $this->getUser()->getAttribute('empName');
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- // echo "<pre>";print_r($result);exit;
- if ($result) {
- $peStatusId = $result[0]->getStatusId();
- $evaluator = $result[0]->getTakenBy();
- $petype = $result[0]->getType();
- $peEmpId = $result[0]->getEmpId();
- }
- if (($this->isStaff() || $this->isQm()) && ($peStatusId == 1))
- return true;
- else if ($this->isAdmin() && $this->isAllowed($peId)) {
- switch ($peStatusId) {
- case 1:
- if ($petype == SELFCODE && ($empId == $peEmpId))
- return true;
- else
- return false;
- break;
- case 2:return false;
- break;
- case 3:
- if ($empId != $peEmpId)
- return true;
- else
- return false;
- break;
- case 5:
- return true;
- break;
- //added by renjo for monthly PE
- case 12:
- case 13:
- if ($empId != $peEmpId)
- return true;
- else
- return false;
- break;
- default:
- return false;
- break;
- }
- }
- else if ($this->isCore()) {
- switch ($peStatusId) {
- case 2:
- case 3: if ($evaluator == $empId || $this->coreCheck($evaluator))
- return true;
- else
- return false;
- break;
- /*
- if($evaluator==$empId)
- return true;
- else
- return false;
- break; */
- case 5:
- //added by renjo for monthly PE
- case 12://return false;
- case 13:
- if ($evaluator == $empId)
- return true;
- else
- return false;
- break;
- default:
- return false;
- break;
- }
- }else if ($this->isHr()) {
- switch ($peStatusId) {
- case 10:
- case 13:
- return true;
- break;
- default:
- return false;
- break;
- }
- }
- else
- return false;
- }
- function isViewable($peId) {
- $empId = $this->getUser()->getAttribute('empId');
- $emp_name = $this->getUser()->getAttribute('empName');
- $criteria = new Criteria();
- $criteria->add(PeEmployeesPeer::PEID, $peId);
- $result = PeEmployeesPeer::doSelect($criteria);
- if ($result) {
- $peStatusId = $result[0]->getStatusId();
- $evaluator = $result[0]->getTakenBy();
- $petype = $result[0]->getType();
- $pe_empid = $result[0]->getEmpId();
- $pe_issuedate = $result[0]->getIssueDate();
- }
- if ($this->isAdmin() && $this->isAllowed($peId)) {
- switch ($peStatusId) {
- case 1:
- if ($petype == SELFCODE && ($empId == $pe_empid))
- return true;
- else
- return false;
- break;
- case 2:
- if ($petype == SELFCODE && ($empId == $pe_empid)) {
- return true;
- } else {
- $PeEmployeeInstance = new PeEmployeesPeer();
- $PeValues = $PeEmployeeInstance->getPestatusvalues('', $pe_empid, ORIGINALCODE, $pe_issuedate);
- if ($PeValues) {
- foreach ($PeValues as $values) {
- $peStatusOforiginal = $values->getStatusId();
- }
- if ($peStatusOforiginal >= 6) {
- return true;
- break;
- } else {
- $_SESSION['error_msg'] = 'You will be authorized to view this self evaluation after Core approves the PE Form';
- $this->redirect('main/index');
- break;
- }
- } else {
- $_SESSION['error_msg'] = 'You will be authorized to view this self evaluation after Core approves the PE Form';
- $this->redirect('main/index');
- break;
- return false;
- break;
- }
- }
- case 3:
- case 4:
- case 5:
- case 11:
- if ($empId != $pe_empid)
- return true;
- else
- return false;
- break;
- case 6: $this->getUser()->setAttribute('status', 6);
- return true;
- break;
- case 7:
- return true;
- break;
- default:
- return true;
- break;
- }
- }
- if ($this->isCore()) {
- switch ($peStatusId) {
- case 1:
- return false;
- break;
- case 2:
- return true;
- break;
- case 3: /* if($evaluator==$empId || $this->coreCheck($evaluator)) */
- return true;
- break;
- // if($evaluator==$empId)
- // return true;
- // else
- // return false;
- // break;
- default:
- return true;
- break;
- }
- }
- if (($this->isStaff()) && $this->isAllowed($peId)) {
- switch ($peStatusId) {
- case 1:
- return true;
- break;
- case 2:
- return true;
- break;
- case 6:
- return true;
- break;
- case 7:
- return true;
- break;
- case 8:
- return true;
- break;
- case 9:
- return true;
- break;
- case 10:
- return true;
- break;
- //added by renjo for monthly PE
- case 13:return true;
- break;
- default:
- return false;
- break;
- }
- }
- if ($this->isQm()) {
- switch ($peStatusId) {
- default:
- return true;
- break;
- }
- }
- if ($this->isHr()) {
- switch ($peStatusId) {
- case 1:
- return false;
- break;
- case 3:
- return false;
- break;
- default:
- return true;
- break;
- }
- }
- }
- /**
- * Function to get employee supervisor
- * @param $empId
- * set variable immediateSupervisor,immediateSupervisorId
- * set variable nextSupervisor, nextSupervisorId
- * set variable takenBy,takenById
- * return true
- */
- function getEmpSupervisor($empId) {
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $this->immediateSupervisorId = $groupwareEmployee->getEmployeeAdminId($empId);
- $this->immediateSupervisor = $groupwareEmployee->getEmployeeAdmin($empId);
- $this->nextSupervisorId = $groupwareEmployee->getEmployeeAdminId($this->immediateSupervisorId);
- $this->nextSupervisor = $groupwareEmployee->getEmployeeAdmin($this->immediateSupervisorId);
- /* To check for employee assignment */
- $criteria = new Criteria();
- $criteria->add(PeAssignedadminPeer::EMPLOYEE, $empId);
- $result = PeAssignedadminPeer::doSelect($criteria);
- if ($result) {
- $assignedAdmin = $result[0]->getNewAdmin();
- if ($assignedAdmin == $this->getUser()->getAttribute('empId')) {
- $this->takenById = $assignedAdmin;
- $this->takenBy = $groupwareEmployee->getEmployeeName($this->takenById);
- } else if ($empId == $this->getUser()->getAttribute('empId')) {
- // $this->takenById = $groupwareEmployee->getEmployeeAdminId($empId);
- // $this->takenBy = $groupwareEmployee->getEmployeeAdmin($empId);
- $this->takenById = $assignedAdmin;
- $this->takenBy = $groupwareEmployee->getEmployeeName($assignedAdmin);
- } else {
- $this->takenById = $this->getUser()->getAttribute('empId');
- $this->takenBy = $this->getUser()->getAttribute('empName');
- }
- } else if ($empId == $this->getUser()->getAttribute('empId')) {
- if ($result) {
- $this->takenById = $result[0]->getNewAdmin();
- $this->takenBy = $groupwareEmployee->getEmployeeAdmin($this->takenById);
- } else {
- $this->takenById = $this->immediateSupervisorId;
- $this->takenBy = $this->immediateSupervisor;
- }
- } else if ($this->isCore()) {
- $this->takenById = $this->getUser()->getAttribute('empId');
- $this->takenBy = $this->getUser()->getAttribute('empName');
- } else if ($this->immediateSupervisorId == $this->getUser()->getAttribute('empId')) {
- $this->takenById = $this->immediateSupervisorId;
- $this->takenBy = $this->immediateSupervisor;
- } else {
- $_SESSION['error_msg'] = 'You are not authorized to evaluate the employee';
- $this->redirect('main/index');
- }
- return true;
- }
- /**
- *
- */
- function getEmpSupervisorforMonthly($empId) {
- $groupwareEmployee = new GroupwareEmployeesPeer();
- $immediateSupervisorId = $groupwareEmployee->getEmployeeAdminId($empId);
- $nextSupervisorId = $groupwareEmployee->getEmployeeAdminId($immediateSupervisorId);
- /* To check for employee assignment */
- $criteria = new Criteria();
- $criteria->add(PeAssignedadminPeer::EMPLOYEE, $empId);
- $result = PeAssignedadminPeer::doSelect($criteria);
- if ($result) {
- $assignedAdmin = $result[0]->getNewAdmin();
- if ($assignedAdmin == $this->getUser()->getAttribute('empId')) {
- $this->takenById = $assignedAdmin;
- $this->takenBy = $groupwareEmployee->getEmployeeName($this->takenById);
- } else if ($empId == $this->getUser()->getAttribute('empId')) {
- // $this->takenById = $groupwareEmployee->getEmployeeAdminId($empId);
- // $this->takenBy = $groupwareEmployee->getEmployeeAdmin($empId);
- $this->takenById = $assignedAdmin;
- $this->takenBy = $groupwareEmployee->getEmployeeName($assignedAdmin);
- } else {
- $this->takenById = $this->getUser()->getAttribute('empId');
- $this->takenBy = $this->getUser()->getAttribute('empName');
- }
- } else if ($empId == $this->getUser()->getAttribute('empId')) {
- if ($result) {
- $this->takenById = $result[0]->getNewAdmin();
- $this->takenBy = $groupwareEmployee->getEmployeeAdmin($this->takenById);
- } else {
- $this->takenById = $this->immediateSupervisorId;
- $this->takenBy = $this->immediateSupervisor;
- }
- } else if ($this->isCore()) {
- $this->takenById = $this->getUser()->getAttribute('empId');
- $this->takenBy = $this->getUser()->getAttribute('empName');
- } else if ($immediateSupervisorId == $this->getUser()->getAttribute('empId')) {
- $this->takenById = $immediateSupervisorId;
- $this->takenBy = $this->immediateSupervisor;
- } else {
- $_SESSION['error_msg'] = 'You are not authorized to evaluate the employee';
- $this->redirect('main/index');
- }
- $employee["supervisor"] = $immediateSupervisorId;
- $employee["nextsupervisor"] = $nextSupervisorId;
- $employee["takenby"] = $this->takenById;
- return $employee;
- }
- /**
- *
- */
- function hasHelp() {
- $helpArray = array('eihelp', 'achelp', 'arhelp',
- 'qlwhelp', 'qnwhelp', 'cmnhelp',
- 'jkhelp', 'mshelp', 'sehelp',
- 'cdhelp', 'aphelp', 'lmhelp',
- 'qmshelp', 'oahelp', 'onahelp',
- 'echelp', 'dphelp'
- );
- foreach ($helpArray as $help) {
- if (!$this->getRequestParameter($help))
- continue;
- else
- return true;
- }
- return false;
- }
- function hasSample() {
- $sampleArray = array('eisample', 'acsample', 'arsample',
- 'qlwsample', 'qnwsample', 'cmnsample',
- 'jksample', 'mssample', 'sesample',
- 'cdsample', 'apsample', 'lmsample',
- 'qmssample', 'oasample', 'onasample',
- 'ecsample', 'dpsample'
- );
- foreach ($sampleArray as $sample) {
- if (!$this->getRequestParameter($sample))
- continue;
- else
- return true;
- }
- return false;
- }
- /**
- *
- * Range
- * |xxxxxxxxxxxx|
- * $von $bis
- * Case 1:|----------------xxxxxxx|
- * Case 2: |xxx---|
- * Case 3: |xxxxxxx|
- * Case 4: |---xxxxxxxxxxxxxx----------|
- * aus :|-------| |-------|
- *
- */
- public function betweenRangeCriteria($von=null, $bis=null, $von_feld=null, $bis_feld=null) {
- $startDate = strtotime($von);
- $endDate = strtotime($bis);
- $newStartDate = strtotime($von_feld);
- $newEndDate = strtotime($bis_feld);
- if (($newEndDate < $startDate) || ($endDate < $newStartDate))
- return true;
- else
- return false;
- }
- public function betweenRangeCriteriaAssign($oldStartDate=null, $oldEndDate=null) {
- $startDate = strtotime($oldStartDate);
- $endDate = strtotime($oldEndDate);
- $currentDate = strtotime(date('Y-m-d'));
- if (($currentDate >= $startDate) && ($currentDate <= $endDate))
- return true;
- else
- return false;
- }
- function qmCheck($empId) {
- $criteria = new Criteria();
- $criteria->add(GroupwareEmployeesPeer::TITLE, array('Quality Manager'), Criteria::IN);
- $criteria->add(GroupwareEmployeesPeer::ID, $empId);
- if (GroupwareEmployeesPeer::doCount($criteria))
- return true;
- else
- return false;
- }
- function adminCheck($empId) {
- //********************* code TO CHECK ADMIN or NOT*************************
- /* $criteria = new Criteria();
- $criteria->add(GroupwareEmployeesPeer::ID,$empId);
- $results = GroupwareEmployeesPeer::doSelect($criteria);
- foreach($results as $user){
- $empId = $user -> getId();
- } */
- $criteria = new Criteria();
- $criteria->add(GroupwareTeamsPeer::ADMIN_ID, $empId);
- $result = GroupwareTeamsPeer::doSelect($criteria);
- if ($result)
- return true;
- else
- return false;
- }
- function staffCheck($empId) {
- //********************* code TO CHECK ADMIN or NOT*************************
- if ($this->qmCheck($empId)) {
- return false;
- }
- else
- return true;
- }
- /* Function to check whether the employee has sufficient experience to submit the PE form */
- function checkExpToSubmitPE($empId) {
- $preExp = 0;
- // $empId = $this->getUser()->getAttribute('empId');
- $criteria = new Criteria();
- $criteria->add(GroupwarePreExperiencePeer::ID, $empId);
- $resultSet = GroupwarePreExperiencePeer::doSelect($criteria);
- if ($resultSet) {
- $preExp = $resultSet[0]->getExperience();
- }
- $expInMonth = $this->experienceInMonth($empId);
- if ($expInMonth >= 6) {
- $totalExp = $preExp + $expInMonth;
- if ($totalExp < 14) {
- if ($this->getUser()->getAttribute('empRole') == 'admin' || $this->getUser()->getAttribute('empRole') == 'core') {
- $_SESSION['error_msg'] = 'The selected employee hasn\'t the sufficient experience to conduct the PE';
- return false;
- }
- $_SESSION['error_msg'] = 'You are not allowed to submit the PE form as you don\'t have the sufficient experience in Poornam Info Vision.';
- $this->redirect('main/index');
- }
- } else {
- if ($this->getUser()->getAttribute('empRole') == 'admin' || $this->getUser()->getAttribute('empRole') == 'core') {
- $_SESSION['error_msg'] = 'The selected employee hasn\'t the sufficient experience to conduct the PE';
- return false;
- }
- $_SESSION['error_msg'] = 'You are not allowed to submit the PE form as you don\'t have the sufficient experience in Poornam Info Vision.';
- $this->redirect('main/index');
- }
- return true;
- }
- /* Function to calculate employee's experience in month */
- function experienceInMonth($empId) {
- $criteria = new Criteria();
- $criteria->add(GroupwareDatesPeer::EMPID, $empId);
- $criteria->add(GroupwareDatesPeer::DATECODE, 'HD');
- $results = GroupwareDatesPeer::doSelect($criteria);
- foreach ($results as $result) {
- $empJoined = $result->getEmpdate();
- }
- // **************** to calculate employees experience *****************
- $nowT = mktime(0, 0, 0, date("m") + 1, "01", date("Y"));
- $currentDate = date('Y-m-d', $nowT);
- $empJoined = GroupwareEmployeesPeer::getEmployeeUl($empId, $currentDate, $empJoined);
- $currentDateArray = explode('-', $currentDate);
- $empJoinedArray = explode('-', $empJoined);
- if ($empJoinedArray[0] != 0) {
- $currentYear = $currentDateArray[0];
- $currentMonth = $currentDateArray[1];
- $currentDay = $currentDateArray[2];
- $empJoinedYear = $empJoinedArray[0];
- $empJoinedMonth = $empJoinedArray[1];
- $empJoinedDay = $empJoinedArray[2];
- if ($empJoinedDay > JOINDATELIMIT) {
- if (($empJoinedMonth + 1) > 12) {
- $empJoinedMonth = 1;
- $empJoinedYear++;
- } else {
- $empJoinedMonth+=1;
- }
- $empJoinedMonth = date('m', mktime(0, 0, 0, $empJoinedMonth, 1, $empJoinedYear));
- $empJoinedDay = date('d', mktime(0, 0, 0, $empJoinedMonth, 1, $empJoinedYear));
- } else {
- $empJoinedDay = date('d', mktime(0, 0, 0, $empJoinedMonth, 1, $empJoinedYear));
- }
- $currentTime = mktime(0, 0, 0, $currentMonth, $currentDay, $currentYear);
- $empJoinedTime = mktime(0, 0, 0, $empJoinedMonth, $empJoinedDay, $empJoinedYear);
- // 60*60*24
- $totalmnths = (int) (($currentTime - $empJoinedTime) / 2628000);
- }
- return $totalmnths;
- }
- function checkRangeCriteria($selectedYear) {
- $this->current_empid = $this->getUser()->getAttribute('empId');
- $assignAdminIdarray = array();
- $criteria = new Criteria();
- if ($this->role == "admin") {
- $c1 = $criteria->getNewCriterion(PeAssignedadminPeer::ASSIGNEDBY, $this->current_empid);
- $c2 = $criteria->getNewCriterion(PeAssignedadminPeer::NEWADMIN, $this->current_empid);
- $c1->addOr($c2);
- $criteria->add($c1);
- }
- $resultSet = PeAssignedAdminPeer::doSelect($criteria);
- if ($resultSet) {
- foreach ($resultSet as $results) {
- $startDate = $results->getStartDate();
- $endDate = $results->getEndDate();
- $assignAdminId = $results->getAssignAdminId();
- $tmpDate1 = explode('-', $startDate);
- $startYear = $tmpDate1[0];
- $tmpDate2 = explode('-', $endDate);
- $endYear = $tmpDate2[0];
- if (($selectedYear >= $startYear) && ($selectedYear <= $endYear)) {
- if ($startYear != $selectedYear) {
- $assignAdminIdarray[] = $assignAdminId;
- }
- }
- }
- return $assignAdminIdarray;
- }
- }
- function coreCheck($empId) {
- $criteria = new Criteria();
- $criteria->add(GroupwareEmployeesPeer::RESIGNED, 'n');
- $criteria->add(GroupwareEmployeesPeer::GRADE, array('MEG'), Criteria::IN);
- $criteria->add(GroupwareEmployeesPeer::ID, $empId);
- if (GroupwareEmployeesPeer::doCount($criteria))
- return true;
- else
- return false;
- }
- }
Add Comment
Please, Sign In to add comment