24include_once 
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
 
   68                include_once(
'Services/WebServices/ECS/classes/class.ilECSSetting.php');
 
   96                return array(self::TYPE_REMOTE_COURSE, self::TYPE_REMOTE_CATEGORY, 
 
   97                        self::TYPE_REMOTE_FILE, self::TYPE_REMOTE_GLOSSARY, self::TYPE_REMOTE_GROUP, 
 
   98                        self::TYPE_REMOTE_LEARNING_MODULE, self::TYPE_REMOTE_WIKI, self::TYPE_REMOTE_TEST);     
 
  111                include_once 
'Services/WebServices/ECS/classes/class.ilRemoteObjectBase.php';
 
  113                foreach($a_types as $type)
 
  118                                $list[$type] = $robj->getAllResourceIds(
$server, $a_sender_only);
 
  136                include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
 
  137                include_once(
'Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
 
  141                        include_once(
'./Services/WebServices/ECS/classes/class.ilECSEventQueueReader.php');
 
  142                        include_once(
'./Services/WebServices/ECS/classes/class.ilECSImport.php');
 
  143                        include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
 
  148                        $event_queue->deleteAllEContentEvents($types);
 
  153                        $GLOBALS[
'ilLog']->write(__METHOD__.
': Imported = '.print_r($imported,
true));
 
  154                        $GLOBALS[
'ilLog']->write(__METHOD__.
': List = '.print_r($list,
true));
 
  156                        foreach($list as $resource_type => $link_ids)
 
  160                                        $GLOBALS[
'ilLog']->write(__METHOD__.
': Ignoring resource type '. $resource_type);
 
  165                                foreach((array) $link_ids as $link_id)
 
  167                                        if(!isset($imported[$link_id]))
 
  186                                        if(isset($imported[$link_id]))
 
  188                                                unset($imported[$link_id]);
 
  193                        if(is_array($imported))
 
  196                                include_once 
'Services/WebServices/ECS/classes/class.ilECSObjectSettings.php';
 
  197                                foreach($imported as $econtent_id => $obj_id)
 
  202                                                $event_queue->add($type,
 
  212                        $ilLog->write(
'Cannot connect to ECS server: '.$e1->getMessage());
 
  217                        $ilLog->write(
'Update failed: '.$e2->getMessage());
 
  233                include_once(
'./Services/WebServices/ECS/classes/class.ilECSExport.php');
 
  237                $queue->deleteAllExportedEvents();
 
  247                $all_remote_ids = array();
 
  248                foreach($list as $resource_type => $remote_ids)
 
  250                        $all_remote_ids = array_merge($all_remote_ids,(array) $remote_ids);
 
  252                $all_remote_ids = array_unique($all_remote_ids);
 
  254                $GLOBALS[
'ilLog']->write(__METHOD__.
': Resources = ' . print_r($all_remote_ids,
true));
 
  255                $GLOBALS[
'ilLog']->write(__METHOD__.
': Local = ' . print_r($local_econtent_ids,
true));
 
  256                foreach($local_econtent_ids as $local_econtent_id => $local_obj_id)
 
  258                        if(!in_array($local_econtent_id, $all_remote_ids))
 
  261                                $GLOBALS[
'ilLog']->write(__METHOD__.
': Deleting deprecated econtent id '. $local_econtent_id);
 
  276                 return $this->settings;
 
  288                return $this->events ? $this->events : array();
 
  300                $query = 
"DELETE FROM ecs_events ".
 
  301                        'WHERE server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  316                $query = 
"DELETE FROM ecs_events ".
 
  317                        "WHERE ".$this->db->in(
"type", $a_types, 
"", 
"text").
' '.
 
  318                        'AND server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  332                $query = 
"DELETE FROM ecs_events ".
 
  333                        "WHERE type = ".$this->db->quote(self::TYPE_EXPORTED,
'text').
' '.
 
  334                        'AND server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  348                        include_once(
'Services/WebServices/ECS/classes/class.ilECSConnector.php');
 
  349                        include_once(
'Services/WebServices/ECS/classes/class.ilECSConnectorException.php');
 
  354                                $res = $connector->readEventFifo(
false);
 
  356                                if(!count(
$res->getResult()))
 
  363                                        include_once 
'./Services/WebServices/ECS/classes/class.ilECSEvent.php';
 
  366                                        $GLOBALS[
'ilLog']->write(__METHOD__.
' ---------------------------- Handling new event ');
 
  367                                        $GLOBALS[
'ilLog']->write(__METHOD__.print_r($event,
true));
 
  368                                        $GLOBALS[
'ilLog']->write(__METHOD__.
' ---------------------------- Done! ');
 
  374                                $connector->readEventFifo(
true);
 
  380                        $GLOBALS[
'ilLog']->write(__METHOD__.
': Cannot read event fifo. Aborting');
 
  393                $query = 
'DELETE FROM ecs_events '.
 
  394                        'WHERE server_id = '.$ilDB->quote($a_server_id,
'integer');
 
  408                        case 'directory_trees':
 
  412                        case 'course_members':
 
  440                        case 'learningmodules':
 
  456                        case 'member_status':
 
  461                $query = 
"SELECT * FROM ecs_events ".
 
  462                        "WHERE type = ".$ilDB->quote($type,
'integer').
" ".
 
  464                        'AND server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  470                        $event_id = 
$row->event_id;
 
  476                        $query = 
"INSERT ecs_events (event_id,type,id,op,server_id) ".
 
  478                                $ilDB->quote(
$ilDB->nextId(
'ecs_events'),
'integer').
','.
 
  479                                $ilDB->quote($type,
'text').
', '.
 
  509                $query = 
"UPDATE ecs_events ".
 
  510                        "SET op = ".$ilDB->quote($ev->
getStatus(),
'text').
" ".
 
  511                        "WHERE event_id = ".$ilDB->quote($event_id,
'integer').
' '.
 
  512                        'AND type = '.$ilDB->quote($type).
' '.
 
  513                        'AND server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  526                $event = array_shift($this->events);
 
  534                        #$this->delete($event['event_id']); 
  545        public function add($a_type,$a_id,$a_op)
 
  549                $next_id = 
$ilDB->nextId(
'ecs_events');
 
  550                $query = 
"INSERT INTO ecs_events (event_id,type,id,op,server_id) ".
 
  552                        $ilDB->quote($next_id,
'integer').
", ".
 
  553                        $this->db->quote($a_type,
'text').
", ".
 
  554                        $this->db->quote($a_id,
'integer').
", ".
 
  555                        $this->db->quote($a_op,
'text').
", ".
 
  560                $new_event[
'event_id'] = $next_id;
 
  561                $new_event[
'type'] = $a_type;
 
  562                $new_event[
'id'] = $a_id;
 
  563                $new_event[
'op'] = $a_op;
 
  565                $this->events[] = $new_event;
 
  566                $this->econtent_ids[$a_id] = $a_id;
 
  576        private function update($a_type,$a_id,$a_operation)
 
  580                $query = 
"UPDATE ecs_events ".
 
  581                        "SET op = ".$this->db->quote($a_operation,
'text').
" ".
 
  582                        "WHERE type = ".$this->db->quote($a_type,
'text').
" ".
 
  583                        "AND id = ".$this->db->quote($a_id,
'integer').
" ".
 
  584                        'AND server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  594        public function delete($a_event_id)
 
  598                $query = 
"DELETE FROM ecs_events ".
 
  599                        "WHERE event_id = ".$this->db->quote($a_event_id,
'integer').
" ".
 
  600                        'AND server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer');
 
  602                unset($this->econtent_ids[$a_event_id]);
 
  614                $query = 
"SELECT * FROM ecs_events  ".
 
  615                        'WHERE server_id = '.$ilDB->quote($this->
getServer()->getServerId(),
'integer').
' '.
 
  622                        $this->events[$counter][
'event_id'] = 
$row->event_id;
 
  623                        $this->events[$counter][
'type'] = 
$row->type;
 
  624                        $this->events[$counter][
'id'] = 
$row->id;
 
  625                        $this->events[$counter][
'op'] = 
$row->op;
 
  627                        $this->econtent_ids[
$row->event_id] = 
$row->event_id;
 
  637                $query = 
'DELETE FROM ecs_events'.
 
  638                        ' WHERE server_id = '.$ilDB->quote($a_server_id,
'integer');
 
const DB_FETCHMODE_OBJECT
Reads ECS events and stores them in the database.
static deleteServer($a_server_id)
Delete by server id @global ilDB $ilDB.
update($a_type, $a_id, $a_operation)
update one entry
static handleExportReset(ilECSSetting $server)
Handle export reset.
static getAllEContentTypes()
All available content types.
const TYPE_REMOTE_GLOSSARY
deleteAllEContentEvents(array $a_types)
Delete all econtents.
getEvents()
get all events
writeEventToDB(ilECSEvent $ev)
Write event to db.
refresh()
Fetch events from fifo Using fifo @access public.
getServer()
get server setting
add($a_type, $a_id, $a_op)
add
shift()
get and delete the first event entry
__construct($a_server_id)
Constructor.
const TYPE_REMOTE_LEARNING_MODULE
const TYPE_DIRECTORY_TREES
static getEventTypeFromObjectType($a_obj_type)
Convert object type to event type.
static handleImportReset(ilECSSetting $server)
Reread all imported econtent.
const TYPE_REMOTE_CATEGORY
deleteAll()
Delete all events.
deleteAllExportedEvents()
Delete all exported events.
const TYPE_CMS_COURSE_MEMBERS
const TYPE_ENROLMENT_STATUS
static deleteByServerId($a_server_id)
static getAllResourceIds(ilECSSetting $server, array $a_types, $a_sender_only=false)
Get all resource ids by resource type.
read()
Read @access public.
getRessourceType()
Get ressource type.
getRessourceId()
Get ressource id.
static _deleteEContentIds($a_server_id, $a_ids)
Delete econtent ids for server.
static _getAllEContentIds($a_server_id)
get all exported econtent ids per server
static getAllImportedRemoteObjects($a_server_id)
get all imported links
static getInstanceByServerId($a_server_id)
Get singleton instance per server.
static getPossibleRemoteTypes($a_with_captions=false)
Get all possible remote object types.
Base class for ILIAS Exception handling.
static _lookupType($a_id, $a_reference=false)
lookup object type
static getInstanceByEventType($a_type)
Get instance by ilECSEvent(QueueReader) type.