ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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  {
56  $this->read();
57  }
58  }
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 394 of file class.ilObjCourseGrouping.php.

References getId(), and getUniqueField().

Referenced by assign().

395  {
396  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
397 
398  $tmp_condh = new ilConditionHandler();
399  $tmp_condh->enableAutomaticValidation(false);
400 
401  $tmp_condh->setTargetRefId($a_target_ref_id);
402  $tmp_condh->setTargetObjId($a_target_obj_id);
403  $tmp_condh->setTargetType('crs');
404  $tmp_condh->setTriggerRefId(0);
405  $tmp_condh->setTriggerObjId($this->getId());
406  $tmp_condh->setTriggerType('crsg');
407  $tmp_condh->setOperator('not_member');
408  $tmp_condh->setValue($this->getUniqueField());
409 
410  if(!$tmp_condh->checkExists())
411  {
412  $tmp_condh->storeCondition();
413 
414  return true;
415  }
416  return false;
417  }
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 281 of file class.ilObjCourseGrouping.php.

282  {
283  global $ilAccess,$tree;
284 
285  $tmp_grouping_obj = new ilObjCourseGrouping($grouping_id);
286 
287  $found_invisible = false;
288  foreach($tmp_grouping_obj->getAssignedItems() as $condition)
289  {
290  if(!$ilAccess->checkAccess('write','',$condition['target_ref_id']))
291  {
292  $found_invisible = true;
293  break;
294  }
295  }
296  return $found_invisible ? false : true;
297  }
Class ilObj<module_name>

◆ _checkCondition()

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

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

Referenced by ilConditionHandler\_checkCondition().

456  {
457  // in the moment i alway return true, there are some problems with presenting the condition if it fails,
458  // only course register class check manually if this condition is fullfilled
459  return true;
460  }
+ Here is the caller graph for this function:

◆ _checkGroupingDependencies()

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

Definition at line 504 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().

505  {
506  global $ilUser,$lng,$tree;
507 
508  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
509 
510  $user_id = is_null($a_user_id) ? $ilUser->getId() : $a_user_id;
511 
512 
513  $trigger_ids = array();
514  foreach(ilConditionHandler::_getConditionsOfTarget($container_obj->getRefId(),
515  $container_obj->getId(),
516  $container_obj->getType()) as $condition)
517  {
518  if($condition['operator'] == 'not_member')
519  {
520  $trigger_ids[] = $condition['trigger_obj_id'];
521  break;
522  }
523  }
524  if(!count($trigger_ids))
525  {
526  return true;
527  }
528  $matriculation_message = $assigned_message = '';
529  self::$assignedObjects = array();
530  foreach($trigger_ids as $trigger_id)
531  {
532  foreach(ilConditionHandler::_getConditionsOfTrigger('crsg',$trigger_id) as $condition)
533  {
534  // Handle deleted items
535  if($tree->isDeleted($condition['target_ref_id']))
536  {
537  continue;
538  }
539  if($condition['operator'] == 'not_member')
540  {
541  switch($condition['value'])
542  {
543  case 'matriculation':
544  if(!strlen(ilObjUser::lookupMatriculation($user_id)))
545  {
546  if(!$matriculation_message)
547  {
548  $matriculation_message = $lng->txt('crs_grp_matriculation_required');
549  }
550  }
551  }
552  if($container_obj->getType() == 'crs')
553  {
554  include_once('Modules/Course/classes/class.ilCourseParticipants.php');
555  $members = ilCourseParticipants::_getInstanceByObjId($condition['target_obj_id']);
556  if($members->isGroupingMember($user_id,$condition['value']))
557  {
558  if(!$assigned_message)
559  {
560  self::$assignedObjects[] = $condition['target_obj_id'];
561  $assigned_message = $lng->txt('crs_grp_already_assigned');
562  }
563  }
564  }
565  elseif($container_obj->getType() == 'grp')
566  {
567  include_once('Modules/Group/classes/class.ilGroupParticipants.php');
568  $members = ilGroupParticipants::_getInstanceByObjId($condition['target_obj_id']);
569  if($members->isGroupingMember($user_id,$condition['value']))
570  {
571  if(!$assigned_message)
572  {
573  self::$assignedObjects[] = $condition['target_obj_id'];
574  $assigned_message = $lng->txt('crs_grp_already_assigned');
575  }
576  }
577 
578  }
579  else
580  {
581  if(ilObjGroup::_isMember($user_id,$condition['target_ref_id'],$condition['value']))
582  {
583  if(!$assigned_message)
584  {
585  self::$assignedObjects[] = $condition['target_obj_id'];
586  $assigned_message = $lng->txt('crs_grp_already_assigned');
587  }
588  }
589 
590  }
591  }
592  }
593  }
594  if($matriculation_message)
595  {
596  $container_obj->appendMessage($matriculation_message);
597  return false;
598  }
599  elseif($assigned_message)
600  {
601  $container_obj->appendMessage($assigned_message);
602  return false;
603  }
604  return true;
605  }
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 420 of file class.ilObjCourseGrouping.php.

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

Referenced by ilObjCourse\delete().

421  {
422  global $ilDB;
423 
424  // DELETE CONDITIONS
425  foreach($groupings = ilObjCourseGrouping::_getGroupings($a_course_id) as $grouping_id)
426  {
427  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
428 
429  $condh = new ilConditionHandler();
430  $condh->deleteByObjId($grouping_id);
431  }
432 
433  $query = "DELETE FROM crs_groupings ".
434  "WHERE crs_id = ".$ilDB->quote($a_course_id,'integer')." ";
435  $res = $ilDB->manipulate($query);
436 
437  return true;
438  }
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 469 of file class.ilObjCourseGrouping.php.

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

470  {
471  global $tree;
472 
473  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
474 
475  // get all grouping ids the course is assigned to
476  foreach(ilConditionHandler::_getConditionsOfTarget($a_course_ref_id,$a_course_id,'crs') as $condition)
477  {
478  if($condition['trigger_type'] == 'crsg')
479  {
480  foreach(ilConditionHandler::_getConditionsOfTrigger('crsg',$condition['trigger_obj_id']) as $target_condition)
481  {
482  if($tree->isDeleted($target_condition['target_ref_id']))
483  {
484  continue;
485  }
486  $course_ids[] = array('id' => $target_condition['target_obj_id'],
487  'unique' => $target_condition['value']);
488  }
489  }
490  }
491  return $course_ids ? $course_ids : array();
492  }
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 614 of file class.ilObjCourseGrouping.php.

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

Referenced by ilRegistrationGUI\fillMembershipLimitation().

615  {
616  global $tree,$ilObjDataCache,$ilAccess,$tree;
617 
618  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
619 
620  $trigger_ids = array();
621  foreach(ilConditionHandler::_getConditionsOfTarget($container_obj->getRefId(),
622  $container_obj->getId(),
623  $container_obj->getType()) as $condition)
624  {
625  if($condition['operator'] == 'not_member')
626  {
627  $trigger_ids[] = $condition['trigger_obj_id'];
628  }
629  }
630  if(!count($trigger_ids))
631  {
632  return false;
633  }
634  $hash_table = array();
635  foreach($trigger_ids as $trigger_id)
636  {
637  foreach(ilConditionHandler::_getConditionsOfTrigger('crsg',$trigger_id) as $condition)
638  {
639  // Continue if trigger is deleted
640  if($tree->isDeleted($condition['target_ref_id']))
641  {
642  continue;
643  }
644 
645  if($condition['operator'] == 'not_member')
646  {
647  if(!$hash_table[$condition['target_ref_id']])
648  {
649  $items[] = $condition['target_ref_id'];
650  }
651  $hash_table[$condition['target_ref_id']] = true;
652  }
653  }
654  }
655  return $items ? $items : array();
656  }
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 440 of file class.ilObjCourseGrouping.php.

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

Referenced by _deleteAll().

441  {
442  global $ilDB;
443 
444  $query = "SELECT * FROM crs_groupings ".
445  "WHERE crs_id = ".$ilDB->quote($a_course_id,'integer')." ";
446 
447  $res = $ilDB->query($query);
448  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
449  {
450  $groupings[] = $row->crs_grp_id;
451  }
452  return $groupings ? $groupings : array();
453  }
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 307 of file class.ilObjCourseGrouping.php.

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

Referenced by ilCourseGroupingTableGUI\getItems().

308  {
309  global $ilObjDataCache,$ilAccess,$ilDB;
310 
311  $container_type = $ilObjDataCache->lookupType($a_obj_id) == 'grp' ? 'grp' : 'crs';
312 
313 
314  // First get all groupings
315  $query = "SELECT * FROM object_data WHERE type = 'crsg' ORDER BY title";
316  $res = $ilDB->query($query);
317  $groupings = array();
318  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
319  {
320  $groupings[] = $row->obj_id;
321  }
322 
323  //check access
324  foreach($groupings as $grouping_id)
325  {
326  $tmp_grouping_obj = new ilObjCourseGrouping($grouping_id);
327 
328  // Check container type
329  if($tmp_grouping_obj->getContainerType() != $container_type)
330  {
331  continue;
332  }
333  // Check if container is current container
334  if($tmp_grouping_obj->getContainerObjId() == $a_obj_id)
335  {
336  $visible_groupings[] = $grouping_id;
337  continue;
338  }
339  // check if items are assigned
340  if(count($items = $tmp_grouping_obj->getAssignedItems()))
341  {
342  foreach($items as $condition_data)
343  {
344  if($ilAccess->checkAccess('write','',$condition_data['target_ref_id']))
345  {
346  $visible_groupings[] = $grouping_id;
347  break;
348  }
349  }
350 
351  }
352  }
353  return $visible_groupings ? $visible_groupings : array();
354  }
Class ilObj<module_name>
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 356 of file class.ilObjCourseGrouping.php.

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

357  {
358  // Add the parent course of grouping
359  $this->__addCondition($this->getContainerRefId(),$this->getContainerObjId());
360  $this->__addCondition($a_crs_ref_id,$a_course_id);
361 
362  return true;
363  }
__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 174 of file class.ilObjCourseGrouping.php.

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

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

◆ deassign()

ilObjCourseGrouping::deassign (   $a_crs_ref_id,
  $a_course_id 
)

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

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

366  {
367  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
368 
369 
370  $condh = new ilConditionHandler();
371 
372  // DELETE also original course if its the last
373  if($this->getCountAssignedCourses() == 2)
374  {
375  $condh->deleteByObjId($this->getId());
376 
377  return true;
378  }
379 
380  foreach(ilConditionHandler::_getConditionsOfTrigger('crsg',$this->getId()) as $cond_data)
381  {
382 
383  if($cond_data['target_ref_id'] == $a_crs_ref_id and
384  $cond_data['target_obj_id'] == $a_course_id)
385  {
386  $condh->deleteCondition($cond_data['id']);
387  }
388  }
389 
390  return true;
391 
392  }
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 150 of file class.ilObjCourseGrouping.php.

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

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

◆ getAssignedItems()

ilObjCourseGrouping::getAssignedItems ( )

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

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

Referenced by getCountAssignedItems(), and isAssigned().

133  {
134  global $tree;
135 
136  include_once './Services/AccessControl/classes/class.ilConditionHandler.php';
137  $condition_data = ilConditionHandler::_getConditionsOfTrigger($this->getType(),$this->getId());
138  $conditions = array();
139  foreach($condition_data as $condition)
140  {
141  if($tree->isDeleted($condition['target_ref_id']))
142  {
143  continue;
144  }
145  $conditions[] = $condition;
146  }
147  return count($conditions) ? $conditions : array();
148  }
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 499 of file class.ilObjCourseGrouping.php.

References array.

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

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

◆ getContainerObjId()

ilObjCourseGrouping::getContainerObjId ( )

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

Referenced by assign().

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

◆ getContainerRefId()

ilObjCourseGrouping::getContainerRefId ( )

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

References $ref_id.

Referenced by assign().

73  {
74  return $this->ref_id;
75  }
$ref_id
Definition: sahs_server.php:39
+ Here is the caller graph for this function:

◆ getContainerType()

ilObjCourseGrouping::getContainerType ( )

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

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

◆ getCountAssignedItems()

ilObjCourseGrouping::getCountAssignedItems ( )

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

References getAssignedItems().

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

◆ getDescription()

ilObjCourseGrouping::getDescription ( )

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

Referenced by create(), and update().

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

◆ getId()

ilObjCourseGrouping::getId ( )

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

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

64  {
65  return $this->id;
66  }
+ Here is the caller graph for this function:

◆ getTitle()

ilObjCourseGrouping::getTitle ( )

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

References $title.

Referenced by create(), and update().

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

◆ getType()

ilObjCourseGrouping::getType ( )

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

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

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

◆ getUniqueField()

ilObjCourseGrouping::getUniqueField ( )

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

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

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

◆ isAssigned()

ilObjCourseGrouping::isAssigned (   $a_course_id)

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

References getAssignedItems().

241  {
242  foreach($this->getAssignedItems() as $condition_data)
243  {
244  if($a_course_id == $condition_data['target_obj_id'])
245  {
246  return true;
247  }
248  }
249  return false;
250  }
+ Here is the call graph for this function:

◆ read()

ilObjCourseGrouping::read ( )

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

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

Referenced by __construct().

253  {
254  global $ilObjDataCache,$ilDB;
255 
256  $query = "SELECT * FROM object_data ".
257  "WHERE obj_id = ".$ilDB->quote($this->getId() ,'integer')." ";
258 
259  $res = $this->db->query($query);
260  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
261  {
262  $this->setTitle($row->title);
263  $this->setDescription($row->description);
264  }
265 
266  $query = "SELECT * FROM crs_groupings ".
267  "WHERE crs_grp_id = ".$ilDB->quote($this->getId(),'integer')." ";
268  $res = $ilDB->query($query);
269 
270  while($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT))
271  {
272  $this->setUniqueField($row->unique_field);
273  $this->setContainerRefId($row->crs_ref_id);
274  $this->setContainerObjId($row->crs_id);
275  $this->setContainerType($ilObjDataCache->lookupType($this->getContainerObjId()));
276  }
277 
278  return true;
279  }
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 76 of file class.ilObjCourseGrouping.php.

Referenced by read().

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

◆ setContainerRefId()

ilObjCourseGrouping::setContainerRefId (   $a_ref_id)

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

Referenced by read().

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

◆ setContainerType()

ilObjCourseGrouping::setContainerType (   $a_type)

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

References $a_type.

Referenced by read().

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

◆ setDescription()

ilObjCourseGrouping::setDescription (   $a_desc)

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

Referenced by read().

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

◆ setId()

ilObjCourseGrouping::setId (   $a_id)

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

Referenced by __construct(), and create().

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

◆ setTitle()

ilObjCourseGrouping::setTitle (   $a_title)

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

Referenced by read().

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

◆ setType()

ilObjCourseGrouping::setType (   $a_type)

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

References $a_type.

Referenced by __construct().

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

◆ setUniqueField()

ilObjCourseGrouping::setUniqueField (   $a_uni)

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

Referenced by read().

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

◆ update()

ilObjCourseGrouping::update ( )

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

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

209  {
210  global $ilDB;
211 
212  if($this->getId() and $this->getType() === 'crsg')
213  {
214  // UPDATe object_data
215  $query = "UPDATE object_data ".
216  "SET title = ".$ilDB->quote($this->getTitle(),'text').", ".
217  "description = ".$ilDB->quote($this->getDescription(),'text')." ".
218  "WHERE obj_id = ".$ilDB->quote($this->getId(),'integer')." ".
219  "AND type = ".$ilDB->quote($this->getType(),'text')." ";
220  $res = $ilDB->manipulate($query);
221 
222  // UPDATE crs_groupings
223  $query = "UPDATE crs_groupings ".
224  "SET unique_field = ".$ilDB->quote($this->getUniqueField(),'text')." ".
225  "WHERE crs_grp_id = ".$ilDB->quote($this->getId(),'integer')." ";
226  $res = $ilDB->manipulate($query);
227 
228  // UPDATE conditions
229  $query = "UPDATE conditions ".
230  "SET value = ".$ilDB->quote($this->getUniqueField(),'text')." ".
231  "WHERE trigger_obj_id = ".$ilDB->quote($this->getId(),'integer')." ".
232  "AND trigger_type = 'crsg'";
233  $res = $ilDB->manipulate($query);
234 
235  return true;
236  }
237  return false;
238  }
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: