ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f87
class.ilHACPResponse.php
Go to the documentation of this file.
1 <?
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once "./Modules/ScormAicc/classes/AICC/class.ilAICCUnit.php";
25 
30 
31  var $unit;
32  var $ref_id;
33  var $obj_id;
34 
35  function ilHACPResponse($ref_id=0, $obj_id=0) {
36 
37  if (!empty($ref_id) && !empty($obj_id)) {
38  $this->ref_id=$ref_id;
39  $this->obj_id=$obj_id;
40 
41  $this->unit=new ilAICCUnit($obj_id);
42  $this->unit->read();
43  }
44 
45  }
46 
47  function sendOk() {
48  echo "error=0\n";
49  echo "error_txt=Successful\n";
50  echo "version=3.0\n";
51  }
52 
53  function getStudentId() {
54  global $ilUser;
55  return $ilUser->getId();
56  }
57 
58  function getStudentName() {
59  global $ilUser;
60  return $ilUser->getFullname();
61  }
62 
63  function sendParam() {
64  global $ilUser, $ilDB, $ilLog;
65 
66  echo "error=0\n";
67  echo "error_txt=Successful\n";
68  echo "version=3.0\n";
69  echo "aicc_data=\n";
70 
71  $data["core"]["student_id"]=$this->getStudentId();
72  $data["core"]["student_name"]=$this->getStudentName();
73  $data["core"]["time"]="00:00:00";
74 
75  $data["core_vendor"]=$this->unit->getCoreVendor();
76 
77  $data["student_data"]["mastery_score"]=$this->unit->getMasteryScore();
78  $data["student_data"]["max_time_allowed"]=$this->unit->getMaxTimeAllowed();
79  $data["student_data"]["time_limit_action"]=$this->unit->getTimeLimitAction();
80 
81  $data["student_preferences"]["audio"]="-1";
82  $data["student_preferences"]["text"]="1";
83 
84  $data["core_lesson"]="";
85  $data["core"]["output_file"]="";
86  $data["core"]["credit"]="c";
87  $data["core"]["lesson_location"]="";
88  $data["core"]["lesson_status"]="n,a";
89  $data["core"]["path"]="";
90  $data["core"]["score"]="";
91 
92 //$ilLog->write("Read Trackingdata A");
93 
94  $slm_id = ilObject::_lookupObjId($this->ref_id);
95  //Read Trackingdata
96  if (is_object($ilUser))
97  {
98  $user_id = $ilUser->getId();
99 
100  $set = $ilDB->queryF('
101  SELECT * FROM scorm_tracking
102  WHERE user_id = %s
103  AND sco_id = %s
104  AND obj_id = %s',
105  array('integer','integer','integer'),
106  array($user_id, $this->obj_id,$slm_id));
107 
108  while ($rec = $ilDB->fetchAssoc($set))
109  {
110  $key=$rec["lvalue"];
111  $value=$rec["rvalue"];
112  $arr=explode(".", $key);
113  //delete useless prefix
114  array_shift($arr);
115  //analyse key and add it to the data array
116  if (count($arr)==1)
117  $data[$arr[0]]=$value;
118  else if (count($arr)==2)
119  $data[$arr[0]][$arr[1]]=$value;
120  }
121  }
122 
123  foreach ($data as $block=>$paar) {
124  echo "[$block]\n";
125  if (!is_array($paar)) {
126  $paar=str_replace("<CR>", "\n", $paar);
127  $paar=str_replace("<cr>", "\n", $paar);
128  echo $paar."\n";
129  continue;
130  }
131 
132  foreach ($paar as $key=>$value)
133  echo "$key=$value\n";
134  }
135 
136  //echo "[evaluation]";
137 
138  }
139 
140 
141 }
142 
143 ?>
144 
static _lookupObjId($a_id)
ilHACPResponse($ref_id=0, $obj_id=0)
global $ilUser
Definition: imgupload.php:15
global $ilDB