ILIAS  release_4-4 Revision
class.ilSCORMOfflineModeGUI.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
15 {
16  var $lmId;
21  var $icon;
22 
23  function ilSCORMOfflineModeGUI($type) {
24  global $ilias, $tpl, $lng, $ilCtrl;
25  include_once "./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php";
26  $this->ilias =& $ilias;
27  $this->tpl =& $tpl;
28  $lng->loadLanguageModule("sop");
29  $this->lng =& $lng;
30  $this->ctrl =& $ilCtrl;
31  $this->ctrl->saveParameter($this, "ref_id");
32  $this->offlineMode = new ilSCORMOfflineMode();
33  $this->online_icon = 'icon_slm_b.png';
34  $this->offline_icon = 'icon_slm_b_offline.png';
35  $this->icon = $this->online_icon;
36  }
37 
38  function executeCommand()
39  {
40  global $tpl, $ilCtrl;
41  $this->lmId = ilObject::_lookupObjectId($_GET["ref_id"]);
42  $this->clientIdSop = $this->offlineMode->getClientIdSop();
43  $cmd = $ilCtrl->getCmd();
44  $this->setOfflineModeTabs($cmd);
45  switch($cmd){
46  case 'offlineMode_il2sopContent':
47  ilUtil::deliverFile(ilUtil::getDataDir()."/lm_data/lm_".$this->lmId.".zip","lm_".$this->lmId.".zip");
48  break;
49  case 'offlineMode_il2sop':
50  $this->offlineMode->il2sop();
51  break;
52  case 'offlineMode_il2sopStop':
53  $this->offlineMode->setOfflineMode("online");
54  $this->view($this->offlineMode->getOfflineMode(),"msg_export_failure");
55  break;
56  case 'offlineMode_il2sopOk':
57  $this->offlineMode->setOfflineMode("offline");
58  $this->view($this->offlineMode->getOfflineMode(),"msg_export_ok");
59  break;
60  case 'offlineMode_sop2il':
61  $this->offlineMode->sop2il();
62  break;
63  case 'offlineMode_sop2ilStop':
64  $this->offlineMode->setOfflineMode("offline");
65  $this->view($this->offlineMode->getOfflineMode(),"msg_push_tracking_failure");
66  break;
67  case 'offlineMode_sop2ilOk':
68  $this->offlineMode->setOfflineMode("online");
69  $this->view($this->offlineMode->getOfflineMode(),"msg_push_tracking_ok");
70  break;
71  default:
72  if ($this->offlineMode->getOfflineMode() == "il2sop") $this->offlineMode->setOfflineMode("online");
73  $this->view($this->offlineMode->getOfflineMode());
74  break;
75  }
76  }
77 
78  function view($offline_mode,$message="") {
79  global $tpl;
80  $this->icon = ($offline_mode == "offline") ? $this->offline_icon : $this->online_icon;
81  // Fill meta header tags
82  $tpl->setCurrentBlock('mh_meta_item');
83  $tpl->setVariable('MH_META_NAME','require-sop-version');
84  $tpl->setVariable('MH_META_CONTENT',"0.1");
85  $tpl->parseCurrentBlock();
86 // $tpl->addJavascript('./Modules/ScormAicc/scripts/sopConnector.js');
87  $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scorm_offline_mode.html", "Modules/ScormAicc");
88  $tpl->setCurrentBlock('offline_content');
89  $tpl->setTitleIcon(ilUtil::getImagePath($this->icon));
90 
91  $tpl->setVariable("CHECK_SYSTEM_REQUIREMENTS",$this->lng->txt('sop_check_system_requirements'));
92  $tpl->setVariable("FIREFOX_REQUIRED",$this->lng->txt('sop_firefox_required'));
93  $tpl->setVariable("ALREADY_EXPORTED",$this->lng->txt('sop_already_exported'));
94  $tpl->setVariable("XPI_INSTALL",sprintf($this->lng->txt('sop_xpi_install'),"<a href='./Modules/ScormAicc/sop/sop.xpi'>sop.xpi</a>",false));
95  $tpl->setVariable("RELOAD_PAGE",$this->lng->txt('sop_reload_page'));
96  $tpl->setVariable("TEXT_EXPORT",$this->lng->txt('sop_text_export'));
97  $tpl->setVariable("EXPORT",$this->lng->txt('sop_export'));
98  $tpl->setVariable("DESC_EXPORT",$this->lng->txt('sop_desc_export'));
99  $tpl->setVariable("TEXT_START_OFFLINE",$this->lng->txt('sop_text_start_offline'));
100  $tpl->setVariable("START_OFFLINE",$this->lng->txt('sop_start_offline'));
101  $tpl->setVariable("TEXT_START_SOM",$this->lng->txt('sop_text_start_som'));
102  $tpl->setVariable("START_SOM",$this->lng->txt('sop_start_som'));
103  $tpl->setVariable("TEXT_PUSH_TRACKING",$this->lng->txt('sop_text_push_tracking'));
104  $tpl->setVariable("PUSH_TRACKING",$this->lng->txt('sop_push_tracking'));
105  $tpl->setVariable("MSG_LM_NOT_EXISTS",$this->lng->txt('sop_msg_lm_not_exists'));
106  $tpl->setVariable("MSG_CLOSE_LM",$this->lng->txt('sop_msg_close_lm'));
107  $tpl->setVariable("MSG_EXPORT_CONTENT",$this->lng->txt('sop_msg_export_content'));
108  $tpl->setVariable("MSG_EXPORT_TRACKING",$this->lng->txt('sop_msg_export_tracking'));
109  $tpl->setVariable("MSG_PUSH_TRACKING",$this->lng->txt('sop_msg_push_tracking'));
110  $tpl->setVariable("MSG_PUSH_TRACKING_OK",$this->lng->txt('sop_msg_push_tracking_ok'));
111 
112  $tpl->setVariable("CLIENT_ID",CLIENT_ID);
113  $tpl->setVariable("CLIENT_ID_SOP",$this->clientIdSop);
114  $tpl->setVariable("REF_ID",$_GET['ref_id']);
115  $tpl->setVariable("LM_ID",$this->lmId);
116  $tpl->setVariable("OFFLINE_MODE",$offline_mode);
117  if ($message != "") $tpl->setVariable("MESSAGE_RESULT",$this->lng->txt('sop_'.$message));
118 // if ($message==""msg_export_failure,msg_export_ok,msg_push_tracking_failure,msg_push_tracking_ok
119 
120  $tpl->parseCurrentBlock();
121  $tpl->show();
122  }
123  function importStop() {
124  }
125 
126  function setOfflineModeTabs($a_active)
127  {
128  global $ilTabs, $ilLocator,$tpl;
129  $icon = ($this->offlineMode->getOfflineMode() == "online") ? "icon_slm_b.png" : "icon_slm_b_offline.png";
130  $tabTitle = $this->lng->txt("offline_mode");
131  $thisurl =$this->ctrl->getLinkTarget($this, $a_active);
132  $ilTabs->addTab($a_active, $tabTitle, $thisurl);
133  $ilTabs->activateTab($a_active);
134  $tpl->getStandardTemplate();
135  $tpl->setTitle(ilObject::_lookupTitle($this->lmId));
136  $tpl->setTitleIcon(ilUtil::getImagePath($icon));
137  $ilLocator->addRepositoryItems();
138  $ilLocator->addItem(ilObject::_lookupTitle($this->lmId),$thisurl);
139  $tpl->setLocator();
140  }
141 }
142 ?>
$_GET["client_id"]
GUI class ilSCORMOfflineModeGUI.
$cmd
Definition: sahs_server.php:35
static _lookupTitle($a_id)
lookup object title
view($offline_mode, $message="")
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
redirection script todo: (a better solution should control the processing via a xml file) ...
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static getDataDir()
get data directory (outside webspace)
global $lng
Definition: privfeed.php:40
Class ilSCORMOfflineMode.