ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilObjCourseGrouping Class Reference

Class ilObj<module_name> More...

+ Collaboration diagram for ilObjCourseGrouping:

Public Member Functions

 __construct ($a_id=0)
 Constructor public. More...
 
 setId ($a_id)
 
 getId ()
 
 setContainerRefId ($a_ref_id)
 
 getContainerRefId ()
 
 setContainerObjId ($a_obj_id)
 
 getContainerObjId ()
 
 getContainerType ()
 
 setContainerType ($a_type)
 
 setType ($a_type)
 
 getType ()
 
 setTitle ($a_title)
 
 getTitle ()
 
 setDescription ($a_desc)
 
 getDescription ()
 
 setUniqueField ($a_uni)
 
 getUniqueField ()
 
 getCountAssignedItems ()
 
 getAssignedItems ()
 
 delete ()
 
 create ($a_course_ref_id, $a_course_id)
 
 update ()
 
 isAssigned ($a_course_id)
 
 read ()
 
 _checkAccess ($grouping_id)
 
 assign ($a_crs_ref_id, $a_course_id)
 
 deassign ($a_crs_ref_id, $a_course_id)
 
 __addCondition ($a_target_ref_id, $a_target_obj_id)
 

Static Public Member Functions

static _getVisibleGroupings ($a_obj_id)
 
static _deleteAll ($a_course_id)
 
static _getGroupings ($a_course_id)
 
static _checkCondition ($trigger_obj_id, $operator, $value, $a_usr_id=0)
 
static _getGroupingCourseIds ($a_course_ref_id, $a_course_id)
 Get all ids of courses that are grouped with another course static. More...
 
static getAssignedObjects ()
 Alway call checkGroupingDependencies before. More...
 
static _checkGroupingDependencies (&$container_obj, $a_user_id=null)
 
static _getGroupingItems ($container_obj)
 Get courses/groups that are assigned to the same membership limitation. More...
 

Data Fields

 $db
 

Static Protected Attributes

static $assignedObjects = array()
 

Detailed Description

Class ilObj<module_name>

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilObjCourseGrouping::__construct (   $a_id = 0)

Constructor public.

Parameters
intreference_id or object_id

Definition at line 45 of file class.ilObjCourseGrouping.php.

References $ilDB, read(), setId(), and setType().

46  {
47  global $ilDB;
48 
49  $this->setType('crsg');
50  $this->db = $ilDB;
51 
52  $this->setId($a_id);
53 
54  if ($a_id) {
55  $this->read();
56  }
57  }
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ __addCondition()

ilObjCourseGrouping::__addCondition (   $a_target_ref_id,
  $a_target_obj_id 
)

Definition at line 370 of file class.ilObjCourseGrouping.php.

References getId(), and getUniqueField().

Referenced by assign().

371  {
372  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
373 
374  $tmp_condh = new ilConditionHandler();
375  $tmp_condh->enableAutomaticValidation(false);
376 
377  $tmp_condh->setTargetRefId($a_target_ref_id);
378  $tmp_condh->setTargetObjId($a_target_obj_id);
379  $tmp_condh->setTargetType('crs');
380  $tmp_condh->setTriggerRefId(0);
381  $tmp_condh->setTriggerObjId($this->getId());
382  $tmp_condh->setTriggerType('crsg');
383  $tmp_condh->setOperator('not_member');
384  $tmp_condh->setValue($this->getUniqueField());
385 
386  if (!$tmp_condh->checkExists()) {
387  $tmp_condh->storeCondition();
388 
389  return true;
390  }
391  return false;
392  }
Handles conditions for accesses to different ILIAS objects.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _checkAccess()

ilObjCourseGrouping::_checkAccess (   $grouping_id)

Definition at line 272 of file class.ilObjCourseGrouping.php.

273  {
274  global $ilAccess,$tree;
275 
276  $tmp_grouping_obj = new ilObjCourseGrouping($grouping_id);
277 
278  $found_invisible = false;
279  foreach ($tmp_grouping_obj->getAssignedItems() as $condition) {
280  if (!$ilAccess->checkAccess('write', '', $condition['target_ref_id'])) {
281  $found_invisible = true;
282  break;
283  }
284  }
285  return $found_invisible ? false : true;
286  }
Class ilObj<module_name>

◆ _checkCondition()

static ilObjCourseGrouping::_checkCondition (   $trigger_obj_id,
  $operator,
  $value,
  $a_usr_id = 0 
)
static

Definition at line 428 of file class.ilObjCourseGrouping.php.

Referenced by ilConditionHandler\_checkCondition().

429  {
430  // in the moment i alway return true, there are some problems with presenting the condition if it fails,
431  // only course register class check manually if this condition is fullfilled
432  return true;
433  }
+ Here is the caller graph for this function:

◆ _checkGroupingDependencies()

static ilObjCourseGrouping::_checkGroupingDependencies ( $container_obj,
  $a_user_id = null 
)
static

Definition at line 473 of file class.ilObjCourseGrouping.php.

References $ilUser, $lng, ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\_getConditionsOfTrigger(), ilGroupParticipants\_getInstanceByObjId(), ilCourseParticipants\_getInstanceByObjId(), ilObjGroup\_isMember(), array, and ilObjUser\lookupMatriculation().

Referenced by ilRegistrationGUI\fillMembershipLimitation(), ilSubscriberTableGUI\fillRow(), and ilWaitingListTableGUI\fillRow().

474  {
475  global $ilUser,$lng,$tree;
476 
477  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
478 
479  $user_id = is_null($a_user_id) ? $ilUser->getId() : $a_user_id;
480 
481 
482  $trigger_ids = array();
484  $container_obj->getRefId(),
485  $container_obj->getId(),
486  $container_obj->getType()
487  ) as $condition) {
488  if ($condition['operator'] == 'not_member') {
489  $trigger_ids[] = $condition['trigger_obj_id'];
490  break;
491  }
492  }
493  if (!count($trigger_ids)) {
494  return true;
495  }
496  $matriculation_message = $assigned_message = '';
497  self::$assignedObjects = array();
498  foreach ($trigger_ids as $trigger_id) {
499  foreach (ilConditionHandler::_getConditionsOfTrigger('crsg', $trigger_id) as $condition) {
500  // Handle deleted items
501  if ($tree->isDeleted($condition['target_ref_id'])) {
502  continue;
503  }
504  if ($condition['operator'] == 'not_member') {
505  switch ($condition['value']) {
506  case 'matriculation':
507  if (!strlen(ilObjUser::lookupMatriculation($user_id))) {
508  if (!$matriculation_message) {
509  $matriculation_message = $lng->txt('crs_grp_matriculation_required');
510  }
511  }
512  }
513  if ($container_obj->getType() == 'crs') {
514  include_once('Modules/Course/classes/class.ilCourseParticipants.php');
515  $members = ilCourseParticipants::_getInstanceByObjId($condition['target_obj_id']);
516  if ($members->isGroupingMember($user_id, $condition['value'])) {
517  if (!$assigned_message) {
518  self::$assignedObjects[] = $condition['target_obj_id'];
519  $assigned_message = $lng->txt('crs_grp_already_assigned');
520  }
521  }
522  } elseif ($container_obj->getType() == 'grp') {
523  include_once('Modules/Group/classes/class.ilGroupParticipants.php');
524  $members = ilGroupParticipants::_getInstanceByObjId($condition['target_obj_id']);
525  if ($members->isGroupingMember($user_id, $condition['value'])) {
526  if (!$assigned_message) {
527  self::$assignedObjects[] = $condition['target_obj_id'];
528  $assigned_message = $lng->txt('grp_grp_already_assigned');
529  }
530  }
531  } else {
532  if (ilObjGroup::_isMember($user_id, $condition['target_ref_id'], $condition['value'])) {
533  if (!$assigned_message) {
534  self::$assignedObjects[] = $condition['target_obj_id'];
535  $assigned_message = $lng->txt('crs_grp_already_assigned');
536  }
537  }
538  }
539  }
540  }
541  }
542  if ($matriculation_message) {
543  $container_obj->appendMessage($matriculation_message);
544  return false;
545  } elseif ($assigned_message) {
546  $container_obj->appendMessage($assigned_message);
547  return false;
548  }
549  return true;
550  }
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static lookupMatriculation($a_usr_id)
Lookup matriculation.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
$ilUser
Definition: imgupload.php:18
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Create styles array
The data for the language used.
global $lng
Definition: privfeed.php:17
_isMember($a_user_id, $a_ref_id, $a_field='')
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _deleteAll()

static ilObjCourseGrouping::_deleteAll (   $a_course_id)
static

Definition at line 395 of file class.ilObjCourseGrouping.php.

References $ilDB, $query, $res, and _getGroupings().

Referenced by ilObjCourse\delete().

396  {
397  global $ilDB;
398 
399  // DELETE CONDITIONS
400  foreach ($groupings = ilObjCourseGrouping::_getGroupings($a_course_id) as $grouping_id) {
401  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
402 
403  $condh = new ilConditionHandler();
404  $condh->deleteByObjId($grouping_id);
405  }
406 
407  $query = "DELETE FROM crs_groupings " .
408  "WHERE crs_id = " . $ilDB->quote($a_course_id, 'integer') . " ";
409  $res = $ilDB->manipulate($query);
410 
411  return true;
412  }
foreach($_POST as $key=> $value) $res
$query
Handles conditions for accesses to different ILIAS objects.
global $ilDB
static _getGroupings($a_course_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getGroupingCourseIds()

static ilObjCourseGrouping::_getGroupingCourseIds (   $a_course_ref_id,
  $a_course_id 
)
static

Get all ids of courses that are grouped with another course static.

Parameters
integerobject_id of one course
arrayinteger ids of courses or empty array if course is not in grouping

Definition at line 442 of file class.ilObjCourseGrouping.php.

References ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\_getConditionsOfTrigger(), and array.

443  {
444  global $tree;
445 
446  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
447 
448  // get all grouping ids the course is assigned to
449  foreach (ilConditionHandler::_getConditionsOfTarget($a_course_ref_id, $a_course_id, 'crs') as $condition) {
450  if ($condition['trigger_type'] == 'crsg') {
451  foreach (ilConditionHandler::_getConditionsOfTrigger('crsg', $condition['trigger_obj_id']) as $target_condition) {
452  if ($tree->isDeleted($target_condition['target_ref_id'])) {
453  continue;
454  }
455  $course_ids[] = array('id' => $target_condition['target_obj_id'],
456  'unique' => $target_condition['value']);
457  }
458  }
459  }
460  return $course_ids ? $course_ids : array();
461  }
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ _getGroupingItems()

static ilObjCourseGrouping::_getGroupingItems (   $container_obj)
static

Get courses/groups that are assigned to the same membership limitation.

Parameters
objectcontainer object
Returns
array array of reference ids

Definition at line 559 of file class.ilObjCourseGrouping.php.

References ilConditionHandler\_getConditionsOfTarget(), ilConditionHandler\_getConditionsOfTrigger(), and array.

Referenced by ilRegistrationGUI\fillMembershipLimitation().

560  {
561  global $tree,$ilObjDataCache,$ilAccess,$tree;
562 
563  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
564 
565  $trigger_ids = array();
567  $container_obj->getRefId(),
568  $container_obj->getId(),
569  $container_obj->getType()
570  ) as $condition) {
571  if ($condition['operator'] == 'not_member') {
572  $trigger_ids[] = $condition['trigger_obj_id'];
573  }
574  }
575  if (!count($trigger_ids)) {
576  return false;
577  }
578  $hash_table = array();
579  foreach ($trigger_ids as $trigger_id) {
580  foreach (ilConditionHandler::_getConditionsOfTrigger('crsg', $trigger_id) as $condition) {
581  // Continue if trigger is deleted
582  if ($tree->isDeleted($condition['target_ref_id'])) {
583  continue;
584  }
585 
586  if ($condition['operator'] == 'not_member') {
587  if (!$hash_table[$condition['target_ref_id']]) {
588  $items[] = $condition['target_ref_id'];
589  }
590  $hash_table[$condition['target_ref_id']] = true;
591  }
592  }
593  }
594  return $items ? $items : array();
595  }
static _getConditionsOfTarget($a_target_ref_id, $a_target_obj_id, $a_target_type="")
get all conditions of target object
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _getGroupings()

static ilObjCourseGrouping::_getGroupings (   $a_course_id)
static

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

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by _deleteAll().

415  {
416  global $ilDB;
417 
418  $query = "SELECT * FROM crs_groupings " .
419  "WHERE crs_id = " . $ilDB->quote($a_course_id, 'integer') . " ";
420 
421  $res = $ilDB->query($query);
422  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
423  $groupings[] = $row->crs_grp_id;
424  }
425  return $groupings ? $groupings : array();
426  }
foreach($_POST as $key=> $value) $res
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ _getVisibleGroupings()

static ilObjCourseGrouping::_getVisibleGroupings (   $a_obj_id)
static
Parameters
int$a_obj_id
Returns
array

Returns a list of all groupings for which the current user hast write permission on all assigned objects. Or groupings the given object id is assigned to.

Definition at line 296 of file class.ilObjCourseGrouping.php.

References $ilDB, $query, $res, $row, array, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilCourseGroupingTableGUI\getItems().

297  {
298  global $ilObjDataCache,$ilAccess,$ilDB;
299 
300  $container_type = $ilObjDataCache->lookupType($a_obj_id) == 'grp' ? 'grp' : 'crs';
301 
302 
303  // First get all groupings
304  $query = "SELECT * FROM object_data WHERE type = 'crsg' ORDER BY title";
305  $res = $ilDB->query($query);
306  $groupings = array();
307  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
308  $groupings[] = $row->obj_id;
309  }
310 
311  //check access
312  foreach ($groupings as $grouping_id) {
313  $tmp_grouping_obj = new ilObjCourseGrouping($grouping_id);
314 
315  // Check container type
316  if ($tmp_grouping_obj->getContainerType() != $container_type) {
317  continue;
318  }
319  // Check if container is current container
320  if ($tmp_grouping_obj->getContainerObjId() == $a_obj_id) {
321  $visible_groupings[] = $grouping_id;
322  continue;
323  }
324  // check if items are assigned
325  if (count($items = $tmp_grouping_obj->getAssignedItems())) {
326  foreach ($items as $condition_data) {
327  if ($ilAccess->checkAccess('write', '', $condition_data['target_ref_id'])) {
328  $visible_groupings[] = $grouping_id;
329  break;
330  }
331  }
332  }
333  }
334  return $visible_groupings ? $visible_groupings : array();
335  }
foreach($_POST as $key=> $value) $res
Class ilObj<module_name>
$query
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ assign()

ilObjCourseGrouping::assign (   $a_crs_ref_id,
  $a_course_id 
)

Definition at line 337 of file class.ilObjCourseGrouping.php.

References __addCondition(), getContainerObjId(), and getContainerRefId().

338  {
339  // Add the parent course of grouping
340  $this->__addCondition($this->getContainerRefId(), $this->getContainerObjId());
341  $this->__addCondition($a_crs_ref_id, $a_course_id);
342 
343  return true;
344  }
__addCondition($a_target_ref_id, $a_target_obj_id)
+ Here is the call graph for this function:

◆ create()

ilObjCourseGrouping::create (   $a_course_ref_id,
  $a_course_id 
)

Definition at line 170 of file class.ilObjCourseGrouping.php.

References $ilDB, $ilUser, $query, $res, getDescription(), getId(), getTitle(), getUniqueField(), and setId().

171  {
172  global $ilUser,$ilDB;
173 
174  // INSERT IN object_data
175  $this->setId($ilDB->nextId("object_data"));
176  $query = "INSERT INTO object_data " .
177  "(obj_id, type,title,description,owner,create_date,last_update) " .
178  "VALUES " .
179  "(" .
180  $ilDB->quote($this->getId(), "integer") . "," .
181  $ilDB->quote($this->type, "text") . "," .
182  $ilDB->quote($this->getTitle(), "text") . "," .
183  $ilDB->quote($this->getDescription(), "text") . "," .
184  $ilDB->quote($ilUser->getId(), "integer") . "," .
185  $ilDB->now() . "," .
186  $ilDB->now() .
187  ')';
188 
189  $ilDB->manipulate($query);
190 
191  // INSERT in crs_groupings
192  $query = "INSERT INTO crs_groupings (crs_grp_id,crs_ref_id,crs_id,unique_field) " .
193  "VALUES (" .
194  $ilDB->quote($this->getId(), 'integer') . ", " .
195  $ilDB->quote($a_course_ref_id, 'integer') . ", " .
196  $ilDB->quote($a_course_id, 'integer') . ", " .
197  $ilDB->quote($this->getUniqueField(), 'text') . " " .
198  ")";
199  $res = $ilDB->manipulate($query);
200 
201  return $this->getId();
202  }
foreach($_POST as $key=> $value) $res
$ilUser
Definition: imgupload.php:18
$query
global $ilDB
+ Here is the call graph for this function:

◆ deassign()

ilObjCourseGrouping::deassign (   $a_crs_ref_id,
  $a_course_id 
)

Definition at line 346 of file class.ilObjCourseGrouping.php.

References ilConditionHandler\_getConditionsOfTrigger(), and getId().

347  {
348  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
349 
350 
351  $condh = new ilConditionHandler();
352 
353  // DELETE also original course if its the last
354  if ($this->getCountAssignedCourses() == 2) {
355  $condh->deleteByObjId($this->getId());
356 
357  return true;
358  }
359 
360  foreach (ilConditionHandler::_getConditionsOfTrigger('crsg', $this->getId()) as $cond_data) {
361  if ($cond_data['target_ref_id'] == $a_crs_ref_id and
362  $cond_data['target_obj_id'] == $a_course_id) {
363  $condh->deleteCondition($cond_data['id']);
364  }
365  }
366 
367  return true;
368  }
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
Handles conditions for accesses to different ILIAS objects.
+ Here is the call graph for this function:

◆ delete()

ilObjCourseGrouping::delete ( )

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

References $ilDB, $query, $res, getId(), and getType().

148  {
149  global $ilDB;
150 
151  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
152 
153  if ($this->getId() and $this->getType() === 'crsg') {
154  $query = "DELETE FROM object_data WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
155  $res = $ilDB->manipulate($query);
156 
157  $query = "DELETE FROM crs_groupings " .
158  "WHERE crs_grp_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
159  $res = $ilDB->manipulate($query);
160 
161  // Delete conditions
162  $condh = new ilConditionHandler();
163  $condh->deleteByObjId($this->getId());
164 
165  return true;
166  }
167  return false;
168  }
foreach($_POST as $key=> $value) $res
$query
Handles conditions for accesses to different ILIAS objects.
global $ilDB
+ Here is the call graph for this function:

◆ getAssignedItems()

ilObjCourseGrouping::getAssignedItems ( )

Definition at line 131 of file class.ilObjCourseGrouping.php.

References ilConditionHandler\_getConditionsOfTrigger(), array, getId(), and getType().

Referenced by getCountAssignedItems(), and isAssigned().

132  {
133  global $tree;
134 
135  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
136  $condition_data = ilConditionHandler::_getConditionsOfTrigger($this->getType(), $this->getId());
137  $conditions = array();
138  foreach ($condition_data as $condition) {
139  if ($tree->isDeleted($condition['target_ref_id'])) {
140  continue;
141  }
142  $conditions[] = $condition;
143  }
144  return count($conditions) ? $conditions : array();
145  }
static _getConditionsOfTrigger($a_trigger_obj_type, $a_trigger_id)
get all conditions of trigger object
Create styles array
The data for the language used.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getAssignedObjects()

static ilObjCourseGrouping::getAssignedObjects ( )
static

Alway call checkGroupingDependencies before.

Returns
array Assigned objects

Definition at line 468 of file class.ilObjCourseGrouping.php.

References array.

Referenced by ilSubscriberTableGUI\fillRow(), and ilWaitingListTableGUI\fillRow().

469  {
470  return self::$assignedObjects ? self::$assignedObjects : array();
471  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getContainerObjId()

ilObjCourseGrouping::getContainerObjId ( )

Definition at line 79 of file class.ilObjCourseGrouping.php.

Referenced by assign().

80  {
81  return $this->obj_id;
82  }
+ Here is the caller graph for this function:

◆ getContainerRefId()

ilObjCourseGrouping::getContainerRefId ( )

Definition at line 71 of file class.ilObjCourseGrouping.php.

Referenced by assign().

72  {
73  return $this->ref_id;
74  }
+ Here is the caller graph for this function:

◆ getContainerType()

ilObjCourseGrouping::getContainerType ( )

Definition at line 83 of file class.ilObjCourseGrouping.php.

84  {
85  return $this->container_type;
86  }

◆ getCountAssignedItems()

ilObjCourseGrouping::getCountAssignedItems ( )

Definition at line 126 of file class.ilObjCourseGrouping.php.

References getAssignedItems().

127  {
128  return count($this->getAssignedItems());
129  }
+ Here is the call graph for this function:

◆ getDescription()

ilObjCourseGrouping::getDescription ( )

Definition at line 113 of file class.ilObjCourseGrouping.php.

References $description.

Referenced by create(), and update().

114  {
115  return $this->description;
116  }
+ Here is the caller graph for this function:

◆ getId()

ilObjCourseGrouping::getId ( )

Definition at line 62 of file class.ilObjCourseGrouping.php.

References $id.

Referenced by __addCondition(), create(), deassign(), delete(), getAssignedItems(), read(), and update().

63  {
64  return $this->id;
65  }
if(!array_key_exists('StateId', $_REQUEST)) $id
+ Here is the caller graph for this function:

◆ getTitle()

ilObjCourseGrouping::getTitle ( )

Definition at line 105 of file class.ilObjCourseGrouping.php.

References $title.

Referenced by create(), and update().

106  {
107  return $this->title;
108  }
+ Here is the caller graph for this function:

◆ getType()

ilObjCourseGrouping::getType ( )

Definition at line 96 of file class.ilObjCourseGrouping.php.

References $type.

Referenced by delete(), getAssignedItems(), and update().

97  {
98  return $this->type;
99  }
$type
+ Here is the caller graph for this function:

◆ getUniqueField()

ilObjCourseGrouping::getUniqueField ( )

Definition at line 121 of file class.ilObjCourseGrouping.php.

Referenced by __addCondition(), create(), and update().

122  {
123  return $this->unique_field;
124  }
+ Here is the caller graph for this function:

◆ isAssigned()

ilObjCourseGrouping::isAssigned (   $a_course_id)

Definition at line 235 of file class.ilObjCourseGrouping.php.

References getAssignedItems().

236  {
237  foreach ($this->getAssignedItems() as $condition_data) {
238  if ($a_course_id == $condition_data['target_obj_id']) {
239  return true;
240  }
241  }
242  return false;
243  }
+ Here is the call graph for this function:

◆ read()

ilObjCourseGrouping::read ( )

Definition at line 245 of file class.ilObjCourseGrouping.php.

References $ilDB, $query, $res, $row, ilDBConstants\FETCHMODE_OBJECT, getId(), setContainerObjId(), setContainerRefId(), setContainerType(), setDescription(), setTitle(), and setUniqueField().

Referenced by __construct().

246  {
247  global $ilObjDataCache,$ilDB;
248 
249  $query = "SELECT * FROM object_data " .
250  "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
251 
252  $res = $this->db->query($query);
253  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
254  $this->setTitle($row->title);
255  $this->setDescription($row->description);
256  }
257 
258  $query = "SELECT * FROM crs_groupings " .
259  "WHERE crs_grp_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
260  $res = $ilDB->query($query);
261 
262  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
263  $this->setUniqueField($row->unique_field);
264  $this->setContainerRefId($row->crs_ref_id);
265  $this->setContainerObjId($row->crs_id);
266  $this->setContainerType($ilObjDataCache->lookupType($this->getContainerObjId()));
267  }
268 
269  return true;
270  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setContainerObjId()

ilObjCourseGrouping::setContainerObjId (   $a_obj_id)

Definition at line 75 of file class.ilObjCourseGrouping.php.

Referenced by read().

76  {
77  $this->obj_id = $a_obj_id;
78  }
+ Here is the caller graph for this function:

◆ setContainerRefId()

ilObjCourseGrouping::setContainerRefId (   $a_ref_id)

Definition at line 67 of file class.ilObjCourseGrouping.php.

Referenced by read().

68  {
69  $this->ref_id = $a_ref_id;
70  }
+ Here is the caller graph for this function:

◆ setContainerType()

ilObjCourseGrouping::setContainerType (   $a_type)

Definition at line 87 of file class.ilObjCourseGrouping.php.

References $a_type.

Referenced by read().

88  {
89  $this->container_type = $a_type;
90  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ setDescription()

ilObjCourseGrouping::setDescription (   $a_desc)

Definition at line 109 of file class.ilObjCourseGrouping.php.

Referenced by read().

110  {
111  $this->description = $a_desc;
112  }
+ Here is the caller graph for this function:

◆ setId()

ilObjCourseGrouping::setId (   $a_id)

Definition at line 58 of file class.ilObjCourseGrouping.php.

Referenced by __construct(), and create().

59  {
60  $this->id = $a_id;
61  }
+ Here is the caller graph for this function:

◆ setTitle()

ilObjCourseGrouping::setTitle (   $a_title)

Definition at line 101 of file class.ilObjCourseGrouping.php.

Referenced by read().

102  {
103  $this->title = $a_title;
104  }
+ Here is the caller graph for this function:

◆ setType()

ilObjCourseGrouping::setType (   $a_type)

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

References $a_type.

Referenced by __construct().

93  {
94  $this->type = $a_type;
95  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ setUniqueField()

ilObjCourseGrouping::setUniqueField (   $a_uni)

Definition at line 117 of file class.ilObjCourseGrouping.php.

Referenced by read().

118  {
119  $this->unique_field = $a_uni;
120  }
+ Here is the caller graph for this function:

◆ update()

ilObjCourseGrouping::update ( )

Definition at line 204 of file class.ilObjCourseGrouping.php.

References $ilDB, $query, $res, getDescription(), getId(), getTitle(), getType(), and getUniqueField().

205  {
206  global $ilDB;
207 
208  if ($this->getId() and $this->getType() === 'crsg') {
209  // UPDATe object_data
210  $query = "UPDATE object_data " .
211  "SET title = " . $ilDB->quote($this->getTitle(), 'text') . ", " .
212  "description = " . $ilDB->quote($this->getDescription(), 'text') . " " .
213  "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer') . " " .
214  "AND type = " . $ilDB->quote($this->getType(), 'text') . " ";
215  $res = $ilDB->manipulate($query);
216 
217  // UPDATE crs_groupings
218  $query = "UPDATE crs_groupings " .
219  "SET unique_field = " . $ilDB->quote($this->getUniqueField(), 'text') . " " .
220  "WHERE crs_grp_id = " . $ilDB->quote($this->getId(), 'integer') . " ";
221  $res = $ilDB->manipulate($query);
222 
223  // UPDATE conditions
224  $query = "UPDATE conditions " .
225  "SET value = " . $ilDB->quote($this->getUniqueField(), 'text') . " " .
226  "WHERE trigger_obj_id = " . $ilDB->quote($this->getId(), 'integer') . " " .
227  "AND trigger_type = 'crsg'";
228  $res = $ilDB->manipulate($query);
229 
230  return true;
231  }
232  return false;
233  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB
+ Here is the call graph for this function:

Field Documentation

◆ $assignedObjects

ilObjCourseGrouping::$assignedObjects = array()
staticprotected

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

◆ $db

ilObjCourseGrouping::$db

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


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