From ad88d3ed2af1511df5f7f40e0aafeaa5a15b722e Mon Sep 17 00:00:00 2001 From: Nobelium Date: Thu, 10 Jul 2014 15:40:39 +0000 Subject: [PATCH] MDL-35870 mod_scorm : Adding phpdocs for new functions get_scorm_default in scorm_12lib.php get_scorm_default in scorm_13lib.php get_scorm_default in aicclib.php scorm_isset in locallib.php scorm_empty in locallib.php --- mod/scorm/datamodels/aicclib.php | 10 ++++++++++ mod/scorm/datamodels/scorm_12lib.php | 10 ++++++++++ mod/scorm/datamodels/scorm_13lib.php | 10 ++++++++++ mod/scorm/locallib.php | 22 ++++++++++++++++++++-- 4 files changed, 50 insertions(+), 2 deletions(-) diff --git a/mod/scorm/datamodels/aicclib.php b/mod/scorm/datamodels/aicclib.php index 59997b51668..6609021cb79 100644 --- a/mod/scorm/datamodels/aicclib.php +++ b/mod/scorm/datamodels/aicclib.php @@ -479,6 +479,16 @@ function scorm_aicc_generate_simple_sco($scorm) { return $id; } +/** + * Sets up $userdata array and default values for AICC package. + * + * @param stdClass $userdata an empty stdClass variable that should be set up with user values + * @param object $scorm package record + * @param string $scoid SCO Id + * @param string $attempt attempt number for the user + * @param string $mode scorm display mode type + * @return array The default values that should be used for AICC package + */ function get_scorm_default (&$userdata, $scorm, $scoid, $attempt, $mode) { global $USER; diff --git a/mod/scorm/datamodels/scorm_12lib.php b/mod/scorm/datamodels/scorm_12lib.php index 59bbe9f34a6..7d8495f8c85 100644 --- a/mod/scorm/datamodels/scorm_12lib.php +++ b/mod/scorm/datamodels/scorm_12lib.php @@ -121,6 +121,16 @@ function scorm_eval_prerequisites($prerequisites, $usertracks) { return eval('return '.implode($stack).';'); } +/** + * Sets up $userdata array and default values for SCORM 1.2 . + * + * @param stdClass $userdata an empty stdClass variable that should be set up with user values + * @param object $scorm package record + * @param string $scoid SCO Id + * @param string $attempt attempt number for the user + * @param string $mode scorm display mode type + * @return array The default values that should be used for SCORM 1.2 package + */ function get_scorm_default (&$userdata, $scorm, $scoid, $attempt, $mode) { global $USER; diff --git a/mod/scorm/datamodels/scorm_13lib.php b/mod/scorm/datamodels/scorm_13lib.php index 605c0d6d92a..bc9e92de17a 100644 --- a/mod/scorm/datamodels/scorm_13lib.php +++ b/mod/scorm/datamodels/scorm_13lib.php @@ -1181,6 +1181,16 @@ function scorm_seq_flow ($activity, $direction, $seq, $childrenflag, $userid) { } } +/** + * Sets up $userdata array and default values for SCORM 1.3 . + * + * @param stdClass $userdata an empty stdClass variable that should be set up with user values + * @param object $scorm package record + * @param string $scoid SCO Id + * @param string $attempt attempt number for the user + * @param string $mode scorm display mode type + * @return array The default values that should be used for SCORM 1.3 package + */ function get_scorm_default (&$userdata, $scorm, $scoid, $attempt, $mode) { global $DB, $USER; diff --git a/mod/scorm/locallib.php b/mod/scorm/locallib.php index 3bdf394bba4..14a5c011a70 100644 --- a/mod/scorm/locallib.php +++ b/mod/scorm/locallib.php @@ -998,7 +998,7 @@ function scorm_get_count_users($scormid, $groupingid=null) { * @param array $userdata User track data * @param string $elementname Name of array element to get values for * @param array $children list of sub elements of this array element that also need instantiating - * @return None + * @return Javascript array elements */ function scorm_reconstitute_array_element($sversion, $userdata, $elementname, $children) { // Reconstitute comments_from_learner and comments_from_lms. @@ -1938,7 +1938,15 @@ function scorm_check_url($url) { return true; } -// Helper function. +/** + * Check for a parameter in userdata and return it if it's set + * or return the value from $ifempty if its empty + * + * @param stdClass $userdata Contains user's data + * @param string $param parameter that should be checked + * @param string $ifempty value to be replaced with if $param is not set + * @return string value from $userdata->$param if its not empty, or $ifempty + */ function scorm_isset($userdata, $param, $ifempty = '') { if (isset($userdata->$param)) { return $userdata->$param; @@ -1947,6 +1955,16 @@ function scorm_isset($userdata, $param, $ifempty = '') { } } +/** + * Check for a parameter in userdata and return it with or without slashes it it's not empty + * or return the value from $ifempty if its empty + * + * @param stdClass $userdata Contains user's data + * @param string $param parameter that should be checked + * @param string $ifempty value to be replaced with if $param is not set + * @param bool $addslash if True - add slashes, if False - Don't add slash + * @return string value from $userdata->$param with or without if its not empty, or $ifempty + */ function scorm_empty($userdata, $param, $ifempty = '', $addslash = false) { if (!empty($userdata->$param)) { return $addslash ? '\''.$userdata->$param.'\'' : $userdata->$param;