* @var Zend_Layout */ protected $_layout; /** * Flash Message helper * @var Zend_Controller_Action_Helper_FlashMessenger */ protected $_flashMessenger; function init() { $this->_redirector = $this->_helper->getHelper('Redirector'); $this->_layout = $this->_helper->getHelper('Layout'); $this->_flashMessenger = $this->_helper->getHelper('FlashMessenger'); //Get Controller,Action,Module Name $this->_moduleName = Zend_Controller_Front::getInstance()->getRequest()->getModuleName(); $this->_controllerName = Zend_Controller_Front::getInstance()->getRequest()->getControllerName(); $this->_actionName = Zend_Controller_Front::getInstance()->getRequest()->getActionName(); $this->_cleanUrl = $this->view->rootUrl() . '/' . $this->_moduleName . '/' . $this->_controllerName . '/' . $this->_actionName; //get user profile $this->setUserProfile(); //Set layout $layout = Zend_Layout::getMvcInstance(); $layout->setLayoutPath(APPLICATION_PATH . '/modules/admin/layouts'); $layout->setLayout('admin'); //set redirector helper $this->_redirector = $this->_helper->getHelper('Redirector'); //set flash messenger $this->_flash = $this->_helper->FlashMessenger; //set Edit state if ($this->_actionName == 'edit') { $this->view->state_edit = TRUE; }
/** * IS: - * FS: Mengirimkan ke viewer: form * Desc: Fungsi untuk menampilkan halaman utama contact us */ public function indexAction() { // Set layout $this->_helper->layout->setLayout('kebudayaan'); // Variabel $request = $this->getRequest(); // Form $form = new Form_ContactUsForm(); // Request dari Form if ($request->isPost()) { if ($form->isValid($request->getPost())) { $contactDb = new Model_DbTable_Contact(); $contactDb->insertContact($request->getPost()); $this->view->submit = true; $form->reset(); } } $this->view->headTitle()->prepend($this->view->translate('id_menu_contact')); $this->view->langId = $this->_languageId; $this->view->titlehead = $this->view->translate('id_menu_contact'); $this->view->titleform = $this->view->translate('id_title_contactus'); $this->view->bigPageTitle = $this->view->translate('id_menu_contact'); $this->view->bgClass = 'red'; // View $this->view->form = $form; $this->view->setAsConversionPage = true; }
/** * IS: Parameter name, email, subject terdeklarasi * FS: Mengirimkan ke viewer: success * Desc: Fungsi untuk melakukan mengirimkan email kepada administrator dan * melakukan penyimpanan data di tabel Contact * * @param Zend_Request $request */ private function _sendMessage($request) { // Model $contactSubject = new Model_DbTable_ContactSubject(); $contactDb = new Model_DbTable_Contact(); // Data $fromName = $this->_getParam('name'); $fromEmail = $this->_getParam('email'); $subject = '[Budaya Indonesia] New comment with topic: ' . $contactSubject->getNameById($this->_getParam('subject')); if (APPLICATION_ENV == 'development') { $to = array('*****@*****.**'); } // Jika email tidak diblacklist //$sendEmail = parent::_sendEmail($msg, $fromName, $fromEmail, $subject, $to); $contactDb->insertContact($request->getPost()); $this->view->success = true; // if ($sendEmail) { // Masukkan data ke tabel // } }
/** * IS: - * FS: - * Desc: Fungsi yang mengatur aksi untuk seleksi beberapa item */ public function actionAction() { //form submit ke sini //di sini ditentukan aksi2 apa aja yg dilakukan //tergantung SUATU variabel: $_POST["actionnya"] $con = new Model_DbTable_Contact(); if ($_POST['actionnya'] && $_POST['contact_item']) { switch ($_POST['actionnya']) { case 'delete_selected': $id = $_POST['contact_item']; //print_r ($id); for ($i = 0; $i < count($id); $i++) { $con->deleteContact($id[$i]); $this->loggingaction('contact', 'delete', $id[$i]); } $this->_redirect($this->view->rootUrl('/admin/contact/')); break; case 'toggle_flag_selected': $contact_db = new Model_DbTable_Contact(); foreach ($_POST['contact_item'] as $id) { $contacts = $contact_db->getAllById($id); if (count($contacts) > 0) { $new_flag = (bool) $contacts[0]['flag'] ? '0' : '1'; $new_data = array('flag' => $new_flag); $contact_db->updateContact($new_data, $id); $this->loggingaction('contact', 'edit', $id); } } $this->_redirect($this->view->rootUrl('/admin/contact/')); break; case 'flag_selected': $contact_db = new Model_DbTable_Contact(); foreach ($_POST['contact_item'] as $id) { $contacts = $contact_db->getAllById($id); if (count($contacts) > 0) { $contact_db->updateContact(array('flag' => '1'), $id); $this->loggingaction('contact', 'edit', $id); } } $this->_redirect($this->view->rootUrl('/admin/contact/')); break; case 'unflag_selected': $contact_db = new Model_DbTable_Contact(); foreach ($_POST['contact_item'] as $id) { $contacts = $contact_db->getAllById($id); if (count($contacts) > 0) { $contact_db->updateContact(array('flag' => '0'), $id); $this->loggingaction('contact', 'edit', $id); } } $this->_redirect($this->view->rootUrl('/admin/contact/')); break; case '': $this->_redirect($this->view->rootUrl('/admin/contact/')); } } }
} public function deleteeventenglishAction() { $event_id = $this->_getParam('eventid'); $table_event = new Model_DbTable_Event(); $table_event_desc = new Model_DbTable_EventDesc(); $table_poitoevent = new Model_DbTable_PoiToEvent(); $table_event_desc->deleteEvent2($event_id, 1); $this->loggingaction('event', 'delete', $event_id); $this->_flash->addMessage("1\\Event Indonesian Translation Delete Success!"); }
$paginator = parent::setPaginator($select, $page_row); } else { $paginator = parent::setPaginator($select); } //if this is a new search then return the page number back to the 1st page if ($new_search) { $paginator->setCurrentPageNumber(1); } $this->view->paginator = $paginator;