Esempio n. 1
0
 /**
  * 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();
     }
 }
Esempio n. 2
0
 /**
  * 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();
 }