ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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->payment_enabled = false;
64 $this->info_screen_enabled = false;
65 $this->progress_enabled = true;
66 $this->type = "lobj";
67 //$this->gui_class_name = "ilobjcoursegui";
68
69 // general commands array
70 $this->commands = array();
71 }
72
79 public function getProperties()
80 {
81 return parent::getProperties();
82 }
83
94 public function getListItemHTML($a_ref_id,$a_obj_id,$a_title,$a_description,$a_manage = false)
95 {
96 $this->tpl =& new ilTemplate("tpl.container_list_item.html", true, true,
97 "Services/Container");
98 $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
99
101 $this->insertTitle();
102 $this->insertDescription();
103
104 // begin-patch lok
105 if(!$a_manage)
106 {
107 $this->insertProgressInfo();
108 }
109 $this->insertPositionField();
110 // end-patch lok
111
112 // subitems
113 $this->insertSubItems();
114
115 // reset properties and commands
116 $this->cust_prop = array();
117 $this->cust_commands = array();
118 $this->sub_item_html = array();
119 $this->position_enabled = false;
120
121 return $this->tpl->get();
122 }
123
131 public function insertTitle()
132 {
133 global $ilUser, $ilCtrl;
134
135 if(
136 ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id) != IL_OBJECTIVE_STATUS_NONE and
137 ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id)
138 )
139 {
140 $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuterHighlight');
141 }
142 else
143 {
144 $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuter');
145 }
146
147 if(!$this->getCommandsStatus())
148 {
149 $this->tpl->setCurrentBlock("item_title");
150 $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
151 $this->tpl->parseCurrentBlock();
152 return true;
153 }
154
155
156 $this->tpl->setCurrentBlock("item_title_linked");
157 $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
158
159 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->object->getRefId());
160 $ilCtrl->setParameterByClass("ilrepositorygui", "objective_details", $this->obj_id);
161 $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
162 $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
163
164 $this->tpl->setVariable("HREF_TITLE_LINKED", $link);
165 $this->tpl->parseCurrentBlock();
166 }
167
168
169
177 public function insertProgressInfo()
178 {
179 global $ilUser,$lng;
180
181 $lng->loadLanguageModule('trac');
182
183 $this->tpl->setCurrentBlock('item_progress');
184
185 switch(ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
186 {
188 $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_status'));
189 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/not_attempted.svg'));
190 $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_no_attempted'));
191 break;
192
195 $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_pretest'));
196 if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
197 {
198 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
199 $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
200 }
201 else
202 {
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 {
213 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
214 $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
215 }
216 else
217 {
218 $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
219 $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
220 }
221 break;
222
223
224 }
225 $this->tpl->parseCurrentBlock();
226 }
227}
228?>
$_GET["client_id"]
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.
getListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_manage=false)
get list item html
insertProgressInfo()
insert objective status
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="", $a_context=self::CONTEXT_REPOSITORY)
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
global $lng
Definition: privfeed.php:40
global $ilUser
Definition: imgupload.php:15