/** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { $form = new Admin_Form_AccountForm(); $form->setRoleOption(); $admin_id = $this->_getParam('id'); $acc = new Model_DbTable_AdminAccount(); $data = $acc->getAllQueryById($admin_id); if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { $data = array('username' => $_POST['adminUser'], 'password' => md5($_POST['adminPassword']), 'email' => $_POST['adminEmail'], 'role_id' => $_POST['adminRole']); $acc->updateAccount($data, $admin_id); $this->loggingaction('account', 'edit', $admin_id); $this->_flash->addMessage('1\\Update Success!'); } else { $this->_flash->addMessage('2\\Update Failed!'); } $this->_redirect($this->view->rootUrl('/admin/account/')); } $form->adminRole->setValue($data['role_id']); $form->adminUser->setValue($data['username']); $form->adminEmail->setValue($data['email']); $this->view->form = $form; }
if ($this->getRequest()->isPost()) { if ($form->isValid($_POST)) { $data = array('username' => $_POST['adminUser'], 'password' => md5($_POST['adminPassword']), 'email' => $_POST['adminEmail'], 'role_id' => $_POST['adminRole']); $account_id = $table_adminAccount->insertAccount($data); $this->loggingaction('account', 'create', $account_id); $this->_flashMessenger->setNamespace('success')->addMessage(array("Akun admin berhasil ditambahkan")); } else { $this->_helper->flashMessenger->setNamespace('error')->addMessage('Gagal menambahkan akun admin'); } $this->_redirector->gotoSimpleAndExit("index"); } $this->view->form = $form; } /** * IS: Parameter id terdeklarasi * FS: Mengirimkan ke viewer: form * Desc: Mengatur aksi yang dilakukan untuk halaman edit */ public function editAction() { $form = new Admin_Form_AccountForm(); $form->setRoleOption(); $admin_id = $this->_getParam('id'); $acc = new Model_DbTable_AdminAccount();