ILIAS  trunk Revision v11.0_alpha-1715-g7fc467680fb
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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 27 of file class.ilECSImportManager.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSImportManager::__construct ( )
private

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

References $DIC.

33  {
34  global $DIC;
35 
36  $this->db = $DIC->database();
37  }
global $DIC
Definition: shib_login.php:22

Member Function Documentation

◆ _deleteByObjId()

ilECSImportManager::_deleteByObjId (   $a_obj_id)

Delete by obj_id.

Parameters
intobj_id

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

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

◆ _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 269 of file class.ilECSImportManager.php.

References _lookupObjId().

269  : int
270  {
271  return $this->_lookupObjId($a_server_id, $a_econtent_id, $a_mid, $a_sub_id);
272  }
_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
+ Here is the call graph for this function:

◆ _lookupEContentId()

ilECSImportManager::_lookupEContentId ( int  $a_obj_id)

get econent_id

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

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ _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 208 of file class.ilECSImportManager.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by _isImported().

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

◆ _lookupObjIds()

ilECSImportManager::_lookupObjIds (   $a_server_id,
  $a_econtent_id 
)

Lookup obj_id.

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

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

193  : array
194  {
195  $query = "SELECT obj_id FROM ecs_import WHERE econtent_id = " . $this->db->quote($a_econtent_id, 'text') . " " .
196  'AND server_id = ' . $this->db->quote($a_server_id, 'integer');
197  $res = $this->db->query($query);
198  $obj_ids = [];
199  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
200  $obj_ids[] = (int) $row->obj_id;
201  }
202  return $obj_ids;
203  }
$res
Definition: ltiservices.php:66
+ 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 149 of file class.ilECSImportManager.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ deleteByServer()

ilECSImportManager::deleteByServer ( int  $a_server_id)

Delete by server id.

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

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

◆ deleteRessources()

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

Delete ressources.

Parameters
string[]$a_econtent_ids

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

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

◆ getAllImportedRemoteObjects()

ilECSImportManager::getAllImportedRemoteObjects (   $a_server_id)

get all imported links

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

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

129  : array
130  {
131  $all = array();
132  $query = "SELECT * FROM ecs_import ei JOIN object_data obd ON ei.obj_id = obd.obj_id " .
133  'WHERE server_id = ' . $this->db->quote($a_server_id) . ' ' .
134  'AND ' . $this->db->in('type', ilECSUtils::getPossibleRemoteTypes(), false, 'text');
135  $res = $this->db->query($query);
136  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
137  $all[$row->econtent_id] = $row->obj_id;
138  }
139 
140  return $all;
141  }
$res
Definition: ltiservices.php:66
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
+ 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 43 of file class.ilECSImportManager.php.

Referenced by ilECSUserConsentModalGUI\__construct(), ilRemoteObjectBase\createAuthResource(), ilECSMappingSettingsGUI\dDeleteTree(), ilECSSetting\delete(), ilObject\delete(), ilRemoteObjectBase\doDelete(), ilECSEnrolmentStatusCommandQueueHandler\doUpdate(), ilECSCmsCourseMemberCommandQueueHandler\doUpdate(), ilObjRemoteCategoryListGUI\getCommandFrame(), ilObjRemoteTestListGUI\getCommandFrame(), ilObjRemoteWikiListGUI\getCommandFrame(), ilObjRemoteGroupListGUI\getCommandFrame(), ilObjRemoteLearningModuleListGUI\getCommandFrame(), ilObjRemoteGlossaryListGUI\getCommandFrame(), ilObjRemoteCourseListGUI\getCommandFrame(), ilObjRemoteFileListGUI\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().

44  {
45  if (!isset(self::$instance)) {
46  self::$instance = new ilECSImportManager();
47  }
48  return self::$instance;
49  }
Manage the ECS imported contents.
+ 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 57 of file class.ilECSImportManager.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ 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 112 of file class.ilECSImportManager.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ 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 73 of file class.ilECSImportManager.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ lookupObjIdsByContentId()

ilECSImportManager::lookupObjIdsByContentId (   $a_content_id)

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

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ lookupServerId()

ilECSImportManager::lookupServerId ( int  $a_obj_id)

Lookup server id of imported content.

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

References $res, and ilDBConstants\FETCHMODE_OBJECT.

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

◆ resetServerId()

ilECSImportManager::resetServerId (   $a_server_id)

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

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

Field Documentation

◆ $db

ilDBInterface ilECSImportManager::$db
protected

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

◆ $instance

ilECSImportManager ilECSImportManager::$instance
staticprivate

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


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