16 import(
'lib.pkp.classes.scheduledTask.ScheduledTask');
30 $this->_plugin = $plugin;
32 if (is_a($plugin,
'DOAJExportPlugin')) {
33 $plugin->addLocaleData();
36 parent::__construct($args);
43 return __(
'plugins.importexport.doaj.senderTask.name');
50 if (!$this->_plugin)
return false;
55 foreach ($journals as $journal) {
57 $unregisteredArticles = $plugin->getUnregisteredArticles($journal);
59 if (count($unregisteredArticles)) {
60 $this->
_registerObjects($unregisteredArticles,
'article=>doaj-json', $journal,
'articles');
74 $journalFactory = $contextDao->getAll(
true);
77 while($journal = $journalFactory->next()) {
78 $journalId = $journal->getId();
79 if (!$plugin->getSetting($journalId,
'apiKey') || !$plugin->getSetting($journalId,
'automaticRegistration'))
continue;
80 $journals[] = $journal;
93 function _registerObjects($objects, $filter, $journal, $objectsFileNamePart) {
95 foreach ($objects as $object) {
97 $exportJson = $plugin->exportJSON($object, $filter, $journal);
99 $result = $plugin->depositXML($object, $journal, $exportJson);
100 if ($result !==
true) {
111 if (is_array($errors)) {
112 foreach($errors as $error) {
113 assert(is_array($error) && count($error) >= 1);
115 __($error[0], array(
'param' => (isset($error[1]) ? $error[1] :
null))),
116 SCHEDULED_TASK_MESSAGE_TYPE_WARNING