ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 117 of file class.ilSCORM2004StoreData.php.

118 {
119 global $DIC;
120
121 $ilDB = $DIC->database();
122 $res = $ilDB->queryF(
123 'select hash from sahs_user where obj_id=%s AND user_id=%s AND hash_end>%s',
124 array('integer','integer','timestamp'),
125 array($packageId,$userId,date('Y-m-d H:i:s'))
126 );
127 $rowtmp=$ilDB->fetchAssoc($res);
128 if ($rowtmp['hash']==$hash) {
129 return;
130 } else {
131 die("not allowed");
132 }
133 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
global $DIC
Definition: saml.php:7
foreach($_POST as $key=> $value) $res
$packageId
global $ilDB

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

◆ persistCMIData()

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

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

69 {
70 global $DIC;
71
72 $ilLog = $DIC["ilLog"];
73
74 if ($defaultLessonMode == "browse") {
75 return;
76 }
77
78 $jsMode = strpos($_SERVER['HTTP_ACCEPT'], 'text/javascript')!==false;
79
80 $data = json_decode(is_string($data) ? $data : file_get_contents('php://input'));
81 $ilLog->write("dataTo_setCMIData: " . file_get_contents('php://input'));
82 if (!$data) {
83 return;
84 }
85 if ($userId == null) {
86 $userId=(int) $data->p;
87 self::checkIfAllowed($packageId, $userId, $data->hash);
88 // header('Access-Control-Allow-Origin: http://localhost:50012');//just for tests - not for release UK
89 }
90 $return = array();
92 $userId,
94 $data,
95 $comments,
96 $interactions,
97 $objectives
98 );
99
100 //$new_global_status=ilSCORM2004StoreData::setGlobalObjectivesAndGetGlobalStatus($userId, $packageId, $data);
102 $new_global_status = $data->now_global_status;
103 $return["new_global_status"] = $new_global_status;
104
105 ilSCORM2004StoreData::syncGlobalStatus($userId, $packageId, $data, $new_global_status, $time_from_lms);
106
107 $ilLog->write("SCORM: return of persistCMIData: " . json_encode($return));
108 if ($jsMode) {
109 header('Content-Type: text/javascript; charset=UTF-8');
110 print(json_encode($return));
111 } else {
112 header('Content-Type: text/html; charset=UTF-8');
113 print(var_export($return, true));
114 }
115 }
if(! $in) print
static setCMIData($userId, $packageId, $data, $getComments, $getInteractions, $getObjectives)
static syncGlobalStatus($userId, $packageId, $data, $new_global_status, $time_from_lms)
static setGlobalObjectives($userId, $packageId, $data)
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']

References $_SERVER, $data, $DIC, $ilLog, $packageId, print, setCMIData(), setGlobalObjectives(), and syncGlobalStatus().

Referenced by ilSCORM13Player\executeCommand().

+ 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.

15 {
16 global $DIC;
17
18 $ilDB = $DIC->database();
19
20 $data = json_decode(is_string($data) ? $data : file_get_contents('php://input'));
21 if (!$data) {
22 return;
23 }
24 if ($userId == null) {
25 $userId=(int) $data->p;
26 self::checkIfAllowed($packageId, $userId, $data->hash);
27 }
28 $last_visited = null;
29 if ($data->last !="") {
30 $last_visited = $data->last;
31 }
32 $endDate = date('Y-m-d H:i:s', mktime(date('H'), date('i')+5, date('s'), date('m'), date('d'), date('Y')));
33 $total_time_sec = null;
34 if ($data->total_time_sec !="") {
35 $total_time_sec = $data->total_time_sec;
36 $ilDB->manipulateF(
37 'UPDATE sahs_user
38 SET total_time_sec = %s, last_visited = %s, hash_end =%s, last_access = %s
39 WHERE obj_id = %s AND user_id = %s',
40 array('integer', 'text', 'timestamp', 'timestamp', 'integer', 'integer'),
41 array($total_time_sec,$last_visited, $endDate, date('Y-m-d H:i:s'), $packageId, $userId)
42 );
43 if ($time_from_lms==true) {
44 self::ensureObjectDataCacheExistence();
45 global $DIC;
46
47 $ilObjDataCache = $DIC["ilObjDataCache"];
48 // sync access number and time in read event table
49 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
50 ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", (int) $_GET['ref_id'], $time_from_lms);
51 //end sync access number and time in read event table
52 }
53 } else {
54 $ilDB->manipulateF(
55 'UPDATE sahs_user
56 SET last_visited = %s, hash_end =%s, last_access = %s
57 WHERE obj_id = %s AND user_id = %s',
58 array('text', 'timestamp', 'timestamp', 'integer', 'integer'),
59 array($last_visited, $endDate, date('Y-m-d H:i:s'), $packageId, $userId)
60 );
61 }
62
63 header('Content-Type: text/plain; charset=UTF-8');
64 print("");
65 }
$_GET["client_id"]
static _syncReadEvent($a_obj_id, $a_user_id, $a_type, $a_ref_id, $time_from_lms=null)
Synch read event table.

References $_GET, $data, $DIC, $ilDB, $packageId, ilSCORM2004Tracking\_syncReadEvent(), date, and print.

Referenced by ilSCORM13Player\executeCommand().

+ 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 135 of file class.ilSCORM2004StoreData.php.

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

References $data, $DIC, $i, $ilDB, $ilLog, $res, $result, $row, $table, and date.

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

+ Here is the caller graph for this function:

◆ setGlobalObjectives()

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

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

383 {
384 global $DIC;
385
386 $ilLog = $DIC["ilLog"];
387 $changed_seq_utilities=$data->changed_seq_utilities;
388 $ilLog->write("SCORM2004 adl_seq_utilities changed: " . $changed_seq_utilities);
389 if ($changed_seq_utilities == 1) {
390 $returnAr=ilSCORM2004StoreData::writeGObjective($data->adl_seq_utilities, $userId, $packageId);
391 }
392 }
static writeGObjective($g_data, $user, $package)

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

Referenced by persistCMIData().

+ 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 394 of file class.ilSCORM2004StoreData.php.

395 {
396 global $DIC;
397
398 $ilDB = $DIC->database();
399 $ilLog = $DIC["ilLog"];
400 $saved_global_status=$data->saved_global_status;
401 $ilLog->write("saved_global_status=" . $saved_global_status);
402
403
404 //update percentage_completed, sco_total_time_sec,status in sahs_user
405 $totalTime=(int) $data->totalTimeCentisec;
406 $totalTime=round($totalTime/100);
407 $ilDB->queryF(
408 'UPDATE sahs_user SET sco_total_time_sec=%s, status=%s, percentage_completed=%s WHERE obj_id = %s AND user_id = %s',
409 array('integer', 'integer', 'integer', 'integer', 'integer'),
410 array($totalTime, $new_global_status, $data->percentageCompleted, $packageId, $userId)
411 );
412
413 self::ensureObjectDataCacheExistence();
414 global $DIC;
415
416 $ilObjDataCache = $DIC["ilObjDataCache"];
417
418 // update learning progress
419 if ($new_global_status != null) {//could only happen when synchronising from SCORM Offline Player
420 include_once("./Services/Tracking/classes/class.ilObjUserTracking.php");
421 include_once("./Services/Tracking/classes/class.ilLPStatus.php");
422 ilLPStatus::writeStatus($packageId, $userId, $new_global_status, $data->percentageCompleted);
423
424 // here put code for soap to MaxCMS e.g. when if($saved_global_status != $new_global_status)
425 }
426 // sync access number and time in read event table
427 if ($time_from_lms==false) {
428 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
429 ilSCORM2004Tracking::_syncReadEvent($packageId, $userId, "sahs", (int) $_GET['ref_id'], $time_from_lms);
430 }
431 //end sync access number and time in read event table
432
433 return true;
434 }
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.

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

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

+ 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 439 of file class.ilSCORM2004StoreData.php.

440 {
441 global $DIC;
442
443 $ilDB = $DIC->database();
444 $ilLog = $DIC["ilLog"];
445 $ilLog->write("SCORM2004 writeGObjective");
446
447 $returnAr=array(null,null,null);
448
449 //iterate over assoziative array
450 if ($g_data == null) {
451 return $returnAr;
452 }
453
454 $rows_to_insert = array();
455
456 foreach ($g_data as $key => $value) {
457 $ilLog->write("SCORM2004 writeGObjective -key: " . $key);
458 //objective
459 //learner = ilias learner id
460 //scope = null / course
461 foreach ($value as $skey => $svalue) {
462 $ilLog->write("SCORM2004 writeGObjective -skey: " . $skey);
463 //we always have objective and learner id
464 if ($g_data->$key->$skey->$user->$package) {
465 $o_value = $g_data->$key->$skey->$user->$package;
466 $scope = $package;
467 } else { //UK: is this okay? can $scope=0 and $user->{"null"}; when is $scope used?
468 //scope 0
469 $o_value = $g_data->$key->$skey->$user->{"null"};
470 //has to be converted to NULL in JS Later
471 $scope = 0;
472 }
473
474 //insert into database
475 $objective_id = $skey;
476 $toset = $o_value;
477 $dbuser = $user;
478
479 if ($key == "status") {
480
481 //special handling for status
482 $completed = $g_data->$key->$skey->$user->{completed};
483 $measure = $g_data->$key->$skey->$user->{measure};
484 $satisfied = $g_data->$key->$skey->$user->{satisfied};
485
486 $returnAr=array($completed, $satisfied, $measure);
487
488 $obj = '-course_overall_status-';
489 $pkg_id = $package;
490
491 $res = $ilDB->queryF(
492 '
493 SELECT user_id FROM cmi_gobjective
494 WHERE objective_id =%s
495 AND user_id = %s
496 AND scope_id = %s',
497 array('text', 'integer', 'integer'),
498 array($obj, $dbuser, $pkg_id)
499 );
500 $ilLog->write("SCORM2004 Count is: " . $ilDB->numRows($res));
501 if (!$ilDB->numRows($res)) {
502 $ilDB->manipulateF(
503 '
504 INSERT INTO cmi_gobjective
505 (user_id, status, scope_id, measure, satisfied, objective_id)
506 VALUES (%s, %s, %s, %s, %s, %s)',
507 array('integer', 'text', 'integer', 'text', 'text', 'text'),
508 array($dbuser, $completed, $pkg_id, $measure, $satisfied, $obj)
509 );
510 $ilLog->write("SCORM2004 cmi_gobjective Insert status=" . $completed . " scope_id=" . $pkg_id . " measure=" . $measure . " satisfied=" . $satisfied . " objective_id=" . $obj);
511 } else {
512 $ilDB->manipulateF(
513 '
514 UPDATE cmi_gobjective
515 SET status = %s,
516 measure = %s,
517 satisfied = %s
518 WHERE objective_id = %s
519 AND user_id = %s
520 AND scope_id = %s',
521 array('text', 'text', 'text', 'text', 'integer', 'integer'),
522 array($completed, $measure, $satisfied, $obj, $dbuser, $pkg_id)
523 );
524 $ilLog->write("SCORM2004 cmi_gobjective Update status=" . $completed . " scope_id=" . $pkg_id . " measure=" . $measure . " satisfied=" . $satisfied . " objective_id=" . $obj);
525 }
526 } else { //add it to the rows_to_insert
527 //create the row if this is the first time it has been found
528 if ($rows_to_insert[$objective_id] == null) {
529 $rows_to_insert[$objective_id] = array();
530 }
531 $rows_to_insert[$objective_id][$key] = $toset;
532 }
533 }
534 }
535
536 //Get the scope for all the global objectives!!!
537 $res = $ilDB->queryF(
538 "SELECT global_to_system
539 FROM cp_package
540 WHERE obj_id = %s",
541 array('text'),
542 array($package)
543 );
544
545 $scope_id = ($ilDB->fetchObject($res)->global_to_system) ? 0 : $package;
546
547 //build up the set to look for in the query
548 $existing_key_template = "";
549 foreach (array_keys($rows_to_insert) as $obj_id) {
550 $existing_key_template .= "'{$obj_id}',";
551 }
552 //remove trailing ','
553 $existing_key_template = substr($existing_key_template, 0, strlen($existing_key_template) - 1);
554 $existing_keys = array();
555
556 if ($existing_key_template != "") {
557 //Get the ones that need to be updated in a single query
558 $res = $ilDB->queryF(
559 "SELECT objective_id
560 FROM cmi_gobjective
561 WHERE user_id = %s
562 AND scope_id = %s
563 AND objective_id IN ($existing_key_template)",
564 array('integer', 'integer'),
565 array($dbuser, $scope_id)
566 );
567
568 while ($row = $ilDB->fetchAssoc($res)) {
569 $existing_keys[] = $row['objective_id'];
570 }
571 }
572
573 foreach ($rows_to_insert as $obj_id => $vals) {
574 if (in_array($obj_id, $existing_keys)) {
575 $ilDB->manipulateF(
576 "UPDATE cmi_gobjective
577 SET satisfied=%s,
578 measure=%s,
579 score_raw=%s,
580 score_min=%s,
581 score_max=%s,
582 completion_status=%s,
583 progress_measure=%s
584 WHERE objective_id = %s
585 AND user_id = %s
586 AND scope_id = %s",
587 array('text','text', 'text', 'text', 'text', 'text',
588 'text', 'text', 'integer', 'integer'),
589 array($vals['satisfied'], $vals["measure"], $vals["score_raw"],
590 $vals["score_min"], $vals["score_max"],
591 $vals["completion_status"], $vals["progress_measure"],
592 $obj_id, $dbuser, $scope_id)
593 );
594 } else {
595 $ilDB->manipulateF(
596 "INSERT INTO cmi_gobjective
597 (user_id, satisfied, measure, scope_id, status, objective_id,
598 score_raw, score_min, score_max, progress_measure, completion_status)
599 VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
600 array('integer', 'text', 'text', 'integer', 'text', 'text',
601 'text', 'text', 'text', 'text', 'text'),
602 array($dbuser, $vals['satisfied'], $vals['measure'],
603 $scope_id, null, $obj_id, $vals['score_raw'],
604 $vals['score_min'], $vals['score_max'],
605 $vals['progress_measure'], $vals['completion_status'])
606 );
607 }
608 }
609
610 // update learning progress here not necessary because integrated in setCMIdata
611 // check _updateStatus for cmi_gobjective
612 // include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
613 // ilLPStatusWrapper::_updateStatus($package, $user);
614
615 return $returnAr;
616 }
$key
Definition: croninfo.php:18

References $DIC, $ilDB, $ilLog, and $key.

Referenced by setGlobalObjectives().

+ Here is the caller graph for this function:

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