00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 require_once("content/classes/class.ilObjHACPLearningModule.php");
00025 require_once("content/classes/AICC/class.ilAICCObjectGUI.php");
00026 require_once("content/classes/AICC/class.ilAICCPresentationGUI.php");
00027
00028
00039 class ilHACPPresentationGUI extends ilAICCPresentationGUI
00040 {
00041 var $ilias;
00042 var $slm;
00043 var $tpl;
00044 var $lng;
00045
00046 function ilHACPPresentationGUI()
00047 {
00048 global $ilias, $tpl, $lng, $ilCtrl;;
00049
00050 $this->ilias =& $ilias;
00051 $this->tpl =& $tpl;
00052 $this->lng =& $lng;
00053 $this->ctrl =& $ilCtrl;
00054
00055 $cmd = (!empty($_GET["cmd"])) ? $_GET["cmd"] : "frameset";
00056
00057
00058 $this->slm =& new ilObjHACPLearningModule($_GET["ref_id"], true);
00059 }
00060
00064 function &executeCommand()
00065 {
00066 global $ilAccess, $ilLog;
00067
00068 $next_class = $this->ctrl->getNextClass($this);
00069 $cmd = $this->ctrl->getCmd("frameset");
00070
00071 if (!$ilAccess->checkAccess("read", "", $_GET["ref_id"]))
00072 {
00073 $ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->WARNING);
00074 }
00075
00076 switch($next_class)
00077 {
00078 default:
00079 $this->$cmd();
00080 }
00081 }
00082
00086 function explorer($a_target = "sahs_content")
00087 {
00088 $this->tpl = new ilTemplate("tpl.sahs_exp_main.html", true, true, true);
00089
00090
00091 require_once("./content/classes/HACP/class.ilHACPExplorer.php");
00092 $exp = new ilHACPExplorer($this->ctrl->getLinkTarget($this, "view"), $this->slm);
00093 $exp->setTargetGet("obj_id");
00094 $exp->setFrameTarget($a_target);
00095
00096
00097 if ($_GET["scexpand"] == "")
00098 {
00099 $mtree = new ilSCORMTree($this->slm->getId());
00100 $expanded = $mtree->readRootId();
00101 }
00102 else
00103 {
00104 $expanded = $_GET["scexpand"];
00105 }
00106 $exp->setExpand($expanded);
00107
00108 $exp->forceExpandAll(true, false);
00109
00110
00111
00112 $exp->setOutput(0);
00113
00114 $output = $exp->getOutput();
00115
00116 $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
00117 $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
00118 $this->tpl->setVariable("TXT_EXPLORER_HEADER", $this->lng->txt("cont_content"));
00119 $this->tpl->setVariable("EXP_REFRESH", $this->lng->txt("refresh"));
00120 $this->tpl->setVariable("EXPLORER",$output);
00121 $this->tpl->setVariable("ACTION", $this->ctrl->getLinkTarget($this, $_GET["cmd"])."&frame=".$_GET["frame"].
00122 "&ref_id=".$this->slm->getRefId()."&scexpand=".$_GET["scexpand"]);
00123 $this->tpl->parseCurrentBlock();
00124 $this->tpl->show();
00125 }
00126
00127 function launchSahs()
00128 {
00129 echo "launchSahs";
00130 exit;
00131
00132 global $ilUser, $ilDB;
00133
00134 $sahs_id = ($_GET["sahs_id"] == "")
00135 ? $_POST["sahs_id"]
00136 : $_GET["sahs_id"];
00137 $ref_id = ($_GET["ref_id"] == "")
00138 ? $_POST["ref_id"]
00139 : $_GET["ref_id"];
00140
00141 $this->slm =& new ilObjAICCLearningModule($ref_id, true);
00142
00143 include_once("content/classes/AICC/class.ilAICCUnit.php");
00144 $unit =& new ilAICCUnit($sahs_id);
00145
00146
00147 $url=$unit->getCommand_line();
00148 if (strlen($url)==0)
00149 $url=$unit->getFilename();
00150 if (strcasecmp(substr($unit->getFilename(),0,4),"http")!=0)
00151 $url=$unit->slm->getDataDirectory("output")."/".$url;
00152 if (strlen($unit->getWebLaunch())>0)
00153 $url.="?".$unit->getWebLaunch();
00154
00155
00156
00157
00158
00159
00160
00161 $this->tpl = new ilTemplate("tpl.sahs_launch_cbt.html", true, true, true);
00162 $this->tpl->setVariable("HREF", $url);
00163
00164 $this->tpl->setVariable("MAST_SCORE", $unit->getMasteryScore());
00165 $this->tpl->setVariable("MAX_TIME", $unit->getMaxTimeAllowed());
00166 $this->tpl->setVariable("LIMIT_ACT", $unit->getTimeLimitAction());
00167 if($ilUser->getFirstName() == "Joe")
00168 {
00169 $this->tpl->setCurrentBlock("credit");
00170 $this->tpl->setVariable("CREDIT_MODE", "normal");
00171 $this->tpl->parseCurrentBlock();
00172 }
00173 $query = "SELECT * FROM scorm_tracking WHERE".
00174 " user_id = ".$ilDB->quote($ilUser->getId()).
00175 " AND sco_id = ".$ilDB->quote($sahs_id);
00176
00177
00178 $val_set = $ilDB->query($query);
00179 $re_value = array();
00180 while($val_rec = $val_set->fetchRow(DB_FETCHMODE_ASSOC))
00181 {
00182 $val_rec["rvalue"] = str_replace("\r\n", "\n", $val_rec["rvalue"]);
00183 $val_rec["rvalue"] = str_replace("\r", "\n", $val_rec["rvalue"]);
00184 $val_rec["rvalue"] = str_replace("\n", "%n%", $val_rec["rvalue"]);
00185 $re_value[$val_rec["lvalue"]] = $val_rec["rvalue"];
00186 }
00187
00188 foreach($re_value as $var => $value)
00189 {
00190 switch ($var)
00191 {
00192 case "cmi.core.lesson_location":
00193 case "cmi.core.lesson_status":
00194 case "cmi.core.entry":
00195 case "cmi.core.score.raw":
00196 case "cmi.core.score.max":
00197 case "cmi.core.score.min":
00198 case "cmi.core.total_time":
00199 case "cmi.core.exit":
00200 case "cmi.suspend_data":
00201 case "cmi.comments":
00202 case "cmi.student_preference.audio":
00203 case "cmi.student_preference.language":
00204 case "cmi.student_preference.speed":
00205 case "cmi.student_preference.text":
00206 $this->setSingleVariable($var, $value);
00207 break;
00208
00209 case "cmi.objectives._count":
00210 $this->setSingleVariable($var, $value);
00211 $this->setArray("cmi.objectives", $value, "id", $re_value);
00212 $this->setArray("cmi.objectives", $value, "score.raw", $re_value);
00213 $this->setArray("cmi.objectives", $value, "score.max", $re_value);
00214 $this->setArray("cmi.objectives", $value, "score.min", $re_value);
00215 $this->setArray("cmi.objectives", $value, "status", $re_value);
00216 break;
00217
00218 case "cmi.interactions._count":
00219 $this->setSingleVariable($var, $value);
00220 $this->setArray("cmi.interactions", $value, "id", $re_value);
00221 for($i=0; $i<$value; $i++)
00222 {
00223 $var2 = "cmi.interactions.".$i.".objectives._count";
00224 if (isset($v_array[$var2]))
00225 {
00226 $cnt = $v_array[$var2];
00227 $this->setArray("cmi.interactions.".$i.".objectives",
00228 $cnt, "id", $re_value);
00229
00230
00231
00232
00233
00234
00235
00236
00237
00238 }
00239 }
00240 $this->setArray("cmi.interactions", $value, "time", $re_value);
00241 $this->setArray("cmi.interactions", $value, "type", $re_value);
00242 for($i=0; $i<$value; $i++)
00243 {
00244 $var2 = "cmi.interactions.".$i.".correct_responses._count";
00245 if (isset($v_array[$var2]))
00246 {
00247 $cnt = $v_array[$var2];
00248 $this->setArray("cmi.interactions.".$i.".correct_responses",
00249 $cnt, "pattern", $re_value);
00250 $this->setArray("cmi.interactions.".$i.".correct_responses",
00251 $cnt, "weighting", $re_value);
00252 }
00253 }
00254 $this->setArray("cmi.interactions", $value, "student_response", $re_value);
00255 $this->setArray("cmi.interactions", $value, "result", $re_value);
00256 $this->setArray("cmi.interactions", $value, "latency", $re_value);
00257 break;
00258 }
00259 }
00260
00261 global $lng;
00262 $this->tpl->setCurrentBlock("switch_icon");
00263 $this->tpl->setVariable("SCO_ID", $_GET["sahs_id"]);
00264 $this->tpl->setVariable("SCO_ICO", ilUtil::getImagePath("scorm/running.gif"));
00265 $this->tpl->setVariable("SCO_ALT",
00266 $lng->txt("cont_status").": "
00267 .$lng->txt("cont_sc_stat_running")
00268 );
00269 $this->tpl->parseCurrentBlock();
00270
00271
00272 $lesson_mode = $this->slm->getDefaultLessonMode();
00273 if ($this->slm->getAutoReview())
00274 {
00275 if ($re_value["cmi.core.lesson_status"] == "completed" ||
00276 $re_value["cmi.core.lesson_status"] == "passed" ||
00277 $re_value["cmi.core.lesson_status"] == "failed")
00278 {
00279 $lesson_mode = "review";
00280 }
00281 }
00282 $this->tpl->setVariable("LESSON_MODE", $lesson_mode);
00283
00284
00285 if ($lesson_mode == "normal")
00286 {
00287 $this->tpl->setVariable("CREDIT_MODE",
00288 str_replace("_", " ", $this->slm->getCreditMode()));
00289 }
00290 else
00291 {
00292 $this->tpl->setVariable("CREDIT_MODE", "no-credit");
00293 }
00294
00295
00296 $sahs_obj_id = ilObject::_lookupObjId($_GET["ref_id"]);
00297 if (!isset($re_value["cmi.core.total_time"]))
00298 {
00299 $unit->insertTrackData("cmi.core.total_time", "0000:00:00", $sahs_obj_id);
00300 }
00301 if (!isset($re_value["cmi.core.lesson_status"]))
00302 {
00303 $unit->insertTrackData("cmi.core.lesson_status", "not attempted", $sahs_obj_id);
00304 }
00305 if (!isset($re_value["cmi.core.entry"]))
00306 {
00307 $unit->insertTrackData("cmi.core.entry", "", $sahs_obj_id);
00308 }
00309
00310 $this->tpl->show();
00311 }
00312
00313
00314 }
00315 ?>