ILIAS  trunk Revision v11.0_alpha-1744-gb0451eebef4
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilECSCmsData Class Reference
+ Collaboration diagram for ilECSCmsData:

Public Member Functions

 __construct (int $a_obj_id=0)
 
 setTitle ($a_title)
 
 getTitle ()
 
 setTerm ($a_term)
 
 getTerm ()
 
 setObjId ($a_id)
 
 getObjId ()
 
 setCmsId ($a_id)
 
 getCmsId ()
 
 setServerId ($a_id)
 
 getServerId ()
 
 setTreeId ($a_id)
 
 getTreeId ()
 
 setMid ($a_id)
 
 getMid ()
 
 setStatus ($a_status)
 
 getStatus ()
 
 setDeleted ($a_is_deleted)
 
 isDeleted ()
 
 save ()
 
 update ()
 
 delete ()
 
 deleteTree ()
 

Static Public Member Functions

static treeExists (int $a_server_id, int $a_mid, int $a_tree_id)
 
static findDeletedNodes (int $a_server_id, int $a_mid, int $a_tree_id)
 Find deleted nodes Uses a left join since this is more robust. More...
 
static lookupObjId (int $a_server_id, int $a_mid, int $a_tree_id, string $cms_id)
 
static lookupFirstTreeOfNode ($a_server_id, $a_mid, $cms_id)
 Lookup first obj_id of cms node. More...
 
static lookupTitle (int $a_server_id, int $a_mid, int $a_tree_id)
 Lookup title by obj id. More...
 
static lookupTopTerm (int $a_server_id, int $a_mid, int $a_tree_id)
 Lookup term (highest term in cms tree) More...
 
static lookupStatusByObjId (int $a_server_id, int $a_mid, int $a_tree_id, int $obj_id)
 Lookup status. More...
 
static lookupStatusByCmsId (int $a_server_id, int $a_mid, int $a_tree_id, string $cms_id)
 Lookup status. More...
 
static updateStatus (int $a_server_id, int $a_mid, int $a_tree_id)
 
static lookupCmsId ($a_obj_id)
 Lookup cms id. More...
 
static lookupCmsIds (array $a_obj_ids)
 
static lookupCmsIdsOfTree ($a_server_id, $a_mid, $a_tree_id)
 
static writeStatus ($a_server_id, $a_mid, $a_tree_id, $cms_ids, $status)
 Update status. More...
 
static writeAllStatus ($a_server_id, $a_mid, $a_tree_id, $status)
 Update status. More...
 
static writeAllDeleted ($a_server_id, $a_mid, $a_tree_id, $a_deleted_flag)
 Write deleted status. More...
 
static lookupTreeIds (int $a_server_id, int $a_mid)
 
static deleteByServerId ($a_server_id)
 

Data Fields

const MAPPING_UNMAPPED = 1
 
const MAPPING_PENDING_DISCONNECTABLE = 2
 
const MAPPING_PENDING_NOT_DISCONNECTABLE = 3
 
const MAPPING_MAPPED = 4
 
const MAPPING_DELETED = 5
 

Protected Member Functions

 read ()
 

Private Attributes

ilDBInterface $db
 
int $obj_id
 
int $server_id
 
int $mid
 
int $tree_id
 
string $cms_id
 
string $title
 
string $term
 
int $status = self::MAPPING_UNMAPPED
 
bool $deleted = false
 

Detailed Description

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 24 of file class.ilECSCmsData.php.

Constructor & Destructor Documentation

◆ __construct()

ilECSCmsData::__construct ( int  $a_obj_id = 0)

Definition at line 44 of file class.ilECSCmsData.php.

References $DIC, and read().

45  {
46  global $DIC;
47  $this->db = $DIC->database();
48 
49  $this->obj_id = $a_obj_id;
50  $this->read();
51  }
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:

Member Function Documentation

◆ delete()

ilECSCmsData::delete ( )

Definition at line 501 of file class.ilECSCmsData.php.

501  : void
502  {
503  $query = "DELETE FROM ecs_cms_data " .
504  'WHERE obj_id = ' . $this->db->quote($this->obj_id, 'integer');
505  $this->db->manipulate($query);
506  }

◆ deleteByServerId()

static ilECSCmsData::deleteByServerId (   $a_server_id)
static

Definition at line 517 of file class.ilECSCmsData.php.

References $DIC, and $ilDB.

Referenced by ilECSSetting\delete().

517  : void
518  {
519  global $DIC;
520 
521  $ilDB = $DIC['ilDB'];
522 
523  $query = "DELETE FROM ecs_cms_data " .
524  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer');
525  $ilDB->manipulate($query);
526  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ deleteTree()

ilECSCmsData::deleteTree ( )

Definition at line 508 of file class.ilECSCmsData.php.

508  : void
509  {
510  $query = "DELETE FROM ecs_cms_data " .
511  'WHERE server_id = ' . $this->db->quote($this->server_id, 'integer') . ' ' .
512  'AND mid = ' . $this->db->quote($this->mid, 'integer') . ' ' .
513  'AND tree_id = ' . $this->db->quote($this->tree_id, 'integer') . ' ';
514  $this->db->manipulate($query);
515  }

◆ findDeletedNodes()

static ilECSCmsData::findDeletedNodes ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id 
)
static

Find deleted nodes Uses a left join since this is more robust.

An alternative implementation could simply check the deleted flag in ecs_cms_data.

Definition at line 76 of file class.ilECSCmsData.php.

References $deleted, $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCmsTreeCommandQueueHandler\handleUpdate().

76  : array
77  {
78  global $DIC;
79 
80  $ilDB = $DIC['ilDB'];
81 
82  $query = 'SELECT ed.obj_id obj_id FROM ecs_cms_data ed ' .
83  'LEFT JOIN ecs_cms_tree et ON ed.obj_id = et.child ' .
84  'WHERE et.child IS NULL ' .
85  'AND server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
86  'AND mid = ' . $ilDB->quote($a_mid) . ' ' .
87  'AND tree_id = ' . $ilDB->quote($a_tree_id);
88  $res = $ilDB->query($query);
89 
90  $deleted = array();
91  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
92  $deleted[] = $row->obj_id;
93  }
94  return $deleted;
95  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ getCmsId()

ilECSCmsData::getCmsId ( )

Definition at line 414 of file class.ilECSCmsData.php.

References $cms_id.

414  : string
415  {
416  return $this->cms_id;
417  }

◆ getMid()

ilECSCmsData::getMid ( )

Definition at line 444 of file class.ilECSCmsData.php.

References $mid.

444  : int
445  {
446  return $this->mid;
447  }

◆ getObjId()

ilECSCmsData::getObjId ( )

Definition at line 404 of file class.ilECSCmsData.php.

References $obj_id.

404  : int
405  {
406  return $this->obj_id;
407  }

◆ getServerId()

ilECSCmsData::getServerId ( )

Definition at line 424 of file class.ilECSCmsData.php.

References $server_id.

424  : int
425  {
426  return $this->server_id;
427  }

◆ getStatus()

ilECSCmsData::getStatus ( )

Definition at line 454 of file class.ilECSCmsData.php.

References $status.

454  : int
455  {
456  return $this->status;
457  }

◆ getTerm()

ilECSCmsData::getTerm ( )

Definition at line 394 of file class.ilECSCmsData.php.

References $term.

394  : string
395  {
396  return $this->term;
397  }

◆ getTitle()

ilECSCmsData::getTitle ( )

Definition at line 384 of file class.ilECSCmsData.php.

References $title.

Referenced by ilECSNodeMappingTreeTableGUI\parse().

384  : string
385  {
386  return $this->title;
387  }
+ Here is the caller graph for this function:

◆ getTreeId()

ilECSCmsData::getTreeId ( )

Definition at line 434 of file class.ilECSCmsData.php.

References $tree_id.

434  : int
435  {
436  return $this->tree_id;
437  }

◆ isDeleted()

ilECSCmsData::isDeleted ( )

Definition at line 464 of file class.ilECSCmsData.php.

References $deleted.

Referenced by update().

464  : bool
465  {
466  return $this->deleted;
467  }
+ Here is the caller graph for this function:

◆ lookupCmsId()

static ilECSCmsData::lookupCmsId (   $a_obj_id)
static

Lookup cms id.

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

Referenced by ilECSMappingSettingsGUI\dInitFormTreeSettings().

255  : string
256  {
257  $cms_ids = self::lookupCmsIds(array($a_obj_id));
258  return $cms_ids[0];
259  }
+ Here is the caller graph for this function:

◆ lookupCmsIds()

static ilECSCmsData::lookupCmsIds ( array  $a_obj_ids)
static
Parameters
int[]$a_obj_ids
Returns
string[]

Definition at line 265 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCourseCreationHandler\syncNodeToTop().

265  : array
266  {
267  global $DIC;
268 
269  $ilDB = $DIC['ilDB'];
270 
271  $query = 'SELECT cms_id FROM ecs_cms_data ' .
272  'WHERE ' . $ilDB->in('obj_id', $a_obj_ids, false, 'integer');
273  $res = $ilDB->query($query);
274 
275  $cms_ids = [];
276  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
277  $cms_ids[] = $row->cms_id;
278  }
279  return $cms_ids;
280  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupCmsIdsOfTree()

static ilECSCmsData::lookupCmsIdsOfTree (   $a_server_id,
  $a_mid,
  $a_tree_id 
)
static

Definition at line 282 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSMappingSettingsGUI\dDeleteTree().

282  : array
283  {
284  global $DIC;
285 
286  $ilDB = $DIC['ilDB'];
287 
288  $query = 'SELECT cms_id FROM ecs_cms_data ' .
289  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
290  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
291  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer');
292  $res = $ilDB->query($query);
293  $cms_ids = array();
294  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
295  $cms_ids[] = $row->cms_id;
296  }
297  return $cms_ids;
298  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupFirstTreeOfNode()

static ilECSCmsData::lookupFirstTreeOfNode (   $a_server_id,
  $a_mid,
  $cms_id 
)
static

Lookup first obj_id of cms node.

Definition at line 122 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCourseCreationHandler\syncParentContainer().

122  : int
123  {
124  global $DIC;
125 
126  $ilDB = $DIC->database();
127  $logger = $DIC->logger()->wsrv();
128 
129  $logger->debug($a_server_id . ' ' . $a_mid . ' ' . $cms_id);
130 
131  $query = 'SELECT tree_id FROM ecs_cms_data ' .
132  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
133  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
134  'AND cms_id = ' . $ilDB->quote($cms_id, 'text') . ' ' .
135  'ORDER BY tree_id ';
136  $res = $ilDB->query($query);
137 
138  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
139  return $row->tree_id;
140  }
141  return 0;
142  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupObjId()

static ilECSCmsData::lookupObjId ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id,
string  $cms_id 
)
static

Definition at line 97 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSCmsTreeCommandQueueHandler\handleCreate(), ilECSCmsTreeCommandQueueHandler\handleUpdate(), ilECSTreeReader\storeTree(), and ilECSCourseCreationHandler\syncNodeToTop().

97  : int
98  {
99  global $DIC;
100 
101  $ilDB = $DIC['ilDB'];
102  $logger = $DIC->logger()->wsrv();
103 
104  $query = 'SELECT obj_id FROM ecs_cms_data ' .
105  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
106  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
107  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ' .
108  'AND cms_id = ' . $ilDB->quote($cms_id, 'text');
109  $res = $ilDB->query($query);
110 
111  $logger->debug($query);
112 
113  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
114  return $row->obj_id;
115  }
116  return 0;
117  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupStatusByCmsId()

static ilECSCmsData::lookupStatusByCmsId ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id,
string  $cms_id 
)
static

Lookup status.

Definition at line 214 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSNodeMappingAssignments\deleteDisconnectableMappings().

214  : int
215  {
216  global $DIC;
217 
218  $ilDB = $DIC['ilDB'];
219 
220  $query = 'SELECT status FROM ecs_cms_data ' .
221  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
222  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
223  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ' .
224  'AND cms_id = ' . $ilDB->quote($cms_id, 'text');
225  $res = $ilDB->query($query);
226  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
227  return (int) $row->status;
228  }
229  return self::MAPPING_UNMAPPED;
230  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupStatusByObjId()

static ilECSCmsData::lookupStatusByObjId ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id,
int  $obj_id 
)
static

Lookup status.

Definition at line 190 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSNodeMappingCmsExplorer\buildFormItem(), and ilECSNodeMappingCmsExplorer\buildTitle().

190  : int
191  {
192  global $DIC;
193 
194  $ilDB = $DIC['ilDB'];
195 
196  $query = 'SELECT status,deleted FROM ecs_cms_data ' .
197  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
198  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
199  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ' .
200  'AND obj_id = ' . $ilDB->quote($obj_id, 'integer');
201  $res = $ilDB->query($query);
202  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
203  if ($row->deleted) {
204  return self::MAPPING_DELETED;
205  }
206  return (int) $row->status;
207  }
208  return self::MAPPING_UNMAPPED;
209  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilECSCmsData::lookupTitle ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id 
)
static

Lookup title by obj id.

Definition at line 147 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSMappingSettingsGUI\dConfirmDeleteTree().

147  : string
148  {
149  global $DIC;
150 
151  $ilDB = $DIC['ilDB'];
152 
153  $query = 'SELECT * FROM ecs_cms_data ' .
154  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
155  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
156  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer');
157  $res = $ilDB->query($query);
158  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
159  return $row->title;
160  }
161  return '';
162  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupTopTerm()

static ilECSCmsData::lookupTopTerm ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id 
)
static

Lookup term (highest term in cms tree)

Definition at line 167 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSNodeMappingTreeTableGUI\parse().

167  : string
168  {
169  global $DIC;
170 
171  $ilDB = $DIC['ilDB'];
172 
173  $query = 'SELECT term FROM ecs_cms_data ' .
174  'JOIN ecs_cms_tree ON obj_id = child ' .
175  'WHERE tree = ' . $ilDB->quote($a_tree_id, 'integer') . ' ' .
176  'AND server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
177  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
178  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ' .
179  'ORDER BY depth';
180  $res = $ilDB->query($query);
181  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
182  return $row->term;
183  }
184  return '';
185  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ lookupTreeIds()

static ilECSCmsData::lookupTreeIds ( int  $a_server_id,
int  $a_mid 
)
static
Parameters
int$a_server_id
int$a_mid
Returns
int[]

Definition at line 360 of file class.ilECSCmsData.php.

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

Referenced by ilECSNodeMappingTreeTableGUI\parse().

360  : array
361  {
362  global $DIC;
363 
364  $ilDB = $DIC['ilDB'];
365 
366  $query = 'SELECT DISTINCT(tree_id) tid FROM ecs_cms_data ' .
367  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
368  'AND mid = ' . $ilDB->quote($a_mid, 'integer');
369  $res = $ilDB->query($query);
370 
371  $tree_ids = [];
372  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
373  $tree_ids[] = (int) $row->tid;
374  }
375  return $tree_ids;
376  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read()

ilECSCmsData::read ( )
protected

Definition at line 528 of file class.ilECSCmsData.php.

References $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by __construct().

528  : void
529  {
530  $query = 'SELECT * FROM ecs_cms_data ' .
531  'WHERE obj_id = ' . $this->db->quote($this->obj_id, 'integer');
532  $res = $this->db->query($query);
533  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
534  $this->title = $row->title;
535  $this->term = $row->term;
536  $this->server_id = $row->server_id;
537  $this->mid = $row->mid;
538  $this->tree_id = $row->tree_id;
539  $this->cms_id = $row->cms_id;
540  $this->status = $row->status;
541  $this->deleted = $row->deleted;
542  }
543  }
$res
Definition: ltiservices.php:66
+ Here is the caller graph for this function:

◆ save()

ilECSCmsData::save ( )

Definition at line 470 of file class.ilECSCmsData.php.

470  : bool
471  {
472  $this->obj_id = $this->db->nextId('ecs_cms_data');
473 
474  $query = 'INSERT INTO ecs_cms_data (obj_id,server_id,mid,tree_id,cms_id,title,term,status,deleted) ' .
475  'VALUES ( ' .
476  $this->db->quote($this->obj_id, 'integer') . ', ' .
477  $this->db->quote($this->server_id, 'integer') . ', ' .
478  $this->db->quote($this->mid, 'integer') . ', ' .
479  $this->db->quote($this->tree_id, 'integer') . ', ' .
480  $this->db->quote($this->cms_id, 'text') . ', ' .
481  $this->db->quote($this->title, 'text') . ', ' .
482  $this->db->quote($this->term, 'text') . ', ' .
483  $this->db->quote($this->status, 'integer') . ', ' .
484  $this->db->quote($this->deleted, 'integer') . ' ' .
485  ')';
486  $this->db->manipulate($query);
487  return true;
488  }

◆ setCmsId()

ilECSCmsData::setCmsId (   $a_id)

Definition at line 409 of file class.ilECSCmsData.php.

409  : void
410  {
411  $this->cms_id = $a_id;
412  }

◆ setDeleted()

ilECSCmsData::setDeleted (   $a_is_deleted)

Definition at line 459 of file class.ilECSCmsData.php.

459  : void
460  {
461  $this->deleted = $a_is_deleted;
462  }

◆ setMid()

ilECSCmsData::setMid (   $a_id)

Definition at line 439 of file class.ilECSCmsData.php.

439  : void
440  {
441  $this->mid = $a_id;
442  }

◆ setObjId()

ilECSCmsData::setObjId (   $a_id)

Definition at line 399 of file class.ilECSCmsData.php.

399  : void
400  {
401  $this->obj_id = $a_id;
402  }

◆ setServerId()

ilECSCmsData::setServerId (   $a_id)

Definition at line 419 of file class.ilECSCmsData.php.

419  : void
420  {
421  $this->server_id = $a_id;
422  }

◆ setStatus()

ilECSCmsData::setStatus (   $a_status)

Definition at line 449 of file class.ilECSCmsData.php.

449  : void
450  {
451  $this->status = $a_status;
452  }

◆ setTerm()

ilECSCmsData::setTerm (   $a_term)

Definition at line 389 of file class.ilECSCmsData.php.

389  : void
390  {
391  $this->term = $a_term;
392  }

◆ setTitle()

ilECSCmsData::setTitle (   $a_title)

Definition at line 379 of file class.ilECSCmsData.php.

379  : void
380  {
381  $this->title = $a_title;
382  }

◆ setTreeId()

ilECSCmsData::setTreeId (   $a_id)

Definition at line 429 of file class.ilECSCmsData.php.

429  : void
430  {
431  $this->tree_id = $a_id;
432  }

◆ treeExists()

static ilECSCmsData::treeExists ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id 
)
static

Definition at line 53 of file class.ilECSCmsData.php.

References $DIC, $ilDB, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilECSTreeReader\read().

53  : bool
54  {
55  global $DIC;
56 
57  $ilDB = $DIC['ilDB'];
58 
59  $query = 'SELECT COUNT(*) num FROM ecs_cms_data ' .
60  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
61  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
62  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer');
63 
64  $res = $ilDB->query($query);
65  if ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
66  return $row->num > 0;
67  }
68  return false;
69  }
$res
Definition: ltiservices.php:66
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ update()

ilECSCmsData::update ( )

Definition at line 490 of file class.ilECSCmsData.php.

References isDeleted().

490  : void
491  {
492  $query = "UPDATE ecs_cms_data SET " .
493  'title = ' . $this->db->quote($this->title, 'text') . ', ' .
494  'term = ' . $this->db->quote($this->term, 'text') . ', ' .
495  'status = ' . $this->db->quote($this->status, 'text') . ', ' .
496  'deleted = ' . $this->db->quote($this->isDeleted(), 'integer') . ' ' .
497  'WHERE obj_id = ' . $this->db->quote($this->obj_id, 'integer');
498  $this->db->manipulate($query);
499  }
+ Here is the call graph for this function:

◆ updateStatus()

static ilECSCmsData::updateStatus ( int  $a_server_id,
int  $a_mid,
int  $a_tree_id 
)
static

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

References ilECSNodeMappingAssignments\lookupAssignmentIds().

Referenced by ilECSMappingSettingsGUI\dInitEditTree(), and ilECSMappingSettingsGUI\dMap().

232  : void
233  {
234  // Set all status to pending unmapped
235  self::writeAllStatus($a_server_id, $a_mid, $a_tree_id, self::MAPPING_UNMAPPED);
236 
237  // Set mapped for mapped and their descendent
238  foreach (ilECSNodeMappingAssignments::lookupAssignmentIds($a_server_id, $a_mid, $a_tree_id) as $assignment) {
239  $cmsTree = new ilECSCmsTree($a_tree_id);
240  $subIds = self::lookupCmsIds(array_merge($cmsTree->getSubTreeIds($assignment), array($assignment)));
241 
242  self::writeStatus(
243  $a_server_id,
244  $a_mid,
245  $a_tree_id,
246  $subIds,
247  self::MAPPING_MAPPED
248  );
249  }
250  }
static lookupAssignmentIds(int $a_server_id, int $a_mid, int $a_tree_id)
Lookup assignments.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeAllDeleted()

static ilECSCmsData::writeAllDeleted (   $a_server_id,
  $a_mid,
  $a_tree_id,
  $a_deleted_flag 
)
static

Write deleted status.

Definition at line 340 of file class.ilECSCmsData.php.

References $DIC, and $ilDB.

Referenced by ilECSCmsTreeCommandQueueHandler\handleUpdate().

340  : bool
341  {
342  global $DIC;
343 
344  $ilDB = $DIC['ilDB'];
345 
346  $query = 'UPDATE ecs_cms_data ' .
347  'SET deleted = ' . $ilDB->quote($a_deleted_flag, 'integer') . ' ' .
348  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
349  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
350  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ';
351  $ilDB->manipulate($query);
352  return true;
353  }
global $DIC
Definition: shib_login.php:22
+ Here is the caller graph for this function:

◆ writeAllStatus()

static ilECSCmsData::writeAllStatus (   $a_server_id,
  $a_mid,
  $a_tree_id,
  $status 
)
static

Update status.

Definition at line 322 of file class.ilECSCmsData.php.

References $DIC, and $ilDB.

322  : bool
323  {
324  global $DIC;
325 
326  $ilDB = $DIC['ilDB'];
327 
328  $query = 'UPDATE ecs_cms_data ' .
329  'SET status = ' . $ilDB->quote($status, 'integer') . ' ' .
330  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
331  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
332  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ';
333  $ilDB->manipulate($query);
334  return true;
335  }
global $DIC
Definition: shib_login.php:22

◆ writeStatus()

static ilECSCmsData::writeStatus (   $a_server_id,
  $a_mid,
  $a_tree_id,
  $cms_ids,
  $status 
)
static

Update status.

Definition at line 303 of file class.ilECSCmsData.php.

References $DIC, and $ilDB.

303  : bool
304  {
305  global $DIC;
306 
307  $ilDB = $DIC['ilDB'];
308 
309  $query = 'UPDATE ecs_cms_data ' .
310  'SET status = ' . $ilDB->quote($status, 'integer') . ' ' .
311  'WHERE server_id = ' . $ilDB->quote($a_server_id, 'integer') . ' ' .
312  'AND mid = ' . $ilDB->quote($a_mid, 'integer') . ' ' .
313  'AND tree_id = ' . $ilDB->quote($a_tree_id, 'integer') . ' ' .
314  'AND ' . $ilDB->in('cms_id', $cms_ids, false, 'text');
315  $ilDB->manipulate($query);
316  return true;
317  }
global $DIC
Definition: shib_login.php:22

Field Documentation

◆ $cms_id

string ilECSCmsData::$cms_id
private

Definition at line 38 of file class.ilECSCmsData.php.

Referenced by getCmsId().

◆ $db

ilDBInterface ilECSCmsData::$db
private

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

◆ $deleted

bool ilECSCmsData::$deleted = false
private

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

Referenced by findDeletedNodes(), and isDeleted().

◆ $mid

int ilECSCmsData::$mid
private

Definition at line 36 of file class.ilECSCmsData.php.

Referenced by getMid().

◆ $obj_id

int ilECSCmsData::$obj_id
private

Definition at line 34 of file class.ilECSCmsData.php.

Referenced by getObjId().

◆ $server_id

int ilECSCmsData::$server_id
private

Definition at line 35 of file class.ilECSCmsData.php.

Referenced by getServerId().

◆ $status

int ilECSCmsData::$status = self::MAPPING_UNMAPPED
private

Definition at line 41 of file class.ilECSCmsData.php.

Referenced by getStatus().

◆ $term

string ilECSCmsData::$term
private

Definition at line 40 of file class.ilECSCmsData.php.

Referenced by getTerm().

◆ $title

string ilECSCmsData::$title
private

Definition at line 39 of file class.ilECSCmsData.php.

Referenced by getTitle().

◆ $tree_id

int ilECSCmsData::$tree_id
private

Definition at line 37 of file class.ilECSCmsData.php.

Referenced by getTreeId().

◆ MAPPING_DELETED

◆ MAPPING_MAPPED

const ilECSCmsData::MAPPING_MAPPED = 4

◆ MAPPING_PENDING_DISCONNECTABLE

const ilECSCmsData::MAPPING_PENDING_DISCONNECTABLE = 2

◆ MAPPING_PENDING_NOT_DISCONNECTABLE

const ilECSCmsData::MAPPING_PENDING_NOT_DISCONNECTABLE = 3

◆ MAPPING_UNMAPPED

const ilECSCmsData::MAPPING_UNMAPPED = 1

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