ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilObjSCORMLearningModuleGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5require_once "./Services/Object/classes/class.ilObjectGUI.php";
6require_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
7require_once("Services/User/classes/class.ilObjUser.php");
8
9require_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleGUI.php");
10require_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
11
29{
30 const EXPORT_UNDEF = 0;
31 const EXPORT_ALL = 1;
32 const EXPORT_SELECTED = 2;
33
34 const EXPORT_TYPE_RAW = 1;
36
42 public function __construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output = true)
43 {
44 global $lng;
45
46 $lng->loadLanguageModule("content");
47 $lng->loadLanguageModule("search");
48
49 $this->type = "sahs";
50 parent::__construct($a_data, $a_id, $a_call_by_reference, false);
51 }
52
56 public function assignObject()
57 {
58 if ($this->id != 0) {
59 if ($this->call_by_reference) {
60 $this->object = new ilObjSCORMLearningModule($this->id, true);
61 } else {
62 $this->object = new ilObjSCORMLearningModule($this->id, false);
63 }
64 }
65 }
66
70 public function properties()
71 {
72 global $rbacsystem, $tree, $tpl, $lng, $ilToolbar, $ilCtrl, $ilSetting, $ilTabs;
73
74 $lng->loadLanguageModule("style");
75
77 $ilTabs->setSubTabActive('cont_settings');
78
79 // view
80 $ilToolbar->addButtonInstance($this->object->getViewButton());
81
82 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
83 $this->form = new ilPropertyFormGUI();
84 $this->form->setFormAction($ilCtrl->getFormAction($this));
85 $this->form->setTitle($this->lng->txt("cont_lm_properties"));
86
87 //check/select only once
88 $this->object->checkMasteryScoreValues();
89
90 //title
91 $ti = new ilTextInputGUI($this->lng->txt("title"), "Fobject_title");
92 $ti->setMaxLength(200);
93 $ti->setValue($this->object->getTitle());
94 $this->form->addItem($ti);
95
96 //description
97 $ti = new ilTextAreaInputGUI($this->lng->txt("description"), "Fobject_description");
98 $ti->setValue($this->object->getDescription());
99 $this->form->addItem($ti);
100
101 // SCORM-type
102 $ne = new ilNonEditableValueGUI($this->lng->txt("type"), "");
103 $ne->setValue($this->lng->txt("lm_type_" . ilObjSAHSLearningModule::_lookupSubType($this->object->getID())));
104 $this->form->addItem($ne);
105
106 // version
107 $ne = new ilNonEditableValueGUI($this->lng->txt("cont_sc_version"), "");
108 $ne->setValue($this->object->getModuleVersion());
109 $ne->setInfo($this->lng->txt("cont_sc_version_info"));
110 $this->form->addItem($ne);
111
112 //
113 // activation
114 //
115 $sh = new ilFormSectionHeaderGUI();
116 $sh->setTitle($this->lng->txt("activation"));
117 $this->form->addItem($sh);
118
119 // online
120 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_online"), "cobj_online");
121 $cb->setValue("y");
122 if ($this->object->getOnline()) {
123 $cb->setChecked(true);
124 }
125 $cb->setInfo($this->lng->txt("cont_online_info"));
126 $this->form->addItem($cb);
127
128 // offline Mode
129 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_offline_mode_allow"), "cobj_offline_mode");
130 $cb->setValue("y");
131 $cb->setChecked($this->object->getOfflineMode());
132 include_once("./Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php");
133 if ($this->object->getOfflineMode()== true && ilSCORMOfflineMode::checkIfAnyoneIsInOfflineMode($this->object->getID()) == true) {
134 $cb->setDisabled(true);
135 $cb->setInfo($this->lng->txt("cont_offline_mode_disable_not_allowed_info"));
136 } else {
137 $cb->setInfo($this->lng->txt("cont_offline_mode_allow_info"));
138 }
139 $this->form->addItem($cb);
140
141 //
142 // presentation
143 //
144 $sh = new ilFormSectionHeaderGUI();
145 $sh->setTitle($this->lng->txt("cont_presentation"));
146 $this->form->addItem($sh);
147
148 $radg = new ilRadioGroupInputGUI($lng->txt("cont_open"), "open_mode");
149 $op0 = new ilRadioOption($this->lng->txt("cont_open_normal"), "0");
150 $radg->addOption($op0);
151 $op1 = new ilRadioOption($this->lng->txt("cont_open_iframe"), "1");
152 $radg->addOption($op1);
153 $op2 = new ilRadioOption($this->lng->txt("cont_open_window"), "5");
154 $radg->addOption($op2);
155 $radg->setValue($this->object->getOpenMode());
156
157 // width
158 $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_0");
159 $ni->setMaxLength(4);
160 $ni->setSize(4);
161 $ni->setValue($this->object->getWidth());
162 $op1->addSubItem($ni);
163 $ni = new ilNumberInputGUI($this->lng->txt("cont_width"), "width_1");
164 $ni->setMaxLength(4);
165 $ni->setSize(4);
166 $ni->setValue($this->object->getWidth());
167 $op2->addSubItem($ni);
168 // height
169 $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_0");
170 $ni->setMaxLength(4);
171 $ni->setSize(4);
172 $ni->setValue($this->object->getHeight());
173 $ni->setInfo($this->lng->txt("cont_width_height_info"));
174 $op1->addSubItem($ni);
175 $ni = new ilNumberInputGUI($this->lng->txt("cont_height"), "height_1");
176 $ni->setMaxLength(4);
177 $ni->setSize(4);
178 $ni->setValue($this->object->getHeight());
179 $ni->setInfo($this->lng->txt("cont_width_height_info"));
180 $op2->addSubItem($ni);
181
182 $this->form->addItem($radg);
183
184 // auto navigation to last visited item
185 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_last_visited"), "cobj_auto_last_visited");
186 $cb->setValue("y");
187 $cb->setChecked($this->object->getAuto_last_visited());
188 $cb->setInfo($this->lng->txt("cont_auto_last_visited_info"));
189 $this->form->addItem($cb);
190
191 // auto continue
192 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_auto_continue"), "auto_continue");
193 $cb->setValue("y");
194 $cb->setChecked($this->object->getAutoContinue());
195 $cb->setInfo($this->lng->txt("cont_sc_auto_continue_info"));
196 $this->form->addItem($cb);
197
198 //
199 // scorm options
200 //
201 $sh = new ilFormSectionHeaderGUI();
202 $sh->setTitle($this->lng->txt("cont_scorm_options"));
203 $this->form->addItem($sh);
204
205 // lesson mode
206 $options = array("normal" => $this->lng->txt("cont_sc_less_mode_normal"),
207 "browse" => $this->lng->txt("cont_sc_less_mode_browse"));
208 $si = new ilSelectInputGUI($this->lng->txt("cont_def_lesson_mode"), "lesson_mode");
209 $si->setOptions($options);
210 $si->setValue($this->object->getDefaultLessonMode());
211 $this->form->addItem($si);
212
213 // credit mode
214 $options = array("credit" => $this->lng->txt("cont_credit_on"),
215 "no_credit" => $this->lng->txt("cont_credit_off"));
216 $si = new ilSelectInputGUI($this->lng->txt("cont_credit_mode"), "credit_mode");
217 $si->setOptions($options);
218 $si->setValue($this->object->getCreditMode());
219 $si->setInfo($this->lng->txt("cont_credit_mode_info"));
220 $this->form->addItem($si);
221
222 // set lesson mode review when completed
223 $options = array(
224 "n" => $this->lng->txt("cont_sc_auto_review_no"),
225// "r" => $this->lng->txt("cont_sc_auto_review_completed_not_failed_or_passed"),
226// "p" => $this->lng->txt("cont_sc_auto_review_passed"),
227// "q" => $this->lng->txt("cont_sc_auto_review_passed_or_failed"),
228// "c" => $this->lng->txt("cont_sc_auto_review_completed"),
229// "d" => $this->lng->txt("cont_sc_auto_review_completed_and_passed"),
230 "y" => $this->lng->txt("cont_sc_auto_review_completed_or_passed"),
231 );
232 $si = new ilSelectInputGUI($this->lng->txt("cont_sc_auto_review_2004"), "auto_review");
233 $si->setOptions($options);
234 $si->setValue($this->object->getAutoReviewChar());
235 // $si->setInfo($this->lng->txt("cont_sc_auto_review_info_12"));
236 $this->form->addItem($si);
237
238 // mastery_score
239 if ($this->object->getMasteryScoreValues() != "") {
240 $ni = new ilNumberInputGUI($this->lng->txt("cont_mastery_score_12"), "mastery_score");
241 $ni->setMaxLength(3);
242 $ni->setSize(3);
243 $ni->setValue($this->object->getMasteryScore());
244 $ni->setInfo($this->lng->txt("cont_mastery_score_12_info") . $this->object->getMasteryScoreValues());
245 $this->form->addItem($ni);
246 }
247
248 //
249 // rte settings
250 //
251 $sh = new ilFormSectionHeaderGUI();
252 $sh->setTitle($this->lng->txt("cont_rte_settings"));
253 $this->form->addItem($sh);
254
255 // unlimited session timeout
256 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_sc_usession"), "cobj_session");
257 $cb->setValue("y");
258 $cb->setChecked($this->object->getSession());
259 $cb->setInfo($this->lng->txt("cont_sc_usession_info"));
260 $this->form->addItem($cb);
261
262 // storage of interactions
263 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_interactions"), "cobj_interactions");
264 $cb->setValue("y");
265 $cb->setChecked($this->object->getInteractions());
266 $cb->setInfo($this->lng->txt("cont_interactions_info_12"));
267 $this->form->addItem($cb);
268
269 // objectives
270 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_objectives"), "cobj_objectives");
271 $cb->setValue("y");
272 $cb->setChecked($this->object->getObjectives());
273 $cb->setInfo($this->lng->txt("cont_objectives_info"));
274 $this->form->addItem($cb);
275
276 // time from lms
277 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_time_from_lms"), "cobj_time_from_lms");
278 $cb->setValue("y");
279 $cb->setChecked($this->object->getTime_from_lms());
280 $cb->setInfo($this->lng->txt("cont_time_from_lms_info"));
281 $this->form->addItem($cb);
282
283 // check values
284 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_check_values"), "cobj_check_values");
285 $cb->setValue("y");
286 $cb->setChecked($this->object->getCheck_values());
287 $cb->setInfo($this->lng->txt("cont_check_values_info"));
288 $this->form->addItem($cb);
289
290 // auto cmi.core.exit to suspend
291 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_auto_suspend"), "cobj_auto_suspend");
292 $cb->setValue("y");
293 $cb->setChecked($this->object->getAutoSuspend());
294 $cb->setInfo($this->lng->txt("cont_auto_suspend_info"));
295 $this->form->addItem($cb);
296
297 // settings for student_id
298 $options = array(
299 0 => $this->lng->txt("cont_sc_id_setting_user_id"),
300 1 => $this->lng->txt("cont_sc_id_setting_user_login"),
301 2 => $this->lng->txt("cont_sc_id_setting_user_id_plus_ref_id"),
302 3 => $this->lng->txt("cont_sc_id_setting_user_login_plus_ref_id"),
303 4 => $this->lng->txt("cont_sc_id_setting_user_id_plus_obj_id"),
304 5 => $this->lng->txt("cont_sc_id_setting_user_login_plus_obj_id")
305 );
306 $si = new ilSelectInputGUI($this->lng->txt("cont_sc_id_setting"), "id_setting");
307 $si->setOptions($options);
308 $si->setValue($this->object->getIdSetting());
309 $si->setInfo($this->lng->txt("cont_sc_id_setting_info"));
310 $this->form->addItem($si);
311
312 // settings for student_name
313 $options = array(
314 0 => $this->lng->txt("cont_sc_name_setting_last_firstname"),
315 1 => $this->lng->txt("cont_sc_name_setting_first_lastname"),
316 2 => $this->lng->txt("cont_sc_name_setting_fullname"),
317 3 => $this->lng->txt("cont_sc_name_setting_salutation_lastname"),
318 4 => $this->lng->txt("cont_sc_name_setting_first_name"),
319 9 => $this->lng->txt("cont_sc_name_setting_no_name")
320 );
321 $si = new ilSelectInputGUI($this->lng->txt("cont_sc_name_setting"), "name_setting");
322 $si->setOptions($options);
323 $si->setValue($this->object->getNameSetting());
324 $si->setInfo($this->lng->txt("cont_sc_name_setting_info"));
325 $this->form->addItem($si);
326
327 //
328 // debugging
329 //
330 $sh = new ilFormSectionHeaderGUI();
331 $sh->setTitle($this->lng->txt("cont_debugging"));
332 $this->form->addItem($sh);
333
334 // test tool
335 $cb = new ilCheckboxInputGUI($this->lng->txt("cont_debug"), "cobj_debug");
336 $cb->setValue("y");
337 $cb->setChecked($this->object->getDebug());
338 if ($this->object->getDebugActivated() == false) {
339 $cb->setDisabled(true);
340 $cb->setInfo($this->lng->txt("cont_debug_deactivated"));
341 } else {
342 $cb->setInfo($this->lng->txt("cont_debug_deactivate12"));
343 }
344 $this->form->addItem($cb);
345 $this->form->addCommandButton("saveProperties", $lng->txt("save"));
346
347 $tpl->setContent($this->form->getHTML());
348 }
349
353 public function newModuleVersion()
354 {
355 global $ilTabs;
357 $ilTabs->setSubTabActive('cont_sc_new_version');
358
361
362 // display import form
363 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scorm_new_version_import.html", "Modules/ScormAicc");
364
365 $this->tpl->setVariable("TYPE_IMG", ilUtil::getImagePath('icon_lm.svg'));
366 $this->tpl->setVariable("ALT_IMG", $this->lng->txt("obj_sahs"));
367
368 $this->ctrl->setParameter($this, "new_type", "sahs");
369 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
370
371 $this->tpl->setVariable("BTN_NAME", "newModuleVersionUpload");
372 $this->tpl->setVariable("TARGET", ' target="' .
373 ilFrameTargetInfo::_getFrame("MainContent") . '" ');
374
375 $this->tpl->setVariable("TXT_SELECT_LMTYPE", $this->lng->txt("type"));
376
377 if ($type == "scorm2004") {
378 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("lm_type_scorm2004"));
379 } else {
380 $this->tpl->setVariable("TXT_TYPE", $this->lng->txt("lm_type_scorm"));
381 }
382
383 include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
386 foreach ($files as $file) {
387 $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
388 $this->tpl->setCurrentBlock("option_uploaded_file");
389 $this->tpl->setVariable("UPLOADED_FILENAME", $file);
390 $this->tpl->setVariable("TXT_UPLOADED_FILENAME", $file);
391 $this->tpl->parseCurrentBlock();
392 }
393 $this->tpl->setCurrentBlock("select_uploaded_file");
394 $this->tpl->setVariable("TXT_SELECT_FROM_UPLOAD_DIR", $this->lng->txt("cont_select_from_upload_dir"));
395 $this->tpl->setVariable("TXT_UPLOADED_FILE", $this->lng->txt("cont_uploaded_file"));
396 $this->tpl->parseCurrentBlock();
397 }
398
399 $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload"));
400 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
401 $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_sahs"));
402 $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file"));
403
404 // gives out the limit as a little notice
405 $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice") . " " . $this->getMaxFileSize());
406 }
407
408
409 public function getMaxFileSize()
410 {
411 // get the value for the maximal uploadable filesize from the php.ini (if available)
412 $umf=get_cfg_var("upload_max_filesize");
413 // get the value for the maximal post data from the php.ini (if available)
414 $pms=get_cfg_var("post_max_size");
415
416 //convert from short-string representation to "real" bytes
417 $multiplier_a=array("K"=>1024, "M"=>1024*1024, "G"=>1024*1024*1024);
418
419 $umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
420 $pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
421
422 if (count($umf_parts) == 2) {
423 $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]];
424 }
425 if (count($pms_parts) == 2) {
426 $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]];
427 }
428
429 // use the smaller one as limit
430 $max_filesize=min($umf, $pms);
431
432 if (!$max_filesize) {
433 $max_filesize=max($umf, $pms);
434 }
435
436 //format for display in mega-bytes
437 return $max_filesize=sprintf("%.1f MB", $max_filesize/1024/1024);
438 }
439
440
441 public function newModuleVersionUpload()
442 {
443 global $_FILES, $rbacsystem;
444
445 $unzip = PATH_TO_UNZIP;
446 $tocheck = "imsmanifest.xml";
447
448 include_once 'Services/FileSystem/classes/class.ilUploadFiles.php';
449
450 // check create permission before because the uploaded file will be copied
451 if (!$rbacsystem->checkAccess("write", $_GET["ref_id"])) {
452 $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->WARNING);
453 } elseif ($_FILES["scormfile"]["name"]) {
454 // check if file was uploaded
455 $source = $_FILES["scormfile"]["tmp_name"];
456 if (($source == 'none') || (!$source)) {
457 ilUtil::sendInfo($this->lng->txt("upload_error_file_not_found"), true);
458 $this->newModuleVersion();
459 return;
460 }
461 } elseif ($_POST["uploaded_file"]) {
462 // check if the file is in the ftp directory and readable
463 if (!ilUploadFiles::_checkUploadFile($_POST["uploaded_file"])) {
464 $this->ilias->raiseError($this->lng->txt("upload_error_file_not_found"), $this->ilias->error_obj->MESSAGE);
465 }
466 // copy the uploaded file to the client web dir to analyze the imsmanifest
467 // the copy will be moved to the lm directory or deleted
468 $source = CLIENT_WEB_DIR . "/" . $_POST["uploaded_file"];
470 $source_is_copy = true;
471 } else {
472 ilUtil::sendInfo($this->lng->txt("upload_error_file_not_found"), true);
473 $this->newModuleVersion();
474 return;
475 }
476 // fim.
477
478 //unzip the imsmanifest-file from new uploaded file
479 $pathinfo = pathinfo($source);
480 $dir = $pathinfo["dirname"];
481 $file = $pathinfo["basename"];
482 $cdir = getcwd();
483 chdir($dir);
484
485 //we need more flexible unzip here than ILIAS standard classes allow
486 $unzipcmd = $unzip . " -o " . ilUtil::escapeShellArg($source) . " " . $tocheck;
487 exec($unzipcmd);
488 chdir($cdir);
489 $tmp_file = $dir . "/" . $_GET["ref_id"] . "." . $tocheck;
490
491 ilFileUtils::rename($dir . "/" . $tocheck, $tmp_file);
492 $new_manifest = file_get_contents($tmp_file);
493
494 //remove temp file
495 unlink($tmp_file);
496
497 //get old manifest file
498 $old_manifest = file_get_contents($this->object->getDataDirectory() . "/" . $tocheck);
499
500 //reload fixed version of file
501 $check ='/xmlns="http:\/\/www.imsglobal.org\/xsd\/imscp_v1p1"/';
502 $replace="xmlns=\"http://www.imsproject.org/xsd/imscp_rootv1p1p2\"";
503 $reload_manifest = preg_replace($check, $replace, $new_manifest);
504
505 //do testing for converted versions as well as earlier ILIAS version messed up utf8 conversion
506 if (strcmp($new_manifest, $old_manifest) == 0 || strcmp(utf8_encode($new_manifest), $old_manifest) == 0 ||
507 strcmp($reload_manifest, $old_manifest) == 0 || strcmp(utf8_encode($reload_manifest), $old_manifest) == 0) {
508
509 //get exisiting module version
510 $module_version = $this->object->getModuleVersion();
511
512 if ($_FILES["scormfile"]["name"]) {
513 //build targetdir in lm_data
514 $file_path = $this->object->getDataDirectory() . "/" . $_FILES["scormfile"]["name"] . "." . $module_version;
515 $file_path = str_replace(".zip." . $module_version, "." . $module_version . ".zip", $file_path);
516 //move to data directory and add subfix for versioning
517 ilUtil::moveUploadedFile($_FILES["scormfile"]["tmp_name"], $_FILES["scormfile"]["name"], $file_path);
518 } else {
519 //build targetdir in lm_data
520 $file_path = $this->object->getDataDirectory() . "/" . $_POST["uploaded_file"] . "." . $module_version;
521 $file_path = str_replace(".zip." . $module_version, "." . $module_version . ".zip", $file_path);
522 // move the already copied file to the lm_data directory
523 ilFileUtils::rename($source, $file_path);
524 }
525
526 //unzip and replace old extracted files
527 ilUtil::unzip($file_path, true);
528 ilUtil::renameExecutables($this->object->getDataDirectory()); //(security)
529
530 //increase module version
531 $this->object->setModuleVersion($module_version+1);
532 $this->object->update();
533
534 //redirect to properties and display success
535 ilUtil::sendInfo($this->lng->txt("cont_new_module_added"), true);
536 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $_GET["ref_id"]);
537 exit;
538 } else {
539 if ($source_is_copy) {
540 unlink($source);
541 }
542
543 ilUtil::sendInfo($this->lng->txt("cont_invalid_new_module"), true);
544 $this->newModuleVersion();
545 }
546 }
547
551 public function saveProperties()
552 {
553 $this->object->setTitle($_POST["Fobject_title"]);
554 $this->object->setDescription($_POST["Fobject_description"]);
555
556 //check if OfflineMode-Zip has to be created
557 $tmpOfflineMode= ilUtil::yn2tf($_POST["cobj_offline_mode"]);
558 if ($tmpOfflineMode == true) {
559 if ($this->object->getOfflineMode() == false) {
560 $this->object->zipLmForOfflineMode();
561 }
562 }
563 if (isset($_POST["mastery_score"])) {
564 $this->object->setMasteryScore($_POST["mastery_score"]);
565 // $this->object->updateMasteryScoreValues();
566 }
567
568 $t_height = $this->object->getHeight();
569 if ($_POST["height_0"] != $this->object->getHeight()) {
570 $t_height = $_POST["height_0"];
571 }
572 if ($_POST["height_1"] != $this->object->getHeight()) {
573 $t_height = $_POST["height_1"];
574 }
575
576 $t_width = $this->object->getWidth();
577 if ($_POST["width_0"] != $this->object->getWidth()) {
578 $t_width = $_POST["width_0"];
579 }
580 if ($_POST["width_1"] != $this->object->getWidth()) {
581 $t_width = $_POST["width_1"];
582 }
583
584 $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
585 $this->object->setOfflineMode($tmpOfflineMode);
586 $this->object->setOpenMode($_POST["open_mode"]);
587 $this->object->setWidth($t_width);
588 $this->object->setHeight($t_height);
589 $this->object->setAuto_last_visited(ilUtil::yn2tf($_POST["cobj_auto_last_visited"]));
590 $this->object->setAutoContinue(ilUtil::yn2tf($_POST["auto_continue"]));
591 $this->object->setMaxAttempt($_POST["max_attempt"]);
592 $this->object->setDefaultLessonMode($_POST["lesson_mode"]);
593 $this->object->setCreditMode($_POST["credit_mode"]);
594 $this->object->setAutoReview(ilUtil::yn2tf($_POST["auto_review"]));
595 $this->object->setSession(ilUtil::yn2tf($_POST["cobj_session"]));
596 $this->object->setInteractions(ilUtil::yn2tf($_POST["cobj_interactions"]));
597 $this->object->setObjectives(ilUtil::yn2tf($_POST["cobj_objectives"]));
598 $this->object->setTime_from_lms(ilUtil::yn2tf($_POST["cobj_time_from_lms"]));
599 $this->object->setCheck_values(ilUtil::yn2tf($_POST["cobj_check_values"]));
600 $this->object->setAutoSuspend(ilUtil::yn2tf($_POST["cobj_auto_suspend"]));
601 $this->object->setDebug(ilUtil::yn2tf($_POST["cobj_debug"]));
602 $this->object->setIdSetting($_POST["id_setting"]);
603 $this->object->setNameSetting($_POST["name_setting"]);
604 $this->object->update();
605 ilUtil::sendInfo($this->lng->txt("msg_obj_modified"), true);
606 $this->ctrl->redirect($this, "properties");
607 }
608
612 protected function showTrackingItemsBySco()
613 {
614 global $ilTabs;
615
617 $ilTabs->setTabActive("cont_tracking_data");
618 $ilTabs->setSubTabActive("cont_tracking_bysco");
619
620 $reports = array('exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportSelectedRaw');//,'tracInteractionItem','tracInteractionUser','tracInteractionUserAnswers'
621 $scoSelected = "all";
622 if (isset($_GET["scoSelected"])) {
623 $scoSelected = ilUtil::stripSlashes($_GET["scoSelected"]);
624 }
625 if (isset($_POST["scoSelected"])) {
626 $scoSelected = ilUtil::stripSlashes($_POST["scoSelected"]);
627 }
628 $this->ctrl->setParameter($this, 'scoSelected', $scoSelected);
629
630 $report = "choose";
631 if (isset($_GET["report"])) {
632 $report = ilUtil::stripSlashes($_GET["report"]);
633 }
634 if (isset($_POST["report"])) {
635 $report = ilUtil::stripSlashes($_POST["report"]);
636 }
637 $this->ctrl->setParameter($this, 'report', $report);
638
639 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemsPerScoFilterGUI.php';
640 $filter = new ilSCORMTrackingItemsPerScoFilterGUI($this, 'showTrackingItemsBySco');
641 $filter->parse($scoSelected, $report, $reports);
642 if ($report == "choose") {
643 $this->tpl->setContent($filter->form->getHTML());
644 } else {
645 $scosSelected = array();
646 if ($scoSelected != "all") {
647 $scosSelected[] = $scoSelected;
648 } else {
649 $scos=$this->object->getTrackedItems();
650 foreach ($scos as $row) {
651 $scosSelected[]=(int) $row->getId();
652 }
653 }
654 //with check for course ...
655 include_once "Services/Tracking/classes/class.ilTrQuery.php";
656 $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
657 // var_dump($this->object->getTrackedUsers(""));
658 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemsTableGUI.php';
659 $tbl = new ilSCORMTrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItemsBySco', $a_users, $scosSelected, $report);
660 $this->tpl->setContent($filter->form->getHTML() . $tbl->getHTML());
661 }
662 return true;
663 }
664
665
671 public function showTrackingItems()
672 {
673 global $ilTabs, $ilAccess;
674
675 $ilTabs->setTabActive('cont_tracking_data');
676
677 if ($ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) {
679 $ilTabs->setSubTabActive('cont_tracking_byuser');
680
681 $reports = array('exportSelectedSuccess','exportSelectedCore','exportSelectedInteractions','exportSelectedObjectives','exportSelectedRaw');
682
683 $userSelected = "all";
684 if (isset($_GET["userSelected"])) {
685 $userSelected = ilUtil::stripSlashes($_GET["userSelected"]);
686 }
687 if (isset($_POST["userSelected"])) {
688 $userSelected = ilUtil::stripSlashes($_POST["userSelected"]);
689 }
690 $this->ctrl->setParameter($this, 'userSelected', $userSelected);
691
692 $report = "choose";
693 if (isset($_GET["report"])) {
694 $report = ilUtil::stripSlashes($_GET["report"]);
695 }
696 if (isset($_POST["report"])) {
697 $report = ilUtil::stripSlashes($_POST["report"]);
698 }
699 $this->ctrl->setParameter($this, 'report', $report);
700
701 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemsPerUserFilterGUI.php';
702 $filter = new ilSCORMTrackingItemsPerUserFilterGUI($this, 'showTrackingItems');
703 $filter->parse($userSelected, $report, $reports);
704 if ($report == "choose") {
705 $this->tpl->setContent($filter->form->getHTML());
706 } else {
707 $usersSelected = array();
708 if ($userSelected != "all") {
709 $usersSelected[] = $userSelected;
710 } else {
711 include_once "Services/Tracking/classes/class.ilTrQuery.php";
713 foreach ($users as $user) {
714 if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
715 $usersSelected[] = $user;
716 }
717 }
718 }
719 $scosSelected = array();
720 $scos=$this->object->getTrackedItems();
721 foreach ($scos as $row) {
722 $scosSelected[]=(int) $row->getId();
723 }
724
725 //with check for course ...
726 // include_once "Services/Tracking/classes/class.ilTrQuery.php";
727 // $a_users=ilTrQuery::getParticipantsForObject($this->ref_id);
728 // var_dump($this->object->getTrackedUsers(""));
729 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemsTableGUI.php';
730 $tbl = new ilSCORMTrackingItemsTableGUI($this->object->getId(), $this, 'showTrackingItems', $usersSelected, $scosSelected, $report);
731 $this->tpl->setContent($filter->form->getHTML() . $tbl->getHTML());
732 }
733 } elseif ($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
734 $this->modifyTrackingItems();
735 }
736 return true;
737 }
738 protected function modifyTrackingItems()
739 {
740 global $ilAccess;
741 if ($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
742 include_once('./Services/PrivacySecurity/classes/class.ilPrivacySettings.php');
744 if (!$privacy->enabledSahsProtocolData()) {
745 $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
746 }
747
748 global $ilTabs, $ilToolbar;
749
750 include_once './Services/UIComponent/Toolbar/classes/class.ilToolbarGUI.php';
751 $ilToolbar->addButton(
752 $this->lng->txt('import'),
753 $this->ctrl->getLinkTarget($this, 'importForm')
754 );
755 $ilToolbar->addButton(
756 $this->lng->txt('cont_export_all'),
757 $this->ctrl->getLinkTarget($this, 'exportAll')
758 );
759
761 $ilTabs->setTabActive('cont_tracking_data');
762 $ilTabs->setSubTabActive('cont_tracking_modify');
763
764 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php';
765 $tbl = new ilSCORMTrackingUsersTableGUI($this->object->getId(), $this, 'modifytrackingItems');
766 $tbl->parse();
767 $this->tpl->setContent($tbl->getHTML());
768 }
769 }
770
771
775 protected function applyUserTableFilter()
776 {
777 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php';
778 $tbl = new ilSCORMTrackingUsersTableGUI($this->object->getId(), $this, 'modifytrackingItems');
779 $tbl->writeFilterToSession();
780 $tbl->resetOffset();
781 $this->modifyTrackingItems();
782 }
783
787 protected function resetUserTableFilter()
788 {
789 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingUsersTableGUI.php';
790 $tbl = new ilSCORMTrackingUsersTableGUI($this->object->getId(), $this, 'modifytrackingItems');
791 $tbl->resetFilter();
792 $tbl->resetOffset();
793 $this->modifyTrackingItems();
794 }
795
799 public function deleteTrackingForUser()
800 {
801 if (!isset($_POST["user"])) {
802 $this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
803 }
804
805 // display confirmation message
806 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
807 $cgui = new ilConfirmationGUI();
808 $cgui->setFormAction($this->ctrl->getFormAction($this));
809 $cgui->setHeaderText($this->lng->txt("info_delete_sure"));
810 $cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteTracking");
811 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeleteTracking");
812
813 foreach ($_POST["user"] as $id) {
814 if (ilObject::_exists($id) && ilObject::_lookUpType($id)=="usr") {
815 $user = new ilObjUser($id);
816
817 $caption = ilUtil::getImageTagByType("sahs", $this->tpl->tplPath) .
818 " " . $this->lng->txt("cont_tracking_data") .
819 ": " . $user->getLastname() . ", " . $user->getFirstname();
820
821
822 $cgui->addItem("user[]", $id, $caption);
823 }
824 }
825
826 $this->tpl->setContent($cgui->getHTML());
827 }
828
832 public function cancelDeleteTracking()
833 {
834 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
835 $this->ctrl->redirect($this, "modifyTrackingItems");
836 }
837
838 public function confirmedDeleteTracking()
839 {
840 $this->object->deleteTrackingDataOfUsers($_POST["user"]);
841 $this->ctrl->redirect($this, "modifyTrackingItems");
842 }
843
847 public function cancel()
848 {
849 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
850 $this->ctrl->redirect($this, "properties");
851 }
852
856 protected function import()
857 {
858 $form = $this->initImportForm("");
859 if ($form->checkInput()) {
860 $source = $form->getInput('csv');
861 $error = $this->object->importTrackingData($source['tmp_name']);
862 switch ($error) {
863 case 0:
864 ilUtil::sendInfo('Tracking data imported', true);
865 $this->ctrl->redirect($this, "showTrackingItems");
866 break;
867 case -1:
868 ilUtil::sendInfo($this->lng->txt('err_check_input'));
869 $this->importForm();
870 break;
871 }
872 }
873 ilUtil::sendInfo($this->lng->txt('err_check_input'));
874 $form->setValuesByPost();
875 $this->importForm();
876 }
877
881 protected function importForm()
882 {
883 global $ilTabs;
884
885 $ilTabs->clearTargets();
886 $ilTabs->setBackTarget($this->lng->txt('back'), $this->ctrl->getLinkTarget($this, 'showTrackingItems'));
887
888 $form = $this->initImportForm("");
889 $this->tpl->setContent($form->getHTML());
890 }
891
895 protected function initImportForm($a_new_type)
896 {
897 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
898 $form = new ilPropertyFormGUI();
899 $form->setFormAction($this->ctrl->getFormAction($this));
900 $form->setTitle($this->lng->txt('cont_import_tracking'));
901 $form->addCommandButton('import', $this->lng->txt('import'));
902 $form->addCommandButton('showTrackingItems', $this->lng->txt('cancel'));
903
904 $csv = new ilFileInputGUI($this->lng->txt('select_file'), 'csv');
905 $csv->setRequired(true);
906 $csv->setSuffixes(array('csv'));
907 $form->addItem($csv);
908
909 return $form;
910 }
911
915 protected function exportAll()
916 {
917 $this->object->exportSelected(1);
918 }
919
923 protected function exportSelectionUsers()
924 {
925 if (!count((array) $_POST['user'])) {
926 //ilUtil::sendFailure($this->lng->txt('select_one'),true);
927 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
928 $this->ctrl->redirect($this, 'modifyTrackingItems');
929 } else {
930 $this->object->exportSelected(0, $_POST["user"]);
931 }
932 }
933
934
935 public function decreaseAttempts()
936 {
937 if (!isset($_POST["user"])) {
938 ilUtil::sendInfo($this->lng->txt("no_checkbox"), true);
939 }
940 $this->object->decreaseAttemptsForUser($_POST["user"]);
941 $this->ctrl->redirect($this, "modifyTrackingItems");
942 }
943
944
948 protected function showTrackingItem()
949 {
950 global $ilTabs;
951
952 include_once "./Services/Table/classes/class.ilTableGUI.php";
953
954 $this->setSubTabs();
955 $ilTabs->setTabActive("cont_tracking_data");
956 $ilTabs->setSubTabActive("cont_tracking_byuser");
957
958 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemsPerUserTableGUI.php';
959 $tbl = new ilSCORMTrackingItemsPerUserTableGUI($this->object->getId(), $this, 'showTrackingItem');
960 $tbl->setUserId((int) $_REQUEST['user_id']);
961 $tbl->parse();
962 $this->tpl->setContent($tbl->getHTML());
963 return true;
964 }
965
969 protected function showTrackingItemSco()
970 {
971 global $ilTabs;
972
973 include_once "./Services/Table/classes/class.ilTableGUI.php";
974
975 $this->setSubTabs();
976 $ilTabs->setTabActive("cont_tracking_data");
977 $ilTabs->setSubTabActive("cont_tracking_bysco");
978
979 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemsScoTableGUI.php';
980 $tbl = new ilSCORMTrackingItemsScoTableGUI($this->object->getId(), $this, 'showTrackingItemSco');
981 $tbl->setScoId((int) $_GET['obj_id']);
982 $tbl->parse();
983 $this->tpl->setContent($tbl->getHTML());
984 return true;
985 }
986
990 protected function showTrackingItemPerUser()
991 {
992 global $ilTabs;
993
994 include_once "./Services/Table/classes/class.ilTableGUI.php";
995
996 $this->setSubTabs();
997 $ilTabs->setTabActive("cont_tracking_data");
998 $ilTabs->setSubTabActive("cont_tracking_byuser");
999
1000 $this->ctrl->setParameter($this, 'obj_id', (int) $_REQUEST['obj_id']);
1001 $this->ctrl->setParameter($this, 'user_id', (int) $_REQUEST['user_id']);
1002
1003 include_once './Modules/ScormAicc/classes/class.ilSCORMTrackingItemPerUserTableGUI.php';
1004 $tbl = new ilSCORMTrackingItemPerUserTableGUI($this->object->getId(), $this, 'showTrackingItemPerUser');
1005 $tbl->setUserId((int) $_REQUEST['user_id']);
1006 $tbl->setScoId((int) $_REQUEST['obj_id']);
1007 $tbl->parse();
1008 $this->tpl->setContent($tbl->getHTML());
1009 return true;
1010 }
1011
1012 //setTabs
1013 public function setSubTabs()
1014 {
1015 global $lng, $ilTabs, $ilCtrl, $ilAccess;
1016
1017 if ($ilAccess->checkAccess("read_learning_progress", "", $_GET["ref_id"])) {
1018 $ilTabs->addSubTabTarget(
1019 "cont_tracking_byuser",
1020 $this->ctrl->getLinkTarget($this, "showTrackingItems"),
1021 array("edit", ""),
1022 get_class($this)
1023 );
1024
1025 $ilTabs->addSubTabTarget(
1026 "cont_tracking_bysco",
1027 $this->ctrl->getLinkTarget($this, "showTrackingItemsBySco"),
1028 array("edit", ""),
1029 get_class($this)
1030 );
1031 }
1032 if ($ilAccess->checkAccess("edit_learning_progress", "", $_GET["ref_id"])) {
1033 $ilTabs->addSubTabTarget(
1034 "cont_tracking_modify",
1035 $this->ctrl->getLinkTarget($this, "modifyTrackingItems"),
1036 array("edit", ""),
1037 get_class($this)
1038 );
1039 }
1040 }
1041
1042
1048 protected function offlineModeManager()
1049 {
1050 global $rbacsystem, $tree, $tpl, $lng, $ilToolbar, $ilCtrl, $ilSetting;
1051
1052 include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
1053 if (!ilLearningProgressAccess::checkAccess($this->object->getRefId())) {
1054 $this->ilias->raiseError($this->lng->txt('permission_denied'), $this->ilias->error_obj->MESSAGE);
1055 }
1056
1057 include_once './Modules/ScormAicc/classes/class.ilSCORMOfflineModeUsersTableGUI.php';
1058 $tbl = new ilSCORMOfflineModeUsersTableGUI($this->object->getId(), $this, 'offlineModeManager');
1059 $tbl->parse();
1060 $this->tpl->setContent($tbl->getHTML());
1061 }
1065 protected function stopUserOfflineMode()
1066 {
1067 if (!count((array) $_POST['user'])) {
1068 ilUtil::sendFailure($this->lng->txt('select_one'), true);
1069 $this->ctrl->redirect($this, 'offlineModeManager');
1070 }
1071 // display confirmation message
1072 include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
1073 $cgui = new ilConfirmationGUI();
1074 $cgui->setFormAction($this->ctrl->getFormAction($this));
1075 $cgui->setHeaderText($this->lng->txt("info_stop_offline_mode_sure"));
1076 $cgui->setCancel($this->lng->txt("cancel"), "cancelStopUserOfflineMode");
1077 $cgui->setConfirm($this->lng->txt("confirm"), "confirmedStopUserOfflineMode");
1078 foreach ($_POST["user"] as $id) {
1079 if (ilObject::_exists($id) && ilObject::_lookUpType($id)=="usr") {
1080 $user = new ilObjUser($id);
1081 $caption = ilUtil::getImageTagByType("sahs_offline", $this->tpl->tplPath) .
1082 " " . $this->lng->txt("stop_user_offline_mode_for_user") .
1083 ": " . $user->getLastname() . ", " . $user->getFirstname();
1084 $cgui->addItem("user[]", $id, $caption);
1085 }
1086 }
1087 $this->tpl->setContent($cgui->getHTML());
1088 }
1089
1091 {
1092 ilUtil::sendInfo($this->lng->txt("msg_cancel"), true);
1093 $this->ctrl->redirect($this, "offlineModeManager");
1094 }
1095
1097 {
1098 include_once './Modules/ScormAicc/classes/class.ilSCORMOfflineMode.php';
1099 foreach ($_POST["user"] as $id) {
1100 ilSCORMOfflineMode::stopOfflineModeForUser($this->object->getId(), $id);
1101 }
1102
1103 $this->offlineModeManager();
1104 }
1105}
1106// END class.ilObjSCORMLearningModule
sprintf('%.4f', $callTime)
$files
Definition: add-vimline.php:18
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
$source
Definition: linkback.php:22
$users
Definition: authpage.php:44
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
This class represents a checkbox property in a property form.
Confirmation screen class.
This class represents a file property in a property form.
static rename($a_source, $a_target)
Rename a file.
This class represents a section header in a property form.
static _getFrame($a_class, $a_type='')
Get content frame name.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
This class represents a non editable value in a property form.
This class represents a number property in a property form.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
Class ilObjSCORMLearningModuleGUI.
offlineModeManager()
Manage offline mode for users @global ilTabs $ilTabs $global ilToolbar $ilToolbar.
__construct($a_data, $a_id, $a_call_by_reference, $a_prepare_output=true)
Constructor.
exportAll()
Show export section for all users.
initImportForm($a_new_type)
Init import form.
stopUserOfflineMode()
Stop offline mode for selected users.
exportSelectionUsers()
Export selection for selected users.
assignObject()
assign scorm object to scorm gui object
showTrackingItemSco()
show tracking data of item
deleteTrackingForUser()
display deletion confirmation screen
showTrackingItemPerUser()
show tracking data of item per user
cancel()
overwrite..jump back to trackingdata not parent
newModuleVersion()
upload new version of module
showTrackingItems()
Show tracking table @global ilTabs $ilTabs $global ilToolbar $ilToolbar.
cancelDeleteTracking()
cancel deletion of export files
Class ilObjSCORMLearningModule.
static _lookupObjectId($a_ref_id)
lookup object id
static _exists($a_id, $a_reference=false, $a_type=null)
checks if an object exists in object_data@access public
static _getInstance()
Get instance of ilPrivacySettings.
This class represents a property form user interface.
This class represents a property in a property form.
This class represents an option in a radio group.
GUI class ilSCORMOfflineModeUsersTableGUI.
static stopOfflineModeForUser($obj_id, $user_id)
static checkIfAnyoneIsInOfflineMode($obj_id)
Class ilSCORMTrackingItemsTableGUI.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static getParticipantsForObject($a_ref_id)
Get participant ids for given object.
static _getUploadFiles()
Get a list of readable files in the upload directory.
static _copyUploadFile($a_file, $a_target, $a_raise_errors=true)
copy an uploaded file to the target directory (including virus check)
static _checkUploadFile($a_file)
Check if a file exists in the upload directory and is readable.
static _getUploadDirectory()
Get the directory with uploaded files.
static escapeShellArg($a_arg)
static getImageTagByType($a_type, $a_path, $a_big=false)
Builds an html image tag TODO: function still in use, but in future use getImagePath and move HTML-Co...
static redirect($a_script)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static unzip($a_file, $overwrite=false, $a_flat=false)
unzip file
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static yn2tf($a_yn)
convert "y"/"n" to true/false
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static renameExecutables($a_dir)
Rename uploaded executables for security reasons.
$tbl
Definition: example_048.php:81
if(!array_key_exists('StateId', $_REQUEST)) $id
global $ilCtrl
Definition: ilias.php:18
$error
Definition: Error.php:17
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:17
$type
if(isset($_POST['submit'])) $form
if(!file_exists("$old.txt")) if( $old===$new) if(file_exists("$new.txt")) $file
echo;exit;}function LogoutNotification($SessionID){ global $ilDB;$q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE