ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 {
21  public function __construct()
22  {
23  parent::__construct();
24  }
25 
31  public 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->info_screen_enabled = true;
39  $this->type = "sahs";
40  $this->gui_class_name = "ilobjsahslearningmodulegui";
41  include_once('./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php');
42  }
43 
52  public function initItem($a_ref_id, $a_obj_id, $a_title = "", $a_description = "")
53  {
54  // general commands array
55  $this->commands = ilObjSAHSLearningModuleAccess::_getCommands($a_obj_id);
56  parent::initItem($a_ref_id, $a_obj_id, $a_title, $a_description);
57  }
58 
68  public function getCommandLink($a_cmd)
69  {
70  global $DIC;
71  $ilCtrl = $DIC['ilCtrl'];
72  $cmd_link = null;
73  switch ($a_cmd) {
74  case "view":
75  require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
77  if ($this->offline_mode) {
78  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id . "&amp;cmd=offlineModeStart";
79  } else {
80  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id;
81  }
82  } else {
83  $cmd_link = "ilias.php?baseClass=ilSAHSEditGUI&amp;ref_id=" . $this->ref_id;
84  }
85 
86  break;
87  case "offlineModeView":
88  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id . "&amp;cmd=offlineModeView";
89  break;
90 
91  case "editContent":
92  $cmd_link = "ilias.php?baseClass=ilSAHSEditGUI&amp;ref_id=" . $this->ref_id . "&amp;cmd=editContent";
93  break;
94 
95  case "edit":
96  $cmd_link = "ilias.php?baseClass=ilSAHSEditGUI&amp;ref_id=" . $this->ref_id;
97  break;
98 
99  case "infoScreen":
100  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id . "&amp;cmd=infoScreen";
101  break;
102 
103  case "offlineModeStart":
104  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id . "&amp;cmd=offlineModeStart";
105 // $cmd_link = $ilCtrl->getLinkTargetByClass(array('ilsahspresentationgui', 'ilscormofflinemodegui'),'start&amp;ref_id='.$_GET["ref_id"]);
106  break;
107 
108  case "offlineModeStop":
109  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id . "&amp;cmdClass=ilSCORMOfflineModeGUI&amp;cmd=stop";
110  break;
111 
112  default:
113  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $this->ref_id);
114  $cmd_link = $ilCtrl->getLinkTargetByClass("ilrepositorygui", $a_cmd);
115  $ilCtrl->setParameterByClass("ilrepositorygui", "ref_id", $_GET["ref_id"]);
116  break;
117  }
118 
119  return $cmd_link;
120  }
121 
122 
130  public function getCommandFrame($a_cmd)
131  {
132  global $DIC;
133  $ilias = $DIC['ilias'];
134 
135  switch ($a_cmd) {
136  case "view":
137  require_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
138  $sahs_obj = new ilObjSAHSLearningModule($this->ref_id);
139  if ($this->offline_mode) {
140  $frame = ilFrameTargetInfo::_getFrame("MainContent");
141  } else {
142  $frame = "ilContObj" . $this->obj_id;
143  }
144  if ($sahs_obj->getEditable() == 1) {
145  $frame = ilFrameTargetInfo::_getFrame("MainContent");
146  }
147  break;
148 
149  case "edit":
150  case "editContent":
151  $frame = ilFrameTargetInfo::_getFrame("MainContent");
152  break;
153 
154  case "infoScreen":
155  $frame = ilFrameTargetInfo::_getFrame("MainContent");
156  break;
157 
158  default:
159  $frame = "";
160  break;
161  }
162 
163  return $frame;
164  }
165 
166 
175  public function getProperties()
176  {
177  global $DIC;
178  $lng = $DIC['lng'];
179  $rbacsystem = $DIC['rbacsystem'];
180  $props = parent::getProperties();
181 
182  $editable = ilObjSAHSLearningModuleAccess::_lookupEditable($this->obj_id);
183 
184  if ($editable) {
185  $props[] = array("alert" => true,
186  "value" => $lng->txt("authoring_mode"));
187  }
188 
189  if ($rbacsystem->checkAccess("write", $this->ref_id)) {
190  $props[] = array("alert" => false, "property" => $lng->txt("type"),
191  "value" => $lng->txt("sahs"));
192  }
193 
194  $certValidator = new ilCertificateDownloadValidator();
195  $allowed = $certValidator->isCertificateDownloadable($this->user->getId(), $this->obj_id);
196  if ($allowed) {
197  include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
199  switch ($type) {
200  case "scorm":
201  $lng->loadLanguageModule('certificate');
202  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id .
203  "&amp;cmd=downloadCertificate";
204  $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"),
205  "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
206  break;
207  case "scorm2004":
208  $lng->loadLanguageModule('certificate');
209  $cmd_link = "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=" . $this->ref_id .
210  "&amp;cmd=downloadCertificate";
211  $props[] = array("alert" => false, "property" => $lng->txt("condition_finished"),
212  "value" => '<a href="' . $cmd_link . '">' . $lng->txt("download_certificate") . '</a>');
213  break;
214  }
215  }
216 
217  return $props;
218  }
219 } // END class.ilObjCategoryGUI
getCommandLink($a_cmd)
Overwrite this method, if link target is not build by ctrl class (e.g.
global $DIC
Definition: saml.php:7
$_GET["client_id"]
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
user()
Definition: user.php:4
global $ilCtrl
Definition: ilias.php:18
static _getCommands()
get commands
Validates if an active certificate is stored in the database and can be downloaded by the user...
Class ilObjectListGUI.
static _lookupEditable($a_obj_id)
Lookup editable.
static _getFrame($a_class, $a_type='')
Get content frame name.
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.