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. 7
      index.php
  2. 16
      main/inc/lib/custom_pages.class.php
  3. 46
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_automatic.js
  4. 22
      main/inc/lib/fckeditor/editor/plugins/glossary/fck_glossary_manual.js
  5. 59
      main/newscorm/learnpathItem.class.php
  6. 8
      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('user_image_block', $controller->return_user_image_block());
if (api_is_platform_admin()) {
$controller->tpl->assign('course_block', $controller->return_course_block());
} else {
$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
}
$controller->tpl->assign('course_block', $controller->return_course_block());
//$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
}
$hot_courses = null;

@ -2,7 +2,7 @@
/**
* Used to implement the loading of custom pages
*
*
* @license see /license.txt
* @author 2011, Jean-Karim Bockstael <jeankarim@cblue.be>
* @author Laurent Opprecht <laurent@opprecht.info> for the Univesity of Geneva
@ -27,7 +27,7 @@ class CustomPages
/**
* Returns the path to a custom page.
*
*
* @param string $name
* @return string
*/
@ -38,7 +38,7 @@ class CustomPages
/**
* If enabled display a custom page and exist. Otherwise log error and returns.
*
*
* @param string $page_name
* @param array $content used to path data to the custom page
*/
@ -53,15 +53,15 @@ class CustomPages
include($file);
exit;
} else {
error_log('CustomPages::displayPage : could not read file ' . $file_name);
error_log('CustomPages::displayPage : could not read file ' . $file);
}
}
/**
* Does not look like this function is being used is being used
*
* Does not look like this function is being used is being used
*
* @param type $url_id
* @return string
* @return string
*/
public static function getURLImages($url_id = null)
{
@ -79,4 +79,4 @@ class CustomPages
return $images;
}
}
}

@ -5,33 +5,35 @@
* document/showinframes.php
* newscorm/lp_view.php
* newscorm/scorm_api.php
*
*
*/
/*$(document).ready(function() {
$(window).load(function() {
*/
*/
my_protocol = location.protocol;
my_pathname=location.pathname;
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({
contentType: "application/x-www-form-urlencoded",
beforeSend: function(content_object) {},
type: "POST",
url: my_protocol+"//"+location.host+work_path+"/main/glossary/glossary_ajax_request.php",
url: glossaryAjaxUrl,
data: "glossary_data=true",
success: function(datas) {
if (datas.length==0) {
return false;
}
// glossary terms
// glossary terms
data_terms=datas.split("[|.|_|.|-|.|]");
var complex_array = new Array();
var cp_complex_array = new Array();
for(i=0;i<data_terms.length;i++) {
specific_terms=data_terms[i].split("__|__|");
var real_term = specific_terms[1]; // glossary term
var real_term = specific_terms[1]; // glossary term
var real_code = specific_terms[0]; // glossary id
complex_array[real_code] = real_term;
cp_complex_array[real_code] = real_term;
@ -55,8 +57,8 @@
}
}
//alert(n + ' ' + my_index);
$('body').removeHighlight().highlight(n,my_index)
}
$('body').removeHighlight().highlight(n,my_index)
}
}
var complex_array = new Array();
@ -67,19 +69,19 @@
//mouse on click
$("body").on("click", ".glossary-ajax", function(e) {
random_id = Math.round(Math.random()*100);
//div_show_id = "div_show_id"+random_id;
//div_content_id = "div_content_id"+random_id;
div_show_id = "div_show_id";
div_content_id = "div_content_id";
$(this).append("<div id="+div_show_id+"><div id="+div_content_id+">&nbsp;</div></div>");
//$("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
//$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");
var $target = $(this);
var $target = $(this);
$("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({
autoOpen: false,
@ -91,25 +93,25 @@
$("div#"+div_content_id).remove();
}
});
notebook_id = $(this).attr("name");
data_notebook = notebook_id.split("link");
my_glossary_id = data_notebook[1];
$.ajax({
contentType: "application/x-www-form-urlencoded",
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",
url: "../../../../../../../main/glossary/glossary_ajax_request.php",
url: glossaryAjaxUrl,
data: "glossary_id="+my_glossary_id,
success: function(datas) {
$("div#"+div_content_id).html(datas);
$("#"+div_show_id).dialog("open");
}
});
});
//mouse out event
@ -118,18 +120,18 @@
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});*/
//mouse click
/*$("body").on("click", ".glossary-ajax", function(){
var current_element = $(this);
div_show_id=current_element.find("div").attr("id");
$("div#"+div_show_id).remove();
});*/
}
});
/*
/*
});
});*/

@ -12,11 +12,13 @@ newscorm/scorm_api.php
// $(window).load(function () {
my_protocol = location.protocol;
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").on("click", ".glossary", function() {
is_glossary_name = $(this).html();
is_glossary_name = $(this).html();
random_id = Math.round(Math.random()*100);
/*div_show_id="div_show_id"+random_id;
@ -24,10 +26,10 @@ newscorm/scorm_api.php
div_show_id="div_show_id";
div_content_id="div_content_id";
$(this).append("<div id="+div_show_id+" ><div id="+div_content_id+">&nbsp;</div></div>");
var $target = $(this);
var $target = $(this);
$("#"+div_show_id).dialog("destroy");
$("#"+div_show_id).dialog({
@ -42,17 +44,17 @@ newscorm/scorm_api.php
});
/* $("div#"+div_show_id).attr("style","z-index:99;display:inline;float:left;position:absolute;background-color:#F2F2F2;border-bottom: 1px solid #2E2E2E;border-right: 1px solid #2E2E2E;border-left: 1px solid #2E2E2E;border-top: 1px solid #2E2E2E;color:#305582;margin-left:5px;margin-right:5px;");
$("div#"+div_content_id).attr("style","z-index:99;background-color:#F2F2F2;color:#0B3861;margin-left:8px;margin-right:8px;margin-top:5px;margin-bottom:5px;");*/
$.ajax({
contentType: "application/x-www-form-urlencoded",
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",
url: "../../../../../../../main/glossary/glossary_ajax_request.php",
url: glossaryAjaxUrl,
data: "glossary_name="+is_glossary_name,
success: function(data) {
$("div#"+div_content_id).html(data);
@ -60,7 +62,7 @@ newscorm/scorm_api.php
}
});
});
/*
$("body .glossary").mouseout(function(){
current_element=$(this);
@ -68,6 +70,6 @@ newscorm/scorm_api.php
$("div#"+div_show_id).remove();
});
*/
// });
//});

@ -285,7 +285,7 @@ class learnpathItem
$this->current_stop_time = time();
$type = $this->get_type();
if ($type != 'sco') {
if ($type == TOOL_QUIZ or $type == TOOL_HOTPOTATOES) {
if ($type == TOOL_QUIZ || $type == TOOL_HOTPOTATOES) {
$this->get_status(
true,
true
@ -1943,7 +1943,7 @@ class learnpathItem
$this->current_start_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) {
error_log(
@ -2247,7 +2247,7 @@ class learnpathItem
} else {
if (isset($items[$refs_list[$list[0]]])) {
$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) {
$this->prereq_alert = get_lang('LearnpathPrereqNotCompleted');
}
@ -2401,7 +2401,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]
) {
$mytrue++;
@ -2449,7 +2449,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;
@ -2511,7 +2511,7 @@ class learnpathItem
// 1. Checking the status in current items.
$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 (self::debug > 1) {
@ -2596,7 +2596,7 @@ class learnpathItem
return $returnstatus;
} else {
$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 (self::debug > 1) {
@ -2614,7 +2614,6 @@ class learnpathItem
}
}
//$returnstatus = true;
if ($returnstatus && $this->prevent_reinit == 1) {
// I would prefer check in the database.
$lp_item_view = Database::get_course_table(
@ -2625,22 +2624,30 @@ class learnpathItem
);
$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);
$lp_id = Database :: fetch_row(
$lp_id = Database::fetch_row(
$rs_lp
);
$my_lp_id = $lp_id[0];
$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);
$status_array = Database :: fetch_row(
$status_array = Database::fetch_row(
$rs_lp
);
$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)) {
$this->prereq_alert = get_lang(
'LearnpathPrereqNotCompleted'
@ -2726,7 +2733,7 @@ class learnpathItem
}
if (isset($items[$refs_list[$list[0]]])) {
$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)) {
$this->prereq_alert = get_lang(
'LearnpathPrereqNotCompleted'
@ -3232,8 +3239,7 @@ class learnpathItem
}
/**
* Sets the score value. If the mastery_score is set and the score reaches
* it, then set the status to 'passed'.
* Sets the score value.
* @param float $score Score
* @return boolean True on success, false otherwise
*/
@ -3253,23 +3259,6 @@ class learnpathItem
$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 false;
@ -3286,7 +3275,7 @@ class learnpathItem
if (self::debug > 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;
if (self::debug > 1) {
error_log(
@ -3777,7 +3766,7 @@ class learnpathItem
}
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')
) {
if (self::debug > 1) {

@ -136,7 +136,6 @@ function save_item(
if (isset($score) && $score != -1) {
if ($debug > 1) {
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);
@ -457,9 +456,10 @@ function save_item(
$tbl_track_login = Database :: get_statistic_table(TABLE_STATISTIC_TRACK_E_LOGIN);
$sql = "SELECT login_id, login_date
FROM $tbl_track_login
WHERE login_user_id= ".api_get_user_id()."
ORDER BY login_date DESC LIMIT 0,1";
FROM $tbl_track_login
WHERE login_user_id= ".api_get_user_id()."
ORDER BY login_date DESC
LIMIT 0,1";
$q_last_connection = Database::query($sql);
if (Database::num_rows($q_last_connection) > 0) {

Loading…
Cancel
Save