Inheritance: extends Form
Beispiel #1
0
 /**
  * Save changes to a section.
  */
 function updateSection($args)
 {
     $this->validate();
     $this->setupTemplate(true);
     import('classes.manager.form.SectionForm');
     $sectionForm = new SectionForm(!isset($args) || empty($args) ? null : (int) $args[0]);
     switch (Request::getUserVar('editorAction')) {
         case 'addSectionEditor':
             $sectionForm->includeSectionEditor((int) Request::getUserVar('userId'));
             $canExecute = false;
             break;
         case 'removeSectionEditor':
             $sectionForm->omitSectionEditor((int) Request::getUserVar('userId'));
             $canExecute = false;
             break;
         default:
             $canExecute = true;
             break;
     }
     $sectionForm->readInputData();
     if ($canExecute && $sectionForm->validate()) {
         $sectionForm->execute();
         Request::redirect(null, null, 'sections');
     } else {
         $sectionForm->display();
     }
 }
Beispiel #2
0
 /**
  * Update a section
  * @param $args array
  * @param $request PKPRequest
  * @return JSONMessage JSON object
  */
 function updateSection($args, $request)
 {
     $sectionId = $request->getUserVar('sectionId');
     import('controllers.grid.settings.sections.form.SectionForm');
     $sectionForm = new SectionForm($request, $sectionId);
     $sectionForm->readInputData();
     if ($sectionForm->validate()) {
         $sectionForm->execute($args, $request);
         return DAO::getDataChangedEvent($sectionForm->getSectionId());
     }
     return new JSONMessage(false);
 }
function smarty_function_sectionForm($params, &$smarty)
{
    $page = $params['page'];
    $link = $params['link'];
    $path = $params['path'];
    $sf = new SectionForm($page, $link, $path);
    return $sf->outputForm();
}