ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
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 {
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, ilObject::_lookupType($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 $DIC;
136
137 $ilUser = $DIC['ilUser'];
138 $ilCtrl = $DIC['ilCtrl'];
139
140 if (
141 ilCourseObjectiveResultCache::getStatus($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id) != IL_OBJECTIVE_STATUS_NONE and
142 ilCourseObjectiveResultCache::isSuggested($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)
143 ) {
144 $this->tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuterHighlight');
145 } else {
146 $this->tpl->setVariable('DIV_CLASS', 'ilContainerListItemOuter');
147 }
148
149 if (!$this->getCommandsStatus()) {
150 $this->tpl->setCurrentBlock("item_title");
151 $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
152 $this->tpl->parseCurrentBlock();
153 return true;
154 }
155
156
157 $this->tpl->setCurrentBlock("item_title_linked");
158 $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
159
160 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->object->getRefId());
161 $ilCtrl->setParameterByClass("ilrepositorygui", "objective_details", $this->obj_id);
162 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
163 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
164
165 $this->tpl->setVariable("HREF_TITLE_LINKED", $link);
166 $this->tpl->parseCurrentBlock();
167 }
168
169
170
178 public function insertProgressInfo()
179 {
180 global $DIC;
181
182 $ilUser = $DIC['ilUser'];
183 $lng = $DIC['lng'];
184
185 $lng->loadLanguageModule('trac');
186
187 $this->tpl->setCurrentBlock('item_progress');
188
189 switch (ilCourseObjectiveResultCache::getStatus($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)) {
191 $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_status'));
192 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/not_attempted.svg'));
193 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_no_attempted'));
194 break;
195
198 $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_pretest'));
199 if (ilCourseObjectiveResultCache::isSuggested($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)) {
200 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
201 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_failed'));
202 } else {
203 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
204 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_passed'));
205 }
206 break;
207
210 $this->tpl->setVariable('TXT_PROGRESS_INFO', $this->lng->txt('crs_objective_result'));
211 if (ilCourseObjectiveResultCache::isSuggested($ilUser->getId(), $this->getContainerObject()->object->getId(), $this->obj_id)) {
212 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
213 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_failed'));
214 } else {
215 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
216 $this->tpl->setVariable('PROGRESS_ALT_IMG', $this->lng->txt('trac_passed'));
217 }
218 break;
219
220
221 }
222 $this->tpl->parseCurrentBlock();
223 }
224}
$_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, $type, $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.
static _lookupType($a_id, $a_reference=false)
lookup object type
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
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46