ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjLearningModuleListGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2005 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 
35 {
41  {
42  $this->ilObjectListGUI();
43  }
44 
50  function init()
51  {
52  $this->static_link_enabled = true;
53  $this->delete_enabled = true;
54  $this->cut_enabled = true;
55  $this->copy_enabled = false;
56  $this->subscribe_enabled = true;
57  $this->link_enabled = true;
58  $this->payment_enabled = true;
59  $this->info_screen_enabled = true;
60  $this->type = "lm";
61  $this->gui_class_name = "ilobjlearningmodulegui";
62 
63  // general commands array
64  include_once('./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php');
65  $this->commands = ilObjLearningModuleAccess::_getCommands();
66  }
67 
68  function setChildId($a_child_id)
69  {
70  $this->child_id = $a_child_id;
71  }
72  function getChildId()
73  {
74  return $this->child_id;
75  }
76 
77 
78  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
79  {
80  global $ilUser;
81 
82  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
83 
84  include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php");
85  $this->last_accessed_page =
86  ilObjLearningModuleAccess::_getLastAccessedPage($a_ref_id, $ilUser->getId());
87 
88  }
89 
90 
100  function getCommandLink($a_cmd)
101  {
102  switch($a_cmd)
103  {
104  case "continue":
105  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id.
106  "&amp;obj_id=".$this->last_accessed_page;
107  break;
108 
109  case "page":
110  // Used for presentation of single pages chapters in search results
111  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id.
112  "&amp;obj_id=".$this->getChildId();
113  break;
114 
115  case "view":
116  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id;
117  break;
118 
119  case "edit":
120  $cmd_link = "ilias.php?baseClass=ilLMEditorGUI&amp;ref_id=".$this->ref_id;
121  break;
122 
123  case "infoScreen":
124  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id.
125  "&amp;cmd=infoScreen&amp;file_id".$this->getChildId();
126  break;
127 
128  case 'downloadFile':
129  $cmd_link = 'ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id='.$this->ref_id.
130  '&amp;cmd=downloadFile&amp;file_id='.$this->getChildId();
131  break;
132 
133  default:
134  $cmd_link = "repository.php?ref_id=".$this->ref_id."&cmd=$a_cmd";
135  break;
136  }
137 
138  return $cmd_link;
139  }
140 
141 
149  function getCommandFrame($a_cmd)
150  {
151  global $ilias;
152 
153  switch($a_cmd)
154  {
155  case "view":
156  case "continue":
157  case 'list':
158 
159  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
160  if (ilPaymentObject::_isBuyable($this->ref_id) &&
161  !ilPaymentObject::_hasAccess($this->ref_id))
162  {
163  $frame = '';
164  }
165  else
166  {
167  $frame = ilFrameTargetInfo::_getFrame("MainContent");
168  //$frame = "ilContObj".$this->obj_id;
169  }
170  break;
171 
172  case "edit":
173  $frame = ilFrameTargetInfo::_getFrame("MainContent");
174  break;
175 
176  case "infoScreen":
177  $frame = ilFrameTargetInfo::_getFrame("MainContent");
178  break;
179 
180  default:
181  $frame = "";
182  break;
183  }
184 
185  return $frame;
186  }
187 
188 
197  function getProperties()
198  {
199  global $lng, $rbacsystem;
200 
201  $props = array();
202 
203  include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php");
204 
205  if (!ilObjLearningModuleAccess::_lookupOnline($this->obj_id))
206  {
207  $props[] = array("alert" => true, "property" => $lng->txt("status"),
208  "value" => $lng->txt("offline"));
209  }
210 
211  if ($rbacsystem->checkAccess('write',$this->ref_id))
212  {
213  $props[] = array("alert" => false, "property" => $lng->txt("type"),
214  "value" => $lng->txt("lm"));
215  }
216 
217  if(IS_PAYMENT_ENABLED)
218  {
219  include_once("Services/Payment/classes/class.ilPaymentObject.php");
220 
221  if (ilPaymentObject::_isBuyable($this->ref_id))
222  {
223  if (ilPaymentObject::_hasAccess($this->ref_id))
224  {
225  $props[] = array("alert" => false, "property" => $lng->txt("payment_system"),
226  "value" => $lng->txt("payment_payed_access"));
227  }
228  else if (ilPaymentObject::_isInCart($this->ref_id))
229  {
230  $props[] = array("alert" => true, "property" => $lng->txt("payment_system"),
231  "value" => $lng->txt("payment_in_sc"));
232  }
233  else
234  {
235  $props[] = array("alert" => true, "property" => $lng->txt("payment_system"),
236  "value" => $lng->txt("payment_buyable"));
237  }
238  }
239  }
240  return $props;
241  }
242 
246  function getCommandImage($a_cmd)
247  {
248  switch ($a_cmd)
249  {
250  case "continue":
251  return ilUtil::getImagePath("cmd_continue_s.gif");
252 
253  default:
254  return "";
255  }
256  }
257 
258 
259 } // END class.ilObjCategoryGUI
260 ?>