/** * Delete an existing vacancy * * @return void */ public function deleteAction() { $vacancyID = $this->getRequest()->getParam('id'); $careers = new Datasource_Cms_Careers(); $job = $careers->getByID($vacancyID); $careers->remove($vacancyID); // Record activity $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('hl_admin')); $username = $auth->getStorage()->read()->username; Application_Core_ActivityLogger::log('CMS Job Vacancy Deleted', 'complete', 'CMS-Admin', $username, "Job Title: " . $job['title']); $this->_helper->getHelper('FlashMessenger')->addMessage(array('deleted' => true)); $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/vacancies'); }
/** * Delete an existing news article * * @return void */ public function deleteAction() { $articleID = $this->getRequest()->getParam('id'); $this->view->currentPage = 'news'; $newsArticle = new Datasource_Cms_News(); $news = $newsArticle->getArticle($articleID); $newsArticle->remove($articleID); // Record activity $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('hl_admin')); $username = $auth->getStorage()->read()->username; Application_Core_ActivityLogger::log('CMS News Article Deleted', 'complete', 'CMS-Admin', $username, "News Article Title: " . $news['title']); $this->_helper->getHelper('FlashMessenger')->addMessage(array('deleted' => true)); $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/news'); }
/** * Deletes a quote entry * * @return void */ public function deleteAction() { $this->view->currentPage = 'headerQuotes'; $quoteDatasource = new Datasource_Cms_HeaderQuotes(); $quoteID = $this->getRequest()->getParam('id'); $quote = $quoteDatasource->getByID($quoteID); $quoteDatasource->remove($quoteID); // Record activity $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('hl_admin')); $username = $auth->getStorage()->read()->username; Application_Core_ActivityLogger::log('CMS Header Quote Deleted', 'complete', 'CMS-Admin', $username, "Quote: " . print_r($quote, true)); // Changes saved - so send them back with a nice success message $this->_helper->getHelper('FlashMessenger')->addMessage(array('deleted' => true)); $this->_helper->getHelper('Redirector')->goToUrl('/cms-admin/header-quotes'); }
/** * This function handles a login attempt and validates the credentials * * @return void */ public function loginAction() { $this->_helper->layout->setLayout('login'); $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('hl_admin')); if ($auth->hasIdentity()) { // User is already logged in so just push them into the system $this->_redirect('/cms_admin/index'); } $request = $this->getRequest(); if ($request->isPost()) { // We have post data from the login form - so attempt a login $form = $this->getLoginForm(); if (!$form->isValid($_POST)) { // Form is invalid $this->view->form = $form; //return $this->render(); } else { // The forms passed validation so we now need to check the identity of the user $adapter = Auth_CmsAdmin::getAdapter($form->getValues()); $result = $auth->authenticate($adapter); if (!$result->isValid()) { // Invalid credentials $form->setDescription('Invalid credentials provided'); $this->view->form = $form; //return $this->render('login'); // re-render the login form } else { // Valid credentials - store the details we need from the database and move the user to the index page $storage = $auth->getStorage(); $storage->write($adapter->getResultRowObject(array('username', 'real_name'))); // Record activity Application_Core_ActivityLogger::log('CMS Admin Login', 'complete', 'CMS-Admin', $_POST['username']); $this->_redirect('/cms-admin/index'); } } } }
/** * Send e-mail to HomeLet screen * * @return void */ public function emailAction() { if ($this->_enquiryId == null) { return; } $pageForm = new Form_TenantsReferencingTracker_Email(); $request = $this->getRequest(); $formData = $request->getPost(); $pageForm->populate($formData); $tatManager = new Manager_Referencing_Tat($this->_enquiryId); $tat = $tatManager->getTat(); $tatMailManager = new Manager_Referencing_TatMail($tatManager->_reference); if ($request->isPost()) { // Check if user's going back to the TAT index, or is submitting the form if (isset($formData['back'])) { // Redirect to index page $this->_helper->redirector->gotoUrl('/tenants/reference-tracker'); return; } else { // Check if this is to add/remove attachments, or is a full submit // TODO: It'd be nice to handle this by separating it out into a smooth non-page-refreshing AJAX method if (isset($formData['attachButton']) || isset($formData['deleteButton'])) { // Handle attachments if (isset($formData['attachButton'])) { $tatMailManager->addAttachments(); } else { $tatMailManager->deleteAttachments(); } } else { if ($pageForm->isValid($formData)) { // Successful set of data, send e-mail and show message to user $data = $pageForm->getValues(); $content = ''; $content .= "Enquiry ID: {$this->_enquiryId}\r\n\r\n"; $content .= "Name: {$data['name']}\r\n\r\n"; $content .= "Contact number or e-mail address: {$data['contact_info']}\r\n\r\n"; $content .= "Message to assessor:\r\n{$data['message']}\r\n\r\n"; $attachmentInfo = $tatMailManager->detailAttachments(); if (count($attachmentInfo) > 0) { $tatMailManager->notifyAssessorWithAttachments($content); $tatMailManager->deleteAttachments(); } else { $tatMailManager->notifyAssessor($content); } // Log MI event Application_Core_ActivityLogger::log('TAT Email HomeLet', 'complete', 'TAT', null, "IRN: {$this->_enquiryId}"); // Redirect to confirmation page, the redirect prevents // multiple submissions if user refreshes browser $this->_helper->redirector->gotoUrl('/tenants/reference-tracker/emailsent'); return; } } } } $this->view->reference = $tatManager->_reference; $this->view->form = $pageForm; }