ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 46 of file class.ilCourseLPBadge.php.

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

47  {
48  $subitem_obj_ids = array();
49  foreach ($a_config["subitems"] as $ref_id) {
50  $subitem_obj_ids[$ref_id] = ilObject::_lookupObjId($ref_id);
51  }
52 
53  $trigger_subitem_id = $a_params["obj_id"];
54 
55  // relevant for current badge instance?
56  if (in_array($trigger_subitem_id, $subitem_obj_ids)) {
57  $completed = true;
58 
59  // check if all subitems are completed now
60  foreach ($a_config["subitems"] as $subitem_id) {
61  $subitem_obj_id = $subitem_obj_ids[$subitem_id];
62  if (ilLPStatus::_lookupStatus($subitem_obj_id, $a_user_id) != ilLPStatus::LP_STATUS_COMPLETED_NUM) {
63  $completed = false;
64  break;
65  }
66  }
67 
68  return $completed;
69  }
70 
71  return false;
72  }
const LP_STATUS_COMPLETED_NUM
static _lookupObjId($a_id)
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 $DIC, and $lng.

23  {
24  global $DIC;
25 
26  $lng = $DIC['lng'];
27  return $lng->txt("badge_course_lp");
28  }
global $DIC
Definition: saml.php:7
$lng

◆ getConfigGUIInstance()

ilCourseLPBadge::getConfigGUIInstance ( )

Get GUI config instance.

Returns
ilBadgeTypeGUI|null

Implements ilBadgeType.

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

41  {
42  include_once "Modules/Course/classes/Badges/class.ilCourseLPBadgeGUI.php";
43  return new ilCourseLPBadgeGUI();
44  }
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 35 of file class.ilCourseLPBadge.php.

36  {
37  return array("crs");
38  }

◆ isSingleton()

ilCourseLPBadge::isSingleton ( )

Can only be created once?

Returns
bool

Implements ilBadgeType.

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

31  {
32  return false;
33  }

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