public function addAction() { $layoutPath = APPLICATION_PATH . '/templates/' . TEMPLATE_USED; $option = array('layout' => 'hethong/layout', 'layoutPath' => $layoutPath); Zend_Layout::startMvc($option); $translate = Zend_Registry::get('Zend_Translate'); $this->view->title = 'Quản lý Nhóm, Quyền - ' . $translate->_('TEXT_DEFAULT_TITLE'); $this->view->headTitle($this->view->title); $groupsModel = new Front_Model_Groups(); $error_message = array(); $success_message = ''; if ($this->_request->isPost()) { $group_name = trim($this->_arrParam['group_name']); $group_status = $this->_arrParam['group_status']; $group_order = $this->_arrParam['group_order']; $validator_length = new Zend_Validate_StringLength(array('min' => 4, 'max' => 255)); if (!is_numeric($group_order)) { $group_order = 0; } //kiem tra dữ liệu if (!$validator_length->isValid($group_name)) { $error_message[] = 'Tên nhóm phải bằng hoặc hơn 4 ký tự và nhỏ hơn hoặc bằng 255 ký tự.'; } if (!sizeof($error_message)) { $current_time = new Zend_Db_Expr('NOW()'); $groupsModel->insert(array('group_name' => $group_name, 'group_status' => $group_status, 'group_order' => $group_order, 'group_date_added' => $current_time, 'group_date_modified' => $current_time)); $success_message = 'Đã thêm nhóm mới thành công.'; } } $this->view->success_message = $success_message; $this->view->error_message = $error_message; }