public function deleteAction() { $auth = Zend_Auth::getInstance(); if ($auth->hasIdentity()) { $loginUserId = $auth->getStorage()->read()->id; } $id = $this->_request->getParam('objid'); $messages['message'] = ''; $actionflag = 3; if ($id) { $policiesModel = new Default_Model_Policies(); $policydata = $policiesModel->getPolicyDataByID($id); $data = array('isactive' => 0, 'modifiedby' => $loginUserId, 'modifieddate' => gmdate("Y-m-d H:i:s")); $where = array('id=?' => $id); $Id = $policiesModel->SaveorUpdatePolicyData($data, $where); if ($Id == 'update') { #$menuidArr = $menumodel->getMenuObjID('/policies'); #$menuID = $menuidArr[0]['id']; $menuID = -999; sapp_Global::logManager($menuID, $actionflag, $loginUserId, $id); $messages['message'] = 'Policy deleted successfully.'; $messages['msgtype'] = 'success'; } else { $messages['message'] = 'Policy cannot be deleted.'; $messages['msgtype'] = 'error'; } } else { $messages['message'] = 'Policy cannot be deleted.'; $messages['msgtype'] = 'error'; } $this->_helper->json($messages); $this->_redirect('policies/index'); }
/** * * @param type $policydatalog * @param type $mode */ public function SendPolicyEmail($policydatalog, $mode) { $policiesModel = new Default_Model_Policies(); $allEmployees = $policiesModel->getAllEmployees(); foreach ($allEmployees as $cEmployee) { $base_url = 'http://' . $this->getRequest()->getHttpHost() . $this->getRequest()->getBaseUrl() . "/policies/"; $view = $this->getHelper('ViewRenderer')->view; $this->view->base_url = $base_url; $this->view->type = $mode; $this->view->policyid = $policydatalog['policyid']; $this->view->policyname = $policydatalog['policyname']; $this->view->policygroup = $policydatalog['group']; $this->view->policyversion = $policydatalog['version']; $this->view->policynotes = $policydatalog['documentnotes']; $text = $view->render('mailtemplates/policy.phtml'); $options['subject'] = APPLICATION_NAME . ': New Policy is added'; $options['header'] = 'New Policy'; $options['toEmail'] = $cEmployee['emailaddress']; $options['toName'] = $cEmployee['userfullname']; $options['message'] = $text; //$options['cron'] = 'yes'; if ($options['toEmail'] != '') { sapp_Global::_sendEmail($options . "policy"); } } }