/** * Edits an existing user group * * @access public * @return void */ public function editAction() { $this->title = 'Edit user group'; $form = new GroupForm(); $groupModel = new Group(); if ($this->getRequest()->isPost()) { if ($form->isValid($this->getRequest()->getPost())) { $groupModel->save($form->getValues()); $this->_helper->FlashMessenger(array('msg-success' => 'The group was successfully edited.')); App_FlagFlippers_Manager::save(); $this->_redirect('/groups/'); } } else { $id = $this->_getParam('id'); if (!is_numeric($id)) { $this->_helper->FlashMessenger(array('msg-success' => 'The provided group_id is invalid.')); $this->_redirect('/groups/'); } $row = $groupModel->findById($id); if (empty($row)) { $this->_helper->FlashMessenger(array('msg-success' => 'The requested group could not be found.')); $this->_redirect('/groups/'); } $form->populate($row->toArray()); $this->view->item = $row; } $this->view->form = $form; }
public function configure() { parent::configure(); $this->useFields(array('name')); }
/** * Save changes to a group. */ function updateGroup() { $groupId = Request::getUserVar('groupId') === null ? null : (int) Request::getUserVar('groupId'); if ($groupId === null) { $this->validate(); $group = null; } else { $this->validate($groupId); $group =& $this->group; } $this->setupTemplate($group); import('manager.form.GroupForm'); $groupForm = new GroupForm($group); $groupForm->readInputData(); if ($groupForm->validate()) { $groupForm->execute(); Request::redirect(null, null, 'groups'); } else { $templateMgr =& TemplateManager::getManager(); $templateMgr->append('pageHierarchy', array(Request::url(null, 'manager', 'groups'), 'manager.groups')); $templateMgr->assign('pageTitle', $group ? 'manager.groups.editTitle' : 'manager.groups.createTitle'); $groupForm->display(); } }
/** * Update a masthead * @param $args array * @param $request PKPRequest * @return string Serialized JSON object */ function updateGroup($args, &$request) { $groupId = Request::getUserVar('groupId'); $press =& $request->getContext(); $groupDao =& DAORegistry::getDAO('GroupDAO'); $group =& $groupDao->getById($groupId, ASSOC_TYPE_PRESS, $press->getId()); import('controllers.grid.settings.masthead.form.GroupForm'); $groupForm = new GroupForm($group); $groupForm->readInputData(); if ($groupForm->validate()) { $groupForm->execute(); $row =& $this->getRowInstance(); $row->setGridId($this->getId()); $row->setId($groupForm->group->getId()); $rowData = array('groups' => $groupForm->group->getLocalizedTitle()); $row->setData($rowData); $row->initialize($request); $json = new JSON(true, $this->_renderRowInternally($request, $row)); } else { $json = new JSON(false); } return $json->getString(); }
public function deleteAction() { try { $form = new GroupForm(); if ($form->isValidForDelete()) { $group = Group::findOrFail(Input::get("id")); $group->delete(); } //return Redirect::route("group/index"); } catch (\Illuminate\Database\QueryException $e) { //001 Codigo error } return Redirect::route("group/index"); }