Пример #1
0
 function manage($verb, $args, &$message, &$messageParams)
 {
     if (!parent::manage($verb, $args, $message, $messageParams)) {
         return false;
     }
     switch ($verb) {
         case 'settings':
             $templateMgr =& TemplateManager::getManager();
             $journal =& Request::getJournal();
             $this->import('OpenAdsSettingsForm');
             $this->import('OpenAdsConnection');
             $openAdsConnection = new OpenAdsConnection($this, $this->getInstallationPath());
             $openAdsConnection->loadConfig();
             $form = new OpenAdsSettingsForm($this, $openAdsConnection, $journal->getId());
             if (array_shift($args) == 'save') {
                 $form->readInputData();
                 $form->execute();
                 Request::redirect(null, 'manager', 'plugins');
                 return false;
             } else {
                 $form->initData();
                 $form->display();
                 return true;
             }
         default:
             // Unknown management verb
             assert(false);
             return false;
     }
 }
Пример #2
0
 function manage($verb, $args, &$message)
 {
     $templateMgr =& TemplateManager::getManager();
     $journal =& Request::getJournal();
     $returner = false;
     switch ($verb) {
         case 'enable':
             $this->setEnabled(true);
             $message = Locale::translate('plugins.generic.openAds.enabled');
             break;
         case 'disable':
             $this->setEnabled(false);
             $message = Locale::translate('plugins.generic.openAds.disabled');
             break;
         case 'settings':
             $this->import('OpenAdsSettingsForm');
             $this->import('OpenAdsConnection');
             $openAdsConnection = new OpenAdsConnection($this, $this->getInstallationPath());
             $openAdsConnection->loadConfig();
             $form = new OpenAdsSettingsForm($this, $openAdsConnection, $journal->getId());
             if (array_shift($args) == 'save') {
                 $form->readInputData();
                 $form->execute();
                 Request::redirect(null, 'manager', 'plugins');
             } else {
                 $form->initData();
                 $form->display();
                 $returner = true;
             }
     }
     return $returner;
 }