/** * Validate the form */ protected function validateForm() { if ($this->frm->isSubmitted()) { $this->frm->cleanupFields(); // validation $fields = $this->frm->getFields(); $fields['title']->isFilled(BL::err('FieldIsRequired')); if ($this->frm->isCorrect()) { $item['title'] = $fields['title']->getValue(); BackendMailengineModel::updateGroup($this->id, $item); $item['id'] = $this->id; //--Delete users from the group BackendMailengineModel::deleteUserFromGroup($this->id); //--Check if there are users if (isset($fields["users"])) { //--Get all the users $users = $fields["users"]->getValue(); foreach ($users as $key => $value) { $userGroup = array(); $userGroup["group_id"] = $this->id; $userGroup["user_id"] = $value; //--Add user to the group BackendMailengineModel::insertUserToGroup($userGroup); } } BackendModel::triggerEvent($this->getModule(), 'after_edit_group', $item); $this->redirect(BackendModel::createURLForAction('groups') . '&report=edited&highlight=row-' . $item['id']); } } }