Ejemplo n.º 1
0
 /**
  * Execute a management verb on this plugin
  * @param $verb string
  * @param $args array
  * @param $message string If a message is returned from this by-ref
  *  argument then it will be displayed as a notification if (and only
  *  if) the method returns false.
  * @return boolean will redirect to the plugin category page if false,
  *  otherwise will remain on the same page
  */
 function manage($verb, $args, &$message)
 {
     switch ($verb) {
         case 'settings':
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $journal =& Request::getJournal();
             $this->import('AbntSettingsForm');
             $form = new AbntSettingsForm($this, $journal->getId());
             if (Request::getUserVar('save')) {
                 $form->readInputData();
                 if ($form->validate()) {
                     $form->execute();
                     Request::redirect(null, 'manager', 'plugin');
                     return false;
                 } else {
                     $this->setBreadCrumbs(true);
                     $form->display();
                 }
             } else {
                 $this->setBreadCrumbs(true);
                 if ($form->isLocaleResubmit()) {
                     $form->readInputData();
                 } else {
                     $form->initData();
                 }
                 $form->display();
             }
             return true;
         default:
             // Unknown management verb, delegate to parent
             return parent::manage($verb, $args, $message);
     }
 }