ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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  {
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)
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 
100  $this->insertIconsAndCheckboxes();
101  $this->insertTitle();
102  $this->insertDescription();
103  $this->insertProgressInfo();
104 
105  // subitems
106  $this->insertSubItems();
107 
108  // reset properties and commands
109  $this->cust_prop = array();
110  $this->cust_commands = array();
111  $this->sub_item_html = array();
112  $this->position_enabled = false;
113 
114  return $this->tpl->get();
115  }
116 
124  public function insertTitle()
125  {
126  global $ilUser, $ilCtrl;
127 
128  if(
129  ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id) != IL_OBJECTIVE_STATUS_NONE and
130  ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id)
131  )
132  {
133  $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuterHighlight');
134  }
135  else
136  {
137  $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuter');
138  }
139 
140  if(!$this->getCommandsStatus())
141  {
142  $this->tpl->setCurrentBlock("item_title");
143  $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
144  $this->tpl->parseCurrentBlock();
145  return true;
146  }
147 
148 
149  $this->tpl->setCurrentBlock("item_title_linked");
150  $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
151 
152  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->getContainerObject()->object->getRefId());
153  $ilCtrl->setParameterByClass("ilrepositorygui", "objective_details", $this->obj_id);
154  $link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", "");
155  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
156 
157  $this->tpl->setVariable("HREF_TITLE_LINKED", $link);
158  $this->tpl->parseCurrentBlock();
159  }
160 
161 
162 
170  public function insertProgressInfo()
171  {
172  global $ilUser,$lng;
173 
174  $lng->loadLanguageModule('trac');
175 
176  $this->tpl->setCurrentBlock('item_progress');
177 
178  switch(ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
179  {
181  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_status'));
182  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/not_attempted.png'));
183  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_no_attempted'));
184  break;
185 
188  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_pretest'));
189  if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
190  {
191  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.png'));
192  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
193  }
194  else
195  {
196  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.png'));
197  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
198  }
199  break;
200 
203  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_result'));
204  if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
205  {
206  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.png'));
207  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
208  }
209  else
210  {
211  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.png'));
212  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
213  }
214  break;
215 
216 
217  }
218  $this->tpl->parseCurrentBlock();
219  }
220 }
221 ?>