ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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
5include_once "Services/Object/classes/class.ilObjectLP.php";
6
15{
16 public static function getDefaultModes($a_lp_active)
17 {
18 // objectives cannot be supported
19
20 if(!$a_lp_active)
21 {
22 return array(
24 );
25 }
26 else
27 {
28 return array(
31 );
32 }
33 }
34
35 public function getDefaultMode()
36 {
37 if($this->checkObjectives())
38 {
40 }
42 }
43
44 public function getValidModes()
45 {
46 if($this->checkObjectives())
47 {
49 }
50 return array(
54 );
55 }
56
57 public function getCurrentMode()
58 {
59 if($this->checkObjectives())
60 {
62 }
63 return parent::getCurrentMode();
64 }
65
66 protected function checkObjectives()
67 {
68 include_once "Modules/Course/classes/class.ilObjCourse.php";
70 {
71 return true;
72 }
73 return false;
74 }
75
76 public function getSettingsInfo()
77 {
78 global $lng;
79
80 // #9004
81 include_once("./Modules/Course/classes/class.ilObjCourse.php");
82 $crs = new ilObjCourse($this->obj_id, false);
83 if($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
84 {
85 return $lng->txt("crs_status_determination_lp_info");
86 }
87 }
88
89 public function getMembers($a_search = true)
90 {
91 include_once "Modules/Course/classes/class.ilCourseParticipants.php";
92 $member_obj = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
93 return $member_obj->getMembers();
94 }
95
96 protected static function isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
97 {
98 global $ilDB;
99
100 // will only find objects with roles for user!
101 // see ilParticipants::_getMembershipByType()
102 $query = " SELECT DISTINCT obd.obj_id, obd.type, obd2.title".
103 " FROM rbac_ua ua".
104 " JOIN rbac_fa fa ON (ua.rol_id = fa.rol_id)".
105 " JOIN object_reference obr ON (fa.parent = obr.ref_id)".
106 " JOIN object_data obd ON (obr.obj_id = obd.obj_id)".
107 " JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id)".
108 " WHERE obd.type = ".$ilDB->quote("crs", "text").
109 " AND fa.assign = ".$ilDB->quote("y", "text").
110 " AND ua.usr_id = ".$ilDB->quote($a_usr_id, "integer").
111 " AND ".$ilDB->in("obd.obj_id", $a_obj_ids, "", "integer");
112 $set = $ilDB->query($query);
113 while($row = $ilDB->fetchAssoc($set))
114 {
115 $role = $row["title"];
116 if(!stristr($role, "il_".$row["type"]."_admin_") &&
117 !stristr($role, "il_".$row["type"]."_tutor_"))
118 {
119 $a_res[$row["obj_id"]] = true;
120 }
121 }
122
123 return true;
124 }
125
126 public function getMailTemplateId()
127 {
128 include_once './Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
130 }
131}
132
133?>
An exception for terminatinating execution or to throw for unit testing.
const IL_CRS_VIEW_OBJECTIVE
static getDefaultModes($a_lp_active)
Get available type-specific default modes (no administration needed)
getMembers($a_search=true)
static isLPMember(array &$a_res, $a_usr_id, $a_obj_ids)
Find (lp-relevant) members for given object ids.
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjCourse.
static _lookupViewMode($a_id)
lookup view mode of container
const STATUS_DETERMINATION_LP
global $lng
Definition: privfeed.php:17
global $ilDB