ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilSCORM2004StoreData Class Reference

Class ilSCORM2004StoreData. More...

+ Collaboration diagram for ilSCORM2004StoreData:

Static Public Member Functions

static scormPlayerUnload ($userId=null, $packageId, $time_from_lms)
 
static persistCMIData ($userId=null, $packageId, $defaultLessonMode, $comments, $interactions, $objectives, $time_from_lms, $data=null)
 
static checkIfAllowed ($packageId, $userId, $hash)
 
static setCMIData ($userId, $packageId, $data, $getComments, $getInteractions, $getObjectives)
 
static syncGlobalStatus ($userId, $packageId, $data, $new_global_status, $time_from_lms)
 
static writeGObjective ($g_data, $user, $package)
 

Static Protected Member Functions

static setGlobalObjectives ($userId, $packageId, $data)
 

Detailed Description

Member Function Documentation

◆ checkIfAllowed()

static ilSCORM2004StoreData::checkIfAllowed (   $packageId,
  $userId,
  $hash 
)
static

Definition at line 104 of file class.ilSCORM2004StoreData.php.

References $ilDB, $packageId, $res, array, and date.

104  {
105  global $ilDB;
106  $res = $ilDB->queryF('select hash from sahs_user where obj_id=%s AND user_id=%s AND hash_end>%s',
107  array('integer','integer','timestamp'),
108  array($packageId,$userId,date('Y-m-d H:i:s'))
109  );
110  $rowtmp=$ilDB->fetchAssoc($res);
111  if ($rowtmp['hash']==$hash) return;
112  else die("not allowed");
113  }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilDB
$packageId

◆ persistCMIData()

static ilSCORM2004StoreData::persistCMIData (   $userId = null,
  $packageId,
  $defaultLessonMode,
  $comments,
  $interactions,
  $objectives,
  $time_from_lms,
  $data = null 
)
static

Definition at line 58 of file class.ilSCORM2004StoreData.php.

References $_SERVER, $data, $ilLog, $packageId, array, header, setCMIData(), setGlobalObjectives(), and syncGlobalStatus().

Referenced by ilSCORM13Player\executeCommand().

59  {
60  global $ilLog;
61 
62  if ($defaultLessonMode == "browse") {return;}
63 
64  $jsMode = strpos($_SERVER['HTTP_ACCEPT'], 'text/javascript')!==false;
65 
66  $data = json_decode(is_string($data) ? $data : file_get_contents('php://input'));
67  $ilLog->write("dataTo_setCMIData: ".file_get_contents('php://input'));
68  if (!$data) return;
69  if ($userId == null) {
70  $userId=(int) $data->p;
71  self::checkIfAllowed($packageId,$userId,$data->hash);
72 // header('Access-Control-Allow-Origin: http://localhost:50012');//just for tests - not for release UK
73  }
74  $return = array();
76  $userId,
77  $packageId,
78  $data,
79  $comments,
80  $interactions,
81  $objectives
82  );
83 
84  //$new_global_status=ilSCORM2004StoreData::setGlobalObjectivesAndGetGlobalStatus($userId, $packageId, $data);
86  $new_global_status = $data->now_global_status;
87  $return["new_global_status"] = $new_global_status;
88 
89  ilSCORM2004StoreData::syncGlobalStatus($userId, $packageId, $data, $new_global_status, $time_from_lms);
90 
91  $ilLog->write("SCORM: return of persistCMIData: ".json_encode($return));
92  if ($jsMode)
93  {
94  header('Content-Type: text/javascript; charset=UTF-8');
95  print(json_encode($return));
96  }
97  else
98  {
99  header('Content-Type: text/html; charset=UTF-8');
100  print(var_export($return, true));
101  }
102  }
static syncGlobalStatus($userId, $packageId, $data, $new_global_status, $time_from_lms)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
static setGlobalObjectives($userId, $packageId, $data)
Add a drawing to the header
Definition: 04printing.php:69
Create styles array
The data for the language used.
static setCMIData($userId, $packageId, $data, $getComments, $getInteractions, $getObjectives)
$packageId
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scormPlayerUnload()

static ilSCORM2004StoreData::scormPlayerUnload (   $userId = null,
  $packageId,
  $time_from_lms 
)
static

Definition at line 14 of file class.ilSCORM2004StoreData.php.

References $_GET, $data, $ilDB, $packageId, ilSCORM2004Tracking\_syncReadEvent(), array, date, and header.

Referenced by ilSCORM13Player\executeCommand().

15  {
16  global $ilDB;
17 
18  $data = json_decode(is_string($data) ? $data : file_get_contents('php://input'));
19  if (!$data) return;
20  if ($userId == null) {
21  $userId=(int) $data->p;
22  self::checkIfAllowed($packageId,$userId,$data->hash);
23  }
24  $last_visited = "";
25  if ($data->last !="") $last_visited = $data->last;
26  $endDate = date('Y-m-d H:i:s', mktime(date('H'), date('i')+5, date('s'), date('m'), date('d'), date('Y')));
27  $total_time_sec = null;
28  if ($data->total_time_sec !="") {
29  $total_time_sec = $data->total_time_sec;
30  $ilDB->manipulateF('UPDATE sahs_user
31  SET total_time_sec = %s, last_visited = %s, hash_end =%s, last_access = %s
32  WHERE obj_id = %s AND user_id = %s',
33  array('integer', 'text', 'timestamp', 'timestamp', 'integer', 'integer'),
34  array($total_time_sec,$last_visited, $endDate, date('Y-m-d H:i:s'), $packageId, $userId)
35  );
36  if ($time_from_lms==true) {
37  self::ensureObjectDataCacheExistence();
38  global $ilObjDataCache;
39  // sync access number and time in read event table
40  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
41  ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", (int)$_GET['ref_id'], $time_from_lms);
42  //end sync access number and time in read event table
43  }
44  } else {
45  $ilDB->manipulateF('UPDATE sahs_user
46  SET last_visited = %s, hash_end =%s, last_access = %s
47  WHERE obj_id = %s AND user_id = %s',
48  array('text', 'timestamp', 'timestamp', 'integer', 'integer'),
49  array($last_visited, $endDate, date('Y-m-d H:i:s'), $packageId, $userId)
50  );
51  }
52 
53  header('Content-Type: text/plain; charset=UTF-8');
54  print("");
55  }
$_GET["client_id"]
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Add a drawing to the header
Definition: 04printing.php:69
Create styles array
The data for the language used.
global $ilDB
$packageId
static _syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id, $time_from_lms=null)
Synch read event table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCMIData()

static ilSCORM2004StoreData::setCMIData (   $userId,
  $packageId,
  $data,
  $getComments,
  $getInteractions,
  $getObjectives 
)
static

Definition at line 115 of file class.ilSCORM2004StoreData.php.

References $data, $ilDB, $ilLog, $res, $result, $row, array, date, and string.

Referenced by persistCMIData(), and ilSCORMOfflineMode\sop2il().

115  {
116  global $ilDB, $ilLog;
117 
118  $result = array();
119 
120  if (!$data) return $result;
121 
122  $i_check=$data->i_check;
123  $i_set=$data->i_set;
124  $b_node_update=false;
125  $cmi_node_id=null;
126  $a_map_cmi_interaction_id=array();
127 
128  $tables = array('node', 'comment', 'interaction', 'objective', 'correct_response');
129 
130  foreach($tables as $table)
131  {
132  if (!is_array($data->$table)) continue;
133 
134  $ilLog->write("SCORM: setCMIData, table -".$table."-");
135 
136  // now iterate through data rows from input
137  foreach($data->$table as &$row)
138  {
139  $ilLog->write("Checking table: ".$table);
140 
141  switch($table)
142  {
143  case 'node': //is always first and has only 1 row
144 
145  $res = $ilDB->queryF(
146  'SELECT cmi_node_id FROM cmi_node WHERE cp_node_id = %s and user_id = %s',
147  array('integer','integer'),
148  array($row[19],$userId)
149  );
150  $rowtmp=$ilDB->fetchAssoc($res);
151  $cmi_node_id=$rowtmp['cmi_node_id'];
152  if ($cmi_node_id!=null) $b_node_update=true;
153  else {
154  $cmi_node_id = $ilDB->nextId('cmi_node');
155  $b_node_update=false;
156  }
157  $ilLog->write("setCMIdata with cmi_node_id = ".$cmi_node_id);
158  $a_data=array(
159  'accesscount' => array('integer', $row[0]),
160  'accessduration' => array('text', $row[1]),
161  'accessed' => array('text', $row[2]),
162  'activityabsduration' => array('text', $row[3]),
163  'activityattemptcount' => array('integer', $row[4]),
164  'activityexpduration' => array('text', $row[5]),
165  'activityprogstatus' => array('integer', $row[6]),
166  'attemptabsduration' => array('text', $row[7]),
167  'attemptcomplamount' => array('float', $row[8]),
168  'attemptcomplstatus' => array('integer', $row[9]),
169  'attemptexpduration' => array('text', $row[10]),
170  'attemptprogstatus' => array('integer', $row[11]),
171  'audio_captioning' => array('integer', $row[12]),
172  'audio_level' => array('float', $row[13]),
173  'availablechildren' => array('text', $row[14]),
174  'cmi_node_id' => array('integer', $cmi_node_id),
175  'completion' => array('float', $row[16]),
176  'completion_status' => array('text', $row[17]),
177  'completion_threshold' => array('text', $row[18]),
178  'cp_node_id' => array('integer', $row[19]),
179  'created' => array('text', $row[20]),
180  'credit' => array('text', $row[21]),
181  'delivery_speed' => array('float', $row[22]),
182  'c_entry' => array('text', $row[23]),
183  'c_exit' => array('text', $row[24]),
184  'c_language' => array('text', $row[25]),
185  'launch_data' => array('clob', $row[26]),
186  'learner_name' => array('text', $row[27]),
187  'location' => array('text', $row[28]),
188  'c_max' => array('float', $row[29]),
189  'c_min' => array('float', $row[30]),
190  'c_mode' => array('text', $row[31]),
191  'modified' => array('text', $row[32]),
192  'progress_measure' => array('float', $row[33]),
193  'c_raw' => array('float', $row[34]),
194  'scaled' => array('float', $row[35]),
195  'scaled_passing_score' => array('float', $row[36]),
196  'session_time' => array('text', $row[37]),
197  'success_status' => array('text', $row[38]),
198  'suspend_data' => array('clob', $row[39]),
199  'total_time' => array('text', $row[40]),
200  'user_id' => array('integer', $userId),
201  'c_timestamp' => array('timestamp', date('Y-m-d H:i:s')),
202  'additional_tables' => array('integer', $i_check)
203  );
204 
205  if($b_node_update==false) {
206  $ilLog->write("Want to insert row: ".count($row) );
207  $ilDB->insert('cmi_node', $a_data);
208  } else {
209  $ilDB->update('cmi_node', $a_data, array('cmi_node_id' => array('integer', $cmi_node_id)));
210  $ilLog->write("updated");
211  }
212 
213  if($b_node_update==true) {
214  //remove
215  if ($i_set>7) {
216  $i_set-=8;
217  if ($getComments) {
218  $q = 'DELETE FROM cmi_comment WHERE cmi_node_id = %s';
219  $ilDB->manipulateF($q, array('integer'), array($cmi_node_id));
220  }
221  }
222  if ($i_set>3) {
223  $i_set-=4;
224  if ($getInteractions) {
225  $q = 'DELETE FROM cmi_correct_response
226  WHERE cmi_interaction_id IN (
227  SELECT cmi_interaction.cmi_interaction_id FROM cmi_interaction WHERE cmi_interaction.cmi_node_id = %s)';
228  $ilDB->manipulateF($q, array('integer'), array($cmi_node_id));
229  }
230  }
231  if ($i_set>1) {
232  $i_set-=2;
233  if ($getInteractions) {
234  $q = 'DELETE FROM cmi_interaction WHERE cmi_node_id = %s';
235  $ilDB->manipulateF($q, array('integer'), array($cmi_node_id));
236  }
237  }
238  if ($i_set>0) {
239  $i_set=0;
240  if ($getObjectives) {
241  $q = 'DELETE FROM cmi_objective WHERE cmi_node_id = %s';
242  $ilDB->manipulateF($q, array('integer'), array($cmi_node_id));
243  }
244  }
245  //end remove
246  }
247  //to send to client
248  $result[(string)$row[19]] = $cmi_node_id;
249  break;
250 
251  case 'comment':
252  $row[0] = $ilDB->nextId('cmi_comment');
253 
254  $ilDB->insert('cmi_comment', array(
255  'cmi_comment_id' => array('integer', $row[0]),
256  'cmi_node_id' => array('integer', $cmi_node_id),
257  'c_comment' => array('clob', $row[2]),
258  'c_timestamp' => array('text', $row[3]),
259  'location' => array('text', $row[4]),
260  'sourceislms' => array('integer', $row[5])
261  ));
262  break;
263 
264  case 'interaction':
265  $cmi_interaction_id = $ilDB->nextId('cmi_interaction');
266  $a_map_cmi_interaction_id[]=array($row[0],$cmi_interaction_id);
267  $ilDB->insert('cmi_interaction', array(
268  'cmi_interaction_id' => array('integer', $cmi_interaction_id),
269  'cmi_node_id' => array('integer', $cmi_node_id),
270  'description' => array('clob', $row[2]),
271  'id' => array('text', $row[3]),
272  'latency' => array('text', $row[4]),
273  'learner_response' => array('clob', $row[5]),
274  'result' => array('text', $row[6]),
275  'c_timestamp' => array('text', $row[7]),
276  'c_type' => array('text', $row[8]),
277  'weighting' => array('float', $row[9])
278  ));
279  break;
280 
281  case 'objective':
282  $row[2] = $ilDB->nextId('cmi_objective');
283  $cmi_interaction_id = null;
284  if ($row[0] != null) {
285  for($i=0;$i<count($a_map_cmi_interaction_id);$i++)
286  if ($row[0] == $a_map_cmi_interaction_id[$i][0]) $cmi_interaction_id=$a_map_cmi_interaction_id[$i][1];
287  }
288  $ilDB->insert('cmi_objective', array(
289  'cmi_interaction_id' => array('integer', $cmi_interaction_id),
290  'cmi_node_id' => array('integer', $cmi_node_id),
291  'cmi_objective_id' => array('integer', $row[2]),
292  'completion_status' => array('text', $row[3]),
293  'description' => array('clob', $row[4]),
294  'id' => array('text', $row[5]),
295  'c_max' => array('float', $row[6]),
296  'c_min' => array('float', $row[7]),
297  'c_raw' => array('float', $row[8]),
298  'scaled' => array('float', $row[9]),
299  'progress_measure' => array('float', $row[10]),
300  'success_status' => array('text', $row[11]),
301  'scope' => array('text', $row[12])
302  ));
303  break;
304 
305  case 'correct_response':
306  $cmi_interaction_id = null;
307  if ($row[1] !== null) {
308  for($i=0;$i<count($a_map_cmi_interaction_id);$i++)
309  if ($row[1] == $a_map_cmi_interaction_id[$i][0]) $cmi_interaction_id=$a_map_cmi_interaction_id[$i][1];
310  $row[0] = $ilDB->nextId('cmi_correct_response');
311  $ilDB->insert('cmi_correct_response', array(
312  'cmi_correct_resp_id' => array('integer', $row[0]),
313  'cmi_interaction_id' => array('integer', $cmi_interaction_id),
314  'pattern' => array('text', $row[2])
315  ));
316  }
317  break;
318  }
319  }
320  }
321  return $result;
322  }
$result
Add rich text string
The name of the decorator.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

◆ setGlobalObjectives()

static ilSCORM2004StoreData::setGlobalObjectives (   $userId,
  $packageId,
  $data 
)
staticprotected

Definition at line 350 of file class.ilSCORM2004StoreData.php.

References $data, $ilLog, $packageId, and writeGObjective().

Referenced by persistCMIData().

350  {
351  global $ilLog;
352  $changed_seq_utilities=$data->changed_seq_utilities;
353  $ilLog->write("SCORM2004 adl_seq_utilities changed: ".$changed_seq_utilities);
354  if ($changed_seq_utilities == 1) {
355  $returnAr=ilSCORM2004StoreData::writeGObjective($data->adl_seq_utilities, $userId, $packageId);
356  }
357  }
$packageId
static writeGObjective($g_data, $user, $package)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ syncGlobalStatus()

static ilSCORM2004StoreData::syncGlobalStatus (   $userId,
  $packageId,
  $data,
  $new_global_status,
  $time_from_lms 
)
static

Definition at line 359 of file class.ilSCORM2004StoreData.php.

References $_GET, $data, $ilDB, $ilLog, $packageId, ilSCORM2004Tracking\_syncReadEvent(), array, and ilLPStatus\writeStatus().

Referenced by persistCMIData(), and ilSCORMOfflineMode\sop2il().

359  {
360 
361  global $ilDB, $ilLog;
362  $saved_global_status=$data->saved_global_status;
363  $ilLog->write("saved_global_status=".$saved_global_status);
364 
365 
366  //update percentage_completed, sco_total_time_sec,status in sahs_user
367  $totalTime=(int)$data->totalTimeCentisec;
368  $totalTime=round($totalTime/100);
369  $ilDB->queryF('UPDATE sahs_user SET sco_total_time_sec=%s, status=%s, percentage_completed=%s WHERE obj_id = %s AND user_id = %s',
370  array('integer', 'integer', 'integer', 'integer', 'integer'),
371  array($totalTime, $new_global_status, $data->percentageCompleted, $packageId, $userId));
372 
373  self::ensureObjectDataCacheExistence();
374  global $ilObjDataCache;
375 
376  // update learning progress
377  if ($new_global_status != null) {//could only happen when synchronising from SCORM Offline Player
378  include_once("./Services/Tracking/classes/class.ilObjUserTracking.php");
379  include_once("./Services/Tracking/classes/class.ilLPStatus.php");
380  ilLPStatus::writeStatus($packageId, $userId,$new_global_status,$data->percentageCompleted);
381 
382 // here put code for soap to MaxCMS e.g. when if($saved_global_status != $new_global_status)
383  }
384  // sync access number and time in read event table
385  if ($time_from_lms==false) {
386  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
387  ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", (int)$_GET['ref_id'], $time_from_lms);
388  }
389  //end sync access number and time in read event table
390 
391  return true;
392  }
$_GET["client_id"]
Create styles array
The data for the language used.
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
global $ilDB
$packageId
static _syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id, $time_from_lms=null)
Synch read event table.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ writeGObjective()

static ilSCORM2004StoreData::writeGObjective (   $g_data,
  $user,
  $package 
)
static

Definition at line 397 of file class.ilSCORM2004StoreData.php.

References $GLOBALS, $ilDB, $ilLog, $res, $row, and array.

Referenced by setGlobalObjectives().

398  {
399  global $ilDB, $ilLog;
400  $ilLog->write("SCORM2004 writeGObjective");
401 
402  $returnAr=array(null,null,null);
403 
404  //iterate over assoziative array
405  if($g_data == null)
406  return $returnAr;
407 
408  $rows_to_insert = Array();
409 
410  foreach($g_data as $key => $value)
411  {
412  $ilLog->write("SCORM2004 writeGObjective -key: ".$key);
413  //objective
414  //learner = ilias learner id
415  //scope = null / course
416  foreach($value as $skey => $svalue)
417  {
418  $ilLog->write("SCORM2004 writeGObjective -skey: ".$skey);
419  //we always have objective and learner id
420  if($g_data->$key->$skey->$user->$package)
421  {
422  $o_value = $g_data->$key->$skey->$user->$package;
423  $scope = $package;
424  }
425  else //UK: is this okay? can $scope=0 and $user->{"null"}; when is $scope used?
426 
427  {
428  //scope 0
429  $o_value = $g_data->$key->$skey->$user->{"null"};
430  //has to be converted to NULL in JS Later
431  $scope = 0;
432  }
433 
434  //insert into database
435  $objective_id = $skey;
436  $toset = $o_value;
437  $dbuser = $user;
438 
439  if($key == "status")
440  {
441 
442  //special handling for status
443  $completed = $g_data->$key->$skey->$user->{completed};
444  $measure = $g_data->$key->$skey->$user->{measure};
445  $satisfied = $g_data->$key->$skey->$user->{satisfied};
446 
447  $returnAr=array($completed, $satisfied, $measure);
448 
449  $obj = '-course_overall_status-';
450  $pkg_id = $package;
451 
452  $res = $ilDB->queryF('
453  SELECT user_id FROM cmi_gobjective
454  WHERE objective_id =%s
455  AND user_id = %s
456  AND scope_id = %s',
457  array('text', 'integer', 'integer'),
458  array($obj, $dbuser, $pkg_id)
459  );
460  $ilLog->write("SCORM2004 Count is: ".$ilDB->numRows($res));
461  if(!$ilDB->numRows($res))
462  {
463  $ilDB->manipulateF('
464  INSERT INTO cmi_gobjective
465  (user_id, status, scope_id, measure, satisfied, objective_id)
466  VALUES (%s, %s, %s, %s, %s, %s)',
467  array('integer', 'text', 'integer', 'text', 'text', 'text'),
468  array($dbuser, $completed, $pkg_id, $measure, $satisfied, $obj)
469  );
470  $ilLog->write("SCORM2004 cmi_gobjective Insert status=".$completed." scope_id=".$pkg_id." measure=".$measure." satisfied=".$satisfied." objective_id=".$obj);
471  }
472  else
473  {
474  $ilDB->manipulateF('
475  UPDATE cmi_gobjective
476  SET status = %s,
477  measure = %s,
478  satisfied = %s
479  WHERE objective_id = %s
480  AND user_id = %s
481  AND scope_id = %s',
482  array('text', 'text', 'text', 'text', 'integer', 'integer'),
483  array($completed, $measure, $satisfied, $obj, $dbuser, $pkg_id)
484  );
485  $ilLog->write("SCORM2004 cmi_gobjective Update status=".$completed." scope_id=".$pkg_id." measure=".$measure." satisfied=".$satisfied." objective_id=".$obj);
486  }
487  } else //add it to the rows_to_insert
488  {
489  //create the row if this is the first time it has been found
490  if($rows_to_insert[$objective_id] == NULL)
491  {
492  $rows_to_insert[$objective_id] = Array();
493  }
494  $rows_to_insert[$objective_id][$key] = $toset;
495  }
496 
497  }
498  }
499 
500  //Get the scope for all the global objectives!!!
501  $res = $ilDB->queryF("SELECT global_to_system
502  FROM cp_package
503  WHERE obj_id = %s",
504  array('text'),
505  array($package)
506  );
507 
508  $scope_id = ($ilDB->fetchObject($res)->global_to_system) ? 0 : $package;
509 
510  //build up the set to look for in the query
511  $existing_key_template = "";
512  foreach(array_keys($rows_to_insert) as $obj_id)
513  {
514  $existing_key_template .= "'{$obj_id}',";
515 
516  }
517  //remove trailing ','
518  $existing_key_template = substr($existing_key_template, 0, strlen($existing_key_template) - 1);
519  $existing_keys = Array();
520 
521  if($existing_key_template != "")
522  {
523  //Get the ones that need to be updated in a single query
524  $res = $ilDB->queryF("SELECT objective_id
525  FROM cmi_gobjective
526  WHERE user_id = %s
527  AND scope_id = %s
528  AND objective_id IN ($existing_key_template)",
529  array('integer', 'integer'),
530  array($dbuser, $scope_id)
531  );
532 
533  while($row = $ilDB->fetchAssoc($res))
534  {
535  $existing_keys[] = $row['objective_id'];
536  }
537  }
538 
539  foreach($rows_to_insert as $obj_id => $vals)
540  {
541  if(in_array($obj_id, $existing_keys))
542  {
543  $ilDB->manipulateF("UPDATE cmi_gobjective
544  SET satisfied=%s,
545  measure=%s,
546  score_raw=%s,
547  score_min=%s,
548  score_max=%s,
549  completion_status=%s,
550  progress_measure=%s
551  WHERE objective_id = %s
552  AND user_id = %s
553  AND scope_id = %s",
554 
555  array('text','text', 'text', 'text', 'text', 'text',
556  'text', 'text', 'integer', 'integer'),
557 
558  array($vals['satisfied'], $vals["measure"], $vals["score_raw"],
559  $vals["score_min"], $vals["score_max"],
560  $vals["completion_status"], $vals["progress_measure"],
561  $obj_id, $dbuser, $scope_id)
562  );
563  } else
564  {
565  $ilDB->manipulateF("INSERT INTO cmi_gobjective
566  (user_id, satisfied, measure, scope_id, status, objective_id,
567  score_raw, score_min, score_max, progress_measure, completion_status)
568  VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
569 
570 
571  array('integer', 'text', 'text', 'integer', 'text', 'text',
572  'text', 'text', 'text', 'text', 'text'),
573 
574  array($dbuser, $vals['satisfied'], $vals['measure'],
575  $scope_id, NULL, $obj_id, $vals['score_raw'],
576  $vals['score_min'], $vals['score_max'],
577  $vals['progress_measure'], $vals['completion_status'])
578  );
579  }
580  }
581 
582  // update learning progress here not necessary because integrated in setCMIdata
583  // check _updateStatus for cmi_gobjective
584 // include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
585 // ilLPStatusWrapper::_updateStatus($package, $user);
586 
587  return $returnAr;
588  }
Create styles array
The data for the language used.
global $ilDB
+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: