Minor - format code

pull/2487/head
jmontoyaa 9 years ago
parent e6d7edff13
commit ce741f7f5c
  1. 21
      main/newscorm/learnpath.class.php
  2. 8
      main/newscorm/lp_add_audio.php
  3. 2
      main/newscorm/lp_add_category.php
  4. 22
      main/newscorm/lp_admin_view.php
  5. 10
      main/newscorm/lp_ajax_initialize.php
  6. 4
      main/newscorm/lp_ajax_start_timer.php
  7. 2
      main/newscorm/lp_ajax_switch_item.php

@ -68,10 +68,10 @@ class learnpath
public $prerequisite = 0;
public $use_max_score = 1; // 1 or 0
public $subscribeUsers = 0; // Subscribe users or not
public $created_on = '';
public $modified_on = '';
public $publicated_on = '';
public $expired_on = '';
public $created_on = '';
public $modified_on = '';
public $publicated_on = '';
public $expired_on = '';
public $ref = null;
public $course_int_id;
public $course_info = array();
@ -1545,7 +1545,7 @@ class learnpath
// TODO: Update the item object (can be ignored for now because refreshed).
return true;
}
/**
* Static admin function exporting a learnpath into a zip file
* @param string Export type (scorm, zip, cd)
@ -10545,13 +10545,18 @@ EOD;
}
/**
* @return \learnpath
* @param string $courseCode
* @param int $lp_id
* @param int $user_id
*
* @return learnpath
*/
public static function getLpFromSession($courseCode, $lp_id, $user_id)
{
$lpObject = Session::read('lpobject');
$learnPath = null;
if (isset($lpObject)) {
$lpObject = Session::read('lpobject');
if ($lpObject !== null) {
$learnPath = unserialize($lpObject);
}

@ -16,9 +16,9 @@ require_once 'resourcelinker.inc.php';
$is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
$learnpath_id = (int)$_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null;
$action = isset($_GET['action']) ? $_GET['action'] : null;
@ -165,7 +165,7 @@ $documentTree = DocumentManager::get_document_preview(
);
$page .= $recordVoiceForm;
$page .= $form->return_form();
$page .= $form->returnForm();
$page .= '<legend>'.get_lang('SelectAnAudioFileFromDocuments').'</legend>';
$page .= $documentTree;
$page .= '</div>';

@ -73,7 +73,7 @@ Display::display_header(get_lang('LearnpathAddLearnpath'), 'Path');
echo '<div class="actions">';
echo '<a href="lp_controller.php?'.api_get_cidreq().'">'.
Display::return_icon('back.png', get_lang('ReturnToLearningPaths'),'',ICON_SIZE_MEDIUM).'</a>';
Display::return_icon('back.png', get_lang('ReturnToLearningPaths'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
$form->display();

@ -31,13 +31,11 @@ $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$tbl_lp = Database::get_course_table(TABLE_LP_MAIN);
$tbl_lp_item = Database::get_course_table(TABLE_LP_ITEM);
$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
$learnpath_id = (int) $_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null;
$learnpath_id = (int)$_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$_course = api_get_course_info();
/* MAIN CODE */
// Using the resource linker as a tool for adding resources to the learning path.
if ($action == 'add' and $type == 'learnpathitem') {
$htmlHeadXtra[] = "<script> window.location=\"../resourcelinker/resourcelinker.php?source_id=5&action=$action&learnpath_id=$learnpath_id&chapter_id=$chapter_id&originalresource=no\"; </script>";
@ -62,9 +60,9 @@ if (isset($_SESSION['gradebook'])) {
if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array (
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook')
);
}
$interbreadcrumb[] = array('url' => 'lp_controller.php?action=list', 'name' => get_lang('LearningPaths'));
@ -87,9 +85,6 @@ if (isset($_REQUEST['updateaudio'])) {
$show_learn_path = true;
$lp_theme_css = $_SESSION['oLP']->get_theme();
/* DISPLAY SECTION */
// POST action handling (uploading mp3, deleting mp3)
if (isset($_POST['save_audio'])) {
@ -106,13 +101,14 @@ if (isset($_POST['save_audio'])) {
}
}
if (count($lp_items_to_remove_audio)>0) {
$sql = "UPDATE $tbl_lp_item SET audio = '' WHERE c_id = $course_id AND id IN (".$in.")";
$sql = "UPDATE $tbl_lp_item SET audio = ''
WHERE c_id = $course_id AND id IN (".$in.")";
$result = Database::query($sql);
}
// Uploading the audio files.
foreach ($_FILES as $key => $value) {
if (substr($key, 0, 7) == 'mp3file' AND !empty($_FILES[$key]['tmp_name'])) {
if (substr($key, 0, 7) == 'mp3file' && !empty($_FILES[$key]['tmp_name'])) {
// The id of the learning path item.
$lp_item_id = str_ireplace('mp3file', '', $key);

@ -22,7 +22,8 @@ require_once '../inc/global.inc.php';
* @param integer Current item ID
* @param integer New item ID
*/
function initialize_item($lp_id, $user_id, $view_id, $next_item) {
function initialize_item($lp_id, $user_id, $view_id, $next_item)
{
global $debug;
$return = '';
if ($debug > 0) { error_log('In initialize_item('.$lp_id.','.$user_id.','.$view_id.','.$next_item.')', 0); }
@ -61,7 +62,9 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
*/
$myscore = $mylpi->get_score();
$mymax = $mylpi->get_max();
if ($mymax === '') { $mymax = "''"; }
if ($mymax === '') {
$mymax = "''";
}
$mymin = $mylpi->get_min();
$mylesson_status = $mylpi->get_status();
@ -80,8 +83,8 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
if (!empty($myistring)) {
$myistring = substr($myistring, 1);
}
// Obtention des donnees d'objectifs
// Obtention des donnees d'objectifs
$mycoursedb = Database::get_course_table(TABLE_LP_IV_OBJECTIVE);
$course_id = api_get_course_int_id();
$mylp_iv_id = $mylpi->db_item_view_id;
@ -166,6 +169,7 @@ function initialize_item($lp_id, $user_id, $view_id, $next_item) {
$mylp->prerequisites_match(); // Check the prerequisites are all complete.
if ($debug > 1) { error_log('Prereq_match() returned '.htmlentities($mylp->error), 0); }
if ($debug > 1) { error_log("return = $return "); }
return $return;
}
echo initialize_item($_POST['lid'], $_POST['uid'], $_POST['vid'], $_POST['iid']);

@ -11,8 +11,10 @@
* var asset_timer
* @return string JavaScript time intializer
*/
function start_timer() {
function start_timer()
{
$time = time();
return $time; //"olms.asset_timer='$time'; olms.asset_timer_total = 0;";
}
echo start_timer();

@ -223,7 +223,7 @@ function switch_item_details($lp_id, $user_id, $view_id, $current_item, $next_it
}
// Save the new item ID for the exercise tool to use.
$_SESSION['scorm_item_id'] = $new_item_id;
$_SESSION['lpobject'] = serialize($mylp);
$_SESSION['lpobject'] = serialize($mylp);
return $return;
}

Loading…
Cancel
Save