Go to the documentation of this file.00001 <?
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 "./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php";
00025
00029 class ilHACPResponse {
00030
00031 var $unit;
00032 var $ref_id;
00033 var $obj_id;
00034
00035 function ilHACPResponse($ref_id=0, $obj_id=0) {
00036
00037 if (!empty($ref_id) && !empty($obj_id)) {
00038 $this->ref_id=$ref_id;
00039 $this->obj_id=$obj_id;
00040
00041 $this->unit=new ilAICCUnit($obj_id);
00042 $this->unit->read();
00043 }
00044
00045 }
00046
00047 function sendOk() {
00048 echo "error=0\n";
00049 echo "error_txt=Successful\n";
00050 echo "version=3.0\n";
00051 }
00052
00053 function getStudentId() {
00054 global $ilUser;
00055 return $ilUser->getId();
00056 }
00057
00058 function getStudentName() {
00059 global $ilUser;
00060 return $ilUser->getFullname();
00061 }
00062
00063 function sendParam() {
00064 global $ilUser, $ilDB, $ilLog;
00065
00066 echo "error=0\n";
00067 echo "error_txt=Successful\n";
00068 echo "version=3.0\n";
00069 echo "aicc_data=\n";
00070
00071 $data["core"]["student_id"]=$this->getStudentId();
00072 $data["core"]["student_name"]=$this->getStudentName();
00073 $data["core"]["time"]="00:00:00";
00074
00075 $data["core_vendor"]=$this->unit->getCoreVendor();
00076
00077 $data["student_data"]["mastery_score"]=$this->unit->getMasteryScore();
00078 $data["student_data"]["max_time_allowed"]=$this->unit->getMaxTimeAllowed();
00079 $data["student_data"]["time_limit_action"]=$this->unit->getTimeLimitAction();
00080
00081 $data["student_preferences"]["audio"]="-1";
00082 $data["student_preferences"]["text"]="1";
00083
00084 $data["core_lesson"]="";
00085 $data["core"]["output_file"]="";
00086 $data["core"]["credit"]="c";
00087 $data["core"]["lesson_location"]="";
00088 $data["core"]["lesson_status"]="n,a";
00089 $data["core"]["path"]="";
00090 $data["core"]["score"]="";
00091
00092
00093
00094 $slm_id = ilObject::_lookupObjId($this->ref_id);
00095
00096 if (is_object($ilUser)) {
00097 $user_id = $ilUser->getId();
00098 $stmt = "SELECT * FROM scorm_tracking WHERE user_id = ".$ilDB->quote($user_id).
00099 " AND sco_id = ".$ilDB->quote($this->obj_id).
00100 " AND obj_id = ".$ilDB->quote($slm_id);
00101
00102 $set = $ilDB->query($stmt);
00103 $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
00104 while ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC)) {
00105 $key=$rec["lvalue"];
00106 $value=$rec["rvalue"];
00107 $arr=explode(".", $key);
00108
00109 array_shift($arr);
00110
00111 if (count($arr)==1)
00112 $data[$arr[0]]=$value;
00113 else if (count($arr)==2)
00114 $data[$arr[0]][$arr[1]]=$value;
00115 }
00116 }
00117
00118 foreach ($data as $block=>$paar) {
00119 echo "[$block]\n";
00120 if (!is_array($paar)) {
00121 $paar=str_replace("<CR>", "\n", $paar);
00122 $paar=str_replace("<cr>", "\n", $paar);
00123 echo $paar."\n";
00124 continue;
00125 }
00126
00127 foreach ($paar as $key=>$value)
00128 echo "$key=$value\n";
00129 }
00130
00131
00132
00133 }
00134
00135
00136 }
00137
00138 ?>
00139