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

Modules/ScormAicc/classes/HACP/class.ilHACPResponse.php

Go to the documentation of this file.
00001 <?
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2006 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
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 //$ilLog->write("Read Trackingdata A");
00093 
00094                 $slm_id = ilObject::_lookupObjId($this->ref_id);
00095                 //Read Trackingdata
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 //$ilLog->write("Read Trackingdata: ".$stmt);
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                                 //delete useless prefix
00109                                 array_shift($arr);
00110                                 //analyse key and add it to the data array
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                 //echo "[evaluation]";          
00132                 
00133         }
00134         
00135         
00136 }
00137 
00138 ?>
00139          

Generated on Fri Dec 13 2013 17:56:52 for ILIAS Release_3_9_x_branch .rev 46835 by  doxygen 1.7.1