• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

content/classes/SCORM/class.ilSCORMItemGUI.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 require_once ("content/classes/SCORM/class.ilSCORMObjectGUI.php");
00025 require_once ("content/classes/SCORM/class.ilSCORMItem.php");
00026 require_once ("content/classes/SCORM/class.ilSCORMResource.php");
00027 require_once ("content/classes/class.ilObjSCORMLearningModule.php");
00028 
00038 class ilSCORMItemGUI extends ilSCORMObjectGUI
00039 {
00040         function ilSCORMItemGUI($a_id)
00041         {
00042                 parent::ilSCORMObjectGUI();
00043                 $this->sc_object =& new ilSCORMItem($a_id);
00044         }
00045 
00046         function view()
00047         {
00048                 global $ilias;
00049 
00050                 // get ressource identifier
00051                 $id_ref = $this->sc_object->getIdentifierRef();
00052                 if ($id_ref != "")
00053                 {
00054                         $resource =& new ilSCORMResource();
00055                         $resource->readByIdRef($id_ref, $this->sc_object->getSLMId());
00056 
00057                         $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
00058 
00059                         if ($resource->getHref() != "")
00060                         {
00061                                 $param_str = ($this->sc_object->getParameters() != "")
00062                                         ? "?".$this->sc_object->getParameters()
00063                                         : "";
00064 
00065                                 //header("Location: ../".$slm_obj->getDataDirectory()."/".$resource->getHref());
00066                                 $this->tpl =& new ilTemplate("tpl.scorm_content_frameset.html", true, true, true);
00067                                 $this->tpl->setVariable("ITEM_LOCATION",$slm_obj->getDataDirectory()."/".$resource->getHref().$param_str);
00068                                 $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
00069                                 $this->tpl->setVariable("REF_ID", $_GET["ref_id"]);
00070                                 $this->tpl->setVariable("USER_ID",$ilias->account->getId());
00071                                 $this->tpl->setVariable("ADAPTER_NAME", $slm_obj->getAPIAdapterName());
00072 //                              echo "itemid: ".$_GET["obj_id"]."userid: ".$ilias->account->getId();
00073                                 $this->tpl->show();
00074                                 exit;
00075                         }
00076                 }
00077 
00078                 // this point is only reached if now resource could be displayed above!
00079                 $this->tpl->addBlockFile("CONTENT", "content", "tpl.scorm_obj.html", true);
00080                 $this->tpl->setCurrentBlock("par_table");
00081                 $this->tpl->setVariable("TXT_OBJECT_TYPE", $this->lng->txt("cont_item"));
00082                 $this->displayParameter($this->lng->txt("cont_import_id"),
00083                         $this->sc_object->getImportId());
00084                 $this->displayParameter($this->lng->txt("cont_id_ref"),
00085                         $this->sc_object->getIdentifierRef());
00086                 $str_visible = ($this->sc_object->getVisible())
00087                         ? "true"
00088                         : "false";
00089                 $this->displayParameter($this->lng->txt("cont_is_visible"),
00090                         $str_visible);
00091                 $this->displayParameter($this->lng->txt("cont_parameters"),
00092                         $this->sc_object->getParameters());
00093                 $this->displayParameter($this->lng->txt("cont_sc_title"),
00094                         $this->sc_object->getTitle());
00095                 $this->displayParameter($this->lng->txt("cont_prereq_type"),
00096                         $this->sc_object->getPrereqType());
00097                 $this->displayParameter($this->lng->txt("cont_prerequisites"),
00098                         $this->sc_object->getPrerequisites());
00099                 $this->displayParameter($this->lng->txt("cont_max_time_allowed"),
00100                         $this->sc_object->getMaxTimeAllowed());
00101                 $this->displayParameter($this->lng->txt("cont_time_limit_action"),
00102                         $this->sc_object->getTimeLimitAction());
00103                 $this->displayParameter($this->lng->txt("cont_data_from_lms"),
00104                         $this->sc_object->getDataFromLms());
00105                 $this->displayParameter($this->lng->txt("cont_mastery_score"),
00106                         $this->sc_object->getMasteryScore());
00107                 $this->tpl->parseCurrentBlock();
00108 
00109         }
00110 
00111         function api()
00112         {
00113                 global $ilias;
00114 
00115                 $slm_obj =& new ilObjSCORMLearningModule($_GET["ref_id"]);
00116 
00117                 $func_tpl = new ilTemplate("tpl.scorm_functions.html", true, true, true);
00118                 $func_tpl->setVariable("PREFIX", $slm_obj->getAPIFunctionsPrefix());
00119                 $func_tpl->parseCurrentBlock();
00120 
00121                 $this->tpl =& new ilTemplate("tpl.scorm_api.html", true, true, true);
00122                 $this->tpl->setVariable("SCORM_FUNCTIONS", $func_tpl->get());
00123                 $this->tpl->setVariable("ITEM_ID", $_GET["obj_id"]);
00124                 $this->tpl->setVariable("USER_ID",$ilias->account->getId());
00125                 $this->tpl->setVariable("SESSION_ID",session_id());
00126                                 
00127                 $this->tpl->setVariable("CODE_BASE", "http://".$_SERVER['SERVER_NAME'].substr($_SERVER['PHP_SELF'], 0, strpos ($_SERVER['PHP_SELF'], "/sahs_presentation.php")));       
00128                 
00129                 $this->tpl->show();
00130                 exit;
00131         }
00132 }
00133 ?>

Generated on Fri Dec 13 2013 13:52:10 for ILIAS Release_3_7_x_branch .rev 46817 by  doxygen 1.7.1