ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilCourseLP.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=0);
20
27{
28 public static function getDefaultModes(bool $a_lp_active): array
29 {
30 if (!$a_lp_active) {
31 return array(
33 );
34 } else {
35 return array(
38 );
39 }
40 }
41
42 public function getDefaultMode(): int
43 {
44 if ($this->checkObjectives()) {
46 }
48 }
49
50 public function getValidModes(): array
51 {
52 if ($this->checkObjectives()) {
54 }
55 return array(
59 );
60 }
61
62 public function getCurrentMode(): int
63 {
64 if ($this->checkObjectives()) {
66 }
67 return parent::getCurrentMode();
68 }
69
70 protected function checkObjectives(): bool
71 {
73 }
74
75 public function getSettingsInfo(): string
76 {
77 global $DIC;
78
79 $lng = $DIC['lng'];
80
81 // #9004
82 $crs = new ilObjCourse($this->obj_id, false);
83 if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
84 return $lng->txt("crs_status_determination_lp_info");
85 }
86 return '';
87 }
88
92 public function getMembers(bool $a_search = true): array
93 {
94 $member_obj = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
95 return $member_obj->getMembers();
96 }
97
98 protected static function isLPMember(array &$a_res, int $a_usr_id, array $a_obj_ids): bool
99 {
100 global $DIC;
101
102 $ilDB = $DIC->database();
103
104 // will only find objects with roles for user!
105 // see ilParticipants::_getMembershipByType()
106 $query = " SELECT DISTINCT obd.obj_id, obd.type, obd2.title" .
107 " FROM rbac_ua ua" .
108 " JOIN rbac_fa fa ON (ua.rol_id = fa.rol_id)" .
109 " JOIN object_reference obr ON (fa.parent = obr.ref_id)" .
110 " JOIN object_data obd ON (obr.obj_id = obd.obj_id)" .
111 " JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id)" .
112 " WHERE obd.type = " . $ilDB->quote("crs", "text") .
113 " AND fa.assign = " . $ilDB->quote("y", "text") .
114 " AND ua.usr_id = " . $ilDB->quote($a_usr_id, "integer") .
115 " AND " . $ilDB->in("obd.obj_id", $a_obj_ids, false, "integer");
116 $set = $ilDB->query($query);
117 while ($row = $ilDB->fetchAssoc($set)) {
118 $role = $row["title"];
119 if (!stristr($role, "il_" . $row["type"] . "_admin_") &&
120 !stristr($role, "il_" . $row["type"] . "_tutor_")) {
121 $a_res[(int) $row["obj_id"]] = true;
122 }
123 }
124 return true;
125 }
126
127 public function getMailTemplateId(): string
128 {
130 }
131}
getMembers(bool $a_search=true)
static getDefaultModes(bool $a_lp_active)
Get available type-specific default modes (no administration needed)
static isLPMember(array &$a_res, int $a_usr_id, array $a_obj_ids)
Find (lp-relevant) members for given object ids.
static _getInstanceByObjId(int $a_obj_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupViewMode(int $a_id)
const int STATUS_DETERMINATION_LP
Base class for object lp connectors.
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26