ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilSCORMOfflineModeGUI Class Reference

GUI class ilSCORMOfflineModeGUI. More...

+ Collaboration diagram for ilSCORMOfflineModeGUI:

Public Member Functions

 __construct ($type)
 
 executeCommand ()
 
 view ($offline_mode, $cmd)
 
 setOfflineModeTabs ($offline_mode)
 
 sendHtml ($html_str)
 
 sendManifest ($manifest_str)
 

Data Fields

 $refId
 
 $lmId
 
 $clientIdSop
 
 $offlineMode
 
 $offline_mode
 
 $lm_frm_url
 
 $sop_frm_url
 
 $sopcache_url
 
 $lmcache_url
 
 $tracking_url
 
 $vers = "v1"
 

Detailed Description

GUI class ilSCORMOfflineModeGUI.

GUI class for scorm offline player connection

Author
Stefan Schneider schne.nosp@m.ider.nosp@m.@hrz..nosp@m.uni-.nosp@m.marbu.nosp@m.rg.d.nosp@m.e
Version
Id
class.ilSCORMOfflineModeGUI.php

Definition at line 14 of file class.ilSCORMOfflineModeGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilSCORMOfflineModeGUI::__construct (   $type)

Definition at line 28 of file class.ilSCORMOfflineModeGUI.php.

References $ilCtrl, $lng, and $tpl.

29  {
30  global $ilias, $tpl, $lng, $ilCtrl;
31  include_once "./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php";
32  $this->ilias = $ilias;
33  $this->tpl = $tpl;
34  $lng->loadLanguageModule("sop");
35  $this->lng = $lng;
36  $this->ctrl = $ilCtrl;
37  $this->ctrl->saveParameter($this, "ref_id");
38  $this->offlineMode = new ilSCORMOfflineMode();
39  $this->offline_mode = $this->offlineMode->getOfflineMode();
40  }
$tpl
Definition: ilias.php:10
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
global $lng
Definition: privfeed.php:17
Class ilSCORMOfflineMode.

Member Function Documentation

◆ executeCommand()

ilSCORMOfflineModeGUI::executeCommand ( )

Definition at line 42 of file class.ilSCORMOfflineModeGUI.php.

References $_COOKIE, $_GET, $ilCtrl, $lng, $log, $tpl, $vers, ilObject\_lookupObjectId(), iljQueryUtil\getLocaljQueryPath(), ilUtil\getStyleSheetLocation(), ilUtil\redirect(), sendHtml(), sendManifest(), ilUtil\sendSuccess(), and view().

43  {
44  global $log, $tpl, $ilCtrl, $lng;
45  $this->refId = $_GET["ref_id"];
46  $this->lmId = ilObject::_lookupObjectId($this->refId);
47  $this->clientIdSop = $this->offlineMode->getClientIdSop();
48  $cmd = $ilCtrl->getCmd();
49  $this->sop_frm_url = $this->offlineMode->cmd_url . 'offlineMode_sop';
50  $this->sopcache_url = $this->offlineMode->cmd_url . 'offlineMode_sopcache';
51  $this->lm_frm_url = $this->offlineMode->lm_cmd_url . 'offlineMode_il2sop';
52  $this->lmcache_url = $this->offlineMode->lm_cmd_url . 'offlineMode_lmcache';
53  $this->tracking_url = $this->offlineMode->lm_cmd_url . 'offlineMode_tracking2sop';
54 
55  switch ($cmd) {
56  case 'offlineMode_sop':
57  $log->write("offlineMode_sop");
58  $sop_cache = new ilTemplate('tpl.cache.html', true, true, 'Modules/ScormAicc');
59  //$sop_cache->setVariable("APPCACHE_URL",$ilCtrl->getLinkTarget($this,"offlineMode_sopcache")."&client_id=" . CLIENT_ID);
60  $sop_cache->setVariable("APPCACHE_URL", $this->sopcache_url);
61  $sop_cache->setVariable("CACHE_TITLE", "SOP Cache Page");
62  $this->sendHtml($sop_cache->get());
63  break;
64 
65  case 'offlineMode_sopcache':
66  $log->write("offlineMode_manifest");
67  $sop_manifest = new ilTemplate('tpl.sop.appcache', true, true, 'Modules/ScormAicc');
68  $entries = $this->offlineMode->getSopManifestEntries();
69  $sop_manifest->setVariable("CACHE_ENTRIES", $entries);
70  $sop_manifest->setVariable("VERSION", $vers);
71  $this->sendManifest($sop_manifest->get());
72  break;
73 
74  case 'offlineMode_il2sop':
75  $log->write("offlineMode_il2sop");
76  $lm_cache = new ilTemplate('tpl.cache.html', true, true, 'Modules/ScormAicc');
77  //$lm_cache->setVariable("APPCACHE_URL",$ilCtrl->getLinkTarget($this,"offlineMode_lmcache")."&client_id=" . CLIENT_ID);
78  $lm_cache->setVariable("APPCACHE_URL", $this->lmcache_url);
79  $lm_cache->setVariable("CACHE_TITLE", "LM Cache Page");
80  $this->sendHtml($lm_cache->get());
81  break;
82 
83  case 'offlineMode_lmcache':
84  $log->write("offlineMode_lmcache");
85  $lm_manifest = new ilTemplate('tpl.lm.appcache', true, true, 'Modules/ScormAicc');
86  $entries = "";
87  if ($_COOKIE['purgeCache'] == 1) {
88  $log->write("purgeCache:" . $_COOKIE['purgeCache']);
89  } else {
90  $entries = $this->offlineMode->getLmManifestEntries();
91  }
92  $lm_manifest->setVariable("CACHE_ENTRIES", $entries);
93  $lm_manifest->setVariable("VERSION", $vers);
94  $this->sendManifest($lm_manifest->get());
95  break;
96 
97  case 'offlineMode_tracking2sop':
98  $this->offlineMode->tracking2sop();
99  break;
100 
101  case 'offlineMode_il2sopOk':
102  $this->offlineMode->setOfflineMode("offline");
103  $this->view($this->offlineMode->getOfflineMode(), $cmd);
104  break;
105 
106  case 'offlineMode_sop2ilpush':
107  $this->offlineMode->sop2il();
108  break;
109 
110  case 'offlineMode_sop2ilOk':
111  $this->offlineMode->setOfflineMode("online");
112  ilUtil::sendSuccess($this->lng->txt('sop_msg_push_tracking_ok'), true);
113  ilUtil::redirect($this->offlineMode->lm_info_url);
114  //$this->view($this->offlineMode->getOfflineMode(),$cmd);
115  break;
116 
117  case 'offlineMode_player12':
118  $log->write("offlineMode_player12");
119  $player12 = new ilTemplate('tpl.player12.html', false, false, 'Modules/ScormAicc');
120  $player12->setVariable("SOP_TITLE", "ILIAS SCORM 1.2 Offline Player"); // ToDo: Language Support
121  $js_data = file_get_contents("./Modules/ScormAicc/scripts/basisAPI.js");
122  $js_data .= file_get_contents("./Modules/ScormAicc/scripts/SCORM1_2standard.js");
123  $player12->setVariable("SOP_SCRIPT", $js_data);
124  $this->sendHtml($player12->get());
125  break;
126 
127  case 'offlineMode_player2004':
128  $log->write("offlineMode_player2004");
129 
130  // language strings
131  $langstrings['btnStart'] = $lng->txt('scplayer_start');
132  $langstrings['btnExit'] = $lng->txt('scplayer_exit');
133  $langstrings['btnExitAll'] = $lng->txt('scplayer_exitall');
134  $langstrings['btnSuspendAll'] = $lng->txt('scplayer_suspendall');
135  $langstrings['btnPrevious'] = $lng->txt('scplayer_previous');
136  $langstrings['btnContinue'] = $lng->txt('scplayer_continue');
137  $langstrings['btnhidetree']=$lng->txt('scplayer_hidetree');
138  $langstrings['btnshowtree']=$lng->txt('scplayer_showtree');
139  $langstrings['linkexpandTree']=$lng->txt('scplayer_expandtree');
140  $langstrings['linkcollapseTree']=$lng->txt('scplayer_collapsetree');
141  $langstrings['contCreditOff']=$lng->txt('cont_credit_off');
142  // if ($this->slm->getAutoReviewChar() == "s") {
143  // $langstrings['contCreditOff']=$lng->txt('cont_sc_score_was_higher_message');
144  // }
145  // $config['langstrings'] = $langstrings;
146 
147  //template variables
148  $player2004 = new ilTemplate('tpl.player2004.html', true, true, 'Modules/ScormAicc');
149 
150  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
151  $player2004->setVariable("JS_FILE", iljQueryUtil::getLocaljQueryPath());
152 
153  $player2004->setVariable('JSON_LANGSTRINGS', json_encode($langstrings));
154  $player2004->setVariable('TREE_JS', "./Modules/Scorm2004/scripts/ilNestedList.js");
155  $player2004->setVariable($langstrings);
156  $player2004->setVariable("DOC_TITLE", "ILIAS SCORM 2004 Offline Player");
157  $player2004->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
158 
159  $player2004->setVariable('TIMESTAMP', sprintf('%d%03d', $tsint, 1000*(float) $tsfrac));
160  $player2004->setVariable('BASE_DIR', './Modules/Scorm2004/');
161 
162  include_once "./Modules/Scorm2004/classes/ilSCORM13Player.php";
163  $player2004->setVariable('INLINE_CSS', ilSCORM13Player::getInlineCss());
164 
165  include_once("./Services/jQuery/classes/class.iljQueryUtil.php");
166  $this->tpl->setVariable("JS_FILE", iljQueryUtil::getLocaljQueryPath());
167 
168  $player2004->setVariable('JS_SCRIPTS', './Modules/Scorm2004/scripts/buildrte/rte.js');
169 
170  //disable top menu
171  // if ($this->slm->getNoMenu()=="y") {
172  // $this->tpl->setVariable("VAL_DISPLAY", "style=\"display:none;\"");
173  // } else {
174  // $this->tpl->setVariable("VAL_DISPLAY", "");
175  // }
176 
177  $this->sendHtml($player2004->get());
178  break;
179 
180  case 'offlineMode_som':
181  $log->write("offlineMode_som");
182  $som = new ilTemplate('tpl.som.html', true, true, 'Modules/ScormAicc');
183  $som->setVariable("SOM_TITLE", "ILIAS SCORM Offline Manager"); // ToDo: Language Support
184  $som->setVariable("PLAYER12_URL", $this->offlineMode->player12_url);
185  $som->setVariable("PLAYER2004_URL", $this->offlineMode->player2004_url);
186  $this->sendHtml($som->get());
187  break;
188 
189  default:
190  $this->view($this->offlineMode->getOfflineMode(), $cmd);
191  break;
192  }
193  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_COOKIE['client_id']
Definition: server.php:9
static getStyleSheetLocation($mode="output", $a_css_name="", $a_css_location="")
get full style sheet file name (path inclusive) of current user
$_GET["client_id"]
$tpl
Definition: ilias.php:10
static _lookupObjectId($a_ref_id)
lookup object id
global $ilCtrl
Definition: ilias.php:18
special template class to simplify handling of ITX/PEAR
global $lng
Definition: privfeed.php:17
static redirect($a_script)
static getLocaljQueryPath()
+ Here is the call graph for this function:

◆ sendHtml()

ilSCORMOfflineModeGUI::sendHtml (   $html_str)

Definition at line 251 of file class.ilSCORMOfflineModeGUI.php.

References header.

Referenced by executeCommand().

252  {
253  header('Content-Type: text/html');
254  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
255  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Datum in der Vergangenheit
256  print $html_str;
257  }
Add a drawing to the header
Definition: 04printing.php:69
+ Here is the caller graph for this function:

◆ sendManifest()

ilSCORMOfflineModeGUI::sendManifest (   $manifest_str)

Definition at line 259 of file class.ilSCORMOfflineModeGUI.php.

References header.

Referenced by executeCommand().

260  {
261  header('Content-Type: text/cache-manifest');
262  header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1
263  header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Datum in der Vergangenheit
264  print $manifest_str;
265  }
Add a drawing to the header
Definition: 04printing.php:69
+ Here is the caller graph for this function:

◆ setOfflineModeTabs()

ilSCORMOfflineModeGUI::setOfflineModeTabs (   $offline_mode)

Definition at line 235 of file class.ilSCORMOfflineModeGUI.php.

References $log, $offline_mode, $tpl, ilObject\_lookupTitle(), and ilUtil\getImagePath().

Referenced by view().

236  {
237  global $ilTabs, $ilLocator,$tpl,$log;
238  $icon = ($offline_mode == "online") ? "icon_sahs.svg" : "icon_sahs_offline.svg";
239  $tabTitle = $this->lng->txt("offline_mode");
240  $thisurl =$this->ctrl->getLinkTarget($this, $a_active);
241  $ilTabs->addTab($a_active, $tabTitle, $thisurl);
242  $ilTabs->activateTab($a_active);
243  $tpl->getStandardTemplate();
244  $tpl->setTitle(ilObject::_lookupTitle($this->lmId));
245  $tpl->setTitleIcon(ilUtil::getImagePath($icon));
246  $ilLocator->addRepositoryItems();
247  $ilLocator->addItem(ilObject::_lookupTitle($this->lmId), $thisurl);
248  $tpl->setLocator();
249  }
$tpl
Definition: ilias.php:10
static _lookupTitle($a_id)
lookup object title
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ view()

ilSCORMOfflineModeGUI::view (   $offline_mode,
  $cmd 
)

Definition at line 195 of file class.ilSCORMOfflineModeGUI.php.

References $_GET, $ilCtrl, $offline_mode, $tpl, and setOfflineModeTabs().

Referenced by executeCommand().

196  {
197  global $tpl, $ilCtrl;
199  $tpl->addJavascript('./Modules/ScormAicc/scripts/ilsop.js');
200  $tpl->addJavascript('./libs/bower/bower_components/pouchdb/dist/pouchdb.min.js');
201  $tpl->addCss('./Modules/ScormAicc/templates/sop/sop.css', "screen");
202  $tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scorm_offline_mode.html", "Modules/ScormAicc");
203  $tpl->setCurrentBlock('offline_content');
204  $tpl->setVariable("Command", $cmd);
205  $tpl->setVariable("CHECK_SYSTEM_REQUIREMENTS", $this->lng->txt('sop_check_system_requirements'));
206  $tpl->setVariable("SOP_SYSTEM_CHECK_HTTPS", $this->lng->txt('sop_system_check_https'));
207  $tpl->setVariable("SOP_SYSTEM_CHECK_ERROR", $this->lng->txt('sop_system_check_error'));
208  $tpl->setVariable("LM_NOT_EXISTS", $this->lng->txt('sop_lm_not_exists'));
209  $tpl->setVariable("EXPORT", $this->lng->txt('sop_export'));
210  $tpl->setVariable("DESC_EXPORT", $this->lng->txt('sop_desc_export'));
211  $tpl->setVariable("TEXT_START_OFFLINE", $this->lng->txt('sop_text_start_offline'));
212  $tpl->setVariable("START_SOP", $this->lng->txt('sop_start_sop')); // ToDo: lng files
213  $tpl->setVariable("TEXT_START_SOM", $this->lng->txt('sop_text_start_som'));
214  $tpl->setVariable("START_SOM", $this->lng->txt('sop_start_som'));
215  $tpl->setVariable("TEXT_PUSH_TRACKING", $this->lng->txt('sop_text_push_tracking'));
216  $tpl->setVariable("PUSH_TRACKING", $this->lng->txt('sop_push_tracking'));
217  $tpl->setVariable("CLIENT_ID", CLIENT_ID);
218  $tpl->setVariable("CLIENT_ID_SOP", $this->clientIdSop);
219  $tpl->setVariable("REF_ID", $_GET['ref_id']);
220  $tpl->setVariable("LM_ID", $this->lmId);
221  $tpl->setVariable("OFFLINE_MODE", $offline_mode);
222  $tpl->setVariable("PURGE_CACHE", $this->lng->txt('sop_purge_cache')); // ToDo
223  $tpl->setVariable("CMD_URL", $this->cmd_url);
224  $tpl->setVariable("LM_CMD_URL", $this->offlineMode->lm_cmd_url);
225  $tpl->setVariable("SOP_FRM_URL", $this->sop_frm_url);
226  $tpl->setVariable("LM_FRM_URL", $this->lm_frm_url);
227  $tpl->setVariable("PLAYER12_URL", $this->offlineMode->player12_url);
228  $tpl->setVariable("PLAYER2004_URL", $this->offlineMode->player2004_url);
229  $tpl->setVariable("SOM_URL", $this->offlineMode->som_url);
230  $tpl->setVariable("TRACKING_URL", $this->tracking_url);
231  $tpl->parseCurrentBlock();
232  $tpl->show();
233  }
$_GET["client_id"]
$tpl
Definition: ilias.php:10
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $clientIdSop

ilSCORMOfflineModeGUI::$clientIdSop

Definition at line 18 of file class.ilSCORMOfflineModeGUI.php.

◆ $lm_frm_url

ilSCORMOfflineModeGUI::$lm_frm_url

Definition at line 21 of file class.ilSCORMOfflineModeGUI.php.

◆ $lmcache_url

ilSCORMOfflineModeGUI::$lmcache_url

Definition at line 24 of file class.ilSCORMOfflineModeGUI.php.

◆ $lmId

ilSCORMOfflineModeGUI::$lmId

Definition at line 17 of file class.ilSCORMOfflineModeGUI.php.

◆ $offline_mode

ilSCORMOfflineModeGUI::$offline_mode

Definition at line 20 of file class.ilSCORMOfflineModeGUI.php.

Referenced by setOfflineModeTabs(), and view().

◆ $offlineMode

ilSCORMOfflineModeGUI::$offlineMode

Definition at line 19 of file class.ilSCORMOfflineModeGUI.php.

◆ $refId

ilSCORMOfflineModeGUI::$refId

Definition at line 16 of file class.ilSCORMOfflineModeGUI.php.

◆ $sop_frm_url

ilSCORMOfflineModeGUI::$sop_frm_url

Definition at line 22 of file class.ilSCORMOfflineModeGUI.php.

◆ $sopcache_url

ilSCORMOfflineModeGUI::$sopcache_url

Definition at line 23 of file class.ilSCORMOfflineModeGUI.php.

◆ $tracking_url

ilSCORMOfflineModeGUI::$tracking_url

Definition at line 25 of file class.ilSCORMOfflineModeGUI.php.

◆ $vers

ilSCORMOfflineModeGUI::$vers = "v1"

Definition at line 26 of file class.ilSCORMOfflineModeGUI.php.

Referenced by executeCommand().


The documentation for this class was generated from the following file: