ILIAS  release_8 Revision v8.24
ilECSImportManager Class Reference

Manage the ECS imported contents. More...

+ Collaboration diagram for ilECSImportManager:

Public Member Functions

 lookupContentId ($a_server_id, $a_mid, $a_econtent_id)
 Lookup content id The content is the - not necessarily unique - id provided by the econtent type. More...
 
 lookupObjIdByContentId (int $a_server_id, int $a_mid, int $a_content_id, ?string $a_sub_id=null)
 Lookup obj_id by content id. More...
 
 lookupObjIdsByContentId ($a_content_id)
 
 lookupEContentIdByContentId ($a_server_id, $a_mid, $a_content_id)
 Lookup econtent id The econtent id is the unique id from ecs. More...
 
 getAllImportedRemoteObjects ($a_server_id)
 get all imported links More...
 
 _lookupObjIdsByMID ($a_server_id, $a_mid)
 lookup obj ids by mid More...
 
 _lookupEContentId (int $a_obj_id)
 get econent_id More...
 
 lookupServerId (int $a_obj_id)
 Lookup server id of imported content. More...
 
 _lookupObjIds ($a_server_id, $a_econtent_id)
 Lookup obj_id. More...
 
 _lookupObjId (int $a_server_id, string $a_econtent_id, int $a_mid, ?string $a_sub_id=null)
 loogup obj_id by econtent and mid and server_id More...
 
 _deleteByObjId ($a_obj_id)
 Delete by obj_id. More...
 
 deleteByServer (int $a_server_id)
 Delete by server id. More...
 
 deleteRessources (int $a_server_id, int $a_mid, array $a_econtent_ids)
 Delete ressources. More...
 
 _isImported (int $a_server_id, string $a_econtent_id, int $a_mid, ?string $a_sub_id=null)
 check if econtent is imported for a specific mid More...
 
 resetServerId ($a_server_id)
 

Static Public Member Functions

static getInstance ()
 Get the singleton instance of this ilECSImportManager. More...
 

Protected Attributes

ilDBInterface $db
 

Private Member Functions

 __construct ()
 

Static Private Attributes

static ilECSImportManager $instance
 

Detailed Description

Manage the ECS imported contents.

This class contains mainly helper functions to work with imported objects.

Author
Per Pascal Seelandpasca.nosp@m.l.se.nosp@m.eland.nosp@m.@tik.nosp@m..uni-.nosp@m.stut.nosp@m.tgart.nosp@m..de

Definition at line 26 of file class.ilECSImportManager.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSImportManager::__construct ( )
private

Definition at line 31 of file class.ilECSImportManager.php.

32 {
33 global $DIC;
34
35 $this->db = $DIC->database();
36 }
global $DIC
Definition: feed.php:28

References $DIC.

Member Function Documentation

◆ _deleteByObjId()

ilECSImportManager::_deleteByObjId (   $a_obj_id)

Delete by obj_id.

Parameters
intobj_id

Definition at line 232 of file class.ilECSImportManager.php.

232 : bool
233 {
234 $query = "DELETE FROM ecs_import " .
235 "WHERE obj_id = " . $this->db->quote($a_obj_id, 'integer') . " ";
236 $this->db->manipulate($query);
237 return true;
238 }
$query

References $query.

◆ _isImported()

ilECSImportManager::_isImported ( int  $a_server_id,
string  $a_econtent_id,
int  $a_mid,
?string  $a_sub_id = null 
)

check if econtent is imported for a specific mid

Definition at line 268 of file class.ilECSImportManager.php.

268 : int
269 {
270 return $this->_lookupObjId($a_server_id, $a_econtent_id, $a_mid, $a_sub_id);
271 }
_lookupObjId(int $a_server_id, string $a_econtent_id, int $a_mid, ?string $a_sub_id=null)
loogup obj_id by econtent and mid and server_id

References _lookupObjId().

+ Here is the call graph for this function:

◆ _lookupEContentId()

ilECSImportManager::_lookupEContentId ( int  $a_obj_id)

get econent_id

Definition at line 165 of file class.ilECSImportManager.php.

165 : string
166 {
167 $query = "SELECT * FROM ecs_import WHERE obj_id = " . $this->db->quote($a_obj_id, 'integer') . " ";
168 $res = $this->db->query($query);
169 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
170 return $row->econtent_id;
171 }
172 return "";
173 }
$res
Definition: ltiservices.php:69

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ _lookupObjId()

ilECSImportManager::_lookupObjId ( int  $a_server_id,
string  $a_econtent_id,
int  $a_mid,
?string  $a_sub_id = null 
)

loogup obj_id by econtent and mid and server_id

Definition at line 207 of file class.ilECSImportManager.php.

207 : int
208 {
209 $query = "SELECT obj_id FROM ecs_import " .
210 "WHERE econtent_id = " . $this->db->quote($a_econtent_id, 'text') . " " .
211 "AND mid = " . $this->db->quote($a_mid, 'integer') . " " .
212 'AND server_id = ' . $this->db->quote($a_server_id, 'integer') . ' ';
213
214 if (!is_null($a_sub_id)) {
215 $query .= 'AND sub_id = ' . $this->db->quote($a_sub_id, 'text');
216 } else {
217 $query .= 'AND sub_id IS NULL';
218 }
219 $res = $this->db->query($query);
220
221 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
222 return (int) $row->obj_id;
223 }
224 return 0;
225 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by _isImported().

+ Here is the caller graph for this function:

◆ _lookupObjIds()

ilECSImportManager::_lookupObjIds (   $a_server_id,
  $a_econtent_id 
)

Lookup obj_id.

Definition at line 192 of file class.ilECSImportManager.php.

192 : array
193 {
194 $query = "SELECT obj_id FROM ecs_import WHERE econtent_id = " . $this->db->quote($a_econtent_id, 'text') . " " .
195 'AND server_id = ' . $this->db->quote($a_server_id, 'integer');
196 $res = $this->db->query($query);
197 $obj_ids = [];
198 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
199 $obj_ids[] = (int) $row->obj_id;
200 }
201 return $obj_ids;
202 }

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ILIAS\Repository\int().

+ Here is the call graph for this function:

◆ _lookupObjIdsByMID()

ilECSImportManager::_lookupObjIdsByMID (   $a_server_id,
  $a_mid 
)

lookup obj ids by mid

Parameters
intmid
Returns
array int

Definition at line 148 of file class.ilECSImportManager.php.

148 : array
149 {
150 $query = "SELECT * FROM ecs_import " .
151 "WHERE mid = " . $this->db->quote($a_mid, 'integer') . " " .
152 'AND server_id = ' . $this->db->quote($a_server_id, 'integer');
153
154 $res = $this->db->query($query);
155 $obj_ids = [];
156 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
157 $obj_ids[] = $row->obj_id;
158 }
159 return $obj_ids;
160 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ deleteByServer()

ilECSImportManager::deleteByServer ( int  $a_server_id)

Delete by server id.

Definition at line 243 of file class.ilECSImportManager.php.

243 : void
244 {
245 $query = 'DELETE FROM ecs_import ' .
246 'WHERE server_id = ' . $this->db->quote($a_server_id, 'integer');
247 $this->db->manipulate($query);
248 }

References $query.

◆ deleteRessources()

ilECSImportManager::deleteRessources ( int  $a_server_id,
int  $a_mid,
array  $a_econtent_ids 
)

Delete ressources.

Parameters
string[]$a_econtent_ids

Definition at line 255 of file class.ilECSImportManager.php.

255 : bool
256 {
257 $query = 'DELETE FROM ecs_import ' .
258 'WHERE server_id = ' . $this->db->quote($a_server_id, 'integer') . ' ' .
259 'AND mid = ' . $this->db->quote($a_mid, 'integer') . ' ' .
260 'AND ' . $this->db->in('econtent_id', $a_econtent_ids, false, 'text');
261 $this->db->manipulate($query);
262 return true;
263 }

References $query.

◆ getAllImportedRemoteObjects()

ilECSImportManager::getAllImportedRemoteObjects (   $a_server_id)

get all imported links

Definition at line 128 of file class.ilECSImportManager.php.

128 : array
129 {
130 $all = array();
131 $query = "SELECT * FROM ecs_import ei JOIN object_data obd ON ei.obj_id = obd.obj_id " .
132 'WHERE server_id = ' . $this->db->quote($a_server_id) . ' ' .
133 'AND ' . $this->db->in('type', ilECSUtils::getPossibleRemoteTypes(), false, 'text');
134 $res = $this->db->query($query);
135 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
136 $all[$row->econtent_id] = $row->obj_id;
137 }
138
139 return $all;
140 }
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.

References $query, $res, ilDBConstants\FETCHMODE_OBJECT, and ilECSUtils\getPossibleRemoteTypes().

+ Here is the call graph for this function:

◆ getInstance()

static ilECSImportManager::getInstance ( )
static

Get the singleton instance of this ilECSImportManager.

Returns
ilECSImportManager

Definition at line 42 of file class.ilECSImportManager.php.

43 {
44 if (!isset(self::$instance)) {
45 self::$instance = new ilECSImportManager();
46 }
47 return self::$instance;
48 }
Manage the ECS imported contents.
static ilECSImportManager $instance

References $instance.

Referenced by ilECSUserConsentModalGUI\__construct(), ilRemoteObjectBase\createAuthResource(), ilECSMappingSettingsGUI\dDeleteTree(), ilObject\delete(), ilECSSetting\delete(), ilRemoteObjectBase\doDelete(), ilECSCmsCourseMemberCommandQueueHandler\doUpdate(), ilECSEnrolmentStatusCommandQueueHandler\doUpdate(), ilObjRemoteCategoryListGUI\getCommandFrame(), ilObjRemoteCourseListGUI\getCommandFrame(), ilObjRemoteFileListGUI\getCommandFrame(), ilObjRemoteGlossaryListGUI\getCommandFrame(), ilObjRemoteGroupListGUI\getCommandFrame(), ilObjRemoteLearningModuleListGUI\getCommandFrame(), ilObjRemoteTestListGUI\getCommandFrame(), ilObjRemoteWikiListGUI\getCommandFrame(), ilRemoteObjectBase\getFullRemoteLink(), ilECSCourseCreationHandler\getImportId(), ilRemoteObjectBase\handleDelete(), ilECSEventQueueReader\handleImportReset(), ilECSCmsTreeSynchronizer\handleTreeUpdate(), ilRemoteObjectBase\handleUpdate(), ilECSUserConsentModalGUI\initMidAndServer(), ilECSAppEventListener\initServer(), ilRemoteObjectBase\isLocalObject(), ilECSImportedContentTableGUI\parse(), ilECSCmsCourseMemberCommandQueueHandler\readCourse(), and ilECSCmsTreeSynchronizer\syncCategory().

+ Here is the caller graph for this function:

◆ lookupContentId()

ilECSImportManager::lookupContentId (   $a_server_id,
  $a_mid,
  $a_econtent_id 
)

Lookup content id The content is the - not necessarily unique - id provided by the econtent type.

The econtent id is the unique id from ecs

Returns
string content id

Definition at line 56 of file class.ilECSImportManager.php.

56 : string
57 {
58 $query = 'SELECT * from ecs_import ' .
59 'WHERE server_id = ' . $this->db->quote($a_server_id, 'integer') . ' ' .
60 'AND mid = ' . $this->db->quote($a_mid, 'integer') . ' ' .
61 'AND econtent_id = ' . $this->db->quote($a_econtent_id, 'text');
62 $res = $this->db->query($query);
63 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
64 return $row->content_id;
65 }
66 return '';
67 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ lookupEContentIdByContentId()

ilECSImportManager::lookupEContentIdByContentId (   $a_server_id,
  $a_mid,
  $a_content_id 
)

Lookup econtent id The econtent id is the unique id from ecs.

Returns
int content id

Definition at line 111 of file class.ilECSImportManager.php.

111 : int
112 {
113 $query = 'SELECT * from ecs_import ' .
114 'WHERE server_id = ' . $this->db->quote($a_server_id, 'integer') . ' ' .
115 'AND mid = ' . $this->db->quote($a_mid, 'integer') . ' ' .
116 'AND content_id = ' . $this->db->quote($a_content_id, 'text');
117 $res = $this->db->query($query);
118 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
119 return (int) $row->econtent_id;
120 }
121 return 0;
122 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ lookupObjIdByContentId()

ilECSImportManager::lookupObjIdByContentId ( int  $a_server_id,
int  $a_mid,
int  $a_content_id,
?string  $a_sub_id = null 
)

Lookup obj_id by content id.

Definition at line 72 of file class.ilECSImportManager.php.

72 : int
73 {
74 $query = "SELECT obj_id FROM ecs_import " .
75 "WHERE content_id = " . $this->db->quote($a_content_id, 'integer') . " " .
76 "&& mid = " . $this->db->quote($a_mid, 'integer') . " " .
77 '&& server_id = ' . $this->db->quote($a_server_id, 'integer') . ' ';
78
79 if (!is_null($a_sub_id)) {
80 $query .= 'AND sub_id = ' . $this->db->quote($a_sub_id, 'text');
81 } else {
82 $query .= 'AND sub_id IS NULL';
83 }
84 $res = $this->db->query($query);
85
86 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
87 return (int) $row->obj_id;
88 }
89 return 0;
90 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ lookupObjIdsByContentId()

ilECSImportManager::lookupObjIdsByContentId (   $a_content_id)

Definition at line 92 of file class.ilECSImportManager.php.

92 : array
93 {
94 $query = "SELECT obj_id FROM ecs_import " .
95 "WHERE content_id = " . $this->db->quote($a_content_id, 'integer');
96
97 $res = $this->db->query($query);
98
99 $obj_ids = array();
100 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
101 $obj_ids[] = $row->obj_id;
102 }
103 return $obj_ids;
104 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ lookupServerId()

ilECSImportManager::lookupServerId ( int  $a_obj_id)

Lookup server id of imported content.

Definition at line 178 of file class.ilECSImportManager.php.

178 : int
179 {
180 $query = 'SELECT * FROM ecs_import WHERE obj_id = ' . $this->db->quote($a_obj_id, 'integer');
181 $res = $this->db->query($query);
182 if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
183 return (int) $row->server_id;
184 }
185 return 0;
186 }

References $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ resetServerId()

ilECSImportManager::resetServerId (   $a_server_id)

Definition at line 273 of file class.ilECSImportManager.php.

273 : bool
274 {
275 $query = 'UPDATE ecs_import SET server_id = ' . $this->db->quote(0, 'integer') .
276 ' WHERE server_id = ' . $this->db->quote($a_server_id, 'integer');
277 $this->db->manipulate($query);
278 return true;
279 }

References $query.

Field Documentation

◆ $db

ilDBInterface ilECSImportManager::$db
protected

Definition at line 28 of file class.ilECSImportManager.php.

◆ $instance

ilECSImportManager ilECSImportManager::$instance
staticprivate

Definition at line 29 of file class.ilECSImportManager.php.

Referenced by getInstance().


The documentation for this class was generated from the following file: