ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSCORM2004ScoGUI Class Reference

Class ilSCORM2004ScoGUI. More...

+ Inheritance diagram for ilSCORM2004ScoGUI:
+ Collaboration diagram for ilSCORM2004ScoGUI:

Public Member Functions

 ilSCORM2004ScoGUI ($a_slm_obj, $a_node_id=0)
 getType ()
 Get Node Type.
executeCommand ()
 execute command
 showProperties ()
 Show Sequencing.
 updateProperties ()
 update Properties
 sahs_questions ()
 getEditTree ()
 setTabs ()
 output tabs
 proceedDragDrop ()
 Perform drag and drop action.
 sco_preview ()
 selectExport ()
 Select the export type of the SCORM 2004 module.
 showExportList ()
 exportScorm2004_4th ()
 exportScorm2004_3rd ()
 exportScorm12 ()
 exportHTML ()
 exportISO ()
 exportPDF ()
 downloadExportFile ()
 confirmDeleteExportFile ()
 confirmation screen for export file deletion
 cancelDeleteExportFile ()
 cancel deletion of export files
 deleteExportFile ()
 delete export files
 getExportResources ()
 sco_resources ()
 downloadResource ()
 downloadFile ()
 import ()
 importSave ()
 cancel ()
 Cancel action.
- Public Member Functions inherited from ilSCORM2004NodeGUI
 ilSCORM2004NodeGUI ($a_slm_obj, $a_node_id=0)
 constructor
 setParentGUI ($a_parentgui)
 Set Parent GUI class (ilObjSCORM2004LearningModuleGUI).
 getParentGUI ()
 Get Parent GUI class (ilObjSCORM2004LearningModuleGUI).
 getNodeObject ($a_node_id)
 Get node object (chapter/sco/page)
 putInTree ($a_parent_id, $a_target)
 put this object into content object tree
 showOrganization ()
 Confirm deletion screen (delete page or structure objects)
 insertChapter ()
 Insert Chapter.
 insertSco ()
 Insert Sco.
 insertPage ()
 Insert Page.
 insertTemplateGUI ()
 Insert Page with Layout.
 collapseAll ()
 Collapse all.
 ExpandAll ()
 Expand all.
 saveAllTitles ()
 Save Titles.
 deleteNodes ()
 Delete nodes in the hierarchy.
 cancelDelete ()
 cancel delete
 confirmedDelete ()
 confirmed delete
 setLocator ()
 Set Locator Items.
 copyItems ($a_return="showOrganization")
 Copy items to clipboard.
 cutItems ($a_return="showOrganization")
 Copy items to clipboard, then cut them from the current tree.
 insertPageClip ()
 Insert pages from clipboard.
 insertScoClip ()
 Insert scos from clipboard.

Static Public Member Functions

static getGlossaryOverviewId ()
 Get sco glossary overlay id.
static getGloOverviewOv ($a_sco)
 des

Data Fields

 $ctrl = null
 Constructor public.
- Data Fields inherited from ilSCORM2004NodeGUI
 $node_object
 $slm_object

Private Member Functions

 insertQuestion ($matches)

Detailed Description

Class ilSCORM2004ScoGUI.

User Interface for Scorm 2004 SCO Nodes

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilSCORM2004ScoGUI: ilMDEditorGUI, ilNoteGUI, ilPCQuestionGUI, ilSCORM2004PageGUI

Definition at line 40 of file class.ilSCORM2004ScoGUI.php.

Member Function Documentation

ilSCORM2004ScoGUI::cancel ( )

Cancel action.

Definition at line 982 of file class.ilSCORM2004ScoGUI.php.

{
$this->ctrl->redirect($this, "showOrganization");
}
ilSCORM2004ScoGUI::cancelDeleteExportFile ( )

cancel deletion of export files

Definition at line 659 of file class.ilSCORM2004ScoGUI.php.

{
session_unregister("ilExportFiles");
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::confirmDeleteExportFile ( )

confirmation screen for export file deletion

Definition at line 622 of file class.ilSCORM2004ScoGUI.php.

References $_POST, $data, $lng, $tpl, ilDatePresentation\formatDate(), IL_CAL_UNIX, ilUtil\sendInfo(), and ilUtil\sendQuestion().

{
global $lng, $tpl;
if(!isset($_POST["file"]))
{
ilUtil::sendInfo($lng->txt("no_checkbox"),true);
$this->ctrl->redirect($this, "showExportList");
}
ilUtil::sendQuestion($lng->txt("info_delete_sure"));
$export_files = $this->node_object->getExportFiles();
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
$table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList', true);
$data = array();
foreach ($export_files as $exp_file)
{
foreach ($_POST['file'] as $delete_file)
{
if (strcmp($delete_file, $exp_file['file']) == 0)
{
// $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($exp_file["type"]))
// ? " <b>(".$this->lng->txt("public").")<b>"
// : "";
$file_arr = explode("__", $exp_file["file"]);
array_push($data, array('file' => $exp_file['file'], 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => $exp_file['size'], 'type' => $exp_file['type'].$public_str));
}
}
}
$table_gui->setData($data);
$tpl->setVariable('ADM_CONTENT', $table_gui->getHTML());
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::deleteExportFile ( )

delete export files

Definition at line 669 of file class.ilSCORM2004ScoGUI.php.

References $_POST, $file, $lng, and ilUtil\sendSuccess().

{
global $lng;
include_once "./Services/Utilities/classes/class.ilUtil.php";
$export = new ilSCORM2004Export($this->node_object);
foreach($_POST['file'] as $idx => $file)
{
$export_dir = $export->getExportDirectoryForType($_POST['type'][$idx]);
$exp_file = $export_dir."/".$file;
if (@is_file($exp_file))
{
unlink($exp_file);
}
}
ilUtil::sendSuccess($lng->txt('msg_deleted_export_files'), true);
$this->ctrl->redirect($this, "showExportList");
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::downloadExportFile ( )

Definition at line 603 of file class.ilSCORM2004ScoGUI.php.

References $_POST, and ilUtil\deliverFile().

{
if(!isset($_POST["file"]))
{
$this->ilias->raiseError($this->lng->txt("no_checkbox"),$this->ilias->error_obj->MESSAGE);
}
if (count($_POST["file"]) > 1)
{
$this->ilias->raiseError($this->lng->txt("cont_select_max_one_item"),$this->ilias->error_obj->MESSAGE);
}
$export = new ilSCORM2004Export($this->node_object);
$export_dir = $export->getExportDirectoryForType($_POST['type'][$_POST['file'][0]]);
ilUtil::deliverFile($export_dir."/".$_POST['file'][0], $_POST['file'][0]);
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::downloadFile ( )

Definition at line 868 of file class.ilSCORM2004ScoGUI.php.

References $_GET, $file, and exit.

{
$file = explode("_", $_GET["file_id"]);
require_once("./Modules/File/classes/class.ilObjFile.php");
$fileObj =& new ilObjFile($file[count($file) - 1], false);
$fileObj->sendFile();
}
ilSCORM2004ScoGUI::downloadResource ( )

Definition at line 835 of file class.ilSCORM2004ScoGUI.php.

References $_GET, $f, $file, ilUtil\deliverFile(), exit, and getExportResources().

{
$export_files = $this->getExportResources();
if ($_GET["file_id"] > 0)
{
$file = new ilObjFile($_GET["file_id"], false);
}
// check that file really belongs to SCORM module (security)
foreach ($export_files as $f)
{
if (is_object($file))
{
if ($f["file"] == $file->getFileName())
{
$file->sendFile();
}
}
else
{
if ($f["path"] == $_GET["resource"])
{
if (is_file($f["path"]))
{
ilUtil::deliverFile($f["path"], $f["file"]);
}
}
}
}
}

+ Here is the call graph for this function:

& ilSCORM2004ScoGUI::executeCommand ( )

execute command

Definition at line 71 of file class.ilSCORM2004ScoGUI.php.

References $_GET, $cmd, $ilCtrl, $ret, $tpl, ilMDEditorGUI\addObserver(), IL_PAGE_PREVIEW, ilSCORM2004NodeGUI\setLocator(), setTabs(), and ilSCORM2004NodeGUI\showOrganization().

{
global $tpl, $ilCtrl, $ilTabs;
$tpl->getStandardTemplate();
$next_class = $ilCtrl->getNextClass($this);
$cmd = $ilCtrl->getCmd();
switch($next_class)
{
// notes
case "ilnotegui":
switch($_GET["notes_mode"])
{
default:
$ilTabs->setTabActive("sahs_organization");
return $this->showOrganization();
}
break;
case 'ilmdeditorgui':
$this->setTabs();
$this->setLocator();
include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
$md_gui =& new ilMDEditorGUI($this->slm_object->getID(),
$this->node_object->getId(), $this->node_object->getType());
$md_gui->addObserver($this->node_object,'MDUpdateListener','General');
$ilCtrl->forwardCommand($md_gui);
break;
case 'ilscorm2004pagegui':
include_once("./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php");
$page_obj = new ilSCORM2004PageGUI("sahs",$_GET["pg_id"]);
//$page_obj->setPresentationTitle($page["title"]);
$page_obj->setOutputMode(IL_PAGE_PREVIEW);
$ilCtrl->forwardCommand($page_obj);
break;
default:
$ret =& $this->$cmd();
break;
}
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::exportHTML ( )

Definition at line 582 of file class.ilSCORM2004ScoGUI.php.

{
$export = new ilScorm2004Export($this->node_object,'HTML');
$export->buildExportFile();
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::exportISO ( )

Definition at line 589 of file class.ilSCORM2004ScoGUI.php.

{
$export = new ilScorm2004Export($this->node_object,'ISO');
$export->buildExportFile();
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::exportPDF ( )

Definition at line 596 of file class.ilSCORM2004ScoGUI.php.

{
$export = new ilScorm2004Export($this->node_object,'PDF');
$export->buildExportFile();
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::exportScorm12 ( )

Definition at line 575 of file class.ilSCORM2004ScoGUI.php.

{
$export = new ilScorm2004Export($this->node_object,'SCORM 1.2');
$export->buildExportFile();
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::exportScorm2004_3rd ( )

Definition at line 568 of file class.ilSCORM2004ScoGUI.php.

{
$export = new ilScorm2004Export($this->node_object,'SCORM 2004 3rd');
$export->buildExportFile();
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::exportScorm2004_4th ( )

Definition at line 560 of file class.ilSCORM2004ScoGUI.php.

{
$export = new ilScorm2004Export($this->node_object,'SCORM 2004 4th');
$export->buildExportFile();
$this->ctrl->redirect($this, "showExportList");
}
ilSCORM2004ScoGUI::getEditTree ( )

Definition at line 268 of file class.ilSCORM2004ScoGUI.php.

References ilTree\setTreeTablePK().

{
$slm_tree = new ilTree($this->node_object->getId(),$this->slm_object->getId());
$slm_tree->setTreeTablePK("slm_id");
$slm_tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
return $slm_tree;
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::getExportResources ( )

Definition at line 687 of file class.ilSCORM2004ScoGUI.php.

References ilObject\_exists(), ilObjMediaObject\_lookupStandardItemPath(), and ilTree\setTableNames().

Referenced by downloadResource(), and sco_resources().

{
$export_files = array();
require_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
include_once "./Modules/File/classes/class.ilObjFile.php";
$tree = new ilTree($this->slm_object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach($tree->getSubTree($tree->getNodeData($this->node_object->getId()),true,'page') as $page)
{
$page_obj = new ilSCORM2004Page($page["obj_id"]);
$page_obj->buildDom();
$mob_ids = $page_obj->collectMediaObjects(false);
foreach($mob_ids as $mob_id)
{
if ($mob_id > 0 && ilObject::_exists($mob_id))
{
$media_obj = new ilObjMediaObject($mob_id);
$export_files[$i]["date"] = $media_obj->getCreateDate();
$export_files[$i]["size"] = filesize(ilObjMediaObject::_lookupStandardItemPath($mob_id,false,false));
$export_files[$i]["file"] = $media_obj->getTitle();
$export_files[$i]["type"] = $media_obj->getDescription();
$export_files[$i]["path"] = ilObjMediaObject::_lookupStandardItemPath($mob_id,false,false);
$this->ctrl->setParameter($this, "resource",
rawurlencode(ilObjMediaObject::_lookupStandardItemPath($mob_id,false,false)));
$export_files[$i]["link"] = $this->ctrl->getLinkTarget($this,"downloadResource");
$i++;
}
}
$file_ids = $page_obj->collectFileItems();
foreach($file_ids as $file_id)
{
$file_obj = new ilObjFile($file_id, false);
$export_files[$i]["date"] = $file_obj->getCreateDate();
$export_files[$i]["size"] = $file_obj->getFileSize();
$export_files[$i]["file"] = $file_obj->getFileName();
$export_files[$i]["type"] = $file_obj->getFileType();
$export_files[$i]["file_id"] = $file_id;
$this->ctrl->setParameter($this, "file_id",$file_id);
$export_files[$i]["link"] = $this->ctrl->getLinkTarget($this,"downloadFile","");
$i++;
}
unset($page_obj);
}
return $export_files;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSCORM2004ScoGUI::getGloOverviewOv (   $a_sco)
static

des

Parameters
@return

Definition at line 1004 of file class.ilSCORM2004ScoGUI.php.

References $lng, $t, $tpl, and getGlossaryOverviewId().

Referenced by ilSCORM2004PageGUI\getGlossaryHTML(), and ilSCORM2004PageGUI\postOutputProcessing().

{
global $lng;
$tpl = new ilTemplate("tpl.sco_glossary_overview.html", true, true, "Modules/Scorm2004");
$terms = $a_sco->getGlossaryTermIds();
foreach ($terms as $k => $t)
{
$tpl->setCurrentBlock("link");
$tpl->setVariable("TXT_LINK", $t);
$tpl->setVariable("ID_LINK", "glo_ov_t".$k);
$tpl->parseCurrentBlock();
}
$tpl->setVariable("TXT_SCO_GLOSSARY", $lng->txt("cont_sco_glossary"));
$tpl->setVariable("TXT_CLOSE", $lng->txt("close"));
if (count($terms) > 1)
{
return $tpl->get();
}
else
{
return "";
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilSCORM2004ScoGUI::getGlossaryOverviewId ( )
static

Get sco glossary overlay id.

Parameters
@return

Definition at line 993 of file class.ilSCORM2004ScoGUI.php.

Referenced by ilSCORM2004PageNodeGUI\executeCommand(), ilSCORM2004Sco\exportHTMLPageObjects(), getGloOverviewOv(), and sco_preview().

{
return "sco_glo_ov";
}

+ Here is the caller graph for this function:

ilSCORM2004ScoGUI::getType ( )

Get Node Type.

Definition at line 63 of file class.ilSCORM2004ScoGUI.php.

{
return "sco";
}
ilSCORM2004ScoGUI::ilSCORM2004ScoGUI (   $a_slm_obj,
  $a_node_id = 0 
)

Definition at line 50 of file class.ilSCORM2004ScoGUI.php.

References $ilCtrl, and ilSCORM2004NodeGUI\ilSCORM2004NodeGUI().

{
global $ilCtrl;
$ilCtrl->saveParameter($this, "obj_id");
$this->ctrl = &$ilCtrl;
parent::ilSCORM2004NodeGUI($a_slm_obj, $a_node_id);
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::import ( )

Definition at line 877 of file class.ilSCORM2004ScoGUI.php.

References $lng, $tpl, ilUtil\getImagePath(), ilSCORM2004NodeGUI\setLocator(), and setTabs().

{
global $tpl, $lng;
$this->setTabs();
$this->setLocator();
$tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.scormeditor_sco_import.html", "Modules/Scorm2004");
$tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_slm.gif'));
$tpl->setVariable("ALT_IMG", $lng->txt("obj_sahs"));
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->setVariable("BTN_NAME", "importSave");
// this leads to _top target which removes the left organization frame
//$tpl->setVariable("TARGET", ' target="'.ilFrameTargetInfo::_getFrame("MainContent").'" ');
$tpl->setVariable("TXT_UPLOAD", $lng->txt("upload"));
$tpl->setVariable("TXT_CANCEL", $lng->txt("cancel"));
$tpl->setVariable("TXT_IMPORT_SCO", $lng->txt("import_sco_object"));
$tpl->setVariable("TXT_SELECT_FILE", $lng->txt("select_file"));
$tpl->setVariable("TXT_VALIDATE_FILE", $lng->txt("cont_validate_file"));
// get the value for the maximal uploadable filesize from the php.ini (if available)
$umf=get_cfg_var("upload_max_filesize");
// get the value for the maximal post data from the php.ini (if available)
$pms=get_cfg_var("post_max_size");
//convert from short-string representation to "real" bytes
$multiplier_a=array("K"=>1024, "M"=>1024*1024, "G"=>1024*1024*1024);
$umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
$pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
// use the smaller one as limit
$max_filesize=min($umf, $pms);
if (!$max_filesize) $max_filesize=max($umf, $pms);
//format for display in mega-bytes
$max_filesize=sprintf("%.1f MB",$max_filesize/1024/1024);
// gives out the limit as a little notice
$tpl->setVariable("TXT_FILE_INFO", $lng->txt("file_notice")." $max_filesize");
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::importSave ( )

Definition at line 928 of file class.ilSCORM2004ScoGUI.php.

References $_GET, $file, $lng, $name, ilUtil\createDirectory(), ilUtil\moveUploadedFile(), ilUtil\renameExecutables(), and ilUtil\unzip().

{
global $_FILES, $rbacsystem;
global $ilias, $lng;
// check if file was uploaded
$source = $_FILES["scormfile"]["tmp_name"];
if (($source == 'none') || (!$source))
{
$ilias->raiseError("No file selected!",$ilias->error_obj->MESSAGE);
}
// check create permission
if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], "sahs"))
{
$ilias->raiseError($lng->txt("no_create_permission"), $ilias->error_obj->WARNING);
}
// get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
switch ($__FILES["scormfile"]["error"])
{
case UPLOAD_ERR_INI_SIZE:
$ilias->raiseError($lng->txt("err_max_file_size_exceeds"),$ilias->error_obj->MESSAGE);
break;
case UPLOAD_ERR_FORM_SIZE:
$ilias->raiseError($lng->txt("err_max_file_size_exceeds"),$ilias->error_obj->MESSAGE);
break;
case UPLOAD_ERR_PARTIAL:
$ilias->raiseError($lng->txt("err_partial_file_upload"),$ilias->error_obj->MESSAGE);
break;
case UPLOAD_ERR_NO_FILE:
$ilias->raiseError($lng->txt("err_no_file_uploaded"),$ilias->error_obj->MESSAGE);
break;
}
$file = pathinfo($_FILES["scormfile"]["name"]);
$name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
$file_path = $this->slm_object->getDataDirectory()."/".$this->node_object->getId()."/".$_FILES["scormfile"]["name"];
ilUtil::createDirectory($this->slm_object->getDataDirectory()."/".$this->node_object->getId());
ilUtil::moveUploadedFile($_FILES["scormfile"]["tmp_name"], $_FILES["scormfile"]["name"], $file_path);
ilUtil::unzip($file_path);
ilUtil::renameExecutables($this->slm_object->getDataDirectory()."/".$this->node_object->getId());
include_once ("./Modules/Scorm2004/classes/ilSCORM13Package.php");
$newPack = new ilSCORM13Package();
$newPack->il_importSco($this->slm_object->getId(),$this->node_object->getId(),$this->slm_object->getDataDirectory()."/".$this->node_object->getId());
$this->ctrl->redirect($this, "showOrganization");
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::insertQuestion (   $matches)
private

Definition at line 486 of file class.ilSCORM2004ScoGUI.php.

{
$q_exporter = new ilQuestionExporter(false);
return $q_exporter->exportQuestion($matches[2]);
}
ilSCORM2004ScoGUI::proceedDragDrop ( )

Perform drag and drop action.

Definition at line 332 of file class.ilSCORM2004ScoGUI.php.

References $_POST, and $ilCtrl.

{
global $ilCtrl;
//echo "-".$_POST["il_hform_source_id"]."-".$_POST["il_hform_target_id"]."-".$_POST["il_hform_fc"]."-";
$this->slm_object->executeDragDrop($_POST["il_hform_source_id"], $_POST["il_hform_target_id"],
$_POST["il_hform_fc"], $_POST["il_hform_as_subitem"]);
$ilCtrl->redirect($this, "showOrganization");
}
ilSCORM2004ScoGUI::sahs_questions ( )

Definition at line 212 of file class.ilSCORM2004ScoGUI.php.

References $ilCtrl, $lng, $tpl, ilPageObject\_getQuestionIdsForPage(), assQuestion\_getTitle(), ilSCORM2004NodeGUI\setLocator(), ilTree\setTableNames(), setTabs(), and ilUtil\switchColor().

{
global $tpl,$lng, $ilCtrl;
$this->setTabs();
$this->setLocator();
include_once "./Services/Table/classes/class.ilTableGUI.php";
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004Page.php";
include_once("./Modules/TestQuestionPool/classes/class.assQuestion.php");
include_once("./Services/COPage/classes/class.ilPCQuestionGUI.php");
// load template for table
$tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
$tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scormeditor_sco_question.html", "Modules/Scorm2004");
$tbl = new ilTableGUI();
$tbl->setTitle("Questions for ".$this->node_object->getTitle());
$tbl->setHeaderNames(array("Question","Page"));
$cols = array("question","page");
$tbl->setHeaderVars($cols, $header_params);
$tbl->setColumnWidth(array("50%", "50%"));
$tbl->disable("sort");
$tbl->disable("footer");
$tree = new ilTree($this->slm_object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
foreach($tree->getSubTree($tree->getNodeData($this->node_object->getId()),true,'page') as $page)
{
// get question ids
$qids = ilSCORM2004Page::_getQuestionIdsForPage("sahs", $page["obj_id"]);
if (count($qids) > 0)
{
// output questions
foreach ($qids as $qid)
{
$tpl->setCurrentBlock("tbl_content");
$tpl->setVariable("TXT_PAGE_TITLE", $page["title"]);
$ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $page["obj_id"]);
$tpl->setVariable("HREF_EDIT_PAGE", $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui", "edit"));
$qtitle = assQuestion::_getTitle($qid);
$tpl->setVariable("TXT_QUESTION", $qtitle);
$ilCtrl->setParameterByClass("ilscorm2004pagenodegui", "obj_id", $page["obj_id"]);
//$tpl->setVariable("HREF_EDIT_QUESTION", $ilCtrl->getLinkTargetByClass("ilscorm2004pagenodegui", "edit"));
$tpl->setVariable("CSS_ROW", ilUtil::switchColor($i++, "tblrow1", "tblrow2"));
$tpl->parseCurrentBlock();
}
}
}
$tbl->render();
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::sco_preview ( )

Definition at line 342 of file class.ilSCORM2004ScoGUI.php.

References $ilCtrl, $lng, $tpl, ilObjStyleSheet\getContentStylePath(), ilMD\getGeneral(), ilSCORM2004PageGUI\getGlossaryHTML(), getGlossaryOverviewId(), ilUtil\getStyleSheetLocation(), IL_PAGE_PREVIEW, ilSCORM2004PageGUI\initExport(), ilPageObjectGUI\setPresentationTitle(), and ilTree\setTableNames().

{
global $tpl, $ilCtrl, $lng;
$tpl = new ilTemplate("tpl.main.html", true, true);
include_once("./Services/Style/classes/class.ilObjStyleSheet.php");
$tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
$tpl->setBodyClass("");
$tpl->setCurrentBlock("ContentStyle");
$tpl->setVariable("LOCATION_CONTENT_STYLESHEET",
ilObjStyleSheet::getContentStylePath($this->slm_object->getStyleSheetId()));
$tpl->parseCurrentBlock();
$tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery.js");
$tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/jquery-ui-min.js");
$tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/pure.js");
$tpl->addJavaScript("./Modules/Scorm2004/scripts/pager.js");
// $this->setTabs();
// $this->setLocator();
$tree = new ilTree($this->slm_object->getId());
$tree->setTableNames('sahs_sc13_tree', 'sahs_sc13_tree_node');
$tree->setTreeTablePK("slm_id");
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004PageGUI.php";
include_once "./Services/MetaData/classes/class.ilMD.php";
$meta = new ilMD($this->node_object->getSLMId(), $this->node_object->getId(), $this->node_object->getType());
$desc_ids = $meta->getGeneral()->getDescriptionIds();
$sco_description = $meta->getGeneral()->getDescription($desc_ids[0])->getDescription();
// @todo
// Why is that much HTML code in an application class?
// Please extract all this HTML to a tpl.<t_name>.html file and use
// placeholders and the template engine to insert data.
//
// There copy/paste code residenting in ilSCORM2004Sco. This
// should be merged.
//
// alex, 4 Apr 09
//
$output = '<!-- BEGIN ilLMNavigation -->
<div class="ilc_page_tnav_TopNavigation">
<!-- BEGIN ilLMNavigation_Prev -->
<div class="ilc_page_lnav_LeftNavigation">
<a class="ilc_page_lnavlink_LeftNavigationLink">
<img class="ilc_page_lnavimage_LeftNavigationImage" border="0" src="/templates/default/images/spacer.gif" alt="" title="" />&nbsp;'.$lng->txt('scplayer_previous').'</a>
</div>
<!-- END ilLMNavigation_Prev -->
<!-- BEGIN ilLMNavigation_Next -->
<div class="ilc_page_rnav_RightNavigation">
<a class="ilc_page_rnavlink_RightNavigationLink">'.$lng->txt('scplayer_next').'&nbsp;<img class="ilc_page_rnavimage_RightNavigationImage" border="0" src="/templates/default/images/spacer.gif" alt="" title="" /></a>
</div>
<!-- END ilLMNavigation_Next -->
<div style="clear:both;"></div>
</div>
<!-- END ilLMNavigation -->';
$output .='<table class="ilc_page_cont_PageContainer" width="100%" cellspacing="0" cellpadding="0" style="display: table;"><tbody><tr><td><div class="ilc_page_Page"><div class="ilc_sco_title_Title">'.$this->node_object->getTitle().'</div>';
// sco description
if (trim($sco_description) != "")
{
$output .='<div class="ilc_sco_desct_DescriptionTop">'.$lng->txt("description").'</div>';
$output .='<div class="ilc_sco_desc_Description">'.$sco_description.'</div>';
}
// sco objective(s)
$objs = $this->node_object->getObjectives();
if (count($objs) > 0)
{
$output .='<div class="ilc_sco_objt_ObjectiveTop">'.$lng->txt("sahs_objectives").'</div>';
foreach ($objs as $objective)
{
$output .= '<div class="ilc_sco_obj_Objective">'.nl2br($objective->getObjectiveID()).'</div>';
}
$output .= "</div>";
}
$output .='</td></tr></table>';
// init export (this initialises glossary template)
$terms = $this->node_object->getGlossaryTermIds();
foreach($tree->getSubTree($tree->getNodeData($this->node_object->getId()),true,'page') as $page)
{
$page_obj = new ilSCORM2004PageGUI($this->node_object->getType(),$page["obj_id"]);
$page_obj->setPresentationTitle($page["title"]);
$page_obj->setOutputMode(IL_PAGE_PREVIEW);
$page_obj->setStyleId($this->slm_object->getStyleSheetId());
if (count($terms) > 1)
{
$page_obj->setGlossaryOverviewInfo(
}
$output .= $page_obj->showPage("export");
}
$output .= '<!-- BEGIN ilLMNavigation2 -->
<div class="ilc_page_bnav_BottomNavigation">
<!-- BEGIN ilLMNavigation_Prev -->
<div class="ilc_page_lnav_LeftNavigation">
<a class="ilc_page_lnavlink_LeftNavigationLink">
<img class="ilc_page_lnavimage_LeftNavigationImage" border="0" src="/templates/default/images/spacer.gif" alt="" title="" />&nbsp;'.$lng->txt('scplayer_previous').'</a>
</div>
<!-- END ilLMNavigation_Prev -->
<!-- BEGIN ilLMNavigation_Next -->
<div class="ilc_page_rnav_RightNavigation">
<a class="ilc_page_rnavlink_RightNavigationLink">'.$lng->txt('scplayer_next').'&nbsp;<img class="ilc_page_rnavimage_RightNavigationImage" border="0" src="/templates/default/images/spacer.gif" alt="" title="" /></a>
</div>
<!-- END ilLMNavigation_Next -->
<div style="clear:both;"></div>
</div>
<!-- END ilLMNavigation2 -->';
// append glossary entries on the sco level
$output.= ilSCORM2004PageGUI::getGlossaryHTML($this->node_object);
//insert questions
require_once './Modules/Scorm2004/classes/class.ilQuestionExporter.php';
$output = preg_replace_callback("/(Question;)(il__qst_[0-9]+)/",array(get_class($this), 'insertQuestion'),$output);
$output = preg_replace("/&#123;/","",$output);
$output = preg_replace("/&#125;/","",$output);
$output = "<script>var ScormApi=null;".ilQuestionExporter::questionsJS()."</script>".$output;
$tpl->addOnloadCode('
ilias.questions.txt.wrong_answers = "'.$lng->txt("cont_wrong_answers").'";
ilias.questions.txt.tries_remaining = "'.$lng->txt("cont_tries_remaining").'";
ilias.questions.txt.please_try_again = "'.$lng->txt("cont_please_try_again").'";
ilias.questions.txt.all_answers_correct = "'.$lng->txt("cont_all_answers_correct").'";
ilias.questions.txt.nr_of_tries_exceeded = "'.$lng->txt("cont_nr_of_tries_exceeded").'";
ilias.questions.txt.correct_answers_shown = "'.$lng->txt("cont_correct_answers_shown").'";
');
$tpl->addJavaScript("./Modules/Scorm2004/scripts/questions/question_handling.js");
//inline JS
$output .='<script type="text/javascript" src="./Modules/Scorm2004/scripts/questions/question_handling.js"></script>';
// $tpl->setContent($output);
$tpl->setVariable("CONTENT", $output);
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::sco_resources ( )

Definition at line 737 of file class.ilSCORM2004ScoGUI.php.

References $_GET, $ilCtrl, $lng, $tpl, getExportResources(), ilSCORM2004NodeGUI\setLocator(), setTabs(), and ilUtil\switchColor().

{
global $tpl, $lng, $ilCtrl;;
$this->setTabs();
$this->setLocator();
$i = 0;
$export_files = $this->getExportResources();
// create table
require_once("./Services/Table/classes/class.ilTableGUI.php");
$tbl = new ilTableGUI();
// load files templates
$tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
// load template for table content data
$tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.download_file_row.html", "Modules/LearningModule");
$num = 0;
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tbl->setTitle($lng->txt("cont_files"));
$tbl->setHeaderNames(array($lng->txt("cont_format"),
$lng->txt("cont_file"),
$lng->txt("size"), $lng->txt("date"),
""));
$cols = array("format", "file", "size", "date", "download");
$header_params = array("ref_id" => $_GET["ref_id"], "obj_id" => $_GET["obj_id"],
"cmd" => "sco_resources", "cmdClass" => strtolower(get_class($this)),
"cmdNode" => $_GET["cmdNode"], "baseClass" => $_GET["baseClass"]);
$tbl->setHeaderVars($cols, $header_params);
$tbl->setColumnWidth(array("10%", "30%", "20%", "20%","20%"));
$tbl->disable("sort");
$tbl->setOrderColumn($_GET["sort_by"]);
$tbl->setOrderDirection($_GET["sort_order"]);
$tbl->setLimit($_GET["limit"]);
$tbl->setOffset($_GET["offset"]);
$tbl->setMaxCount($this->maxcount); // ???
$tbl->setMaxCount(count($export_files));
// footer
$tbl->setFooter("tblfooter",$lng->txt("previous"),$lng->txt("next"));
//$tbl->disable("footer");
$tbl->setMaxCount(count($export_files));
$export_files = array_slice($export_files, $_GET["offset"], $_GET["limit"]);
$tbl->render();
if(count($export_files) > 0)
{
$i=0;
foreach($export_files as $exp_file)
{
if (!$exp_file["size"] > 0)
{
continue;
}
$tpl->setCurrentBlock("tbl_content");
$tpl->setVariable("TXT_FILENAME", $exp_file["file"]);
$css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
$tpl->setVariable("CSS_ROW", $css_row);
$tpl->setVariable("TXT_SIZE", $exp_file["size"]);
$tpl->setVariable("TXT_FORMAT", $exp_file["type"]);
$tpl->setVariable("TXT_DATE", $exp_file["date"]);
$tpl->setVariable("TXT_DOWNLOAD", $lng->txt("download"));
//$tpl->setVariable("LINK_DOWNLOAD",
// $exp_file["link"]);
$ilCtrl->setParameter($this, "resource", rawurlencode($exp_file["path"]));
$ilCtrl->setParameter($this, "file_id", rawurlencode($exp_file["file_id"]));
$tpl->setVariable("LINK_DOWNLOAD",
$ilCtrl->getLinkTarget($this, "downloadResource"));
$tpl->parseCurrentBlock();
}
} //if is_array
else
{
$tpl->setCurrentBlock("notfound");
$tpl->setVariable("TXT_OBJECT_NOT_FOUND", $lng->txt("obj_not_found"));
$tpl->setVariable("NUM_COLS", 4);
$tpl->parseCurrentBlock();
}
$tpl->parseCurrentBlock();
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::selectExport ( )

Select the export type of the SCORM 2004 module.

Definition at line 495 of file class.ilSCORM2004ScoGUI.php.

References $_POST.

{
switch ($_POST['select_export'])
{
case "exportScorm12":
case "exportScorm2004_3rd":
case "exportScorm2004_4th":
case "exportPDF":
case "exportHTML":
$this->ctrl->redirect($this, $_POST['select_export']);
break;
default:
$this->ctrl->redirect($this, 'showExportList');
break;
}
}
ilSCORM2004ScoGUI::setTabs ( )

output tabs

Definition at line 279 of file class.ilSCORM2004ScoGUI.php.

References $ilCtrl, $lng, $tpl, and ilUtil\getImagePath().

Referenced by executeCommand(), import(), sahs_questions(), sco_resources(), showExportList(), and showProperties().

{
global $ilTabs, $ilCtrl, $tpl, $lng;
// subelements
$ilTabs->addTarget("sahs_organization",
$ilCtrl->getLinkTarget($this,'showOrganization'),
"showOrganization", get_class($this));
// properties (named learning objectives, since here is currently
// no other property)
$ilTabs->addTarget("sahs_learning_objectives",
$ilCtrl->getLinkTarget($this,'showProperties'),
"showProperties", get_class($this));
// questions
$ilTabs->addTarget("sahs_questions",
$ilCtrl->getLinkTarget($this,'sahs_questions'),
"sahs_questions", get_class($this));
// resources
$ilTabs->addTarget("cont_files",
$ilCtrl->getLinkTarget($this,'sco_resources'),
"sco_resources", get_class($this));
// metadata
$ilTabs->addTarget("meta_data",
$ilCtrl->getLinkTargetByClass("ilmdeditorgui",''),
"", "ilmdeditorgui");
// export
$ilTabs->addTarget("export",
$ilCtrl->getLinkTarget($this, "showExportList"), "showExportList",
get_class($this));
// import
$ilTabs->addTarget("import",
$ilCtrl->getLinkTarget($this, "import"), "import",
get_class($this));
// preview
$ilTabs->addNonTabbedLink("preview",
$lng->txt("cont_preview"),
$ilCtrl->getLinkTarget($this,'sco_preview'), "_blank");
$tpl->setTitleIcon(ilUtil::getImagePath("icon_sco_b.gif"));
$tpl->setTitle(
$lng->txt("sahs_unit").": ".$this->node_object->getTitle());
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004ScoGUI::showExportList ( )

Definition at line 512 of file class.ilSCORM2004ScoGUI.php.

References $data, $ilCtrl, $lng, $tpl, ilDatePresentation\formatDate(), IL_CAL_UNIX, ilUtil\prepareFormOutput(), ilSCORM2004NodeGUI\setLocator(), and setTabs().

{
global $tpl, $ilCtrl, $lng;
$this->setTabs();
$this->setLocator();
$template = new ilTemplate("tpl.scorm2004_export_buttons.html", true, true, 'Modules/Scorm2004');
$buttons = array(
"exportScorm2004_3rd" => $lng->txt("scorm_create_export_file_scrom2004"),
"exportScorm2004_4th" => $lng->txt("scorm_create_export_file_scrom2004_4th"),
"exportScorm12" => $lng->txt("scorm_create_export_file_scrom12"),
"exportPDF" => $lng->txt("scorm_create_export_file_pdf"),
"exportHTML" => $lng->txt("scorm_create_export_file_html")
);
foreach ($buttons as $value => $text)
{
$template->setCurrentBlock('option');
$template->setVariable('OPTION_VALUE', $value);
$template->setVariable('OPTION_TITLE', ilUtil::prepareFormOutput($text));
$template->parseCurrentBlock();
}
$template->setVariable('EXPORT_TITLE', $lng->txt('export'));
$template->setVariable('EXPORT_LABEL', $lng->txt('type'));
$template->setVariable('FORMACTION', $ilCtrl->getFormAction($this, 'selectExport'));
$export_files = $this->node_object->getExportFiles();
include_once "./Modules/Scorm2004/classes/class.ilSCORM2004ExportTableGUI.php";
$table_gui = new ilSCORM2004ExportTableGUI($this, 'showExportList');
$data = array();
foreach ($export_files as $exp_file)
{
$filetype = $exp_file['type'];
// $public_str = ($exp_file["file"] == $this->object->getPublicExportFile($filetype))
// ? " <b>(".$this->lng->txt("public").")<b>"
// : "";
$file_arr = explode("__", $exp_file["file"]);
array_push($data, array('file' => $exp_file['file'], 'filetype' => $filetype, 'date' => ilDatePresentation::formatDate(new ilDateTime($file_arr[0], IL_CAL_UNIX)), 'size' => $exp_file['size'], 'type' => $exp_file['type'].$public_str));
}
$table_gui->setData($data);
$tpl->setVariable('ADM_CONTENT', $template->get() . "\n" . $table_gui->getHTML());
}

+ Here is the call graph for this function:

ilSCORM2004ScoGUI::showProperties ( )

Show Sequencing.

Definition at line 120 of file class.ilSCORM2004ScoGUI.php.

References $data, $lng, $tpl, ilUtil\getImagePath(), ilSCORM2004NodeGUI\setLocator(), setTabs(), and ilUtil\switchColor().

Referenced by updateProperties().

{
global $tpl,$lng,$ilTabs;
$this->setTabs();
$this->setLocator();
$ilTabs->setTabActive("sahs_learning_objectives");
include_once "./Services/Table/classes/class.ilTableGUI.php";
// load template for table
$tpl->addBlockfile("ADM_CONTENT", "adm_content", "tpl.table.html");
// load template for table content data
$tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.scormeditor_sco_properties.html", "Modules/Scorm2004");
$tbl = new ilTableGUI();
$tbl->enable("action");
$tbl->disable("sort");
$tbl->setTitle("Learning Objectives for ".$this->node_object->getTitle());
$tbl->setHeaderNames(array("", $lng->txt("title"),"Scope"));
$cols = array("", "title","scope");
$tbl->setHeaderVars($cols, $header_params);
$tr_data = $this->node_object->getObjectives();
$tpl->setVariable("COLUMN_COUNTS", 3);
$tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
$tpl->setCurrentBlock("tbl_action_btn");
$tpl->setVariable("BTN_NAME", "updateProperties");
$tpl->setVariable("BTN_VALUE", $lng->txt("save"));
$tpl->parseCurrentBlock();
$tbl->render();
foreach ($tr_data as $data)
{
$tpl->setCurrentBlock("tbl_content");
$tpl->setVariable("TITLE", $data->getObjectiveID());
$tpl->setVariable("NODE_ID", "obj_".$data->getId());
$tpl->setVariable("ICON" , ilUtil::getImagePath("icon_lobj.gif"));
$mappings = $data->getMappings();
$mapinfo = null;
foreach($mappings as $map) {
$mapinfo .= $map->getTargetObjectiveID();
}
if ($mapinfo == null) {
$mapinfo = "local";
} else {
$mapinfo = "global to ".$mapinfo;
}
$tpl->setVariable("REFERENCE", $mapinfo);
$css_row = ilUtil::switchColor($i++, "tblrow1", "tblrow2");
$tpl->setVariable("CSS_ROW", $css_row);
$tpl->parseCurrentBlock();
}
//block sequencing rules
//$tpl->touchBlock("adm_content");
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSCORM2004ScoGUI::updateProperties ( )

update Properties

Definition at line 187 of file class.ilSCORM2004ScoGUI.php.

References $_POST, $lng, $tpl, ilUtil\sendInfo(), showProperties(), and ilUtil\stripSlashes().

{
global $tpl,$lng;
$empty = false;
foreach ($_POST as $key=>$value) {
if(preg_match('/(obj_)(.+)/', $key,$match)){
$objective = new ilScorm2004Objective($this->node_object->getId(),$match[2]);
if (!$value)
{
$empty=true;
} else {
$objective->setObjectiveID(ilUtil::stripSlashes($value));
$objective->updateObjective();
}
}
}
if (!$empty) {
ilUtil::sendInfo($lng->txt("saved_successfully"),true);
} else {
ilUtil::sendInfo("Objective titles can't be blank",true);
}
$this->showProperties();
}

+ Here is the call graph for this function:

Field Documentation

ilSCORM2004ScoGUI::$ctrl = null

Constructor public.

Definition at line 48 of file class.ilSCORM2004ScoGUI.php.


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