Merge branch '1.9.x' of github.com:chamilo/chamilo-lms into 1.9.x

1.9.x
Yannick Warnier 11 years ago
commit 14a2d5595b
  1. 5
      index.php
  2. 2
      main/inc/lib/custom_pages.class.php
  3. 8
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js
  4. 6
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js
  5. 59
      main/newscorm/learnpathItem.class.php
  6. 4
      main/newscorm/lp_ajax_save_item.php

@ -139,11 +139,8 @@ if (!api_is_anonymous()) {
$controller->tpl->assign('profile_block', $controller->return_profile_block()); $controller->tpl->assign('profile_block', $controller->return_profile_block());
$controller->tpl->assign('user_image_block', $controller->return_user_image_block()); $controller->tpl->assign('user_image_block', $controller->return_user_image_block());
if (api_is_platform_admin()) {
$controller->tpl->assign('course_block', $controller->return_course_block()); $controller->tpl->assign('course_block', $controller->return_course_block());
} else { //$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
}
} }
$hot_courses = null; $hot_courses = null;

@ -53,7 +53,7 @@ class CustomPages
include($file); include($file);
exit; exit;
} else { } else {
error_log('CustomPages::displayPage : could not read file ' . $file_name); error_log('CustomPages::displayPage : could not read file ' . $file);
} }
} }

@ -14,12 +14,14 @@
my_protocol = location.protocol; my_protocol = location.protocol;
my_pathname=location.pathname; my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
var glossaryAjaxUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
var mainUrl = my_protocol+"//"+location.host+work_path+"/main/";
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(content_object) {}, beforeSend: function(content_object) {},
type: "POST", type: "POST",
url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php", url: glossaryAjaxUrl,
data: "glossary_data=true", data: "glossary_data=true",
success: function(datas) { success: function(datas) {
if (datas.length==0) { if (datas.length==0) {
@ -99,10 +101,10 @@
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(content_object) { beforeSend: function(content_object) {
$("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />"); $("div#"+div_content_id).html("<img src='"+mainUrl+"inc/lib/javascript/indicator.gif' />");
}, },
type: "POST", type: "POST",
url: "../../../../../../../main/glossary/glossary_ajax_request.php", url: glossaryAjaxUrl,
data: "glossary_id="+my_glossary_id, data: "glossary_id="+my_glossary_id,
success: function(datas) { success: function(datas) {
$("div#"+div_content_id).html(datas); $("div#"+div_content_id).html(datas);

@ -13,6 +13,8 @@ newscorm/scorm_api.php
my_protocol = location.protocol; my_protocol = location.protocol;
my_pathname=location.pathname; my_pathname=location.pathname;
work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/')); work_path = my_pathname.substr(0,my_pathname.indexOf('/courses/'));
var glossaryAjaxUrl = my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php";
var mainUrl = my_protocol+"//"+location.host+work_path+"/main/";
//$("body .glossary").mouseover(function(){ //$("body .glossary").mouseover(function(){
$("body").on("click", ".glossary", function() { $("body").on("click", ".glossary", function() {
@ -49,10 +51,10 @@ newscorm/scorm_api.php
$.ajax({ $.ajax({
contentType: "application/x-www-form-urlencoded", contentType: "application/x-www-form-urlencoded",
beforeSend: function(result) { beforeSend: function(result) {
$("div#"+div_content_id).html("<img src='../../../../../../../main/inc/lib/javascript/indicator.gif' />"); $("div#"+div_content_id).html("<img src='"+mainUrl+"inc/lib/javascript/indicator.gif' />");
}, },
type: "POST", type: "POST",
url: "../../../../../../../main/glossary/glossary_ajax_request.php", url: glossaryAjaxUrl,
data: "glossary_name="+is_glossary_name, data: "glossary_name="+is_glossary_name,
success: function(data) { success: function(data) {
$("div#"+div_content_id).html(data); $("div#"+div_content_id).html(data);

@ -285,7 +285,7 @@ class learnpathItem
$this->current_stop_time = time(); $this->current_stop_time = time();
$type = $this->get_type(); $type = $this->get_type();
if ($type != 'sco') { if ($type != 'sco') {
if ($type == TOOL_QUIZ or $type == TOOL_HOTPOTATOES) { if ($type == TOOL_QUIZ || $type == TOOL_HOTPOTATOES) {
$this->get_status( $this->get_status(
true, true,
true true
@ -1943,7 +1943,7 @@ class learnpathItem
$this->current_start_time = time(); $this->current_start_time = time();
} }
//$this->current_stop_time=time(); //$this->current_stop_time=time();
if (time() < $this->current_stop_time or $this->current_stop_time == 0 if (time() < $this->current_stop_time || $this->current_stop_time == 0
) { ) {
if (self::debug > 2) { if (self::debug > 2) {
error_log( error_log(
@ -2247,7 +2247,7 @@ class learnpathItem
} else { } else {
if (isset($items[$refs_list[$list[0]]])) { if (isset($items[$refs_list[$list[0]]])) {
$status = $items[$refs_list[$list[0]]]->get_status(true); $status = $items[$refs_list[$list[0]]]->get_status(true);
$returnstatus = ($status == $this->possible_status[2]) OR ($status == $this->possible_status[3]); $returnstatus = ($status == $this->possible_status[2]) || ($status == $this->possible_status[3]);
if (empty($this->prereq_alert) && !$returnstatus) { if (empty($this->prereq_alert) && !$returnstatus) {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted'); $this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
} }
@ -2401,7 +2401,7 @@ class learnpathItem
foreach ($list as $cond) { foreach ($list as $cond) {
if (isset($items[$refs_list[$cond]])) { if (isset($items[$refs_list[$cond]])) {
$status = $items[$refs_list[$cond]]->get_status(true); $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] $status == $this->possible_status[3]
) { ) {
$mytrue++; $mytrue++;
@ -2449,7 +2449,7 @@ class learnpathItem
foreach ($list as $cond) { foreach ($list as $cond) {
if (isset($items[$refs_list[$cond]])) { if (isset($items[$refs_list[$cond]])) {
$status = $items[$refs_list[$cond]]->get_status(true); $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] $status == $this->possible_status[3]
) { ) {
$mycond = true; $mycond = true;
@ -2511,7 +2511,7 @@ class learnpathItem
// 1. Checking the status in current items. // 1. Checking the status in current items.
$status = $items[$refs_list[$prereqs_string]]->get_status(true); $status = $items[$refs_list[$prereqs_string]]->get_status(true);
$returnstatus = $status == $this->possible_status[2] OR $status == $this->possible_status[3]; $returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3];
if (!$returnstatus) { if (!$returnstatus) {
if (self::debug > 1) { if (self::debug > 1) {
@ -2596,7 +2596,7 @@ class learnpathItem
return $returnstatus; return $returnstatus;
} else { } else {
$status = $items[$refs_list[$prereqs_string]]->get_status(false); $status = $items[$refs_list[$prereqs_string]]->get_status(false);
$returnstatus = $status == $this->possible_status[2] OR $status == $this->possible_status[3]; $returnstatus = $status == $this->possible_status[2] || $status == $this->possible_status[3];
if (!$returnstatus) { if (!$returnstatus) {
if (self::debug > 1) { if (self::debug > 1) {
@ -2614,7 +2614,6 @@ class learnpathItem
} }
} }
//$returnstatus = true;
if ($returnstatus && $this->prevent_reinit == 1) { if ($returnstatus && $this->prevent_reinit == 1) {
// I would prefer check in the database. // I would prefer check in the database.
$lp_item_view = Database::get_course_table( $lp_item_view = Database::get_course_table(
@ -2625,22 +2624,30 @@ class learnpathItem
); );
$sql = 'SELECT id FROM ' . $lp_view . ' $sql = 'SELECT id FROM ' . $lp_view . '
WHERE c_id = ' . $course_id . ' AND user_id = ' . $user_id . ' AND lp_id = ' . $this->lp_id . ' LIMIT 0, 1'; WHERE
c_id = ' . $course_id . ' AND
user_id = ' . $user_id . ' AND
lp_id = ' . $this->lp_id . '
LIMIT 0, 1';
$rs_lp = Database::query($sql); $rs_lp = Database::query($sql);
$lp_id = Database :: fetch_row( $lp_id = Database::fetch_row(
$rs_lp $rs_lp
); );
$my_lp_id = $lp_id[0]; $my_lp_id = $lp_id[0];
$sql = 'SELECT status FROM ' . $lp_item_view . ' $sql = 'SELECT status FROM ' . $lp_item_view . '
WHERE c_id = ' . $course_id . ' AND lp_view_id = ' . $my_lp_id . ' AND lp_item_id = ' . $refs_list[$prereqs_string] . ' LIMIT 0, 1'; WHERE
c_id = ' . $course_id . ' AND
lp_view_id = ' . $my_lp_id . ' AND
lp_item_id = ' . $refs_list[$prereqs_string] . '
LIMIT 0, 1';
$rs_lp = Database::query($sql); $rs_lp = Database::query($sql);
$status_array = Database :: fetch_row( $status_array = Database::fetch_row(
$rs_lp $rs_lp
); );
$status = $status_array[0]; $status = $status_array[0];
$returnstatus = (($status == $this->possible_status[2]) OR ($status == $this->possible_status[3])); $returnstatus = ($status == $this->possible_status[2]) || ($status == $this->possible_status[3]);
if (!$returnstatus && empty($this->prereq_alert)) { if (!$returnstatus && empty($this->prereq_alert)) {
$this->prereq_alert = get_lang( $this->prereq_alert = get_lang(
'LearnpathPrereqNotCompleted' 'LearnpathPrereqNotCompleted'
@ -2726,7 +2733,7 @@ class learnpathItem
} }
if (isset($items[$refs_list[$list[0]]])) { if (isset($items[$refs_list[$list[0]]])) {
$status = $items[$refs_list[$list[0]]]->get_status(true); $status = $items[$refs_list[$list[0]]]->get_status(true);
$returnstatus = (($status == 'completed') OR ($status == 'passed')); $returnstatus = (($status == 'completed') || ($status == 'passed'));
if (!$returnstatus && empty($this->prereq_alert)) { if (!$returnstatus && empty($this->prereq_alert)) {
$this->prereq_alert = get_lang( $this->prereq_alert = get_lang(
'LearnpathPrereqNotCompleted' 'LearnpathPrereqNotCompleted'
@ -3232,8 +3239,7 @@ class learnpathItem
} }
/** /**
* Sets the score value. If the mastery_score is set and the score reaches * Sets the score value.
* it, then set the status to 'passed'.
* @param float $score Score * @param float $score Score
* @return boolean True on success, false otherwise * @return boolean True on success, false otherwise
*/ */
@ -3253,23 +3259,6 @@ class learnpathItem
$masteryScore = $this->max_score; $masteryScore = $this->max_score;
} }
if ($debug > 0) {
error_log('get_mastery_score: ' . $masteryScore);
error_log('current_status: ' . $current_status);
error_log('current score : ' . $this->current_score);
}
// If mastery_score is set AND the current score reaches the mastery
// score AND the current status is different from 'completed', then
// set it to 'passed'.
/*
if ($master != -1 && $this->current_score >= $master && $current_status != $this->possible_status[2]) {
if ($debug > 0) error_log('Status changed to: '.$this->possible_status[3]);
$this->set_status($this->possible_status[3]); //passed
} elseif ($master != -1 && $this->current_score < $master) {
if ($debug > 0) error_log('Status changed to: '.$this->possible_status[4]);
$this->set_status($this->possible_status[4]); //failed
}*/
return true; return true;
} }
return false; return false;
@ -3286,7 +3275,7 @@ class learnpathItem
if (self::debug > 0) { if (self::debug > 0) {
error_log('learnpathItem::set_max_score(' . $score . ')', 0); error_log('learnpathItem::set_max_score(' . $score . ')', 0);
} }
if (is_int($score) or $score == '') { if (is_int($score) || $score == '') {
$this->view_max_score = $score; $this->view_max_score = $score;
if (self::debug > 1) { if (self::debug > 1) {
error_log( error_log(
@ -3777,7 +3766,7 @@ class learnpathItem
} }
if ((($save === false && $this->type == 'sco') || if ((($save === false && $this->type == 'sco') ||
($this->type == 'sco' && ($credit == 'no-credit' OR $mode == 'review' OR $mode == 'browse'))) && ($this->type == 'sco' && ($credit == 'no-credit' || $mode == 'review' || $mode == 'browse'))) &&
($this->seriousgame_mode != 1 && $this->type == 'sco') ($this->seriousgame_mode != 1 && $this->type == 'sco')
) { ) {
if (self::debug > 1) { if (self::debug > 1) {

@ -136,7 +136,6 @@ function save_item(
if (isset($score) && $score != -1) { if (isset($score) && $score != -1) {
if ($debug > 1) { if ($debug > 1) {
error_log('Calling set_score('.$score.')', 0); error_log('Calling set_score('.$score.')', 0);
error_log('set_score changes the status to failed/passed if mastery score is provided', 0);
} }
$myLPI->set_score($score); $myLPI->set_score($score);
@ -459,7 +458,8 @@ function save_item(
$sql = "SELECT login_id, login_date $sql = "SELECT login_id, login_date
FROM $tbl_track_login FROM $tbl_track_login
WHERE login_user_id= ".api_get_user_id()." WHERE login_user_id= ".api_get_user_id()."
ORDER BY login_date DESC LIMIT 0,1"; ORDER BY login_date DESC
LIMIT 0,1";
$q_last_connection = Database::query($sql); $q_last_connection = Database::query($sql);
if (Database::num_rows($q_last_connection) > 0) { if (Database::num_rows($q_last_connection) > 0) {

Loading…
Cancel
Save