ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilCourseObjectiveListGUI.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
24include_once "Services/Object/classes/class.ilObjectListGUI.php";
25include_once('./Modules/Course/classes/class.ilCourseObjectiveResultCache.php');
26
27
38{
44 public function __construct()
45 {
46 parent::__construct();
47 }
48
56 public function init()
57 {
58 $this->static_link_enabled = true;
59 $this->delete_enabled = false;
60 $this->cut_enabled = false;
61 $this->subscribe_enabled = false;
62 $this->link_enabled = false;
63 $this->info_screen_enabled = false;
64 $this->progress_enabled = true;
65 $this->type = "lobj";
66 //$this->gui_class_name = "ilobjcoursegui";
67
68 // general commands array
69 $this->commands = array();
70 }
71
78 public function getProperties()
79 {
80 return parent::getProperties();
81 }
82
93 public function getObjectiveListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_manage = false)
94 {
95 $this->tpl = new ilTemplate(
96 "tpl.container_list_item.html",
97 true,
98 true,
99 "Services/Container"
100 );
101 $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
102
104 $this->insertTitle();
105 $this->insertDescription();
106
107 // begin-patch lok
108 if (!$a_manage) {
109 $this->insertProgressInfo();
110 }
111 $this->insertPositionField();
112 // end-patch lok
113
114 // subitems
115 $this->insertSubItems();
116
117 // reset properties and commands
118 $this->cust_prop = array();
119 $this->cust_commands = array();
120 $this->sub_item_html = array();
121 $this->position_enabled = false;
122
123 return $this->tpl->get();
124 }
125
133 public function insertTitle()
134 {
135 global $ilUser, $ilCtrl;
136
137 if (
138 ilCourseObjectiveResultCache::getStatus($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id) != IL_OBJECTIVE_STATUS_NONE and
139 ilCourseObjectiveResultCache::isSuggested($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)
140 ) {
141 $this->tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuterHighlight');
142 } else {
143 $this->tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuter');
144 }
145
146 if (!$this->getCommandsStatus()) {
147 $this->tpl->setCurrentBlock("item_title");
148 $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
149 $this->tpl->parseCurrentBlock();
150 return true;
151 }
152
153
154 $this->tpl->setCurrentBlock("item_title_linked");
155 $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
156
157 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->object->getRefId());
158 $ilCtrl->setParameterByClass("ilrepositorygui", "objective_details", $this->obj_id);
159 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
160 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
161
162 $this->tpl->setVariable("HREF_TITLE_LINKED", $link);
163 $this->tpl->parseCurrentBlock();
164 }
165
166
167
175 public function insertProgressInfo()
176 {
177 global $ilUser,$lng;
178
179 $lng->loadLanguageModule('trac');
180
181 $this->tpl->setCurrentBlock('item_progress');
182
183 switch (ilCourseObjectiveResultCache::getStatus($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)) {
185 $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_status'));
186 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/not_attempted.svg'));
187 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_no_attempted'));
188 break;
189
192 $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_pretest'));
193 if (ilCourseObjectiveResultCache::isSuggested($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)) {
194 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
195 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_failed'));
196 } else {
197 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
198 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_passed'));
199 }
200 break;
201
204 $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_result'));
205 if (ilCourseObjectiveResultCache::isSuggested($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)) {
206 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
207 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_failed'));
208 } else {
209 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
210 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_passed'));
211 }
212 break;
213
214
215 }
216 $this->tpl->parseCurrentBlock();
217 }
218}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
const IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST
const IL_OBJECTIVE_STATUS_FINISHED
const IL_OBJECTIVE_STATUS_NONE
const IL_OBJECTIVE_STATUS_PRETEST
const IL_OBJECTIVE_STATUS_FINAL
List gui for course objectives.
insertProgressInfo()
insert objective status
getObjectiveListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_manage=false)
get list item html
static isSuggested($a_usr_id, $a_crs_id, $a_objective_id)
check if objective is suggested
static getStatus($a_usr_id, $a_crs_id)
get status of user
Class ilObjectListGUI.
getContainerObject()
get container object
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item (is called by getItemHTML())
insertDescription()
insert item description
insertPositionField()
Insert field for positioning.
insertSubItems()
Insert subitems.
insertIconsAndCheckboxes()
Insert icons and checkboxes.
special template class to simplify handling of ITX/PEAR
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18