Example #1
0
 function setPidsRetroactively($journalId, $pidAssignorPath, $pidResolverPath, $pidUsername, $pidPassword)
 {
     $pidResourceDao =& DAORegistry::getDAO('pidResourceDAO');
     $articleIdList = $pidResourceDao->getJournalArticleIDsWithoutPid($journalId, ASSOC_TYPE_PID_ARTICLE);
     foreach ($articleIdList as $articleId) {
         pidHandler::requestHsPid($pidAssignorPath, $pidResolverPath, $pidUsername, $pidPassword, $articleId);
     }
     return true;
 }
Example #2
0
 function manage($verb, $args)
 {
     $templateMgr =& TemplateManager::getManager();
     $templateMgr->register_function('plugin_url', array(&$this, 'smartyPluginUrl'));
     $journalId = $this->journal->getJournalId();
     $isEnabled = $this->getSetting($journalId, 'enabled');
     $this->addLocaleData();
     $returner = true;
     $publishedArticleDao =& DAORegistry::getDAO('PublishedArticleDAO');
     $publishedArticleIds = $publishedArticleDao->getPublishedArticleIdsByJournal($journalId);
     $articlesNoPid = pidHandler::countPublishedArticlesNoPid($journalId);
     $templateMgr->assign('articlesNoPid', $articlesNoPid);
     $templateMgr->assign('publishedArticles', count($publishedArticleIds));
     switch ($verb) {
         case 'enable':
             $this->updateSetting($journalId, 'enabled', true);
             $returner = false;
             break;
         case 'disable':
             $this->updateSetting($journalId, 'enabled', false);
             $returner = false;
             break;
         case 'settings':
             if ($isEnabled) {
                 $this->import('pidSettingsForm');
                 $form = new pidSettingsForm($this, $journalId);
                 if (Request::getUserVar('save')) {
                     $form->readInputData();
                     if ($form->validate()) {
                         $form->execute();
                         Request::redirect(null, 'manager');
                     }
                 }
                 if (Request::getUserVar('setPidsRetroactively')) {
                     $form->readInputData();
                     if ($form->validate()) {
                         $pidAssignorPath = $this->getSetting($journalId, 'pidAssignorPath');
                         $pidResolverPath = $this->getSetting($journalId, 'pidResolverPath');
                         $pidUsername = $this->getSetting($journalId, 'pidUsername');
                         $pidPassword = $this->getSetting($journalId, 'pidPassword');
                         pidHandler::setPidsRetroactively($journalId, $pidAssignorPath, $pidResolverPath, $pidUsername, $pidPassword);
                         Request::redirect(null, 'manager');
                     }
                 }
                 $form->initData();
                 $this->setBreadCrumbs(true);
                 $form->display();
             } else {
                 Request::redirect(null, 'manager');
             }
             break;
     }
     return $returner;
 }