ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
24 include_once "Services/Object/classes/class.ilObjectListGUI.php";
25 include_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("tpl.container_list_item.html", true, true,
96  "Services/Container");
97  $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
98 
99  $this->insertIconsAndCheckboxes();
100  $this->insertTitle();
101  $this->insertDescription();
102 
103  // begin-patch lok
104  if(!$a_manage)
105  {
106  $this->insertProgressInfo();
107  }
108  $this->insertPositionField();
109  // end-patch lok
110 
111  // subitems
112  $this->insertSubItems();
113 
114  // reset properties and commands
115  $this->cust_prop = array();
116  $this->cust_commands = array();
117  $this->sub_item_html = array();
118  $this->position_enabled = false;
119 
120  return $this->tpl->get();
121  }
122 
130  public function insertTitle()
131  {
132  global $ilUser, $ilCtrl;
133 
134  if(
136  ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id)
137  )
138  {
139  $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuterHighlight');
140  }
141  else
142  {
143  $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuter');
144  }
145 
146  if(!$this->getCommandsStatus())
147  {
148  $this->tpl->setCurrentBlock("item_title");
149  $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
150  $this->tpl->parseCurrentBlock();
151  return true;
152  }
153 
154 
155  $this->tpl->setCurrentBlock("item_title_linked");
156  $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
157 
158  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->object->getRefId());
159  $ilCtrl->setParameterByClass("ilrepositorygui", "objective_details", $this->obj_id);
160  $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
161  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
162 
163  $this->tpl->setVariable("HREF_TITLE_LINKED", $link);
164  $this->tpl->parseCurrentBlock();
165  }
166 
167 
168 
176  public function insertProgressInfo()
177  {
178  global $ilUser,$lng;
179 
180  $lng->loadLanguageModule('trac');
181 
182  $this->tpl->setCurrentBlock('item_progress');
183 
184  switch(ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
185  {
187  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_status'));
188  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/not_attempted.svg'));
189  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_no_attempted'));
190  break;
191 
194  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_pretest'));
195  if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
196  {
197  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.svg'));
198  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
199  }
200  else
201  {
202  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
203  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
204  }
205  break;
206 
209  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_result'));
210  if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
211  {
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  }
215  else
216  {
217  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.svg'));
218  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
219  }
220  break;
221 
222 
223  }
224  $this->tpl->parseCurrentBlock();
225  }
226 }
227 ?>
insertIconsAndCheckboxes()
Insert icons and checkboxes.
getContainerObject()
get container object
$_GET["client_id"]
const IL_OBJECTIVE_STATUS_FINISHED
getObjectiveListItemHTML($a_ref_id, $a_obj_id, $a_title, $a_description, $a_manage=false)
get list item html
const IL_OBJECTIVE_STATUS_PRETEST_NON_SUGGEST
global $ilCtrl
Definition: ilias.php:18
insertPositionField()
Insert field for positioning.
static isSuggested($a_usr_id, $a_crs_id, $a_objective_id)
check if objective is suggested
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
insertSubItems()
Insert subitems.
special template class to simplify handling of ITX/PEAR
Class ilObjectListGUI.
static getStatus($a_usr_id, $a_crs_id)
get status of user
const IL_OBJECTIVE_STATUS_NONE
$ilUser
Definition: imgupload.php:18
const IL_OBJECTIVE_STATUS_FINAL
Create styles array
The data for the language used.
getTitle()
getTitle overwritten in class.ilObjLinkResourceList.php
const IL_OBJECTIVE_STATUS_PRETEST
Create new PHPExcel object
obj_idprivate
insertProgressInfo()
insert objective status
global $lng
Definition: privfeed.php:17
List gui for course objectives.
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item (is called by getItemHTML())
insertDescription()
insert item description