Minor - format code

1.9.x
Julio Montoya 12 years ago
parent f0504a01ad
commit 45c6d9e537
  1. 12
      main/newscorm/learnpathItem.class.php
  2. 9
      main/newscorm/lp_ajax_save_item.php

@ -11,7 +11,8 @@
* lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional * lp_item defines items belonging to a learnpath. Each item has a name, a score, a use time and additional
* information that enables tracking a user's progress in a learning path * information that enables tracking a user's progress in a learning path
*/ */
class learnpathItem { class learnpathItem
{
public $attempt_id; // Also called "objectives" SCORM-wise. public $attempt_id; // Also called "objectives" SCORM-wise.
public $audio; // The path to an audio file (stored in document/audio/). public $audio; // The path to an audio file (stored in document/audio/).
public $children = array(); // Contains the ids of children items. public $children = array(); // Contains the ids of children items.
@ -1844,7 +1845,8 @@ class learnpathItem {
* @return void * @return void
* @todo //todo insert into lp_item_view if lp_view not exists * @todo //todo insert into lp_item_view if lp_view not exists
*/ */
public function set_lp_view($lp_view_id, $course_id = null) { public function set_lp_view($lp_view_id, $course_id = null)
{
if (empty($course_id)) { if (empty($course_id)) {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
} else { } else {
@ -1935,7 +1937,8 @@ class learnpathItem {
* @param float Score * @param float Score
* @return boolean True on success, false otherwise * @return boolean True on success, false otherwise
*/ */
public function set_score($score) { public function set_score($score)
{
//$possible_status = array('not attempted','incomplete','completed','passed','failed','browsed'); //$possible_status = array('not attempted','incomplete','completed','passed','failed','browsed');
$debug = self::debug; $debug = self::debug;
if ($debug > 0) { error_log('learnpathItem::set_score('.$score.')', 0); } if ($debug > 0) { error_log('learnpathItem::set_score('.$score.')', 0); }
@ -1989,7 +1992,8 @@ class learnpathItem {
* @param string Status - must be one of the values defined in $this->possible_status * @param string Status - must be one of the values defined in $this->possible_status
* @return boolean True on success, false on error * @return boolean True on success, false on error
*/ */
public function set_status($status) { public function set_status($status)
{
if (self::debug > 0) { error_log('learnpathItem::set_status('.$status.')', 0); } if (self::debug > 0) { error_log('learnpathItem::set_status('.$status.')', 0); }
$found = false; $found = false;
foreach ($this->possible_status as $possible) { foreach ($this->possible_status as $possible) {

@ -44,7 +44,8 @@ require_once 'aiccItem.class.php';
* @param array Interactions array * @param array Interactions array
* @param string Core exit SCORM string * @param string Core exit SCORM string
*/ */
function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1, $min = -1, $status = '', $time = 0, $suspend = '', $location = '', $interactions = array(), $core_exit = 'none') { function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1, $min = -1, $status = '', $time = 0, $suspend = '', $location = '', $interactions = array(), $core_exit = 'none')
{
$return = null; $return = null;
if ($debug > 0) { if ($debug > 0) {
@ -82,6 +83,8 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
} }
$prereq_check = $mylp->prerequisites_match($item_id); $prereq_check = $mylp->prerequisites_match($item_id);
/** @var learnpathItem $mylpi */
$mylpi = $mylp->items[$item_id]; $mylpi = $mylp->items[$item_id];
if (empty($mylpi)) { if (empty($mylpi)) {
@ -266,6 +269,7 @@ function save_item($lp_id, $user_id, $view_id, $item_id, $score = -1, $max = -1,
Session::write('lpobject', serialize($mylp)); Session::write('lpobject', serialize($mylp));
if ($debug > 0) { error_log('---------------- lp_ajax_save_item.php : save_item end ----- '); } if ($debug > 0) { error_log('---------------- lp_ajax_save_item.php : save_item end ----- '); }
return $return; return $return;
} }
@ -294,4 +298,5 @@ echo save_item(
(!empty($_REQUEST['suspend'])?$_REQUEST['suspend']:null), (!empty($_REQUEST['suspend'])?$_REQUEST['suspend']:null),
(!empty($_REQUEST['loc'])?$_REQUEST['loc']:null), (!empty($_REQUEST['loc'])?$_REQUEST['loc']:null),
$interactions, $interactions,
(!empty($_REQUEST['core_exit'])?$_REQUEST['core_exit']:'')); (!empty($_REQUEST['core_exit'])?$_REQUEST['core_exit']:'')
);

Loading…
Cancel
Save