public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; $loginUserEmail = $auth->getStorage()->read()->emailaddress; $loginUserName = $auth->getStorage()->read()->userfullname; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $actionflag = 5; $businessunitid = ''; $leavetypetext = ''; if ($id) { $leaverequestmodel = new Default_Model_Leaverequest(); $usersmodel = new Default_Model_Users(); $employeesmodel = new Default_Model_Employees(); $menumodel = new Default_Model_Menu(); $employeeleavetypesmodel = new Default_Model_Employeeleavetypes(); $loggedInEmployeeDetails = $employeesmodel->getLoggedInEmployeeDetails($loginUserId); if ($loggedInEmployeeDetails[0]['businessunit_id'] != '') { $businessunitid = $loggedInEmployeeDetails[0]['businessunit_id']; } $dataarr = array('leavestatus' => 4, 'modifieddate' => gmdate("Y-m-d H:i:s"), 'modifiedby' => $loginUserId); $where = array('id=?' => $id); $Id = $leaverequestmodel->SaveorUpdateLeaveRequest($dataarr, $where); $data = $leaverequestmodel->getsinglePendingLeavesData($id); $data = $data[0]; $appliedleavesdaycount = $data['appliedleavescount']; $to_date = $data['to_date']; $from_date = $data['from_date']; $reason = $data['reason']; $leavetypeid = $data['leavetypeid']; $repmngrnameArr = $usersmodel->getUserDetailsByID($data['rep_mang_id']); $reportingmanageremail = $repmngrnameArr[0]['emailaddress']; $reportingmanagername = $repmngrnameArr[0]['userfullname']; if ($Id == 'update') { $menuidArr = $menumodel->getMenuObjID('/manageremployeevacations'); $menuID = $menuidArr[0]['id']; $result = sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); /** MAILING CODE * */ if ($to_date == '' || $to_date == NULL) { $to_date = $from_date; } /* Mail to Employee */ $view = $this->getHelper('ViewRenderer')->view; $base_URL = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $mailpurpose = "The below leave(s) has been cancelled by your manager."; $this->view->base_url = $base_URL; $this->view->application_name = APPLICATION_NAME; $this->view->type = "New"; $this->view->emp_name = $loginUserName; $this->view->mailpurpose = $mailpurpose; $this->view->requester_name = $loginUserName; $this->view->NoOfDays = $appliedleavesdaycount; $this->view->leave_from = $from_date; $this->view->leave_to = $to_date; $this->view->reason_for_leave = $reason; $this->view->reporting_manager = $reportingmanagername; $options['subject'] = APPLICATION_NAME . ':Leave request cancelled by your manager'; $options['header'] = 'Leave Request'; $options['toEmail'] = $loginUserEmail; $options['toName'] = $loginUserName; $options['message'] = $view->render('mailtemplates/leaves.phtml'); sapp_Global::_sendEmail($options, "new"); /* End */ /* Mail to Reporting Manager */ $view = $this->getHelper('ViewRenderer')->view; $base_URL = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $mailpurpose = "The below leave(s) has been cancelled by your manager."; $this->view->base_url = $base_URL; $this->view->application_name = APPLICATION_NAME; $this->view->type = "New"; $this->view->emp_name = $reportingmanagername; $this->view->mailpurpose = $mailpurpose; $this->view->requester_name = $loginUserName; $this->view->NoOfDays = $appliedleavesdaycount; $this->view->leave_from = $from_date; $this->view->leave_to = $to_date; $this->view->reason_for_leave = $reason; $this->view->reporting_manager = $reportingmanagername; $options['subject'] = APPLICATION_NAME . ':Leave request cancelled by your manager'; $options['header'] = 'Leave Request'; $options['toEmail'] = $reportingmanageremail; $options['toName'] = $reportingmanagername; $options['message'] = $view->render('mailtemplates/leaves.phtml'); //$options['message'] = '<div>Hi,</div><div>The below leave(s) has been cancelled.</div><div><table ><tbody><tr><td width="28%" >Employee Name</td><td width="72%">' . $loginUserName . '</td></tr><tr ><td >No. of Day(s)</td><td>' . $appliedleavesdaycount . '</td>/tr><tr><td >From</td><td>' . $from_date . '</td></tr><tr ><td >To</td><td>' . $to_date . '</td></tr><tr ><td >Reason for Leave</td><td>' . $reason . '</td></tr></tbody></table></div>'; sapp_Global::_sendEmail($options, "new"); /* End */ /* Mail to HR */ $view = $this->getHelper('ViewRenderer')->view; $base_URL = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl(); $mailpurpose = "The below leave(s) has been cancelled by your manager."; $this->view->base_url = $base_URL; $this->view->application_name = APPLICATION_NAME; $this->view->type = "New"; $this->view->emp_name = 'Leave management'; $this->view->mailpurpose = $mailpurpose; $this->view->requester_name = $loginUserName; $this->view->NoOfDays = $appliedleavesdaycount; $this->view->leave_from = $from_date; $this->view->leave_to = $to_date; $this->view->reason_for_leave = $reason; $this->view->reporting_manager = $reportingmanagername; $options['subject'] = APPLICATION_NAME . ':Leave request cancelled by your manager'; $options['header'] = 'Leave Request'; $options['toEmail'] = constant('LV_HR_0'); $options['toName'] = 'Leave management'; $options['message'] = $view->render('mailtemplates/leaves.phtml'); sapp_Global::_sendEmail($options, "new"); $messages['message'] = 'Leave request cancelled'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Leave request cannot be cancelled'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Leave request cannot be cancelled'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); $this->_redirect(sapp_Global::_curPageURL()); //$this->_redirect('/manageremployeevacations'); }