/**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams)
 {
     $returner = parent::manage($verb, $args, $message, $messageParams);
     if (!$returner) {
         return false;
     }
     $this->import('UsageStatsSettingsForm');
     switch ($verb) {
         case 'settings':
             $templateMgr =& TemplateManager::getManager();
             $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
             $settingsForm = new UsageStatsSettingsForm($this);
             $settingsForm->initData();
             $settingsForm->display();
             break;
         case 'save':
             $settingsForm = new UsageStatsSettingsForm($this);
             $settingsForm->readInputData();
             if ($settingsForm->validate()) {
                 $settingsForm->execute();
                 $message = NOTIFICATION_TYPE_SUCCESS;
                 $messageParams = array('contents' => __('plugins.generic.usageStats.settings.saved'));
                 return false;
             } else {
                 $settingsForm->display();
             }
             break;
         default:
             return $returner;
     }
     return true;
 }
Ejemplo n.º 2
0
 /**
  * @see PKPPlugin::manage()
  */
 function manage($verb, $args, &$message, &$messageParams, &$pluginModalContent = null)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     $request =& $this->getRequest();
     $this->import('UsageStatsSettingsForm');
     switch ($verb) {
         case 'settings':
             $settingsForm = new UsageStatsSettingsForm($this);
             $settingsForm->initData();
             $pluginModalContent = $settingsForm->fetch($request);
             return true;
         case 'save':
             $settingsForm = new UsageStatsSettingsForm($this);
             $settingsForm->readInputData();
             if ($settingsForm->validate()) {
                 $settingsForm->execute();
                 $message = NOTIFICATION_TYPE_SUCCESS;
                 $messageParams = array('contents' => __('plugins.generic.usageStats.settings.saved'));
                 return false;
             } else {
                 $pluginModalContent = $settingsForm->fetch($request);
             }
             return true;
         default:
             break;
     }
 }
Ejemplo n.º 3
0
 /**
  * @see PKPPlugin::manage()
  */
 function manage($args, $request)
 {
     $this->import('UsageStatsSettingsForm');
     switch ($request->getUserVar('verb')) {
         case 'settings':
             $settingsForm = new UsageStatsSettingsForm($this);
             $settingsForm->initData();
             return new JSONMessage(true, $settingsForm->fetch($request));
         case 'save':
             $settingsForm = new UsageStatsSettingsForm($this);
             $settingsForm->readInputData();
             if ($settingsForm->validate()) {
                 $settingsForm->execute();
                 $notificationManager = new NotificationManager();
                 $notificationManager->createTrivialNotification($request->getUser()->getId(), NOTIFICATION_TYPE_SUCCESS, array('contents' => __('plugins.generic.usageStats.settings.saved')));
                 return new JSONMessage(true);
             }
             return new JSONMessage(true, $settingsForm->fetch($request));
     }
     return parent::manage($args, $request);
 }