24 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
71 include_once(
'Services/WebServices/ECS/classes/class.ilECSSetting.php');
99 return array(self::TYPE_REMOTE_COURSE, self::TYPE_REMOTE_CATEGORY,
100 self::TYPE_REMOTE_FILE, self::TYPE_REMOTE_GLOSSARY, self::TYPE_REMOTE_GROUP,
101 self::TYPE_REMOTE_LEARNING_MODULE, self::TYPE_REMOTE_WIKI, self::TYPE_REMOTE_TEST);
114 include_once
'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
116 foreach ($a_types as
$type) {
119 $list[
$type] = $robj->getAllResourceIds($server, $a_sender_only);
139 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
140 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
143 include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
144 include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
145 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
147 $types = self::getAllEContentTypes();
152 $list = self::getAllResourceIds($server, $types);
155 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Imported = ' . print_r($imported,
true));
156 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': List = ' . print_r(
$list,
true));
158 foreach (
$list as $resource_type => $link_ids) {
160 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Ignoring resource type ' . $resource_type);
165 foreach ((array) $link_ids as $link_id) {
166 if (!isset($imported[$link_id])) {
182 if (isset($imported[$link_id])) {
183 unset($imported[$link_id]);
188 if (is_array($imported)) {
190 include_once
'Services/WebServices/ECS/classes/class.ilECSObjectSettings.php';
191 foreach ($imported as $econtent_id => $obj_id) {
203 $ilLog->write(
'Cannot connect to ECS server: ' . $e1->getMessage());
206 $ilLog->write(
'Update failed: ' . $e2->getMessage());
222 include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
231 $types = self::getAllEContentTypes();
232 $list = self::getAllResourceIds($server, $types,
true);
236 $all_remote_ids = array();
237 foreach (
$list as $resource_type => $remote_ids) {
238 $all_remote_ids = array_merge($all_remote_ids, (array) $remote_ids);
240 $all_remote_ids = array_unique($all_remote_ids);
242 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Resources = ' . print_r($all_remote_ids,
true));
243 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Local = ' . print_r($local_econtent_ids,
true));
244 foreach ($local_econtent_ids as $local_econtent_id => $local_obj_id) {
245 if (!in_array($local_econtent_id, $all_remote_ids)) {
247 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Deleting deprecated econtent id ' . $local_econtent_id);
261 return $this->settings;
273 return $this->events ? $this->events : array();
285 $ilDB = $DIC[
'ilDB'];
287 $query =
"DELETE FROM ecs_events " .
288 'WHERE server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer');
303 $ilDB = $DIC[
'ilDB'];
305 $query =
"DELETE FROM ecs_events " .
306 "WHERE " . $this->db->in(
"type", $a_types,
"",
"text") .
' ' .
307 'AND server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer');
321 $ilDB = $DIC[
'ilDB'];
323 $query =
"DELETE FROM ecs_events " .
324 "WHERE type = " . $this->db->quote(self::TYPE_EXPORTED,
'text') .
' ' .
325 'AND server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer');
339 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
340 include_once(
'Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
344 $res = $connector->readEventFifo(
false);
346 if (!count(
$res->getResult())) {
351 include_once
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
354 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
' ---------------------------- Handling new event ');
355 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ . print_r($event,
true));
356 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
' ---------------------------- Done! ');
362 $connector->readEventFifo(
true);
365 $GLOBALS[
'DIC'][
'ilLog']->write(__METHOD__ .
': Cannot read event fifo. Aborting');
378 $ilDB = $DIC[
'ilDB'];
380 $query =
'DELETE FROM ecs_events ' .
381 'WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer');
392 $ilDB = $DIC[
'ilDB'];
396 case 'directory_trees':
397 $type = self::TYPE_DIRECTORY_TREES;
400 case 'course_members':
401 $type = self::TYPE_CMS_COURSE_MEMBERS;
405 $type = self::TYPE_CMS_COURSES;
409 $type = self::TYPE_REMOTE_COURSE;
413 $type = self::TYPE_REMOTE_CATEGORY;
417 $type = self::TYPE_REMOTE_FILE;
421 $type = self::TYPE_REMOTE_GLOSSARY;
425 $type = self::TYPE_REMOTE_GROUP;
428 case 'learningmodules':
429 $type = self::TYPE_REMOTE_LEARNING_MODULE;
433 $type = self::TYPE_REMOTE_WIKI;
437 $type = self::TYPE_REMOTE_TEST;
441 $type = self::TYPE_COURSE_URLS;
444 case 'member_status':
445 $type = self::TYPE_ENROLMENT_STATUS;
454 $query =
"SELECT * FROM ecs_events " .
455 "WHERE type = " .
$ilDB->quote(
$type,
'integer') .
" " .
457 'AND server_id = ' .
$ilDB->quote($this->getServer()->getServerId(),
'integer');
462 $event_id =
$row->event_id;
467 $query =
"INSERT ecs_events (event_id,type,id,op,server_id) " .
469 $ilDB->quote(
$ilDB->nextId(
'ecs_events'),
'integer') .
',' .
473 $ilDB->quote($this->getServer()->getServerId(),
'integer') .
' ' .
498 $query =
"UPDATE ecs_events " .
500 "WHERE event_id = " .
$ilDB->quote($event_id,
'integer') .
' ' .
502 'AND server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer');
515 $event = array_shift($this->events);
516 if ($event == null) {
520 #$this->delete($event['event_id']); 535 $ilDB = $DIC[
'ilDB'];
537 $next_id =
$ilDB->nextId(
'ecs_events');
538 $query =
"INSERT INTO ecs_events (event_id,type,id,op,server_id) " .
540 $ilDB->quote($next_id,
'integer') .
", " .
541 $this->db->quote(
$a_type,
'text') .
", " .
542 $this->db->quote($a_id,
'integer') .
", " .
543 $this->db->quote($a_op,
'text') .
", " .
544 $ilDB->quote($this->
getServer()->getServerId(),
'integer') .
' ' .
548 $new_event[
'event_id'] = $next_id;
550 $new_event[
'id'] = $a_id;
551 $new_event[
'op'] = $a_op;
553 $this->events[] = $new_event;
554 $this->econtent_ids[$a_id] = $a_id;
568 $ilDB = $DIC[
'ilDB'];
570 $query =
"UPDATE ecs_events " .
571 "SET op = " . $this->db->quote($a_operation,
'text') .
" " .
572 "WHERE type = " . $this->db->quote(
$a_type,
'text') .
" " .
573 "AND id = " . $this->db->quote($a_id,
'integer') .
" " .
574 'AND server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer');
584 public function delete($a_event_id)
588 $ilDB = $DIC[
'ilDB'];
590 $query =
"DELETE FROM ecs_events " .
591 "WHERE event_id = " . $this->db->quote($a_event_id,
'integer') .
" " .
592 'AND server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer');
594 unset($this->econtent_ids[$a_event_id]);
606 $ilDB = $DIC[
'ilDB'];
608 $query =
"SELECT * FROM ecs_events " .
609 'WHERE server_id = ' .
$ilDB->quote($this->
getServer()->getServerId(),
'integer') .
' ' .
615 $this->events[$counter][
'event_id'] =
$row->event_id;
616 $this->events[$counter][
'type'] =
$row->type;
617 $this->events[$counter][
'id'] =
$row->id;
618 $this->events[$counter][
'op'] =
$row->op;
620 $this->econtent_ids[
$row->event_id] =
$row->event_id;
630 $ilDB = $DIC[
'ilDB'];
632 $query =
'DELETE FROM ecs_events' .
633 ' WHERE server_id = ' .
$ilDB->quote($a_server_id,
'integer');
const TYPE_REMOTE_CATEGORY
static getAllImportedRemoteObjects($a_server_id)
get all imported links
if(isset($_REQUEST['delete'])) $list
static getEventTypeFromObjectType($a_obj_type)
Convert object type to event type.
static _getAllEContentIds($a_server_id)
get all exported econtent ids per server
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
static handleImportReset(ilECSSetting $server)
Reread all imported econtent.
update($a_type, $a_id, $a_operation)
update one entry
static deleteServer($a_server_id)
Delete by server id ilDB $ilDB.
getServerId()
Get current server id.
static _deleteEContentIds($a_server_id, $a_ids)
Delete econtent ids for server.
getRessourceType()
Get ressource type.
deleteAllExportedEvents()
Delete all exported events.
static getInstanceByEventType($a_type)
Get instance by ilECSEvent(QueueReader) type.
static getAllEContentTypes()
All available content types.
deleteAllEContentEvents(array $a_types)
Delete all econtents.
deleteAll()
Delete all events.
getRessourceId()
Get ressource id.
const TYPE_DIRECTORY_TREES
foreach($_POST as $key=> $value) $res
writeEventToDB(ilECSEvent $ev)
Write event to db.
refresh()
Fetch events from fifo Using fifo public.
Reads ECS events and stores them in the database.
static deleteByServerId($a_server_id)
const TYPE_REMOTE_LEARNING_MODULE
static _lookupType($a_id, $a_reference=false)
lookup object type
shift()
get and delete the first event entry
const TYPE_CMS_COURSE_MEMBERS
const TYPE_REMOTE_GLOSSARY
__construct($a_server_id)
Constructor.
getServer()
get server setting
static handleExportReset(ilECSSetting $server)
Handle export reset.
getEvents()
get all events
const TYPE_ENROLMENT_STATUS
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
static getAllResourceIds(ilECSSetting $server, array $a_types, $a_sender_only=false)
Get all resource ids by resource type.
add($a_type, $a_id, $a_op)
add