ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjLearningModuleListGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 include_once "Services/Object/classes/class.ilObjectListGUI.php";
6 
16 {
22  {
23  $this->ilObjectListGUI();
24  }
25 
31  function init()
32  {
33  $this->static_link_enabled = true;
34  $this->delete_enabled = true;
35  $this->cut_enabled = true;
36  $this->copy_enabled = true;
37  $this->subscribe_enabled = true;
38  $this->link_enabled = true;
39  $this->payment_enabled = true;
40  $this->info_screen_enabled = true;
41  $this->type = "lm";
42  $this->gui_class_name = "ilobjlearningmodulegui";
43 
44  // general commands array
45  include_once('./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php');
46  $this->commands = ilObjLearningModuleAccess::_getCommands();
47  }
48 
49  function setChildId($a_child_id)
50  {
51  $this->child_id = $a_child_id;
52  }
53  function getChildId()
54  {
55  return $this->child_id;
56  }
57 
58 
59  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
60  {
61  global $ilUser;
62 
63  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
64 
65  include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php");
66  $this->last_accessed_page =
67  ilObjLearningModuleAccess::_getLastAccessedPage($a_ref_id, $ilUser->getId());
68 
69  }
70 
71 
81  function getCommandLink($a_cmd)
82  {
83  global $ilCtrl;
84 
85  switch($a_cmd)
86  {
87  case "continue":
88  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id.
89  "&amp;obj_id=".$this->last_accessed_page;
90  break;
91 
92  case "page":
93  // Used for presentation of single pages chapters in search results
94  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id.
95  "&amp;obj_id=".$this->getChildId();
96  break;
97 
98  case "view":
99  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id;
100  break;
101 
102  case "edit":
103  $cmd_link = "ilias.php?baseClass=ilLMEditorGUI&amp;ref_id=".$this->ref_id;
104  break;
105 
106  case "properties":
107  $cmd_link = "ilias.php?baseClass=ilLMEditorGUI&amp;ref_id=".$this->ref_id."&amp;to_props=1";
108  break;
109 
110  case "infoScreen":
111  $cmd_link = "ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id=".$this->ref_id.
112  "&amp;cmd=infoScreen&amp;file_id".$this->getChildId();
113  break;
114 
115  case 'downloadFile':
116  $cmd_link = 'ilias.php?baseClass=ilLMPresentationGUI&amp;ref_id='.$this->ref_id.
117  '&amp;cmd=downloadFile&amp;file_id='.$this->getChildId();
118  break;
119 
120  default:
121  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
122  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
123  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
124  break;
125  }
126 
127  return $cmd_link;
128  }
129 
130 
138  function getCommandFrame($a_cmd)
139  {
140  global $ilias;
141 
142  switch($a_cmd)
143  {
144  case "view":
145  case "continue":
146  case 'list':
147 
148  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
149  if (ilPaymentObject::_isBuyable($this->ref_id) &&
150  !ilPaymentObject::_hasAccess($this->ref_id))
151  {
152  $frame = '';
153  }
154  else
155  {
156  $frame = ilFrameTargetInfo::_getFrame("MainContent");
157  //$frame = "ilContObj".$this->obj_id;
158  }
159  break;
160 
161  case "edit":
162  case "properties":
163  $frame = ilFrameTargetInfo::_getFrame("MainContent");
164  break;
165 
166  case "infoScreen":
167  $frame = ilFrameTargetInfo::_getFrame("MainContent");
168  break;
169 
170  default:
171  $frame = "";
172  break;
173  }
174 
175  return $frame;
176  }
177 
178 
187  function getProperties()
188  {
189  global $lng, $rbacsystem;
190 
191  $props = array();
192 
193  include_once("./Modules/LearningModule/classes/class.ilObjLearningModuleAccess.php");
194 
195  if (ilObjLearningModuleAccess::_isOffline($this->obj_id))
196  {
197  $props[] = array("alert" => true, "property" => $lng->txt("status"),
198  "value" => $lng->txt("offline"));
199  }
200 
201  if ($rbacsystem->checkAccess('write',$this->ref_id))
202  {
203  $props[] = array("alert" => false, "property" => $lng->txt("type"),
204  "value" => $lng->txt("lm"));
205  }
206 
207  if(IS_PAYMENT_ENABLED)
208  {
209  include_once("Services/Payment/classes/class.ilPaymentObject.php");
210 
211  if (ilPaymentObject::_isBuyable($this->ref_id))
212  {
213  if (ilPaymentObject::_hasAccess($this->ref_id))
214  {
215  $props[] = array("alert" => false, "property" => $lng->txt("payment_system"),
216  "value" => $lng->txt("payment_payed_access"));
217  }
218  else if (ilPaymentObject::_isInCart($this->ref_id))
219  {
220  $props[] = array("alert" => true, "property" => $lng->txt("payment_system"),
221  "value" => $lng->txt("payment_in_sc"));
222  }
223  else
224  {
225  $props[] = array("alert" => true, "property" => $lng->txt("payment_system"),
226  "value" => $lng->txt("payment_buyable"));
227  }
228  }
229  }
230  return $props;
231  }
232 
236  function getCommandImage($a_cmd)
237  {
238  switch ($a_cmd)
239  {
240  case "continue":
241  return ilUtil::getImagePath("cmd_continue_s.png");
242 
243  default:
244  return "";
245  }
246  }
247 
248 
249 } // END class.ilObjCategoryGUI
250 ?>