ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilCourseLPBadge Class Reference
+ Inheritance diagram for ilCourseLPBadge:
+ Collaboration diagram for ilCourseLPBadge:

Public Member Functions

 getId ()
 Get typ id (unique for component) More...
 
 getCaption ()
 Get caption. More...
 
 isSingleton ()
 Can only be created once? More...
 
 getValidObjectTypes ()
 Get valid (repository) "parent" object types. More...
 
 getConfigGUIInstance ()
 Get GUI config instance. More...
 
 evaluate ($a_user_id, array $a_params, array $a_config)
 Evaluate if given user has earned badge. More...
 

Detailed Description

Definition at line 15 of file class.ilCourseLPBadge.php.

Member Function Documentation

◆ evaluate()

ilCourseLPBadge::evaluate (   $a_user_id,
array  $a_params,
array  $a_config 
)

Evaluate if given user has earned badge.

Parameters
int$a_user_id
array$a_params
array$a_config
Returns
bool

Implements ilBadgeAuto.

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

References ilObject\_lookupObjId(), ilLPStatus\_lookupStatus(), array, and ilLPStatus\LP_STATUS_COMPLETED_NUM.

45  {
46  $subitem_obj_ids = array();
47  foreach ($a_config["subitems"] as $ref_id) {
48  $subitem_obj_ids[$ref_id] = ilObject::_lookupObjId($ref_id);
49  }
50 
51  $trigger_subitem_id = $a_params["obj_id"];
52 
53  // relevant for current badge instance?
54  if (in_array($trigger_subitem_id, $subitem_obj_ids)) {
55  $completed = true;
56 
57  // check if all subitems are completed now
58  foreach ($a_config["subitems"] as $subitem_id) {
59  $subitem_obj_id = $subitem_obj_ids[$subitem_id];
60  if (ilLPStatus::_lookupStatus($subitem_obj_id, $a_user_id) != ilLPStatus::LP_STATUS_COMPLETED_NUM) {
61  $completed = false;
62  break;
63  }
64  }
65 
66  return $completed;
67  }
68 
69  return false;
70  }
const LP_STATUS_COMPLETED_NUM
static _lookupObjId($a_id)
Create styles array
The data for the language used.
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
+ Here is the call graph for this function:

◆ getCaption()

ilCourseLPBadge::getCaption ( )

Get caption.

Returns
string

Implements ilBadgeType.

Definition at line 22 of file class.ilCourseLPBadge.php.

References $lng.

23  {
24  global $lng;
25  return $lng->txt("badge_course_lp");
26  }
global $lng
Definition: privfeed.php:17

◆ getConfigGUIInstance()

ilCourseLPBadge::getConfigGUIInstance ( )

Get GUI config instance.

Returns
ilBadgeTypeGUI|null

Implements ilBadgeType.

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

39  {
40  include_once "Modules/Course/classes/Badges/class.ilCourseLPBadgeGUI.php";
41  return new ilCourseLPBadgeGUI();
42  }
Course LP badge gui.

◆ getId()

ilCourseLPBadge::getId ( )

Get typ id (unique for component)

Returns
string

Implements ilBadgeType.

Definition at line 17 of file class.ilCourseLPBadge.php.

18  {
19  return "course_lp";
20  }

◆ getValidObjectTypes()

ilCourseLPBadge::getValidObjectTypes ( )

Get valid (repository) "parent" object types.

Returns
array

Implements ilBadgeType.

Definition at line 33 of file class.ilCourseLPBadge.php.

References array.

34  {
35  return array("crs");
36  }
Create styles array
The data for the language used.

◆ isSingleton()

ilCourseLPBadge::isSingleton ( )

Can only be created once?

Returns
bool

Implements ilBadgeType.

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

29  {
30  return false;
31  }

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