|
@@ 5184-5213 (lines=30) @@
|
| 5181 |
|
* Updates the "prevent_reinit" value that enables control on reinitialising items on second view |
| 5182 |
|
* @return boolean True if prevent_reinit has been set to 'on', false otherwise (or 1 or 0 in this case) |
| 5183 |
|
*/ |
| 5184 |
|
public function update_reinit() |
| 5185 |
|
{ |
| 5186 |
|
$course_id = api_get_course_int_id(); |
| 5187 |
|
if ($this->debug > 0) { |
| 5188 |
|
error_log('New LP - In learnpath::update_reinit()', 0); |
| 5189 |
|
} |
| 5190 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5191 |
|
$sql = "SELECT * FROM $lp_table |
| 5192 |
|
WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
| 5193 |
|
$res = Database::query($sql); |
| 5194 |
|
if (Database :: num_rows($res) > 0) { |
| 5195 |
|
$row = Database :: fetch_array($res); |
| 5196 |
|
$force = $row['prevent_reinit']; |
| 5197 |
|
if ($force == 1) { |
| 5198 |
|
$force = 0; |
| 5199 |
|
} elseif ($force == 0) { |
| 5200 |
|
$force = 1; |
| 5201 |
|
} |
| 5202 |
|
$sql = "UPDATE $lp_table SET prevent_reinit = $force |
| 5203 |
|
WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
| 5204 |
|
Database::query($sql); |
| 5205 |
|
$this->prevent_reinit = $force; |
| 5206 |
|
return $force; |
| 5207 |
|
} else { |
| 5208 |
|
if ($this->debug > 2) { |
| 5209 |
|
error_log('New LP - Problem in update_reinit() - could not find LP ' . $this->get_id() . ' in DB', 0); |
| 5210 |
|
} |
| 5211 |
|
} |
| 5212 |
|
return -1; |
| 5213 |
|
} |
| 5214 |
|
|
| 5215 |
|
/** |
| 5216 |
|
* Determine the attempt_mode thanks to prevent_reinit and seriousgame_mode db flag |
|
@@ 5322-5350 (lines=29) @@
|
| 5319 |
|
* @return boolean true if seriousgame_mode has been set to 1, false otherwise |
| 5320 |
|
* @author ndiechburg <[email protected]> |
| 5321 |
|
**/ |
| 5322 |
|
public function set_seriousgame_mode() |
| 5323 |
|
{ |
| 5324 |
|
$course_id = api_get_course_int_id(); |
| 5325 |
|
if ($this->debug > 0) { |
| 5326 |
|
error_log('New LP - In learnpath::set_seriousgame_mode()', 0); |
| 5327 |
|
} |
| 5328 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5329 |
|
$sql = "SELECT * FROM $lp_table WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
| 5330 |
|
$res = Database::query($sql); |
| 5331 |
|
if (Database :: num_rows($res) > 0) { |
| 5332 |
|
$row = Database :: fetch_array($res); |
| 5333 |
|
$force = $row['seriousgame_mode']; |
| 5334 |
|
if ($force == 1) { |
| 5335 |
|
$force = 0; |
| 5336 |
|
} elseif ($force == 0) { |
| 5337 |
|
$force = 1; |
| 5338 |
|
} |
| 5339 |
|
$sql = "UPDATE $lp_table SET seriousgame_mode = $force |
| 5340 |
|
WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
| 5341 |
|
Database::query($sql); |
| 5342 |
|
$this->seriousgame_mode = $force; |
| 5343 |
|
return $force; |
| 5344 |
|
} else { |
| 5345 |
|
if ($this->debug > 2) { |
| 5346 |
|
error_log('New LP - Problem in set_seriousgame_mode() - could not find LP ' . $this->get_id() . ' in DB', 0); |
| 5347 |
|
} |
| 5348 |
|
} |
| 5349 |
|
return -1; |
| 5350 |
|
} |
| 5351 |
|
|
| 5352 |
|
/** |
| 5353 |
|
* Updates the "scorm_debug" value that shows or hide the debug window |
|
@@ 5356-5385 (lines=30) @@
|
| 5353 |
|
* Updates the "scorm_debug" value that shows or hide the debug window |
| 5354 |
|
* @return boolean True if scorm_debug has been set to 'on', false otherwise (or 1 or 0 in this case) |
| 5355 |
|
*/ |
| 5356 |
|
public function update_scorm_debug() |
| 5357 |
|
{ |
| 5358 |
|
$course_id = api_get_course_int_id(); |
| 5359 |
|
if ($this->debug > 0) { |
| 5360 |
|
error_log('New LP - In learnpath::update_scorm_debug()', 0); |
| 5361 |
|
} |
| 5362 |
|
$lp_table = Database :: get_course_table(TABLE_LP_MAIN); |
| 5363 |
|
$sql = "SELECT * FROM $lp_table |
| 5364 |
|
WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
| 5365 |
|
$res = Database::query($sql); |
| 5366 |
|
if (Database :: num_rows($res) > 0) { |
| 5367 |
|
$row = Database :: fetch_array($res); |
| 5368 |
|
$force = $row['debug']; |
| 5369 |
|
if ($force == 1) { |
| 5370 |
|
$force = 0; |
| 5371 |
|
} elseif ($force == 0) { |
| 5372 |
|
$force = 1; |
| 5373 |
|
} |
| 5374 |
|
$sql = "UPDATE $lp_table SET debug = $force |
| 5375 |
|
WHERE c_id = ".$course_id." AND id = " . $this->get_id(); |
| 5376 |
|
$res = Database::query($sql); |
| 5377 |
|
$this->scorm_debug = $force; |
| 5378 |
|
return $force; |
| 5379 |
|
} else { |
| 5380 |
|
if ($this->debug > 2) { |
| 5381 |
|
error_log('New LP - Problem in update_scorm_debug() - could not find LP ' . $this->get_id() . ' in DB', 0); |
| 5382 |
|
} |
| 5383 |
|
} |
| 5384 |
|
return -1; |
| 5385 |
|
} |
| 5386 |
|
|
| 5387 |
|
/** |
| 5388 |
|
* Function that makes a call to the function sort_tree_array and create_tree_array |