ILIAS  eassessment Revision 61809
 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  $this->initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
98 
99  $this->insertIconsAndCheckboxes();
100  $this->insertTitle();
101  $this->insertDescription();
102  $this->insertProgressInfo();
103 
104  // subitems
105  $this->insertSubItems();
106 
107  // reset properties and commands
108  $this->cust_prop = array();
109  $this->cust_commands = array();
110  $this->sub_item_html = array();
111  $this->position_enabled = false;
112 
113  return $this->tpl->get();
114  }
115 
123  public function insertTitle()
124  {
125  global $ilUser;
126 
127  if(
128  ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id) != IL_OBJECTIVE_STATUS_NONE and
129  ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id)
130  )
131  {
132  $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuterHighlight');
133  }
134  else
135  {
136  $this->tpl->setVariable('DIV_CLASS','ilContainerListItemOuter');
137  }
138 
139  if(!$this->getCommandsStatus())
140  {
141  $this->tpl->setCurrentBlock("item_title");
142  $this->tpl->setVariable("TXT_TITLE", $this->getTitle());
143  $this->tpl->parseCurrentBlock();
144  return true;
145  }
146 
147 
148  $this->tpl->setCurrentBlock("item_title_linked");
149  $this->tpl->setVariable("TXT_TITLE_LINKED", $this->getTitle());
150  $this->tpl->setVariable("HREF_TITLE_LINKED",'repository.php?ref_id='.$this->getContainerObject()->object->getRefId().'&objective_details='.$this->obj_id);
151  $this->tpl->parseCurrentBlock();
152  }
153 
154 
155 
163  public function insertProgressInfo()
164  {
165  global $ilUser,$lng;
166 
167  $lng->loadLanguageModule('trac');
168 
169  $this->tpl->setCurrentBlock('item_progress');
170 
171  switch(ilCourseObjectiveResultCache::getStatus($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
172  {
174  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_status'));
175  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/not_attempted.gif'));
176  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_no_attempted'));
177  break;
178 
181  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_pretest'));
182  if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
183  {
184  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.gif'));
185  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
186  }
187  else
188  {
189  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.gif'));
190  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
191  }
192  break;
193 
196  $this->tpl->setVariable('TXT_PROGRESS_INFO',$this->lng->txt('crs_objective_result'));
197  if(ilCourseObjectiveResultCache::isSuggested($ilUser->getId(),$this->getContainerObject()->object->getId(),$this->obj_id))
198  {
199  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/failed.gif'));
200  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_failed'));
201  }
202  else
203  {
204  $this->tpl->setVariable('PROGRESS_TYPE_IMG', ilUtil::getImagePath('scorm/passed.gif'));
205  $this->tpl->setVariable('PROGRESS_ALT_IMG',$this->lng->txt('trac_passed'));
206  }
207  break;
208 
209 
210  }
211  $this->tpl->parseCurrentBlock();
212  }
213 }
214 ?>