Minor - format code

pull/2487/head
jmontoyaa 10 years ago
parent 4204dbf828
commit d7355d0bd4
  1. 6
      main/document/download_scorm.php
  2. 18
      main/newscorm/learnpathItem.class.php
  3. 13
      main/newscorm/lp_content.php
  4. 6
      main/newscorm/lp_controller.php

@ -27,21 +27,19 @@ if (isset($_SESSION['oLP'])) {
api_not_allowed();
}
//If is visible for the current user
// If is visible for the current user
if (!learnpath::is_lp_visible_for_student($obj->get_id(), api_get_user_id())) {
api_not_allowed();
}
$doc_url = isset($_GET['doc_url']) ? $_GET['doc_url'] : null;
// Change the '&' that got rewritten to '///' by mod_rewrite back to '&'
$doc_url = str_replace('///', '&', $doc_url);
// Still a space present? it must be a '+' (that got replaced by mod_rewrite)
$doc_url = str_replace(' ', '+', $doc_url);
$doc_url = str_replace(array('../', '\\..', '\\0', '..\\'), array('', '', '', ''), $doc_url); //echo $doc_url;
if (strpos($doc_url,'../') OR strpos($doc_url,'/..')) {
if (strpos($doc_url,'../') || strpos($doc_url,'/..')) {
$doc_url = '';
}

@ -2153,8 +2153,10 @@ class learnpathItem
// (looking for less-inclusives first).
if ($prereqs_string == '_true_') {
return true;
}
if ($prereqs_string == '_false_') {
if (empty($this->prereq_alert)) {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
@ -2211,6 +2213,7 @@ class learnpathItem
$refs_list,
$user_id
);
if (!$andstatus) {
if (self::debug > 1) {
error_log(
@ -2234,9 +2237,11 @@ class learnpathItem
if (empty($this->prereq_alert) && !$returnstatus) {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
}
return $returnstatus;
}
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
return false;
}
} else {
@ -2245,6 +2250,7 @@ class learnpathItem
if (self::debug > 1) {
error_log('New LP - Didnt find any AND, looking for =', 0);
}
if (strpos($prereqs_string, '=') !== false) {
if (self::debug > 1) {
error_log('New LP - Found =, looking into it', 0);
@ -2255,7 +2261,7 @@ class learnpathItem
// Right number of operands.
if (isset($items[$refs_list[$params[0]]])) {
$status = $items[$refs_list[$params[0]]]->get_status(true);
$returnstatus = ($status == $params[1]);
$returnstatus = $status == $params[1];
if (empty($this->prereq_alert) && !$returnstatus) {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
}
@ -2274,6 +2280,7 @@ class learnpathItem
0
);
}
if (strpos($prereqs_string, '<>') !== false) {
if (self::debug > 1) {
error_log('New LP - Found <>, looking into it', 0);
@ -2284,7 +2291,7 @@ class learnpathItem
// Right number of operands.
if (isset($items[$refs_list[$params[0]]])) {
$status = $items[$refs_list[$params[0]]]->get_status(true);
$returnstatus = ($status != $params[1]);
$returnstatus = $status != $params[1];
if (empty($this->prereq_alert) && !$returnstatus) {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
}
@ -2292,6 +2299,7 @@ class learnpathItem
return $returnstatus;
}
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
return false;
}
} else {
@ -2432,7 +2440,7 @@ class learnpathItem
foreach ($list as $cond) {
if (isset($items[$refs_list[$cond]])) {
$status = $items[$refs_list[$cond]]->get_status(true);
if ($status == $this->possible_status[2] OR
if ($status == $this->possible_status[2] ||
$status == $this->possible_status[3]
) {
$mycond = true;
@ -2604,6 +2612,7 @@ class learnpathItem
$returnstatus = false;
}
}
return $returnstatus;
} else {
$status = $items[$refs_list[$prereqs_string]]->get_status(false);
@ -2745,12 +2754,13 @@ class learnpathItem
}
if (isset($items[$refs_list[$list[0]]])) {
$status = $items[$refs_list[$list[0]]]->get_status(true);
$returnstatus = (($status == 'completed') || ($status == 'passed'));
$returnstatus = $status == 'completed' || $status == 'passed';
if (!$returnstatus && empty($this->prereq_alert)) {
$this->prereq_alert = get_lang(
'LearnpathPrereqNotCompleted'
);
}
return $returnstatus;
}
}

@ -17,7 +17,7 @@ if (empty($lp_controller_touched)) {
if ($debug > 0) {
error_log('New lp - In lp_content.php - Redirecting to lp_controller', 0);
}
header('location: lp_controller.php?action=content&lp_id='.Security::remove_XSS($_REQUEST['lp_id']).'&item_id='.Security::remove_XSS($_REQUEST['item_id']).'&'.api_get_cidreq());
header('location: lp_controller.php?action=content&lp_id='.intval($_REQUEST['lp_id']).'&item_id='.intval($_REQUEST['item_id']).'&'.api_get_cidreq());
exit;
}
$_SESSION['oLP']->error = '';
@ -37,11 +37,12 @@ $list = $_SESSION['oLP']->get_toc();
$dokeos_chapter = false;
foreach ($list as $toc) {
if ($toc['id'] == $lp_item_id && ($toc['type'] == 'dokeos_chapter' || $toc['type'] == 'dokeos_module' || $toc['type'] == 'dir')) {
if ($toc['id'] == $lp_item_id &&
($toc['type'] == 'dokeos_chapter' || $toc['type'] == 'dokeos_module' || $toc['type'] == 'dir')
) {
$dokeos_chapter = true;
}
}
if ($dokeos_chapter) {
$src = 'blank.php';
} else {
@ -63,6 +64,7 @@ if ($dokeos_chapter) {
case 2:
$_SESSION['oLP']->stop_previous_item();
$prereq_check = $_SESSION['oLP']->prerequisites_match($lp_item_id);
if ($prereq_check === true) {
$src = $_SESSION['oLP']->get_link('http', $lp_item_id);
$_SESSION['oLP']->start_current_item(); // starts time counter manually if asset
@ -103,7 +105,10 @@ if (!empty($gradebook) && $gradebook == 'view') {
}
// Define the 'doc.inc.php' as language file.
$nameTools = $_SESSION['oLP']->get_name();
$interbreadcrumb[] = array('url' => './lp_list.php', 'name' => get_lang('Doc'));
$interbreadcrumb[] = array(
'url' => api_get_path(WEB_CODE_PATH).'newscorm/lp_list.php?'.api_get_cidreq(),
'name' => get_lang('Doc'),
);
// Update global setting to avoid displaying right menu.
$save_setting = api_get_setting('show_navigation_menu');
global $_setting;

@ -1097,10 +1097,12 @@ switch ($action) {
if (!$lp_found) {
error_log('New LP - No learnpath given for content', 0);
require 'lp_list.php';
}
else {
} else {
if ($debug > 0) error_log('New LP - save_last()', 0);
$_SESSION['oLP']->save_last();
if ($debug > 0) error_log('New LP - set_current_item()', 0);
$_SESSION['oLP']->set_current_item($_GET['item_id']);
if ($debug > 0) error_log('New LP - start_current_item()', 0);
$_SESSION['oLP']->start_current_item();
require 'lp_content.php';
}

Loading…
Cancel
Save