Public Member Functions | Data Fields

ilHACPPresentationGUI Class Reference

Inheritance diagram for ilHACPPresentationGUI:
Collaboration diagram for ilHACPPresentationGUI:

Public Member Functions

 ilHACPPresentationGUI ()
executeCommand ()
 execute command
 explorer ($a_target="sahs_content")
 output table of content
 launchSahs ()
 This function is called by the API applet in the content frame when a SCO is started.

Data Fields

 $ilias
 $slm
 $tpl
 $lng

Detailed Description

Definition at line 39 of file class.ilHACPPresentationGUI.php.


Member Function Documentation

& ilHACPPresentationGUI::executeCommand (  ) 

execute command

Reimplemented from ilAICCPresentationGUI.

Definition at line 64 of file class.ilHACPPresentationGUI.php.

References $_GET, $cmd, $ilias, $ilLog, and $lng.

        {
                global $ilAccess, $ilLog;

                $next_class = $this->ctrl->getNextClass($this);
                $cmd = $this->ctrl->getCmd("frameset");

                if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))
                {
                        $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
                }

                switch($next_class)
                {
                        default:
                                $this->$cmd();
                }
        }

ilHACPPresentationGUI::explorer ( a_target = "sahs_content"  ) 

output table of content

Reimplemented from ilAICCPresentationGUI.

Definition at line 86 of file class.ilHACPPresentationGUI.php.

References $_GET, $exp, $expanded, $mtree, $output, and ilUtil::getStyleSheetLocation().

        {
                $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, true);
                //$this->tpl->setVariable("LOCATION_JAVASCRIPT", "./scorm_functions.js");
                
                require_once("./content/classes/HACP/class.ilHACPExplorer.php");
                $exp = new ilHACPExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
                $exp->setTargetGet("obj_id");
                $exp->setFrameTarget($a_target);
                //$exp->setFiltered(true);

                if ($_GET["scexpand"] == "")
                {
                        $mtree = new ilSCORMTree($this->slm->getId());
                        $expanded = $mtree->readRootId();
                }
                else
                {
                        $expanded = $_GET["scexpand"];
                }
                $exp->setExpand($expanded);
                
                $exp->forceExpandAll(true, false);

                // build html-output
                //666$exp->setOutput(0);
                $exp->setOutput(0);

                $output = $exp->getOutput();

                $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
                $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
                $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
                $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
                $this->tpl->setVariable("EXPLORER",$output);
                $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, $_GET["cmd"])."&frame=".$_GET["frame"].
                        "&ref_id=".$this->slm->getRefId()."&scexpand=".$_GET["scexpand"]);
                $this->tpl->parseCurrentBlock();
                $this->tpl->show();
        }

Here is the call graph for this function:

ilHACPPresentationGUI::ilHACPPresentationGUI (  ) 

Definition at line 46 of file class.ilHACPPresentationGUI.php.

References $_GET, $cmd, $ilCtrl, $ilias, $lng, and $tpl.

        {
                global $ilias, $tpl, $lng, $ilCtrl;;

                $this->ilias =& $ilias;
                $this->tpl =& $tpl;
                $this->lng =& $lng;
                $this->ctrl =& $ilCtrl;

                $cmd = (!empty($_GET["cmd"])) ? $_GET["cmd"] : "frameset";

                // Todo: check lm id
                $this->slm =& new ilObjHACPLearningModule($_GET["ref_id"], true);
        }

ilHACPPresentationGUI::launchSahs (  ) 

This function is called by the API applet in the content frame when a SCO is started.

Reimplemented from ilAICCPresentationGUI.

Definition at line 127 of file class.ilHACPPresentationGUI.php.

References $_GET, $_POST, $lng, $query, $ref_id, _lookupObjId(), exit, ilUtil::getImagePath(), ilSCORMPresentationGUI::setArray(), and ilSCORMPresentationGUI::setSingleVariable().

        {
                echo "launchSahs";
                exit;
                
                global $ilUser, $ilDB;

                $sahs_id = ($_GET["sahs_id"] == "")
                        ? $_POST["sahs_id"]
                        : $_GET["sahs_id"];
                $ref_id = ($_GET["ref_id"] == "")
                        ? $_POST["ref_id"]
                        : $_GET["ref_id"];

                $this->slm =& new ilObjAICCLearningModule($ref_id, true);

                include_once("content/classes/AICC/class.ilAICCUnit.php");
                $unit =& new ilAICCUnit($sahs_id);
                
                //guess the url to be able to launch most contents
                $url=$unit->getCommand_line();
                if (strlen($url)==0)
                        $url=$unit->getFilename();
                if (strcasecmp(substr($unit->getFilename(),0,4),"http")!=0)
                        $url=$unit->slm->getDataDirectory("output")."/".$url;
                if (strlen($unit->getWebLaunch())>0)
                        $url.="?".$unit->getWebLaunch();
                        
/*              
                if (strcasecmp(substr($unit->getFilename(),0,4),"http")==0)
                        $href=$unit->getFilename();
                else
                        $href=$this->slm->getDataDirectory("output")."/".$unit->getFilename();
*/              
                $this->tpl = new ilTemplate("tpl.sahs_launch_cbt.html", true, true, true);
                $this->tpl->setVariable("HREF", $url);
//              $this->tpl->setVariable("LAUNCH_DATA", $unit->getDataFromLms());
                $this->tpl->setVariable("MAST_SCORE", $unit->getMasteryScore());
                $this->tpl->setVariable("MAX_TIME", $unit->getMaxTimeAllowed());
                $this->tpl->setVariable("LIMIT_ACT", $unit->getTimeLimitAction());
                if($ilUser->getFirstName() == "Joe")    // for test purpose
                {
                        $this->tpl->setCurrentBlock("credit");
                        $this->tpl->setVariable("CREDIT_MODE", "normal");
                        $this->tpl->parseCurrentBlock();
                }
                $query = "SELECT * FROM scorm_tracking WHERE".
                        " user_id = ".$ilDB->quote($ilUser->getId()).
                        " AND sco_id = ".$ilDB->quote($sahs_id);


                $val_set = $ilDB->query($query);
                $re_value = array();
                while($val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
                        $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
                        $val_rec["rvalue"] = str_replace("\n", "%n%", $val_rec["rvalue"]);
                        $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
                }

                foreach($re_value as $var => $value)
                {
                        switch ($var)
                        {
                                case "cmi.core.lesson_location":
                                case "cmi.core.lesson_status":
                                case "cmi.core.entry":
                                case "cmi.core.score.raw":
                                case "cmi.core.score.max":
                                case "cmi.core.score.min":
                                case "cmi.core.total_time":
                                case "cmi.core.exit":
                                case "cmi.suspend_data":
                                case "cmi.comments":
                                case "cmi.student_preference.audio":
                                case "cmi.student_preference.language":
                                case "cmi.student_preference.speed":
                                case "cmi.student_preference.text":
                                        $this->setSingleVariable($var, $value);
                                        break;

                                case "cmi.objectives._count":
                                        $this->setSingleVariable($var, $value);
                                        $this->setArray("cmi.objectives", $value, "id", $re_value);
                                        $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
                                        $this->setArray("cmi.objectives", $value, "score.max", $re_value);
                                        $this->setArray("cmi.objectives", $value, "score.min", $re_value);
                                        $this->setArray("cmi.objectives", $value, "status", $re_value);
                                        break;

                                case "cmi.interactions._count":
                                        $this->setSingleVariable($var, $value);
                                        $this->setArray("cmi.interactions", $value, "id", $re_value);
                                        for($i=0; $i<$value; $i++)
                                        {
                                                $var2 = "cmi.interactions.".$i.".objectives._count";
                                                if (isset($v_array[$var2]))
                                                {
                                                        $cnt = $v_array[$var2];
                                                        $this->setArray("cmi.interactions.".$i.".objectives",
                                                                $cnt, "id", $re_value);
                                                        /*
                                                        $this->setArray("cmi.interactions.".$i.".objectives",
                                                                $cnt, "score.raw", $re_value);
                                                        $this->setArray("cmi.interactions.".$i.".objectives",
                                                                $cnt, "score.max", $re_value);
                                                        $this->setArray("cmi.interactions.".$i.".objectives",
                                                                $cnt, "score.min", $re_value);
                                                        $this->setArray("cmi.interactions.".$i.".objectives",
                                                                $cnt, "status", $re_value);*/
                                                }
                                        }
                                        $this->setArray("cmi.interactions", $value, "time", $re_value);
                                        $this->setArray("cmi.interactions", $value, "type", $re_value);
                                        for($i=0; $i<$value; $i++)
                                        {
                                                $var2 = "cmi.interactions.".$i.".correct_responses._count";
                                                if (isset($v_array[$var2]))
                                                {
                                                        $cnt = $v_array[$var2];
                                                        $this->setArray("cmi.interactions.".$i.".correct_responses",
                                                                $cnt, "pattern", $re_value);
                                                        $this->setArray("cmi.interactions.".$i.".correct_responses",
                                                                $cnt, "weighting", $re_value);
                                                }
                                        }
                                        $this->setArray("cmi.interactions", $value, "student_response", $re_value);
                                        $this->setArray("cmi.interactions", $value, "result", $re_value);
                                        $this->setArray("cmi.interactions", $value, "latency", $re_value);
                                        break;
                        }
                }

                global $lng;
                $this->tpl->setCurrentBlock("switch_icon");
                $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
                $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.gif"));
                $this->tpl->setVariable("SCO_ALT",
                         $lng->txt("cont_status").": "
                        .$lng->txt("cont_sc_stat_running")
                );
                $this->tpl->parseCurrentBlock();

                // lesson mode
                $lesson_mode = $this->slm->getDefaultLessonMode();
                if ($this->slm->getAutoReview())
                {
                        if ($re_value["cmi.core.lesson_status"] == "completed" ||
                                $re_value["cmi.core.lesson_status"] == "passed" ||
                                $re_value["cmi.core.lesson_status"] == "failed")
                        {
                                $lesson_mode = "review";
                        }
                }
                $this->tpl->setVariable("LESSON_MODE", $lesson_mode);

                // credit mode
                if ($lesson_mode == "normal")
                {
                        $this->tpl->setVariable("CREDIT_MODE",
                                str_replace("_", " ", $this->slm->getCreditMode()));
                }
                else
                {
                        $this->tpl->setVariable("CREDIT_MODE", "no-credit");
                }

                // init cmi.core.total_time, cmi.core.lesson_status and cmi.core.entry
                $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
                if (!isset($re_value["cmi.core.total_time"]))
                {
                        $unit->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
                }
                if (!isset($re_value["cmi.core.lesson_status"]))
                {
                        $unit->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
                }
                if (!isset($re_value["cmi.core.entry"]))
                {
                        $unit->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
                }

                $this->tpl->show();
        }

Here is the call graph for this function:


Field Documentation

ilHACPPresentationGUI::$ilias

Reimplemented from ilAICCPresentationGUI.

Definition at line 41 of file class.ilHACPPresentationGUI.php.

Referenced by executeCommand(), and ilHACPPresentationGUI().

ilHACPPresentationGUI::$lng

Reimplemented from ilAICCPresentationGUI.

Definition at line 44 of file class.ilHACPPresentationGUI.php.

Referenced by executeCommand(), ilHACPPresentationGUI(), and launchSahs().

ilHACPPresentationGUI::$slm

Reimplemented from ilAICCPresentationGUI.

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

ilHACPPresentationGUI::$tpl

Reimplemented from ilAICCPresentationGUI.

Definition at line 43 of file class.ilHACPPresentationGUI.php.

Referenced by ilHACPPresentationGUI().


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