ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5
class.ilObjSAHSLearningModuleListGUI.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->copy_enabled = true;
34  $this->delete_enabled = true;
35  $this->cut_enabled = true;
36  $this->subscribe_enabled = true;
37  $this->link_enabled = true;
38  $this->payment_enabled = true;
39  $this->info_screen_enabled = true;
40  $this->type = "sahs";
41  $this->gui_class_name = "ilobjsahslearningmodulegui";
42  include_once('./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php');
43  }
44 
53  function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
54  {
55  // general commands array
56  $this->commands = ilObjSAHSLearningModuleAccess::_getCommands($a_obj_id);
57  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
58  }
59 
69  function getCommandLink($a_cmd)
70  {
71  global $ilCtrl;
72  $cmd_link = null;
73  switch($a_cmd)
74  {
75  case "view":
76  require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
78  {
79  if ($this->offline_mode) {
80  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id."&amp;cmd=offlineModeStart";
81  }
82  else {
83  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id;
84  }
85  }
86  else
87  {
88  $cmd_link = "ilias.php?baseClass=ilSAHSEditGUI&amp;ref_id=".$this->ref_id;
89  }
90 
91  break;
92  case "offlineModeView":
93  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id."&amp;cmd=offlineModeView";
94  break;
95 
96  case "editContent":
97  $cmd_link = "ilias.php?baseClass=ilSAHSEditGUI&amp;ref_id=".$this->ref_id."&amp;cmd=editContent";
98  break;
99 
100  case "edit":
101  $cmd_link = "ilias.php?baseClass=ilSAHSEditGUI&amp;ref_id=".$this->ref_id;
102  break;
103 
104  case "infoScreen":
105  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id."&amp;cmd=infoScreen";
106  break;
107 
108  case "offlineModeStart":
109  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id."&amp;cmd=offlineModeStart";
110 // $cmd_link = $ilCtrl->getLinkTargetByClass(array('ilsahspresentationgui', 'ilscormofflinemodegui'),'start&amp;ref_id='.$_GET["ref_id"]);
111  break;
112 
113  case "offlineModeStop":
114  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id."&amp;cmdClass=ilSCORMOfflineModeGUI&amp;cmd=stop";
115  break;
116 
117  default:
118  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
119  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
120  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
121  break;
122  }
123 
124  return $cmd_link;
125  }
126 
127 
135  function getCommandFrame($a_cmd)
136  {
137  global $ilias;
138 
139  switch($a_cmd)
140  {
141  case "view":
142  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
143  require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
144  $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
145  if(ilPaymentObject::_isBuyable($this->ref_id) &&
146  !ilPaymentObject::_hasAccess($this->ref_id))
147  {
148  $frame = '';
149  }
150  else
151  {
152  if ($this->offline_mode) {
153  $frame = ilFrameTargetInfo::_getFrame("MainContent");
154  }
155  else {
156  $frame = "ilContObj".$this->obj_id;
157  }
158  }
159  if ($sahs_obj->getEditable() == 1)
160  {
161  $frame = ilFrameTargetInfo::_getFrame("MainContent");
162  }
163  break;
164 
165  case "edit":
166  case "editContent":
167  $frame = ilFrameTargetInfo::_getFrame("MainContent");
168  break;
169 
170  case "infoScreen":
171  $frame = ilFrameTargetInfo::_getFrame("MainContent");
172  break;
173 
174  default:
175  $frame = "";
176  break;
177  }
178 
179  return $frame;
180  }
181 
182 
191  function getProperties()
192  {
193  global $lng, $rbacsystem;
194 
195  $props = array();
196 
197  include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php");
198 
199  $editable = ilObjSAHSLearningModuleAccess::_lookupEditable($this->obj_id);
200 
201  if (!$editable && ilObjSAHSLearningModuleAccess::_isOffline($this->obj_id))
202  {
203  $props[] = array("alert" => true, "property" => $lng->txt("status"),
204  "value" => $lng->txt("offline"));
205  }
206  else if ($editable)
207  {
208  $props[] = array("alert" => true,
209  "value" => $lng->txt("authoring_mode"));
210  }
211 
212  if ($rbacsystem->checkAccess("write", $this->ref_id))
213  {
214  $props[] = array("alert" => false, "property" => $lng->txt("type"),
215  "value" => $lng->txt("sahs"));
216  }
217 
218  // check for certificates
220  {
221  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
223  switch ($type)
224  {
225  case "scorm":
226  $lng->loadLanguageModule('certificate');
227  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id.
228  "&amp;cmd=downloadCertificate";
229  $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"),
230  "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
231  break;
232  case "scorm2004":
233  $lng->loadLanguageModule('certificate');
234  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->ref_id.
235  "&amp;cmd=downloadCertificate";
236  $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"),
237  "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
238  break;
239  }
240  }
241 
242  return $props;
243  }
244 
245 
246 } // END class.ilObjCategoryGUI
247 ?>
getCommandLink($a_cmd)
Overwrite this method, if link target is not build by ctrl class (e.g.
ilObjectListGUI()
constructor
$_GET["client_id"]
static _isOffline($a_obj_id)
Type-specific implementation of general status.
global $ilCtrl
Definition: ilias.php:18
static _isBuyable($a_ref_id, $a_subtype='')
Class ilObjectListGUI.
_lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static _lookupEditable($a_obj_id)
Lookup editable.
_getCommands()
get commands
static _getFrame($a_class, $a_type='')
Get content frame name.
global $lng
Definition: privfeed.php:40
static _hasAccess($a_ref_id, $a_transaction=0, $a_subtype='')
initItem($a_ref_id, $a_obj_id, $a_title="", $a_description="")
inititialize new item
Class ilObjSAHSLearningModuleListGUI.
getCommandFrame($a_cmd)
Get command target frame.
Class ilObjSCORMLearningModule.
static _lookupUserCertificate($obj_id, $usr_id=0)
Checks whether a certificate exists for the active user or not.