Esempio n. 1
0
 /**
  * Action to edit a group
  * @param $args array, first parameter is the ID of the group to edit
  * @param $request PKPRequest
  * @return string Serialized JSON object
  */
 function editGroup($args, &$request)
 {
     $groupId = isset($args['rowId']) ? $args['rowId'] : null;
     $router =& $request->getRouter();
     $press =& $router->getContext($request);
     if ($groupId !== null) {
         $groupDao =& DAORegistry::getDAO('GroupDAO');
         $group =& $groupDao->getById($groupId, ASSOC_TYPE_PRESS, $press->getId());
         if (!$group) {
             $json = new JSON(false);
             return $json->getString();
         }
     } else {
         $group = null;
     }
     import('controllers.grid.settings.masthead.form.GroupForm');
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->assign('pageTitle', $group === null ? 'manager.groups.createTitle' : 'manager.groups.editTitle');
     $groupForm = new GroupForm($group);
     if ($groupForm->isLocaleResubmit()) {
         $groupForm->readInputData();
     } else {
         $groupForm->initData();
     }
     $json = new JSON(true, $groupForm->fetch($request));
     return $json->getString();
 }