ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilOerHarvesterSettings.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
12{
13 const CRON_JOB_IDENTIFIER = 'meta_oer_harvester';
14
15 const STORAGE_IDENTIFIER = 'meta_oer';
16
18 'file'
19 ];
20
24 private static $instance = null;
25
29 private $storage = null;
30
34 private $target = 0;
35
36
41
45 private $cronjob = null;
46
47
48
53 protected function __construct()
54 {
55 $this->storage = new ilSetting(self::STORAGE_IDENTIFIER);
56 /*
57 $this->cronjob = ilCronManager::getJobInstanceById(self::CRON_JOB_IDENTIFIER);
58 if(!$this->cronjob instanceof ilCronJob) {
59
60 throw new \LogicException(
61 'Cannot create cron job instance'
62 );
63 }
64 */
65 $this->read();
66 }
67
68
69
73 public static function getInstance()
74 {
75 if (!self::$instance instanceof ilOerHarvesterSettings) {
76 self::$instance = new self();
77 }
78 return self::$instance;
79 }
80
85 public function supportsHarvesting($a_type)
86 {
87 return in_array($a_type, self::COLLECTED_TYPES);
88 }
89
93 public function getHarvestingTypes()
94 {
96 }
97
101 public function setTarget($a_target)
102 {
103 $this->target = $a_target;
104 }
105
109 public function getTarget()
110 {
111 return $this->target;
112 }
113
117 public function setCopyrightTemplates(array $a_template_ids)
118 {
119 $this->copyright_templates = $a_template_ids;
120 }
121
125 public function getCopyrightTemplates()
126 {
128 }
129
134 public function isActiveCopyrightTemplate($a_id)
135 {
136 return in_array($a_id, $this->getCopyrightTemplates());
137 }
138
144 {
145 global $DIC;
146
147 $settings = $DIC->settings();
148
149 $lom_entries = [];
150 foreach ($this->getCopyrightTemplates() as $copyright_id) {
151 $lom_entries[] = 'il_copyright_entry__' . $settings->get('inst_id', 0) . '__' . $copyright_id;
152 }
153 return $lom_entries;
154 }
155
156
160 public function save()
161 {
162 $this->storage->set('target', $this->getTarget());
163 $this->storage->set('templates', serialize($this->copyright_templates));
164 }
165
169 public function read()
170 {
171 $this->setTarget($this->storage->get('target', 0));
172 $this->setCopyrightTemplates(unserialize($this->storage->get('templates', serialize([]))));
173 }
174}
An exception for terminatinating execution or to throw for unit testing.
Cron job for definition for oer harvesting.
getHarvestingTypes()
Get obj types that support harvesing.
__construct()
ilOerHarvesterSettings constructor.
getCopyRightTemplatesInLomFormat()
Get copyright entries in LOM format: "il_copyright_entry_INST_ID_ID" return string[].
setCopyrightTemplates(array $a_template_ids)
ILIAS Setting Class.
global $DIC
Definition: goto.php:24