예제 #1
0
 /**
  * Display form to edit an announcement type.
  * @param $args array first parameter is the ID of the announcement type to edit
  * @param $request PKPRequest
  */
 function editAnnouncementType($args, &$request)
 {
     // FIXME: Remove call to validate() when all ManagerHandler implementations
     // (across all apps) have been migrated to the authorize() authorization approach.
     $this->validate();
     $this->setupTemplate($request, true);
     $typeId = !isset($args) || empty($args) ? null : (int) $args[0];
     $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
     // Ensure announcement type is valid and for this context
     if ($this->_announcementTypeIsValid($request, $typeId)) {
         import('classes.manager.form.AnnouncementTypeForm');
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->append('pageHierarchy', array($request->url(null, 'manager', 'announcementTypes'), 'manager.announcementTypes'));
         if ($typeId == null) {
             $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.createTitle');
         } else {
             $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.editTitle');
         }
         $announcementTypeForm = new AnnouncementTypeForm($typeId);
         if ($announcementTypeForm->isLocaleResubmit()) {
             $announcementTypeForm->readInputData();
         } else {
             $announcementTypeForm->initData();
         }
         $announcementTypeForm->display();
     } else {
         $router =& $request->getRouter();
         $request->redirectUrl($router->url($request, null, null, 'announcementTypes'));
     }
 }
 /**
  * Display form to edit an announcement type.
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function editAnnouncementType($args, $request)
 {
     $announcementTypeId = (int) $request->getUserVar('announcementTypeId');
     $context = $request->getContext();
     $contextId = $context->getId();
     $announcementTypeForm = new AnnouncementTypeForm($contextId, $announcementTypeId);
     $announcementTypeForm->initData($args, $request);
     return new JSONMessage(true, $announcementTypeForm->fetch($request));
 }
 /**
  * Display form to edit an announcement type.
  * @param $args array optional, first parameter is the ID of the announcement type to edit
  */
 function editAnnouncementType($args = array())
 {
     $this->validate();
     $this->setupTemplate(true);
     $typeId = !isset($args) || empty($args) ? null : (int) $args[0];
     $announcementTypeDao =& DAORegistry::getDAO('AnnouncementTypeDAO');
     // Ensure announcement type is valid and for this context
     if ($this->_announcementTypeIsValid($typeId)) {
         import('manager.form.AnnouncementTypeForm');
         $templateMgr =& TemplateManager::getManager();
         $templateMgr->append('pageHierarchy', array(PKPRequest::url(null, 'manager', 'announcementTypes'), 'manager.announcementTypes'));
         if ($typeId == null) {
             $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.createTitle');
         } else {
             $templateMgr->assign('announcementTypeTitle', 'manager.announcementTypes.editTitle');
         }
         $announcementTypeForm = new AnnouncementTypeForm($typeId);
         if ($announcementTypeForm->isLocaleResubmit()) {
             $announcementTypeForm->readInputData();
         } else {
             $announcementTypeForm->initData();
         }
         $announcementTypeForm->display();
     } else {
         PKPRequest::redirect(null, null, 'announcementTypes');
     }
 }