ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilCourseLP.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Object/classes/class.ilObjectLP.php";
6 
14 class ilCourseLP extends ilObjectLP
15 {
16  public static function getDefaultModes($a_lp_active)
17  {
18  // objectives cannot be supported
19 
20  if (!$a_lp_active) {
21  return array(
23  );
24  } else {
25  return array(
28  );
29  }
30  }
31 
32  public function getDefaultMode()
33  {
34  if ($this->checkObjectives()) {
36  }
38  }
39 
40  public function getValidModes()
41  {
42  if ($this->checkObjectives()) {
44  }
45  return array(
49  );
50  }
51 
52  public function getCurrentMode()
53  {
54  if ($this->checkObjectives()) {
56  }
57  return parent::getCurrentMode();
58  }
59 
60  protected function checkObjectives()
61  {
62  include_once "Modules/Course/classes/class.ilObjCourse.php";
64  return true;
65  }
66  return false;
67  }
68 
69  public function getSettingsInfo()
70  {
71  global $DIC;
72 
73  $lng = $DIC['lng'];
74 
75  // #9004
76  include_once("./Modules/Course/classes/class.ilObjCourse.php");
77  $crs = new ilObjCourse($this->obj_id, false);
78  if ($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP) {
79  return $lng->txt("crs_status_determination_lp_info");
80  }
81  }
82 
83  public function getMembers($a_search = true)
84  {
85  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
86  $member_obj = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
87  return $member_obj->getMembers();
88  }
89 
90  protected static function isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
91  {
92  global $DIC;
93 
94  $ilDB = $DIC['ilDB'];
95 
96  // will only find objects with roles for user!
97  // see ilParticipants::_getMembershipByType()
98  $query = " SELECT DISTINCT obd.obj_id, obd.type, obd2.title" .
99  " FROM rbac_ua ua" .
100  " JOIN rbac_fa fa ON (ua.rol_id = fa.rol_id)" .
101  " JOIN object_reference obr ON (fa.parent = obr.ref_id)" .
102  " JOIN object_data obd ON (obr.obj_id = obd.obj_id)" .
103  " JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id)" .
104  " WHERE obd.type = " . $ilDB->quote("crs", "text") .
105  " AND fa.assign = " . $ilDB->quote("y", "text") .
106  " AND ua.usr_id = " . $ilDB->quote($a_usr_id, "integer") .
107  " AND " . $ilDB->in("obd.obj_id", $a_obj_ids, "", "integer");
108  $set = $ilDB->query($query);
109  while ($row = $ilDB->fetchAssoc($set)) {
110  $role = $row["title"];
111  if (!stristr($role, "il_" . $row["type"] . "_admin_") &&
112  !stristr($role, "il_" . $row["type"] . "_tutor_")) {
113  $a_res[$row["obj_id"]] = true;
114  }
115  }
116 
117  return true;
118  }
119 
120  public function getMailTemplateId()
121  {
122  include_once './Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
124  }
125 }
const IL_CRS_VIEW_OBJECTIVE
global $DIC
Definition: saml.php:7
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
static _lookupViewMode($a_id)
lookup view mode of container
static isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
const STATUS_DETERMINATION_LP
Class ilObjCourse.
$lng
$query
$row
static getDefaultModes($a_lp_active)
global $ilDB
getMembers($a_search=true)