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
This commit is contained in:
Nobelium 2014-07-10 15:40:39 +00:00
parent 3ad5eeedcf
commit ad88d3ed2a
4 changed files with 50 additions and 2 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;