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

content/classes/HACP/class.ilHACPResponse.php

Go to the documentation of this file.
00001 <?
00002 
00003 require_once "./content/classes/AICC/class.ilAICCUnit.php";
00004 
00005 class ilHACPResponse {
00006 
00007         var $unit;
00008         var $ref_id;
00009         var $obj_id;
00010 
00011         function ilHACPResponse($ref_id=0, $obj_id=0) {
00012         
00013                 if (!empty($ref_id) && !empty($obj_id)) {
00014                         $this->ref_id=$ref_id;
00015                         $this->obj_id=$obj_id;
00016                         
00017                         $this->unit=new ilAICCUnit($obj_id);
00018                         $this->unit->read();
00019                 }
00020         
00021         }
00022         
00023         function sendOk() {
00024                 echo "error=0\n";
00025                 echo "error_txt=Successful\n";
00026                 echo "version=3.0\n";
00027         }
00028         
00029         function getStudentId() {
00030                 global $ilUser;
00031                 return $ilUser->getId();
00032         }
00033         
00034         function getStudentName() {
00035                 global $ilUser;
00036                 return $ilUser->getFullname();
00037         }
00038         
00039         function sendParam() {
00040                 global $ilUser, $ilDB;
00041                 
00042                 echo "error=0\n";
00043                 echo "error_txt=Successful\n";
00044                 echo "version=3.0\n";
00045                 echo "aicc_data=\n";
00046                 
00047                 $data["core"]["student_id"]=$this->getStudentId();  
00048                 $data["core"]["student_name"]=$this->getStudentName();  
00049                 $data["core"]["time"]="00:00:00";
00050                 
00051                 $data["core_vendor"]=$this->unit->getCoreVendor();
00052                 
00053                 $data["student_data"]["mastery_score"]=$this->unit->getMasteryScore();
00054                 $data["student_data"]["max_time_allowed"]=$this->unit->getMaxTimeAllowed();
00055                 $data["student_data"]["time_limit_action"]=$this->unit->getTimeLimitAction();
00056                 
00057                 $data["student_preferences"]["audio"]="-1";
00058                 $data["student_preferences"]["text"]="1";
00059                 
00060                 $data["core_lesson"]="";
00061                 $data["core"]["output_file"]="";
00062                 $data["core"]["credit"]="c";
00063                 $data["core"]["lesson_location"]="";
00064                 $data["core"]["lesson_status"]="n,a";
00065                 $data["core"]["path"]="";
00066                 $data["core"]["score"]="";
00067                 
00068                 
00069                 //Read Trackingdata
00070                 if (is_object($ilUser)) {
00071                         $user_id = $ilUser->getId();
00072                         $stmt = "SELECT * FROM scorm_tracking WHERE user_id = ".$ilDB->quote($user_id).
00073                                         " AND sco_id = ".$ilDB->quote($this->obj_id);
00074                         $set = $ilDB->query($stmt);
00075                         $rec = $set->fetchRow(DB_FETCHMODE_ASSOC);
00076                         while ($rec = $set->fetchRow(DB_FETCHMODE_ASSOC))       {
00077                                 $key=$rec["lvalue"];
00078                                 $value=$rec["rvalue"];
00079                                 $arr=explode(".", $key);
00080                                 //delete useless prefix
00081                                 array_shift($arr);
00082                                 //analyse key and add it to the data array
00083                                 if (count($arr)==1)
00084                                         $data[$arr[0]]=$value;
00085                                 else if (count($arr)==2)
00086                                         $data[$arr[0]][$arr[1]]=$value;
00087                         }
00088                 }
00089                 
00090                 foreach ($data as $block=>$paar) {
00091                         echo "[$block]\n";
00092                         if (!is_array($paar)) {
00093                                 $paar=str_replace("<CR>", "\n", $paar);
00094                                 $paar=str_replace("<cr>", "\n", $paar);
00095                                 echo $paar."\n";
00096                                 continue;
00097                         }
00098                         
00099                         foreach ($paar as $key=>$value)
00100                                 echo "$key=$value\n";
00101                 }
00102                 
00103                 //echo "[evaluation]";          
00104                 
00105         }
00106         
00107         
00108 }
00109 
00110 ?>
00111          

Generated on Fri Dec 13 2013 09:06:36 for ILIAS Release_3_4_x_branch .rev 46804 by  doxygen 1.7.1