ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 function getDefaultMode()
17  {
18  if($this->checkObjectives())
19  {
21  }
23  }
24 
25  public function getValidModes()
26  {
27  if($this->checkObjectives())
28  {
30  }
31  return array(
35  );
36  }
37 
38  public function getCurrentMode()
39  {
40  if($this->checkObjectives())
41  {
43  }
44  return parent::getCurrentMode();
45  }
46 
47  protected function checkObjectives()
48  {
49  include_once "Modules/Course/classes/class.ilObjCourse.php";
51  {
52  return true;
53  }
54  return false;
55  }
56 
57  public function getSettingsInfo()
58  {
59  global $lng;
60 
61  // #9004
62  include_once("./Modules/Course/classes/class.ilObjCourse.php");
63  $crs = new ilObjCourse($this->obj_id, false);
64  if($crs->getStatusDetermination() == ilObjCourse::STATUS_DETERMINATION_LP)
65  {
66  return $lng->txt("crs_status_determination_lp_info");
67  }
68  }
69 
70  public function getMembers($a_search = true)
71  {
72  include_once "Modules/Course/classes/class.ilCourseParticipants.php";
73  $member_obj = ilCourseParticipants::_getInstanceByObjId($this->obj_id);
74  return $member_obj->getMembers();
75  }
76 
77  protected static function isLPMember(array &$a_res, $a_usr_id, array $a_obj_ids)
78  {
79  global $ilDB;
80 
81  // will only find objects with roles for user!
82  // see ilParticipants::_getMembershipByType()
83  $query = " SELECT DISTINCT obd.obj_id, obd.type, obd2.title".
84  " FROM rbac_ua ua".
85  " JOIN rbac_fa fa ON (ua.rol_id = fa.rol_id)".
86  " JOIN object_reference obr ON (fa.parent = obr.ref_id)".
87  " JOIN object_data obd ON (obr.obj_id = obd.obj_id)".
88  " JOIN object_data obd2 ON (ua.rol_id = obd2.obj_id)".
89  " WHERE obd.type = ".$ilDB->quote("crs", "text").
90  " AND fa.assign = ".$ilDB->quote("y", "text").
91  " AND ua.usr_id = ".$ilDB->quote($a_usr_id, "integer").
92  " AND ".$ilDB->in("obd.obj_id", $a_obj_ids, "", "integer");
93  $set = $ilDB->query($query);
94  while($row = $ilDB->fetchAssoc($set))
95  {
96  $role = $row["title"];
97  if(!stristr($role, "il_".$row["type"]."_admin_") &&
98  !stristr($role, "il_".$row["type"]."_tutor_"))
99  {
100  $a_res[$row["obj_id"]] = true;
101  }
102  }
103 
104  return true;
105  }
106 
107  public function getMailTemplateId()
108  {
109  include_once './Modules/Course/classes/class.ilCourseMailTemplateTutorContext.php';
111  }
112 }
113 
114 ?>
const IL_CRS_VIEW_OBJECTIVE
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
const STATUS_DETERMINATION_LP
static isLPMember(array &$a_res, $a_usr_id, array $a_obj_ids)
Class ilObjCourse.
global $lng
Definition: privfeed.php:40
global $ilDB
getMembers($a_search=true)