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

1.9.x
Yannick Warnier 11 years ago
commit eaff3649e9
  1. 10
      index.php
  2. 900
      main/admin/configure_homepage.php
  3. 8
      main/admin/sub_language.class.php
  4. 1
      main/course_home/activity.php
  5. 26
      main/course_home/course_home.php
  6. 55
      main/exercice/question_admin.inc.php
  7. 27
      main/exercice/question_create.php
  8. 347
      main/exercice/question_list_admin.inc.php
  9. 15
      main/exercice/testheaderpage.php
  10. 1
      main/exercice/unique_answer.class.php
  11. 7
      main/exercice/upload_exercise.php
  12. 3
      main/gradebook/gradebook_display_certificate.php
  13. 2
      main/gradebook/gradebook_flatview.php
  14. 6
      main/gradebook/index.php
  15. 1
      main/gradebook/lib/be/abstractlink.class.php
  16. 3
      main/gradebook/lib/be/attendancelink.class.php
  17. 45
      main/gradebook/lib/be/category.class.php
  18. 4
      main/gradebook/lib/be/evallink.class.php
  19. 17
      main/gradebook/lib/be/exerciselink.class.php
  20. 2
      main/gradebook/lib/be/learnpathlink.class.php
  21. 7
      main/gradebook/lib/be/studentpublicationlink.class.php
  22. 35
      main/gradebook/lib/be/surveylink.class.php
  23. 14
      main/gradebook/lib/fe/displaygradebook.php
  24. 25
      main/gradebook/lib/flatview_data_generator.class.php
  25. 15
      main/gradebook/lib/gradebook_functions.inc.php
  26. 74
      main/gradebook/lib/gradebook_functions_users.inc.php
  27. 47
      main/inc/introductionSection.inc.php
  28. 8
      main/inc/lib/display.lib.php
  29. 16
      main/inc/lib/internationalization.lib.php
  30. 8
      main/inc/lib/internationalization_database/name_order_conventions.php
  31. 30
      main/inc/lib/internationalization_internal.lib.php
  32. 26
      main/inc/lib/main_api.lib.php
  33. 2
      main/inc/lib/sessionmanager.lib.php
  34. 63
      main/inc/lib/userportal.lib.php
  35. 4
      main/install/configuration.dist.php
  36. 35
      main/mySpace/myStudents.php
  37. 2
      main/webservices/rest.php

@ -118,8 +118,7 @@ if (!empty($_POST['submitAuth'])) {
}
}
// End login -- if ($_POST['submitAuth'])
}
else {
} else {
// Only if login form was not sent because if the form is sent the user was already on the page.
event_open();
}
@ -142,8 +141,7 @@ if (!api_is_anonymous()) {
if (api_is_platform_admin()) {
$controller->tpl->assign('course_block', $controller->return_course_block());
}
else {
} else {
$controller->tpl->assign('teacher_block', $controller->return_teacher_link());
}
}
@ -163,9 +161,7 @@ if (!isset($_REQUEST['include'])) {
$controller->tpl->assign('hot_courses', $hot_courses);
$controller->tpl->assign('announcements_block', $announcements_block);
$controller->tpl->assign('home_page_block', $controller->return_home_page());
$controller->tpl->assign('navigation_course_links', $controller->return_navigation_links());
$controller->tpl->assign('notice_block', $controller->return_notice());
$controller->tpl->assign('main_navigation_block', $controller->return_navigation_links());
$controller->tpl->assign('help_block', $controller->return_help());
@ -183,7 +179,7 @@ if (isset($_GET['firstpage'])) {
api_set_firstpage_parameter($_GET['firstpage']);
// if we are already logged, go directly to course
if (api_user_is_login()) {
echo "<script type='text/javascript'>self.location.href='index.php?firstpage=".$_GET['firstpage']."'</script>";
echo "<script type='text/javascript'>self.location.href='index.php?firstpage=".Security::remove_XSS($_GET['firstpage'])."'</script>";
}
} else {
api_delete_firstpage_parameter();

File diff suppressed because it is too large Load Diff

@ -412,8 +412,9 @@ class SubLanguageManager
// select language - if case several languages match, get the last (more recent) one
$sql = "SELECT english_name
FROM " . $adminLanguagesTable . "
WHERE isocode ='$isocode'
AND available = 1
WHERE
isocode ='$isocode' AND
available = 1
ORDER BY id
DESC LIMIT 1";
$res = Database::query($sql);
@ -434,7 +435,9 @@ class SubLanguageManager
if (empty($preferences)) {
return false;
}
$preferencesArray = explode(',', $preferences);
if (count($preferencesArray) > 0) {
foreach ($preferencesArray as $pref) {
$s = strpos($pref, ';');
@ -444,6 +447,7 @@ class SubLanguageManager
$code = $pref;
}
$name = self::getLanguageFromIsocode($code);
if ($name !== false) {
return $name;
}

@ -65,7 +65,6 @@ if ($enabled == 'true') {
// COURSE ADMIN ONLY VIEW
// Start of tools for CourseAdmins (teachers/tutors)
if ($session_id == 0 && api_is_course_admin() && api_is_allowed_to_edit(null, true)) {
$content .= '<div class="courseadminview" style="border:0px; margin-top: 0px;padding:0px;">
<div class="normal-message" id="id_normal_message" style="display:none">';

@ -28,13 +28,10 @@
* @package chamilo.course_home
*/
/* INIT SECTION */
use \ChamiloSession as Session;
// Name of the language file that needs to be included.
$language_file = array('course_home','courses');
$language_file = array('course_home', 'courses');
$use_anonymous = true;
// Inlcuding the global initialization file.
@ -48,9 +45,7 @@ require_once dirname(__FILE__).'/../inc/global.inc.php';
//unset($_SESSION['lpobject']);
$htmlHeadXtra[] ='<script>
/* option show/hide thematic-block */
$(document).ready(function(){
$("#thematic-show").click(function(){
$(".btn-hide-thematic").hide();
@ -64,7 +59,6 @@ $(document).ready(function(){
});
});
$(document).ready(function() {
$(".make_visible_and_invisible").attr("href", "javascript:void(0);");
$(".make_visible_and_invisible > img").click(function () {
@ -119,7 +113,6 @@ $(document).ready(function() {
});
});
</script>';
// The section for the tabs
@ -140,11 +133,11 @@ define('TOOL_DRH', 'tool_drh');
define('TOOL_STUDENT_VIEW', 'toolstudentview');
define('TOOL_ADMIN_VISIBLE', 'tooladminvisible');
$user_id = api_get_user_id();
$course_code = api_get_course_id();
$user_id = api_get_user_id();
$course_code = api_get_course_id();
$show_message = '';
//Deleting group session
// Deleting group session
Session::erase('toolgroup');
Session::erase('_gid');
@ -255,12 +248,15 @@ $content = Display::return_introduction_section(TOOL_COURSE_HOMEPAGE, array(
the setting homepage_view is adjustable through
the platform administration section */
//require_once api_get_path(LIBRARY_PATH).'course_home.lib.php';
if ($show_autolunch_lp_warning) {
$show_message .= Display::return_message(get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'),'warning');
$show_message .= Display::return_message(
get_lang('TheLPAutoLaunchSettingIsONStudentsWillBeRedirectToAnSpecificLP'),
'warning'
);
}
if (api_get_setting('homepage_view') == 'activity' || api_get_setting('homepage_view') == 'activity_big') {
if (api_get_setting('homepage_view') == 'activity' ||
api_get_setting('homepage_view') == 'activity_big'
) {
require 'activity.php';
} elseif (api_get_setting('homepage_view') == '2column') {
require '2column.php';

@ -1,15 +1,13 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Statement (?) administration
* This script allows to manage the statements of questions.
* It is included from the script admin.php
* @package chamilo.exercise
* @author Olivier Brouckaert
* @version $Id: question_admin.inc.php 22126 2009-07-15 22:38:39Z juliomontoya $
*/
/**
* Code
* Statement (?) administration
* This script allows to manage the statements of questions.
* It is included from the script admin.php
* @package chamilo.exercise
* @author Olivier Brouckaert
* @version $Id: question_admin.inc.php 22126 2009-07-15 22:38:39Z juliomontoya $
*/
// INIT QUESTION
@ -44,7 +42,6 @@ if (is_object($objQuestion)) {
$objQuestion->createForm($form);
// answer form elements
$objQuestion->createAnswersForm($form);
// this variable $show_quiz_edition comes from admin.php blocks the exercise/quiz modifications
@ -56,29 +53,29 @@ if (is_object($objQuestion)) {
if (isset($_POST['submitQuestion']) && $form->validate()) {
// question
$objQuestion->processCreation($form, $objExercise);
$objQuestion->processCreation($form, $objExercise);
// answers
$nb_answers = isset($nb_answers) ? $nb_answers : 0;
$objQuestion->processAnswersCreation($form, $nb_answers);
// answers
$nb_answers = isset($nb_answers) ? $nb_answers : 0;
$objQuestion->processAnswersCreation($form, $nb_answers);
// TODO: maybe here is the better place to index this tool, including answers text
// TODO: maybe here is the better place to index this tool, including answers text
// redirect
if ($objQuestion->type != HOT_SPOT && $objQuestion->type != HOT_SPOT_DELINEATION) {
if(isset($_GET['editQuestion'])) {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&message=ItemUpdated"</script>';
} else {
//New question
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&message=ItemAdded"</script>';
}
} else {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&hotspotadmin='.$objQuestion->id.'"</script>';
}
// redirect
if ($objQuestion->type != HOT_SPOT && $objQuestion->type != HOT_SPOT_DELINEATION) {
if(isset($_GET['editQuestion'])) {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&message=ItemUpdated"</script>';
} else {
//New question
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&message=ItemAdded"</script>';
}
} else {
echo '<script type="text/javascript">window.location.href="admin.php?exerciseId='.$exerciseId.'&hotspotadmin='.$objQuestion->id.'"</script>';
}
} else {
if (isset($questionName)) {
echo '<h3>'.$questionName.'</h3>';
}
if (isset($questionName)) {
echo '<h3>'.$questionName.'</h3>';
}
if (!empty($pictureName)) {
echo '<img src="../document/download.php?doc_url=%2Fimages%2F'.$pictureName.'" border="0">';
}

@ -1,12 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Exercise
* @package chamilo.exercise
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file='exercice';
@ -36,7 +35,7 @@ $form->addElement('header','',get_lang('AddQuestionToExercise'));
$question_list = Question::get_question_type_list();
$question_list_options = array();
foreach ($question_list as $key=> $value) {
foreach ($question_list as $key=> $value) {
$question_list_options[$key] = addslashes(get_lang($value[1]));
}
$form->addElement('select', 'question_type_hidden', get_lang('QuestionType'), $question_list_options, array('id' => 'question_type_hidden'));
@ -72,26 +71,26 @@ $form->addRule('question_type_hidden', get_lang('InvalidQuestionType'), 'validqu
if ($form->validate()) {
$values = $form->exportValues();
$answer_type = $values['question_type_hidden'];
// check feedback_type from current exercise for type of question delineation
$exercise_id = intval($values['exercice']);
$exercise_id = intval($values['exercice']);
$sql = "SELECT feedback_type FROM $tbl_exercices WHERE c_id = $course_id AND id = '$exercise_id'";
$rs_feedback_type = Database::query($sql);
$row_feedback_type = Database::fetch_row($rs_feedback_type);
$feedback_type = $row_feedback_type[0];
// if question type does not belong to self-evaluation (immediate feedback) it'll send an error
if (($answer_type == HOT_SPOT_DELINEATION && $feedback_type != 1) ||
if (($answer_type == HOT_SPOT_DELINEATION && $feedback_type != 1) ||
($feedback_type == 1 && ($answer_type != HOT_SPOT_DELINEATION && $answer_type != UNIQUE_ANSWER))) {
header('Location: question_create.php?'.api_get_cidreq().'&error=true');
exit;
}
exit;
}
header('Location: admin.php?exerciseId='.$values['exercice'].'&newQuestion=yes&isContent='.$values['is_content'].'&answerType='.$answer_type);
exit;
} else {
// header
Display::display_header($nameTools);
echo '<div class="actions">';
echo '<a href="exercice.php?show=test">'.Display :: return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
@ -104,13 +103,13 @@ if ($form->validate()) {
}
function check_question_type($parameter) {
$question_list = Question::get_question_type_list();
$question_list = Question::get_question_type_list();
foreach ($question_list as $key => $value) {
$valid_question_types[] = $key;
}
}
if (in_array($parameter, $valid_question_types)) {
return true;
} else {
return false;
}
}
}

@ -1,128 +1,127 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Code library for HotPotatoes integration.
* @package chamilo.exercise
* @author Olivier Brouckaert & Julio Montoya & Hubert Borderiou 21-10-2011 (Question by category)
* Code library for HotPotatoes integration.
* @package chamilo.exercise
* @author Olivier Brouckaert & Julio Montoya & Hubert Borderiou 21-10-2011 (Question by category)
* QUESTION LIST ADMINISTRATION
*
* This script allows to manage the question list
* It is included from the script admin.php
*/
* QUESTION LIST ADMINISTRATION
*
* This script allows to manage the question list
* It is included from the script admin.php
*/
// deletes a question from the exercise (not from the data base)
if ($deleteQuestion) {
// if the question exists
if ($objQuestionTmp = Question::read($deleteQuestion)) {
$objQuestionTmp->delete($exerciseId);
// if the question exists
if ($objQuestionTmp = Question::read($deleteQuestion)) {
$objQuestionTmp->delete($exerciseId);
// if the question has been removed from the exercise
if ($objExercise->removeFromList($deleteQuestion)) {
$nbrQuestions--;
}
}
// destruction of the Question object
unset($objQuestionTmp);
// if the question has been removed from the exercise
if ($objExercise->removeFromList($deleteQuestion)) {
$nbrQuestions--;
}
}
// destruction of the Question object
unset($objQuestionTmp);
}
$ajax_url = api_get_path(WEB_AJAX_PATH)."exercise.ajax.php?".api_get_cidreq()."&exercise_id=".intval($exerciseId);
?>
<style>
.ui-state-highlight { height: 30px; line-height: 1.2em; }
/*Fixes edition buttons*/
.ui-accordion-icons .ui-accordion-header .edition a {
padding-left:4px;
}
</style>
<style>
.ui-state-highlight { height: 30px; line-height: 1.2em; }
/*Fixes edition buttons*/
.ui-accordion-icons .ui-accordion-header .edition a {
padding-left:4px;
}
</style>
<div id="dialog-confirm" title="<?php echo get_lang("ConfirmYourChoice"); ?>" style="display:none;">
<p>
<div id="dialog-confirm" title="<?php echo get_lang("ConfirmYourChoice"); ?>" style="display:none;">
<p>
<span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0; display:none;">
</span>
<?php echo get_lang("AreYouSureToDelete"); ?>
</p>
</div>
<script>
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
autoOpen: false,
show: "blind",
resizable: false,
height:150,
modal: false
});
<?php echo get_lang("AreYouSureToDelete"); ?>
</p>
</div>
$(".opener").click(function() {
var targetUrl = $(this).attr("href");
$( "#dialog-confirm" ).dialog({
modal: true,
buttons: {
"<?php echo get_lang("Yes"); ?>": function() {
location.href = targetUrl;
$( this ).dialog( "close" );
},
"<?php echo get_lang("No"); ?>": function() {
$( this ).dialog( "close" );
}
}
});
$( "#dialog-confirm" ).dialog("open");
return false;
});
<script>
$(function() {
$( "#dialog:ui-dialog" ).dialog( "destroy" );
$( "#dialog-confirm" ).dialog({
autoOpen: false,
show: "blind",
resizable: false,
height:150,
modal: false
});
var stop = false;
$( "#question_list h3" ).click(function( event ) {
if ( stop ) {
event.stopImmediatePropagation();
event.preventDefault();
stop = false;
}
});
$(".opener").click(function() {
var targetUrl = $(this).attr("href");
$( "#dialog-confirm" ).dialog({
modal: true,
buttons: {
"<?php echo get_lang("Yes"); ?>": function() {
location.href = targetUrl;
$( this ).dialog( "close" );
var icons = {
header: "ui-icon-circle-arrow-e",
headerSelected: "ui-icon-circle-arrow-s"
};
},
"<?php echo get_lang("No"); ?>": function() {
$( this ).dialog( "close" );
}
}
});
$( "#dialog-confirm" ).dialog("open");
return false;
});
var stop = false;
$( "#question_list h3" ).click(function( event ) {
if ( stop ) {
event.stopImmediatePropagation();
event.preventDefault();
stop = false;
}
});
/* We can add links in the accordion header */
$("div > div > div > .edition > div > a").click(function() {
//Avoid the redirecto when selecting the delete button
if (this.id.indexOf('delete') == -1) {
newWind = window.open(this.href,"_self");
newWind.focus();
return false;
}
});
var icons = {
header: "ui-icon-circle-arrow-e",
headerSelected: "ui-icon-circle-arrow-s"
};
$( "#question_list" ).accordion({
icons: icons,
autoHeight: false,
active: false, // all items closed by default
collapsible: true,
header: ".header_operations"
})
/* We can add links in the accordion header */
$("div > div > div > .edition > div > a").click(function() {
//Avoid the redirecto when selecting the delete button
if (this.id.indexOf('delete') == -1) {
newWind = window.open(this.href,"_self");
newWind.focus();
return false;
}
});
.sortable({
cursor: "move", // works?
update: function(event, ui) {
var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']);?>";
$.post("<?php echo $ajax_url ?>", order, function(reponse){
$("#message").html(reponse);
$( "#question_list" ).accordion({
icons: icons,
autoHeight: false,
active: false, // all items closed by default
collapsible: true,
header: ".header_operations"
})
.sortable({
cursor: "move", // works?
update: function(event, ui) {
var order = $(this).sortable("serialize") + "&a=update_question_order&exercise_id=<?php echo intval($_GET['exerciseId']);?>";
$.post("<?php echo $ajax_url ?>", order, function(reponse){
$("#message").html(reponse);
});
},
axis: "y",
placeholder: "ui-state-highlight", //defines the yellow highlight
handle: ".moved", //only the class "moved"
stop: function() {
stop = true;
}
});
},
axis: "y",
placeholder: "ui-state-highlight", //defines the yellow highlight
handle: ".moved", //only the class "moved"
stop: function() {
stop = true;
}
});
});
</script>
});
</script>
<?php
//we filter the type of questions we can add
@ -136,7 +135,7 @@ unset($_SESSION['less_answer']);
// If we are in a test
$inATest = isset($exerciseId) && $exerciseId > 0;
if (!$inATest) {
echo "<p class='warning-message'>".get_lang("ChoiceQuestionType")."</p>";
echo "<p class='warning-message'>".get_lang("ChoiceQuestionType")."</p>";
} else {
// Title line
echo "<div>";
@ -149,7 +148,7 @@ if (!$inATest) {
echo "<div style='clear:both'>&nbsp;</div>";
echo '<div id="question_list">';
if ($nbrQuestions) {
if ($nbrQuestions) {
//Always getting list from DB
$questionList = $objExercise->selectQuestionList(true);
@ -161,65 +160,69 @@ if (!$inATest) {
$styleScore = "width:4%; float:left; padding-top:8px; text-align:center;";
if (is_array($questionList)) {
foreach ($questionList as $id) {
//To avoid warning messages
if (!is_numeric($id)) {
continue;
}
$objQuestionTmp = Question::read($id);
$question_class = get_class($objQuestionTmp);
foreach ($questionList as $id) {
//To avoid warning messages
if (!is_numeric($id)) {
continue;
}
$objQuestionTmp = Question::read($id);
$question_class = get_class($objQuestionTmp);
$clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
/*$edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
$clone_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&clone_question='.$id.'">'.Display::return_icon('cd.gif',get_lang('Copy'), array(), ICON_SIZE_SMALL).'</a>';
/*$edit_link = '<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.Display::return_icon('edit.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
if ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) {
$edit_link = '<a>'.Display::return_icon('edit_na.png',get_lang('Modify'), array(), ICON_SIZE_SMALL).'</a>';
}*/
$edit_link = ($objQuestionTmp->type == CALCULATED_ANSWER && $objQuestionTmp->isAnswered()) ?
'<a>'.Display::return_icon(
'edit_na.png',
get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'),
array(),
ICON_SIZE_SMALL
).'</a>' :
'<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.
$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.
Display::return_icon(
'edit.png',
get_lang('Modify'),
array(),
ICON_SIZE_SMALL
).'</a>';
'<a>'.Display::return_icon(
'edit_na.png',
get_lang('QuestionEditionNotAvailableBecauseItIsAlreadyAnsweredHoweverYouCanCopyItAndModifyTheCopy'),
array(),
ICON_SIZE_SMALL
).'</a>' :
'<a href="'.api_get_self().'?'.api_get_cidreq().'&type='.
$objQuestionTmp->selectType().'&myid=1&editQuestion='.$id.'">'.
Display::return_icon(
'edit.png',
get_lang('Modify'),
array(),
ICON_SIZE_SMALL
).'</a>';
$delete_link = null;
if ($objExercise->edit_exercise_in_lp == true) {
$delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
}
if ($objExercise->edit_exercise_in_lp == true) {
$delete_link = '<a id="delete_'.$id.'" class="opener" href="'.api_get_self().'?'.api_get_cidreq().'&exerciseId='.$exerciseId.'&deleteQuestion='.$id.'" >'.Display::return_icon('delete.png',get_lang('RemoveFromTest'), array(), ICON_SIZE_SMALL).'</a>';
}
$edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px'));
$clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px'));
$delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px'));
$actions = Display::tag('div', $edit_link.$clone_link.$delete_link, array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 0px; position: absolute; top: 10%;'));
$edit_link = Display::tag('div', $edit_link, array('style'=>'float:left; padding:0px; margin:0px'));
$clone_link = Display::tag('div', $clone_link, array('style'=>'float:left; padding:0px; margin:0px'));
$delete_link = Display::tag('div', $delete_link, array('style'=>'float:left; padding:0px; margin:0px'));
$actions = Display::tag('div', $edit_link.$clone_link.$delete_link, array('class'=>'edition','style'=>'width:100px; right:10px; margin-top: 0px; position: absolute; top: 10%;'));
$title = Security::remove_XSS($objQuestionTmp->selectTitle());
$move = Display::return_icon('all_directions.png',get_lang('Move'), array('class'=>'moved', 'style'=>'margin-bottom:-0.5em;'));
// Question name
$questionName = Display::tag('div', '<a href="#" title = "'.htmlentities($title).'">'.$move.' '.cut($title, 42).'</a>', array('style'=>$styleQuestion));
$questionName = Display::tag(
'div',
'<a href="#" title = "'.Security::remove_XSS($title).'">'.$move.' '.cut($title, 42).'</a>',
array('style'=>$styleQuestion)
);
// Question type
list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html();
$questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM), array('style'=>$styleType));
// Question type
list($typeImg, $typeExpl) = $objQuestionTmp->get_type_icon_html();
$questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM), array('style'=>$styleType));
// Question category
$txtQuestionCat = Security::remove_XSS(Testcategory::getCategoryNameForQuestion($objQuestionTmp->id));
if (empty($txtQuestionCat)) {
$txtQuestionCat = "-";
}
$questionCategory = Display::tag('div', '<a href="#" style="padding:0px; margin:0px;" title="'.$txtQuestionCat.'">'.cut($txtQuestionCat, 42).'</a>', array('style'=>$styleCat));
// Question category
$txtQuestionCat = Security::remove_XSS(Testcategory::getCategoryNameForQuestion($objQuestionTmp->id));
if (empty($txtQuestionCat)) {
$txtQuestionCat = "-";
}
$questionCategory = Display::tag('div', '<a href="#" style="padding:0px; margin:0px;" title="'.$txtQuestionCat.'">'.cut($txtQuestionCat, 42).'</a>', array('style'=>$styleCat));
// Question level
$txtQuestionLevel = $objQuestionTmp->level;
// Question level
$txtQuestionLevel = $objQuestionTmp->level;
if (empty($objQuestionTmp->level)) {
$txtQuestionLevel = '-';
}
@ -229,32 +232,32 @@ if (!$inATest) {
$questionScore = Display::tag('div', $objQuestionTmp->selectWeighting(), array('style'=>$styleScore));
echo '<div id="question_id_list_'.$id.'" >';
echo '<div class="header_operations">';
echo $questionName;
echo $questionType;
echo $questionCategory;
echo $questionLevel;
echo $questionScore;
echo $actions;
echo '</div>';
echo '<div class="question-list-description-block">';
echo '<p>';
//echo get_lang($question_class.$label);
echo get_lang($question_class);
echo '<br />';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
echo '<br />';
showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
echo '</p>';
echo '</div>';
echo '<div class="header_operations">';
echo $questionName;
echo $questionType;
echo $questionCategory;
echo $questionLevel;
echo $questionScore;
echo $actions;
echo '</div>';
echo '<div class="question-list-description-block">';
echo '<p>';
//echo get_lang($question_class.$label);
echo get_lang($question_class);
echo '<br />';
//echo get_lang('Level').': '.$objQuestionTmp->selectLevel();
echo '<br />';
showQuestion($id, false, null, null, false, true, false, true, $objExercise->feedback_type, true);
echo '</p>';
echo '</div>';
echo '</div>';
unset($objQuestionTmp);
}
}
}
}
}
}
if (!$nbrQuestions) {
echo Display::display_warning_message(get_lang('NoQuestion'));
}
echo '</div>'; //question list div
if (!$nbrQuestions) {
echo Display::display_warning_message(get_lang('NoQuestion'));
}
echo '</div>'; //question list div
}

@ -1,13 +1,12 @@
<?php //$id: $
<?php
/* For licensing terms, see /license.txt */
/**
* Code library for HotPotatoes integration.
* @package chamilo.exercise
* @author Istvan Mandak
*/
/**
* Code
*/
// name of the language file that needs to be included
$language_file='exercice';
@ -16,9 +15,7 @@ require '../inc/global.inc.php';
require_once(api_get_path(SYS_CODE_PATH).'exercice/hotpotatoes.lib.php');
$documentPath= api_get_path(SYS_COURSE_PATH).$_course['path']."/document";
$my_file = Security::remove_XSS($_GET['file']);
$my_file=str_replace(array('../','\\..','\\0','..\\'),array('','','',''),urldecode($my_file));
$title = GetQuizName($my_file,$documentPath);
if ($title =='') {
$title = basename($my_file);
@ -31,9 +28,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"=>"./exercice.php", "name"=> get_lang('Exercices'));
Display::display_header($nameTools,"Exercise");

@ -12,7 +12,6 @@
* @author Julio Montoya
* @package chamilo.exercise
**/
class UniqueAnswer extends Question
{
static $typePicture = 'mcua.png';

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Upload quiz: This script shows the upload quiz feature
* Initial work by Isaac flores on Nov 4 of 2010
@ -327,15 +328,15 @@ function lp_upload_quiz_action_handling() {
$globalScore = null;
$objAnswer = new Answer($question_id, $courseId);
$globalScore = $score_list[$i][3];
// Calculate the number of correct answers to divide the
// Calculate the number of correct answers to divide the
// score between them when importing from CSV
$numberRightAnswers = 0;
foreach ($answers_data as $answer_data) {
if (strtolower($answer_data[3]) == 'x') {
$numberRightAnswers++;
}
}
}
foreach ($answers_data as $answer_data) {
$answerValue = $answer_data[2];
$correct = 0;

@ -13,6 +13,9 @@ $current_course_tool = TOOL_GRADEBOOK;
api_protect_course_script();
set_time_limit(0);
ini_set('max_execution_time', 0);
require_once 'lib/gradebook_functions.inc.php';
require_once 'lib/be.inc.php';
require_once 'lib/gradebook_data_generator.class.php';

@ -99,7 +99,6 @@ if ($simple_search_form->validate() && (empty($keyword))) {
if (!empty($keyword)) {
$users = find_students($keyword);
} else {
if (isset($alleval) && isset($alllinks)) {
$users = get_all_users($alleval, $alllinks);
@ -107,7 +106,6 @@ if (!empty($keyword)) {
$users = null;
}
}
$offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
// Main course category

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Gradebook controller
* @package chamilo.gradebook
@ -126,7 +127,9 @@ if (isset($_GET['isStudentView'])) {
}
}
if ((isset($_GET['selectcat']) && $_GET['selectcat']>0) && (isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview')) {
if ((isset($_GET['selectcat']) && $_GET['selectcat']>0) &&
(isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview')
) {
Display :: display_header();
//Introduction tool: student view
Display::display_introduction_section(TOOL_GRADEBOOK, array('ToolbarSet' => 'AssessmentsIntroduction'));
@ -735,6 +738,7 @@ $no_qualification = false;
// Show certificate link.
$certificate = array();
if ($category != '0') {
$cat = new Category();
$category_id = intval($_GET['selectcat']);

@ -228,6 +228,7 @@ abstract class AbstractLink implements GradebookItem
$result = Database::query($sql);
$links = AbstractLink::create_objects_from_sql_result($result);
return $links;
}

@ -196,7 +196,8 @@ class AttendanceLink extends AbstractLink
return false;
}
public function get_name() {
public function get_name()
{
$this->get_attendance_data();
$attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
$attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';

@ -786,14 +786,14 @@ class Category implements GradebookItem
foreach ($links as $link) {
$linkres = $link->calc_score($stud_id);
if (isset($linkres) && $link->get_weight() != 0) {
$linkweight = $link->get_weight();
$link_res_denom = ($linkres[1] == 0) ? 1 : $linkres[1];
if (!empty($linkres) && $link->get_weight() != 0) {
$linkweight = $link->get_weight();
$link_res_denom = $linkres[1] == 0 ? 1 : $linkres[1];
$rescount++;
$weightsum += $linkweight;
$ressum += (($linkres[0] / $link_res_denom) * $linkweight);
$ressum += ($linkres[0] / $link_res_denom) * $linkweight;
} else {
// Ddding if result does not exists
// Adding if result does not exists
if ($link->get_weight() != 0) {
$linkweight = $link->get_weight();
$weightsum += $linkweight;
@ -1439,8 +1439,14 @@ class Category implements GradebookItem
$sessionId
);
if (!empty($subcats)) {
/** @var Category $subcat */
foreach ($subcats as $subcat) {
$sublinks = $subcat->get_links($stud_id, false, $course_code, $sessionId);
$sublinks = $subcat->get_links(
$stud_id,
false,
$course_code,
$sessionId
);
$links = array_merge($links, $sublinks);
}
}
@ -1567,10 +1573,19 @@ class Category implements GradebookItem
public static function register_user_certificate($category_id, $user_id)
{
// Generating the total score for a course
$cats_course = Category::load($category_id, null, null, null, null, api_get_session_id(), false);
$alleval_course = $cats_course[0]->get_evaluations($user_id, true);
$alllink_course = $cats_course[0]->get_links($user_id, true);
$cats_course = Category::load(
$category_id,
null,
null,
null,
null,
api_get_session_id(),
false
);
/** @var Category $category */
$category = $cats_course[0];
$alleval_course = $category->get_evaluations($user_id, true);
$alllink_course = $category->get_links($user_id, true);
$evals_links = array_merge($alleval_course, $alllink_course);
//@todo move these in a function
@ -1589,13 +1604,15 @@ class Category implements GradebookItem
$main_weight = $cats_course[0]->get_weight();
$item_total_value = 0;
$item_value = 0;
for ($count=0; $count < count($evals_links); $count++) {
/** @var AbstractLink $item */
$item = $evals_links[$count];
$score = $item->calc_score($user_id);
$divide = ( ($score[1])==0 ) ? 1 : $score[1];
$item_value = $score[0]/$divide*$item->get_weight();
$item_value = 0;
if (!empty($score)) {
$divide = $score[1] == 0 ? 1 : $score[1];
$item_value = $score[0] / $divide * $item->get_weight();
}
$item_total_value += $item_value;
}

@ -157,7 +157,8 @@ abstract class EvalLink extends AbstractLink
/**
* Lazy load function to get the linked evaluation
*/
protected function get_evaluation () {
protected function get_evaluation ()
{
if (!isset($this->evaluation)) {
if (isset($this->ref_id)) {
$evalarray = Evaluation::load($this->get_ref_id());
@ -175,6 +176,7 @@ abstract class EvalLink extends AbstractLink
$this->set_ref_id($eval->get_id());
}
}
return $this->evaluation;
}
}

@ -260,6 +260,7 @@ class ExerciseLink extends AbstractLink
if ($title == '') {
$title = basename($data['path']);
}
return $title;
}
}
@ -334,20 +335,22 @@ class ExerciseLink extends AbstractLink
private function get_exercise_data()
{
$TBL_ITEM_PROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
if ($this->is_hp == 1) {
$tbl_exercise = Database :: get_course_table(TABLE_DOCUMENT);
} else {
$tbl_exercise = $this->get_exercise_table();
}
if ($tbl_exercise=='') {
$ref_id = intval($this->get_ref_id());
if ($tbl_exercise == '') {
return false;
} elseif (!isset($this->exercise_data)) {
if ($this->is_hp == 1) {
$ref_id = intval($this->get_ref_id());
$sql = "SELECT * FROM $tbl_exercise ex, $TBL_ITEM_PROPERTY ip
$sql = "SELECT * FROM $tbl_exercise ex
INNER JOIN $TBL_ITEM_PROPERTY ip
ON (ip.ref = ex.id AND ip.c_id = ex.c_id)
WHERE
ip.ref = ex.id AND
ip.c_id = $this->course_id AND
ex.c_id = $this->course_id AND
ip.ref = $ref_id AND
@ -359,10 +362,10 @@ class ExerciseLink extends AbstractLink
$sql = 'SELECT * FROM '.$tbl_exercise.'
WHERE
c_id = '.$this->course_id.' AND
id = '.(int)$this->get_ref_id().' ';
id = '.$ref_id.' ';
}
$result = Database::query($sql);
$this->exercise_data=Database::fetch_array($result);
$this->exercise_data = Database::fetch_array($result);
}
return $this->exercise_data;

@ -236,7 +236,7 @@ class LearnpathLink extends AbstractLink
$sql = 'SELECT * FROM '.$this->get_learnpath_table().'
WHERE c_id = '.$this->course_id.' AND id = '.$this->get_ref_id().' ';
$result = Database::query($sql);
$this->learnpath_data=Database::fetch_array($result);
$this->learnpath_data = Database::fetch_array($result);
}
return $this->learnpath_data;
}

@ -202,7 +202,10 @@ class StudentPublicationLink extends AbstractLink
// for 1 student
if (!empty($stud_id)) {
if ($data = Database::fetch_array($scores)) {
return array($data['qualification'], $assignment['qualification']);
return array(
$data['qualification'],
$assignment['qualification']
);
} else {
return '';
}
@ -224,7 +227,7 @@ class StudentPublicationLink extends AbstractLink
if ($rescount == 0) {
return null;
} else {
return array ($sum , $rescount);
return array($sum, $rescount);
}
}
}

@ -69,8 +69,15 @@ class SurveyLink extends AbstractLink
WHERE c_id = '.$course_id.' AND session_id = '.intval($session_id).'';
$result = Database::query($sql);
while ($data = Database::fetch_array($result)) {
$links[] = array($data['survey_id'], api_trunc_str($data['code'].': '.self::html_to_text($data['title']), 80));
};
$links[] = array(
$data['survey_id'],
api_trunc_str(
$data['code'] . ': ' . self::html_to_text($data['title']),
80
)
);
}
return isset($links) ? $links : null;
}
@ -112,7 +119,6 @@ class SurveyLink extends AbstractLink
$session_id = api_get_session_id();
$tbl_survey = Database::get_course_table(TABLE_SURVEY);
$tbl_survey_invitation = Database::get_course_table(TABLE_SURVEY_INVITATION);
$get_individual_score = !is_null($stud_id);
$sql = "SELECT
COUNT(i.answered)
FROM $tbl_survey AS s
@ -153,7 +159,9 @@ class SurveyLink extends AbstractLink
WHERE
s.c_id = {$this->course_id} AND
i.c_id = {$this->course_id} AND
s.survey_id = $ref_id AND i.session_id = $session_id";
s.survey_id = $ref_id AND
i.session_id = $session_id
";
if ($get_individual_score) {
$sql .= ' AND i.user = '.intval($stud_id);
@ -199,7 +207,10 @@ class SurveyLink extends AbstractLink
{
$session_id = api_get_session_id();
$sql = 'SELECT count(survey_id) FROM '.$this->get_survey_table().'
WHERE c_id = '.$this->course_id.' AND survey_id = '.intval($this->get_ref_id()).' AND session_id='.intval($session_id).'';
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id).'';
$result = Database::query($sql);
$number = Database::fetch_row($result);
return ($number[0] != 0);
@ -217,7 +228,10 @@ class SurveyLink extends AbstractLink
$session_id = api_get_session_id();
if ($tbl_name != '') {
$sql = 'SELECT survey_id FROM '.$this->get_survey_table().'
WHERE c_id = '.$this->course_id.' AND survey_id = '.intval($this->get_ref_id()).' AND session_id = '.intval($session_id).' ';
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id = '.intval($session_id).' ';
$result = Database::query($sql);
$row = Database::fetch_array($result, 'ASSOC');
$survey_id = $row['survey_id'];
@ -234,7 +248,11 @@ class SurveyLink extends AbstractLink
if ($tbl_name == '') {
return false;
} elseif (!isset($this->survey_data)) {
$sql = 'SELECT * FROM '.$tbl_name.' WHERE c_id = '.$this->course_id.' AND survey_id = '.intval($this->get_ref_id()).' AND session_id='.intval($session_id).'';
$sql = 'SELECT * FROM '.$tbl_name.'
WHERE
c_id = '.$this->course_id.' AND
survey_id = '.intval($this->get_ref_id()).' AND
session_id='.intval($session_id).'';
$query = Database::query($sql);
$this->survey_data = Database::fetch_array($query);
}
@ -248,6 +266,7 @@ class SurveyLink extends AbstractLink
private static function html_to_text($string)
{
return trim(api_html_entity_decode(strip_tags(str_ireplace(array('<p>', '</p>', '<br />', '<br/>', '<br>'), array('', ' ', ' ', ' ', ' '), $string)), ENT_QUOTES));
return strip_tags($string);
//return trim(api_html_entity_decode(strip_tags(str_ireplace(array('<p>', '</p>', '<br />', '<br/>', '<br>'), array('', ' ', ' ', ' ', ' '), $string)), ENT_QUOTES));
}
}

@ -439,12 +439,14 @@ class DisplayGradebook
for ($count = 0; $count < count($allEvalsLinks); $count++) {
$item = $allEvalsLinks[$count];
$score = $item->calc_score($user_id);
$divide = ( ($score[1]) == 0 ) ? 1 : $score[1];
//$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0] / $divide * $item->get_weight() / $sub_cat_percentage * $sub_cat_percentage / $main_weight * $main_weight;
$item_value = $score[0] / $divide * $item->get_weight();
//var_dump($score[0], $divide, $item->get_weight(), $sub_cat_percentage, $main_weight, $item_value);
$item_value_total += $item_value;
if (!empty($score)) {
$divide = $score[1] == 0 ? 1 : $score[1];
//$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
//$item_value = $score[0] / $divide * $item->get_weight() / $sub_cat_percentage * $sub_cat_percentage / $main_weight * $main_weight;
$item_value = $score[0] / $divide * $item->get_weight();
//var_dump($score[0], $divide, $item->get_weight(), $sub_cat_percentage, $main_weight, $item_value);
$item_value_total += $item_value;
}
}
$item_total = $main_weight;

@ -57,6 +57,7 @@ class FlatViewDataGenerator
/**
* Get total number of users (rows)
* @return int
*/
public function get_total_users_count()
{
@ -65,6 +66,7 @@ class FlatViewDataGenerator
/**
* Get total number of evaluations/links (columns) (the 2 users columns not included)
* @return int
*/
public function get_total_items_count()
{
@ -161,9 +163,6 @@ class FlatViewDataGenerator
foreach ($allcat as $sub_cat) {
$sub_cat_weight = round(100 * $sub_cat->get_weight() / $main_weight, 1);
$add_weight = " $sub_cat_weight %";
/*if (isset($this->params['export_pdf']) && $this->params['export_pdf']) {
$add_weight = null;
}*/
$headers[] = Display::url(
$sub_cat->get_name(),
api_get_self().'?selectcat='.$sub_cat->get_id()
@ -188,7 +187,9 @@ class FlatViewDataGenerator
for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
/** @var AbstractLink $item */
$item = $this->evals_links[$count + $items_start];
if ($mainCategoryId == $item->get_category_id() && !in_array($item->get_id(), $evaluationsAdded)) {
if ($mainCategoryId == $item->get_category_id() &&
!in_array($item->get_id(), $evaluationsAdded)
) {
$weight = round(100 * $item->get_weight() / $main_weight, 1);
$headers[] = $item->get_name() . ' ' . $weight . ' % ';
}
@ -220,6 +221,7 @@ class FlatViewDataGenerator
/**
* Get array containing evaluation items
* @return array
*/
public function get_evaluation_items($items_start = 0, $items_count = null)
{
@ -272,9 +274,10 @@ class FlatViewDataGenerator
// sort users array
if ($users_sorting & self :: FVDG_SORT_LASTNAME) {
usort($userTable, array ('FlatViewDataGenerator','sort_by_last_name'));
usort($userTable, array('FlatViewDataGenerator','sort_by_last_name'));
} elseif ($users_sorting & self :: FVDG_SORT_FIRSTNAME) {
usort($userTable, array ('FlatViewDataGenerator','sort_by_first_name'));
usort($userTable, array('FlatViewDataGenerator','sort_by_first_name'));
}
if ($users_sorting & self :: FVDG_SORT_DESC) {
@ -796,11 +799,21 @@ class FlatViewDataGenerator
return $data;
}
/**
* @param $item1
* @param $item2
* @return int
*/
public function sort_by_last_name($item1, $item2)
{
return api_strcmp($item1[2], $item2[2]);
}
/**
* @param $item1
* @param $item2
* @return int
*/
public function sort_by_first_name($item1, $item2)
{
return api_strcmp($item1[3], $item2[3]);

@ -5,6 +5,7 @@
* Script
* @package chamilo.gradebook
*/
/**
* These are functions used in gradebook
*
@ -110,6 +111,7 @@ function remove_resource_from_course_gradebook($link_id)
$l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
Database::query($sql);
return true;
}
@ -127,7 +129,9 @@ function block_students()
function get_course_name_from_code($code)
{
$tbl_main_categories = Database :: get_main_table(TABLE_MAIN_COURSE);
$sql = 'SELECT title, code FROM ' . $tbl_main_categories . 'WHERE code = "' . Database::escape_string($code) . '"';
$sql = 'SELECT title, code
FROM ' . $tbl_main_categories . '
WHERE code = "' . Database::escape_string($code) . '"';
$result = Database::query($sql);
if ($col = Database::fetch_array($result)) {
return $col['title'];
@ -194,6 +198,7 @@ function get_icon_file_name($type)
$icon = 'link.gif';
break;
}
return $icon;
}
@ -400,7 +405,10 @@ function is_resource_in_course_gradebook($course_code, $resource_type, $resource
$l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
$course_code = Database::escape_string($course_code);
$sql = "SELECT * FROM $l l
WHERE course_code = '$course_code' AND type = ".(int)$resource_type . " AND ref_id = " . (int)$resource_id;
WHERE
course_code = '$course_code' AND
type = ".(int)$resource_type . " AND
ref_id = " . (int)$resource_id;
$res = Database::query($sql);
if (Database::num_rows($res) < 1) {
@ -649,7 +657,8 @@ function get_list_users_certificates($cat_id = null, $userList = array())
$table_user = Database::get_main_table(TABLE_MAIN_USER);
$sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username
FROM ' . $table_user . ' u
INNER JOIN ' . $table_certificate . ' gc ON u.user_id=gc.user_id ';
INNER JOIN ' . $table_certificate . ' gc
ON u.user_id=gc.user_id ';
if (!is_null($cat_id) && $cat_id > 0) {
$sql.=' WHERE cat_id=' . intval($cat_id);
}

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Various user related functions
* @author Julio Montoya <gugli100@gmail.com> adding security functions
@ -23,17 +24,25 @@ function get_users_in_course($course_id)
if (!empty($current_session)) {
$sql = "SELECT user.user_id, user.username, lastname, firstname, official_code
FROM $tbl_session_course_user as scru, $tbl_user as user
WHERE scru.id_user=user.user_id
AND scru.status=0
AND scru.course_code='$course_id' AND id_session ='$current_session' $order_clause ";
WHERE
scru.id_user=user.user_id AND
scru.status=0 AND
scru.course_code='$course_id' AND
id_session ='$current_session'
$order_clause
";
} else {
$sql = 'SELECT user.user_id, user.username, lastname, firstname, official_code
FROM '.$tbl_course_user.' as course_rel_user, '.$tbl_user.' as user
WHERE course_rel_user.user_id=user.user_id AND
course_rel_user.status='.STUDENT.' AND
course_rel_user.course_code = "'.$course_id.'" '.$order_clause;
WHERE
course_rel_user.user_id=user.user_id AND
course_rel_user.status='.STUDENT.' AND
course_rel_user.course_code = "'.$course_id.'" '.
$order_clause;
}
$result = Database::query($sql);
return get_user_array_from_sql_result($result);
}
@ -55,7 +64,7 @@ function get_user_array_from_sql_result($result)
return $a_students;
}
function get_all_users ($evals = array(), $links = array())
function get_all_users($evals = array(), $links = array())
{
$coursecodes = array();
$users = array();
@ -64,18 +73,26 @@ function get_all_users ($evals = array(), $links = array())
$coursecode = $eval->get_course_code();
// evaluation in course
if (isset($coursecode) && !empty($coursecode)) {
if (!array_key_exists($coursecode,$coursecodes)) {
if (!array_key_exists($coursecode, $coursecodes)) {
$coursecodes[$coursecode] = '1';
$users = array_merge($users, get_users_in_course($coursecode));
}
} else {// course independent evaluation
} else {
// course independent evaluation
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_res = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_RESULT);
$sql = 'SELECT user.user_id,lastname, firstname, user.official_code
$sql = 'SELECT user.user_id, lastname, firstname, user.official_code
FROM '.$tbl_res.' as res, '.$tbl_user.' as user
WHERE res.evaluation_id = '.intval($eval->get_id())
.' AND res.user_id = user.user_id';
WHERE
res.evaluation_id = '.intval($eval->get_id()).' AND
res.user_id = user.user_id
';
$sql .= ' ORDER BY lastname, firstname';
if (api_is_western_name_order()) {
$sql .= ' ORDER BY firstname, lastname';
}
$result = Database::query($sql);
$users = array_merge($users, get_user_array_from_sql_result($result));
}
@ -89,7 +106,7 @@ function get_all_users ($evals = array(), $links = array())
$users = array_merge($users, get_users_in_course($coursecode));
}
}
unset ($coursecodes);
return $users;
}
@ -105,9 +122,10 @@ function find_students($mask= '')
}
$mask = Database::escape_string($mask);
$tbl_user= Database :: get_main_table(TABLE_MAIN_USER);
$tbl_cru= Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql= 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code ' . ' FROM ' . $tbl_user . ' user';
$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
$tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
$sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
FROM ' . $tbl_user . ' user';
if (!api_is_platform_admin()) {
$sql .= ', ' . $tbl_cru . ' cru';
}
@ -117,12 +135,26 @@ function find_students($mask= '')
$sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')";
if (!api_is_platform_admin()) {
$sql .= ' AND user.user_id = cru.user_id AND cru.relation_type<>'.COURSE_RELATION_TYPE_RRHH.' ' . ' AND cru.course_code in' . ' (SELECT course_code' . ' FROM ' . $tbl_cru . ' WHERE user_id = ' . api_get_user_id() . ' AND status = ' . COURSEMANAGER . ')';
$sql .= ' AND user.user_id = cru.user_id AND
cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND
cru.course_code in (
SELECT course_code FROM '.$tbl_cru . '
WHERE
user_id = ' . api_get_user_id() . ' AND
status = ' . COURSEMANAGER . '
)
';
}
$sql .= ' ORDER BY lastname';
$result= Database::query($sql);
$db_users= Database::store_result($result);
return $db_users;
$sql .= ' ORDER BY lastname, firstname';
if (api_is_western_name_order()) {
$sql .= ' ORDER BY firstname, lastname';
}
$result = Database::query($sql);
$users = Database::store_result($result);
return $users;
}
/**

@ -1,5 +1,6 @@
<?php
/* For licensing terms, see /license.txt */
/**
* The INTRODUCTION MICRO MODULE is used to insert and edit
* an introduction section on a Chamilo module or on the course homepage.
@ -18,7 +19,7 @@
*
* usage :
*
* $moduleId = XX // specifying the module Id
* $moduleId = 'XX'; // specifying the module tool (string value)
* include(introductionSection.inc.php);
*
* This script is also used since Chamilo 1.9 to show course progress (from the
@ -91,19 +92,27 @@ $form->addElement('style_submit_button', 'intro_cmdUpdate', get_lang('SaveIntroT
$course_id = api_get_course_int_id();
if ($intro_editAllowed) {
$moduleId = intval($moduleId);
/* Replace command */
if ($intro_cmdUpdate) {
if ($form->validate()) {
$form_values = $form->exportValues();
$intro_content = Security::remove_XSS(stripslashes(api_html_entity_decode($form_values['intro_content'])), COURSEMANAGERLOWSECURITY);
if (!empty($intro_content)) {
$sql = "REPLACE $TBL_INTRODUCTION SET c_id = $course_id, id='$moduleId',intro_text='".Database::escape_string($intro_content)."', session_id='".intval($session_id)."'";
$sql = "REPLACE $TBL_INTRODUCTION
SET
c_id = $course_id, id='".Database::escape_string($moduleId)."',
intro_text='".Database::escape_string($intro_content)."',
session_id='".intval($session_id)."'
";
Database::query($sql);
$introduction_section .= Display::return_message(get_lang('IntroductionTextUpdated'),'confirmation', false);
$introduction_section .= Display::return_message(
get_lang('IntroductionTextUpdated'),
'confirmation',
false
);
} else {
$intro_cmdDel = true; // got to the delete command
// got to the delete command
$intro_cmdDel = true;
}
} else {
$intro_cmdEdit = true;
@ -112,12 +121,16 @@ if ($intro_editAllowed) {
/* Delete Command */
if ($intro_cmdDel) {
Database::query("DELETE FROM $TBL_INTRODUCTION WHERE c_id = $course_id AND id='".$moduleId."' AND session_id='".intval($session_id)."'");
$sql = "DELETE FROM $TBL_INTRODUCTION
WHERE
c_id = $course_id AND
id='".Database::escape_string($moduleId)."' AND
session_id='".intval($session_id)."'";
Database::query($sql);
$introduction_section .= Display::return_message(get_lang('IntroductionTextDeleted'), 'confirmation');
}
}
/* INTRODUCTION MICRO MODULE - DISPLAY SECTION */
/* Retrieves the module introduction text, if exist */
@ -126,6 +139,7 @@ if ($intro_editAllowed) {
$intro_content = null;
$sql = "SELECT intro_text FROM $TBL_INTRODUCTION
WHERE c_id = $course_id AND id='".Database::escape_string($moduleId)."' AND session_id = 0";
$intro_dbQuery = Database::query($sql);
if (Database::num_rows($intro_dbQuery) > 0) {
$intro_dbResult = Database::fetch_array($intro_dbQuery);
@ -243,7 +257,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
<div class="row-fluid score-thematic">
<div class="span8">';
$thematic_description_html .=
'<div class="span6 name-student">
'<div class="span6 name-student">
<h2>' . $userInfo['firstName'] . '</h2>
<h3>' . $userInfo['lastName'] . '</h3>
</div>
@ -256,7 +270,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
</div>
</div>';
$thematic_description_html .=
'<div class="span4">
'<div class="span4">
<a id="thematic-show" class="btn btn-small btn-primary accordion-toggle btn-hide-thematic" href="#pross" data-toggle="collapse" data-parent="#progress-bar-course">
' . get_lang('SeeDetail') . '
</a>
@ -268,7 +282,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
</div>
</div>';
$thematic_description_html .=
'<div class="accordion-body collapse in" id="pross" style="height: auto !important;">
'<div class="accordion-body collapse in" id="pross" style="height: auto !important;">
<div class="accordion-inner">
<div class="row-fluid">
<div class="span4">
@ -291,10 +305,10 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
</div>
</div>';
$thematic_description_html .=
'<div class="span8">
'<div class="span8">
<div class="row-fluid">';
$thematic_description_html .=
'<div class="span6 items-progress'.$class1.'">
'<div class="span6 items-progress'.$class1.'">
<div class="topics">' . $subTitle1 . '</div>
<p class="title_topics">' . $thematic_info['title'] . '</p>
<p class="date">' . $thematic_advance_info['start_date'] . '</p>
@ -308,7 +322,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
$thematic_advance_info2['start_date'] = api_format_date($thematic_advance_info2['start_date'], DATE_TIME_FORMAT_LONG);
$thematic_description_html .=
'<div class="span6 items-progress">
'<div class="span6 items-progress">
<div class="topics">'.$subTitle2.'</div>
<p class="title_topics">'.$thematic_info['title'].'</p>
<p class="date">'.$thematic_advance_info2['start_date'].'</p>
@ -317,7 +331,7 @@ if ($tool == TOOL_COURSE_HOMEPAGE && !isset($_GET['intro_cmdEdit'])) {
</div>';
}
$thematic_description_html.=
'</div>
'</div>
</div>
</div>
</div>
@ -337,9 +351,6 @@ $introduction_section .= '</div>';
$introduction_section .= '<div class="home-course-intro span12"><div class="page-course">';
if ($intro_dispDefault) {
$intro_content = $intro_content;
if (!empty($intro_content)) {
$introduction_section.='<div class="page-course-intro">';
$introduction_section .= $intro_content;

@ -142,7 +142,13 @@ class Display
echo self::return_introduction_section($tool, $editor_config);
}
public static function return_introduction_section($tool, $editor_config = null) {
/**
* @param string $tool
* @param array $editor_config
* @return null
*/
public static function return_introduction_section($tool, $editor_config = null)
{
$is_allowed_to_edit = api_is_allowed_to_edit();
$moduleId = $tool;
if (api_get_setting('enable_tool_introduction') == 'true' || $tool == TOOL_COURSE_HOMEPAGE) {

@ -1011,7 +1011,15 @@ function api_get_months_long($language = null) {
* @author Carlos Vargas <carlos.vargas@dokeos.com> - initial implementation.
* @author Ivan Tcholakov
*/
function api_get_person_name($first_name, $last_name, $title = null, $format = null, $language = null, $encoding = null, $username = null) {
function api_get_person_name(
$first_name,
$last_name,
$title = null,
$format = null,
$language = null,
$encoding = null,
$username = null
) {
static $valid = array();
if (empty($format)) {
$format = PERSON_NAME_COMMON_CONVENTION;
@ -1025,6 +1033,7 @@ function api_get_person_name($first_name, $last_name, $title = null, $format = n
if (empty($encoding)) {
$encoding = _api_mb_internal_encoding();
}
if (!isset($valid[$format][$language])) {
if (is_int($format)) {
switch ($format) {
@ -1078,7 +1087,7 @@ function api_get_person_name($first_name, $last_name, $title = null, $format = n
/**
* Checks whether a given format represents person name in Western order (for which first name is first).
* @param int/string $format (optional) The person name format. It may be a pattern-string (for example '%t. %l, %f') or some of the constants PERSON_NAME_COMMON_CONVENTION (default), PERSON_NAME_WESTERN_ORDER, PERSON_NAME_EASTERN_ORDER, PERSON_NAME_LIBRARY_ORDER.
* @param string $language (optional) The language indentificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @param string $language (optional) The language identificator. If it is omited, the current interface language is assumed. This parameter has meaning with the format PERSON_NAME_COMMON_CONVENTION only.
* @return bool The result TRUE means that the order is first_name last_name, FALSE means last_name first_name.
* Note: You may use this function for determing the order of the fields or columns "First name" and "Last name" in forms, tables and reports.
* @author Ivan Tcholakov
@ -2499,7 +2508,8 @@ function api_strcasecmp($string1, $string2, $language = null, $encoding = null)
* @link http://php.net/manual/en/function.strcmp.php
* @link http://php.net/manual/en/collator.compare.php
*/
function api_strcmp($string1, $string2, $language = null, $encoding = null) {
function api_strcmp($string1, $string2, $language = null, $encoding = null)
{
if (INTL_INSTALLED) {
$collator = _api_get_collator($language);
if (is_object($collator)) {

@ -84,15 +84,7 @@ return array(
'simpl_chinese' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name' ), // Eastern order
'slovak' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'slovenian' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
//'spanish' => array( 'format' => 'title first_name last_name', 'sort_by' => 'last_name'),
//'spanish' => array( 'format' => 'title last_name first_name', 'sort_by' => 'last_name'),
// Some experimental settings for Spanish language:
//'spanish' => array( 'format' => 'title first_name LAST_NAME', 'sort_by' => 'first_name'), // Western order, last name is uppercase when a full name is assembled
//'spanish' => array( 'format' => 'title first_name LAST_NAME', 'sort_by' => 'last_name'), // Western order, last name is uppercase when a full name is assembled
'spanish' => array('format' => 'title last_name, first_name', 'sort_by' => 'last_name'), // Library order
//'spanish' => array( 'format' => 'title LAST_NAME, first_name', 'sort_by' => 'last_name'), // Library order, last name is uppercase when a full name is assembled
'swahili' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'swedish' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),
'tagalog' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'),

@ -196,18 +196,16 @@ function &_api_get_day_month_names($language = null) {
return $date_parts[$language];
}
/**
* Appendix to "Name order conventions"
*/
/**
* Returns returns person name convention for a given language.
* @param string $language The input language.
* @param string $type The type of the requested convention. It may be 'format' for name order convention or 'sort_by' for name sorting convention.
* @return mixed Depending of the requested type, the returned result may be string or boolean; null is returned on error;
* @param string $type The type of the requested convention.
* It may be 'format' for name order convention or 'sort_by' for name sorting convention.
* @return mixed Depending of the requested type,
* the returned result may be string or boolean; null is returned on error;
*/
function _api_get_person_name_convention($language, $type) {
function _api_get_person_name_convention($language, $type)
{
static $conventions;
$language = api_purify_language_id($language);
if (!isset($conventions)) {
@ -215,8 +213,22 @@ function _api_get_person_name_convention($language, $type) {
if (file_exists($file)) {
$conventions = include ($file);
} else {
$conventions = array('english' => array('format' => 'title first_name last_name', 'sort_by' => 'first_name'));
$conventions = array(
'english' => array(
'format' => 'title first_name last_name',
'sort_by' => 'first_name'
)
);
}
// Overwrite classic conventions
$customConventions = api_get_configuration_value('name_order_conventions');
if (!empty($customConventions)) {
foreach ($customConventions as $key => $data) {
$conventions[$key] = $data;
}
}
$search1 = array('FIRST_NAME', 'LAST_NAME', 'TITLE');
$replacement1 = array('%F', '%L', '%T');
$search2 = array('first_name', 'last_name', 'title');

@ -3776,8 +3776,8 @@ function api_get_languages_combo($name = 'language', $chozen=true) {
* @param boolean Hide form if only one language available (defaults to false = show the box anyway)
* @return void Display the box directly
*/
function api_display_language_form($hide_if_no_choice = false) {
function api_display_language_form($hide_if_no_choice = false)
{
// Retrieve a complete list of all the languages.
$language_list = api_get_languages();
if (count($language_list['name']) <= 1 && $hide_if_no_choice) {
@ -3788,7 +3788,6 @@ function api_display_language_form($hide_if_no_choice = false) {
if (isset($_SESSION['user_language_choice'])) {
$user_selected_language = $_SESSION['user_language_choice'];
}
if (empty($user_selected_language)) {
$user_selected_language = api_get_setting('platformLanguage');
}
@ -3808,7 +3807,6 @@ function api_display_language_form($hide_if_no_choice = false) {
$html .= '<label style="display: none;" for="language_list">' . get_lang('Language') . '</label>';
$html .= '<select id="language_list" class="chzn-select" name="language_list" onchange="javascript: jumpMenu(\'parent\',this,0);">';
foreach ($original_languages as $key => $value) {
if ($folder[$key] == $user_selected_language) {
$option_end = ' selected="selected" >';
@ -6416,24 +6414,28 @@ function api_is_multiple_url_enabled() {
* Returns a md5 unique id
* @todo add more parameters
*/
function api_get_unique_id() {
$id = md5(time().uniqid().api_get_user_id().api_get_course_id().api_get_session_id());
return $id;
}
/**
* Get home path
* @return string
*/
function api_get_home_path() {
$home = 'home/';
if (api_get_multiple_access_url()) {
$access_url_id = api_get_current_access_url_id();
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
$url_info = api_get_access_url($access_url_id);
$url = api_remove_trailing_slash(preg_replace('/https?:\/\//i', '', $url_info['url']));
$clean_url = replace_dangerous_char($url);
$clean_url = str_replace('/', '-', $clean_url);
$clean_url .= '/';
// if $clean_url == "localhost/" means that the multiple URL was not well configured we don't rename the $home variable
if ($clean_url != 'localhost/')
$home = 'home/'.$clean_url;
//if ($clean_url != 'localhost/') {
$home = 'home/' . $clean_url;
//}
}
return $home;
}

@ -2741,9 +2741,9 @@ class SessionManager
}
}
}
// Inserting new sessions list.
if (!empty($sessions_list) && is_array($sessions_list)) {
foreach ($sessions_list as $session_id) {
$session_id = intval($session_id);
$sql = "INSERT IGNORE INTO $tbl_session_rel_user (id_session, id_user, relation_type)

@ -8,17 +8,21 @@ use \ChamiloSession as Session;
*/
class IndexManager
{
//An instance of the template engine
public $tpl = false;
public $name = '';
public $home = '';
public $default_home = 'home/';
// An instance of the template engine
public $tpl = false;
public $name = '';
public $home = '';
public $default_home = 'home/';
/**
* Construct
* @param string $title
*/
public function __construct($title)
{
$this->tpl = new Template($title);
$this->home = api_get_home_path();
$this->user_id = api_get_user_id();
$this->home = api_get_home_path();
$this->user_id = api_get_user_id();
$this->load_directories_preview = false;
if (api_get_setting('show_documents_preview') == 'true') {
@ -39,9 +43,7 @@ class IndexManager
// Only display if the user isn't logged in.
$this->tpl->assign('login_language_form', api_display_language_form(true));
if ($setLoginForm) {
$this->tpl->assign('login_form', self::display_login_form());
if ($loginFailed) {
@ -213,11 +215,15 @@ class IndexManager
if (!empty($html)) {
$html = self::show_right_block(get_lang('Courses'), $html, 'teacher_block');
}
return $html;
}
/* Includes a created page */
function return_home_page()
/**
* Includes a created page
* @return string
*/
public function return_home_page()
{
$userId = api_get_user_id();
global $_configuration;
@ -229,7 +235,9 @@ class IndexManager
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
} else {
// Hiding home top when user not connected.
if (isset($_configuration['hide_home_top_when_connected']) && $_configuration['hide_home_top_when_connected'] && !empty($userId)) {
if (isset($_configuration['hide_home_top_when_connected']) &&
$_configuration['hide_home_top_when_connected'] && !empty($userId)
) {
return $html;
}
@ -241,20 +249,22 @@ class IndexManager
$user_selected_language = api_get_setting('platformLanguage');
}
if (!file_exists($this->home.'home_news_'.$user_selected_language.'.html')) {
if (file_exists($this->home.'home_top.html')) {
$home_top_temp = file($this->home.'home_top.html');
} else {
$home_top_temp = file($this->default_home.'home_top.html');
}
$home_top_temp = implode('', $home_top_temp);
} else {
if (file_exists($this->home.'home_top_'.$user_selected_language.'.html')) {
$home_top_temp = file_get_contents($this->home.'home_top_'.$user_selected_language.'.html');
} else {
$home_top_temp = file_get_contents($this->home.'home_top.html');
}
}
// Try language specific home
if (file_exists($this->home.'home_top_'.$user_selected_language.'.html')) {
$home_top_temp = file_get_contents($this->home.'home_top_'.$user_selected_language.'.html');
}
// Try default language home
if (empty($home_top_temp)) {
if (file_exists($this->home.'home_top.html')) {
$home_top_temp = file_get_contents($this->home.'home_top.html');
} else {
if (file_exists($this->default_home.'home_top.html')) {
$home_top_temp = file_get_contents($this->default_home . 'home_top.html');
}
}
}
if (trim($home_top_temp) == '' && api_is_platform_admin()) {
$home_top_temp = '<div class="welcome-mascot">' . get_lang('PortalHomepageDefaultIntroduction') . '</div>';
} else {
@ -263,6 +273,7 @@ class IndexManager
$open = str_replace('{rel_path}', api_get_path(REL_PATH), $home_top_temp);
$html = api_to_system_encoding($open, api_detect_encoding(strip_tags($open)));
}
return $html;
}

@ -278,3 +278,7 @@ $_configuration['system_stable'] = NEW_VERSION_STABLE;
//$_configuration['exercise_max_fckeditors_in_page'] = 0;
// Default upload option
//$_configuration['document_if_file_exists_option'] = 'rename'; // overwrite
// Custom name_order_conventions
//$_configuration['name_order_conventions'] = array(
// 'french' => array('format' => 'title last_name first_name', 'sort_by' => 'last_name')
//);

@ -33,7 +33,6 @@ require_once api_get_path(SYS_CODE_PATH).'survey/survey.lib.php';
api_block_anonymous_users();
if (!api_is_allowed_to_create_course() && !api_is_session_admin() && !api_is_drh()) {
// Check if the user is tutor of the course
$user_course_status = CourseManager::get_tutor_in_course_status(
@ -304,8 +303,6 @@ $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
api_get_course_info()
);
if (api_is_drh() && !api_is_platform_admin()) {
if (!empty($student_id)) {
if (api_drh_can_access_all_session_content()) {
@ -352,8 +349,7 @@ if (!empty($student_id)) {
}
echo $send_mail;
if (!empty($student_id) && !empty($_GET['course'])) {
//only show link to connection details if course and student were defined in the URL
// Only show link to connection details if course and student were defined in the URL
echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&amp;origin=' . Security :: remove_XSS($_GET['origin']) . '&amp;cidReq='.Security::remove_XSS($_GET['course']).'&amp;id_session='.$session_id.'">'.
Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>';
}
@ -418,7 +414,7 @@ if (!empty($student_id)) {
$last_connection_date = get_lang('NoConnexion');
}
// cvs informations
// cvs information
$csv_content[] = array(
get_lang('Informations', '')
);
@ -614,7 +610,6 @@ if (!empty($student_id)) {
</td>
</tr>
</table>
<?php
$table_title = '';
@ -722,7 +717,7 @@ if (!empty($student_id)) {
$progress = empty($progress) ? '0%' : $progress.'%';
$score = empty($score) ? '0%' : $score.'%';
$csv_content[] = array (
$csv_content[] = array(
$session_name,
$course_info['title'],
$time_spent_on_course,
@ -733,12 +728,12 @@ if (!empty($student_id)) {
);
echo '<tr>
<td >'.$course_info['title'].'</td>
<td >'.$time_spent_on_course .'</td>
<td >'.$progress.'</td>
<td >'.$score.'</td>
<td >'.$attendances_faults_avg.'</td>
<td >'.$scoretotal_display.'</td>';
<td >'.$course_info['title'].'</td>
<td >'.$time_spent_on_course .'</td>
<td >'.$progress.'</td>
<td >'.$score.'</td>
<td >'.$attendances_faults_avg.'</td>
<td >'.$scoretotal_display.'</td>';
if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
echo '<td width="10"><a href="'.api_get_self().'?student='.$user_info['user_id'].'&details=true&course='.$course_info['code'].'&id_coach='.Security::remove_XSS($_GET['id_coach']).'&origin='.Security::remove_XSS($_GET['origin']).'&id_session='.$session_id.'#infosStudent"><img src="'.api_get_path(WEB_IMG_PATH).'2rightarrow.gif" border="0" /></a></td>';
@ -827,7 +822,10 @@ if (!empty($student_id)) {
array($lp_id),
$session_id
);
if (!empty($total_time)) $any_result = true;
if (!empty($total_time)) {
$any_result = true;
}
// Get last connection time in lp
$start_time = Tracking::get_last_connection_time_in_lp(
@ -913,14 +911,17 @@ if (!empty($student_id)) {
if ($from_myspace) {
$from ='&from=myspace';
}
$link = Display::url('<img src="../img/2rightarrow.gif" border="0" />','lp_tracking.php?course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$session_id);
$link = Display::url(
'<img src="../img/2rightarrow.gif" border="0" />',
'lp_tracking.php?cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).$from.'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student_id='.$user_info['user_id'].'&id_session='.$session_id
);
echo Display::tag('td', $link);
}
if (api_is_allowed_to_edit()) {
echo '<td>';
if ($any_result === true) {
echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.Security::remove_XSS($_GET['id_session']).'">';
echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.Security::remove_XSS($_GET['origin']).'&lp_id='.$learnpath['id'].'&student='.$user_info['user_id'].'&details=true&id_session='.Security::remove_XSS($_GET['id_session']).'">';
echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
echo '</a>';
}

@ -3,7 +3,7 @@
/**
* Controller for REST request
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.tour
* @package chamilo.webservices
*/
/* Require libs and classes */
require_once '../main/inc/global.inc.php';
Loading…
Cancel
Save