Scrutinizer Auto-Fixes

This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com
remotes/angel/1.11.x
Scrutinizer Auto-Fixer 8 years ago
parent 2b735d0d0a
commit 699ede4dbe
  1. 4
      main/admin/user_information.php
  2. 82
      main/dropbox/dropbox_functions.inc.php
  3. 18
      main/exercise/adminhp.php
  4. 22
      main/exercise/exercise.php
  5. 12
      main/exercise/question_create.php
  6. 12
      main/gradebook/gradebook_showlog_eval.php
  7. 4
      main/gradebook/lib/be/attendancelink.class.php
  8. 4
      main/help/faq.php
  9. 26
      main/lp/lp_add_audio.php
  10. 30
      main/session/add_many_session_to_category.php
  11. 4
      main/survey/preview.php
  12. 8
      main/survey/question.php
  13. 2
      main/survey/survey_invite.php
  14. 42
      main/user/resume_session.php
  15. 4
      src/Chamilo/CoreBundle/Entity/Skill.php
  16. 4
      whoisonlinesession.php

@ -37,7 +37,7 @@ $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdm
$interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList')); $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList'));
$userId = $user['user_id']; $userId = $user['user_id'];
$tool_name = $user['complete_name'].(empty($user['official_code'])?'':' ('.$user['official_code'].')'); $tool_name = $user['complete_name'].(empty($user['official_code']) ? '' : ' ('.$user['official_code'].')');
$table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER); $table_course_user = Database::get_main_table(TABLE_MAIN_COURSE_USER);
$table_course = Database::get_main_table(TABLE_MAIN_COURSE); $table_course = Database::get_main_table(TABLE_MAIN_COURSE);
@ -452,7 +452,7 @@ if (Database::num_rows($res) > 0) {
$tools = '<a href="course_information.php?code='.$courseCode.'">'. $tools = '<a href="course_information.php?code='.$courseCode.'">'.
Display::return_icon('synthese_view.gif', get_lang('Overview')).'</a>'. Display::return_icon('synthese_view.gif', get_lang('Overview')).'</a>'.
'<a href="'.$courseInfo['course_public_url'].'">'. '<a href="'.$courseInfo['course_public_url'].'">'.
Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>' . Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'</a>'.
'<a href="course_edit.php?id='.$course->c_id.'">'. '<a href="course_edit.php?id='.$course->c_id.'">'.
Display::return_icon('edit.gif', get_lang('Edit')).'</a>'; Display::return_icon('edit.gif', get_lang('Edit')).'</a>';
if ($course->status == STUDENT) { if ($course->status == STUDENT) {

@ -42,7 +42,7 @@ function handle_multiple_actions()
// STEP 2: at least one file has to be selected. If not we return an error message // STEP 2: at least one file has to be selected. If not we return an error message
$ids = isset($_GET['id']) ? $_GET['id'] : array(); $ids = isset($_GET['id']) ? $_GET['id'] : array();
if (count($ids)>0) { if (count($ids) > 0) {
$checked_file_ids = $_POST['id']; $checked_file_ids = $_POST['id'];
} else { } else {
foreach ($_POST as $key => $value) { foreach ($_POST as $key => $value) {
@ -133,7 +133,7 @@ function delete_category($action, $id, $user_id = null)
} }
$cat = get_dropbox_category($id); $cat = get_dropbox_category($id);
if (count($cat)==0) { if (count($cat) == 0) {
return false; return false;
} }
@ -157,7 +157,7 @@ function delete_category($action, $id, $user_id = null)
} }
// step 1: delete the category // step 1: delete the category
$sql = "DELETE FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
WHERE c_id = $course_id AND cat_id='".intval($id)."' AND $sentreceived='1'"; WHERE c_id = $course_id AND cat_id='".intval($id)."' AND $sentreceived='1'";
Database::query($sql); Database::query($sql);
@ -241,7 +241,7 @@ function store_move($id, $target, $part)
$return_message = get_lang('ReceivedFileMoved'); $return_message = get_lang('ReceivedFileMoved');
} }
if ($part == 'sent') { if ($part == 'sent') {
$sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FILE) ." $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)."
SET cat_id = ".intval($target)." SET cat_id = ".intval($target)."
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
@ -276,7 +276,7 @@ function get_dropbox_categories($filter = '')
$session_id = api_get_session_id(); $session_id = api_get_session_id();
$condition_session = api_get_session_condition($session_id); $condition_session = api_get_session_condition($session_id);
$sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
WHERE c_id = $course_id AND user_id='".$_user['user_id']."' $condition_session"; WHERE c_id = $course_id AND user_id='".$_user['user_id']."' $condition_session";
$result = Database::query($sql); $result = Database::query($sql);
@ -298,7 +298,7 @@ function get_dropbox_category($id)
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
if (empty($id) or $id != intval($id)) { return array(); } if (empty($id) or $id != intval($id)) { return array(); }
$sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
WHERE c_id = $course_id AND cat_id='".$id."'"; WHERE c_id = $course_id AND cat_id='".$id."'";
$res = Database::query($sql); $res = Database::query($sql);
if ($res === false) { if ($res === false) {
@ -347,7 +347,7 @@ function store_addcategory()
if (!isset($_POST['edit_id'])) { if (!isset($_POST['edit_id'])) {
$session_id = api_get_session_id(); $session_id = api_get_session_id();
// step 3a, we check if the category doesn't already exist // step 3a, we check if the category doesn't already exist
$sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
WHERE WHERE
c_id = $course_id AND c_id = $course_id AND
user_id='".$_user['user_id']."' AND user_id='".$_user['user_id']."' AND
@ -370,7 +370,7 @@ function store_addcategory()
]; ];
$id = Database::insert(Database::get_course_table(TABLE_DROPBOX_CATEGORY), $params); $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_CATEGORY), $params);
if ($id) { if ($id) {
$sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." SET cat_id = iid WHERE iid = $id"; $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)." SET cat_id = iid WHERE iid = $id";
Database::query($sql); Database::query($sql);
} }
@ -419,7 +419,7 @@ function display_addcategory_form($category_name = '', $id = '', $action)
if (isset($id) && $id != '') { if (isset($id) && $id != '') {
// retrieve the category we are editing // retrieve the category we are editing
$sql = "SELECT * FROM ". Database::get_course_table(TABLE_DROPBOX_CATEGORY) ." $sql = "SELECT * FROM ".Database::get_course_table(TABLE_DROPBOX_CATEGORY)."
WHERE c_id = $course_id AND cat_id = ".intval($id); WHERE c_id = $course_id AND cat_id = ".intval($id);
$result = Database::query($sql); $result = Database::query($sql);
$row = Database::fetch_array($result); $row = Database::fetch_array($result);
@ -637,7 +637,7 @@ function display_add_form($viewReceivedCategory, $viewSentCategory, $view, $id =
$full_name = $userInfo['complete_name'].$groupNameListToString; $full_name = $userInfo['complete_name'].$groupNameListToString;
$current_user_id = $current_user['user_id']; $current_user_id = $current_user['user_id'];
$options['user_' . $current_user_id] = $full_name; $options['user_'.$current_user_id] = $full_name;
} }
} }
} }
@ -745,8 +745,8 @@ function removeUnusedFiles()
// select all files that aren't referenced anymore // select all files that aren't referenced anymore
$sql = "SELECT DISTINCT f.id, f.filename $sql = "SELECT DISTINCT f.id, f.filename
FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f
LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " p LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON)." p
ON (f.id = p.file_id) ON (f.id = p.file_id)
WHERE p.user_id IS NULL AND WHERE p.user_id IS NULL AND
f.c_id = $course_id f.c_id = $course_id
@ -754,14 +754,14 @@ function removeUnusedFiles()
$result = Database::query($sql); $result = Database::query($sql);
while ($res = Database::fetch_array($result)) { while ($res = Database::fetch_array($result)) {
//delete the selected files from the post and file tables //delete the selected files from the post and file tables
$sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'"; WHERE c_id = $course_id AND file_id = '".$res['id']."'";
Database::query($sql); Database::query($sql);
$sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)."
WHERE c_id = $course_id AND id ='" . $res['id'] . "'"; WHERE c_id = $course_id AND id ='".$res['id']."'";
Database::query($sql); Database::query($sql);
//delete file from server //delete file from server
@unlink( api_get_path(SYS_COURSE_PATH) . $_course['path'] . '/dropbox/' . $res['filename']); @unlink(api_get_path(SYS_COURSE_PATH).$_course['path'].'/dropbox/'.$res['filename']);
} }
} }
@ -783,11 +783,11 @@ function getUserOwningThisMailing($mailingPseudoId, $owner = 0, $or_die = '')
$mailingPseudoId = intval($mailingPseudoId); $mailingPseudoId = intval($mailingPseudoId);
$sql = "SELECT f.uploader_id $sql = "SELECT f.uploader_id
FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f
LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST) . " p LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST)." p
ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id) ON (f.id = p.file_id AND f.c_id = $course_id AND p.c_id = $course_id)
WHERE WHERE
p.dest_user_id = '" . $mailingPseudoId . "' AND p.dest_user_id = '".$mailingPseudoId."' AND
p.c_id = $course_id p.c_id = $course_id
"; ";
$result = Database::query($sql); $result = Database::query($sql);
@ -813,21 +813,21 @@ function removeMoreIfMailing($file_id)
// for all content files, replace mailingPseudoId by owner as uploader // for all content files, replace mailingPseudoId by owner as uploader
$file_id = intval($file_id); $file_id = intval($file_id);
$sql = "SELECT p.dest_user_id $sql = "SELECT p.dest_user_id
FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " p FROM " . Database::get_course_table(TABLE_DROPBOX_POST)." p
WHERE c_id = $course_id AND p.file_id = '" . $file_id . "'"; WHERE c_id = $course_id AND p.file_id = '".$file_id."'";
$result = Database::query($sql); $result = Database::query($sql);
if ($res = Database::fetch_array($result)) { if ($res = Database::fetch_array($result)) {
$mailingPseudoId = $res['dest_user_id']; $mailingPseudoId = $res['dest_user_id'];
$mailId = get_mail_id_base(); $mailId = get_mail_id_base();
if ($mailingPseudoId > $mailId) { if ($mailingPseudoId > $mailId) {
$sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
WHERE c_id = $course_id AND user_id='" . $mailingPseudoId . "'"; WHERE c_id = $course_id AND user_id='".$mailingPseudoId."'";
Database::query($sql); Database::query($sql);
$sql = "UPDATE " . Database::get_course_table(TABLE_DROPBOX_FILE) ." $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)."
SET uploader_id='" . api_get_user_id() . "' SET uploader_id='" . api_get_user_id()."'
WHERE c_id = $course_id AND uploader_id='" . $mailingPseudoId . "'"; WHERE c_id = $course_id AND uploader_id='".$mailingPseudoId."'";
Database::query($sql); Database::query($sql);
} }
} }
@ -993,7 +993,7 @@ function store_add_dropbox($file = [], $work = null)
} }
} }
} else { // rename file to login_filename_uniqueId format } else { // rename file to login_filename_uniqueId format
$dropbox_filename = $_user['username'] . "_" . $dropbox_filename . "_".uniqid(''); $dropbox_filename = $_user['username']."_".$dropbox_filename."_".uniqid('');
} }
if (empty($work)) { if (empty($work)) {
@ -1038,14 +1038,14 @@ function store_add_dropbox($file = [], $work = null)
), ),
$recipent_temp['email'], $recipent_temp['email'],
get_lang('NewDropboxFileUploaded'), get_lang('NewDropboxFileUploaded'),
get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?' . api_get_cidreq() . '">'.get_lang('SeeFile').'</a>'. get_lang('NewDropboxFileUploadedContent').' <a href="'.api_get_path(WEB_CODE_PATH).'dropbox/index.php?'.api_get_cidreq().'">'.get_lang('SeeFile').'</a>'.
"\n\n". "\n\n".
api_get_person_name( api_get_person_name(
$_user['firstName'], $_user['firstName'],
$_user['lastName'], $_user['lastName'],
null, null,
PERSON_NAME_EMAIL_ADDRESS PERSON_NAME_EMAIL_ADDRESS
)."\n". get_lang('Email') ." : ".$_user['mail'], )."\n".get_lang('Email')." : ".$_user['mail'],
api_get_person_name( api_get_person_name(
$_user['firstName'], $_user['firstName'],
$_user['lastName'], $_user['lastName'],
@ -1156,12 +1156,12 @@ function user_can_download_file($id, $user_id)
$id = intval($id); $id = intval($id);
$user_id = intval($user_id); $user_id = intval($user_id);
$sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id; WHERE c_id = $course_id AND user_id = $user_id AND file_id = ".$id;
$result = Database::query($sql); $result = Database::query($sql);
$number_users_who_see_file = Database::num_rows($result); $number_users_who_see_file = Database::num_rows($result);
$sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_POST) ." $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
WHERE c_id = $course_id AND dest_user_id = $user_id AND file_id = ".$id; WHERE c_id = $course_id AND dest_user_id = $user_id AND file_id = ".$id;
$result = Database::query($sql); $result = Database::query($sql);
$count = Database::num_rows($result); $count = Database::num_rows($result);
@ -1175,12 +1175,12 @@ function check_if_file_exist($id)
{ {
$id = intval($id); $id = intval($id);
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)."
WHERE c_id = $course_id AND file_id = ".$id; WHERE c_id = $course_id AND file_id = ".$id;
$result = Database::query($sql); $result = Database::query($sql);
$number_users_who_see_file = Database::num_rows($result); $number_users_who_see_file = Database::num_rows($result);
$sql = "SELECT file_id FROM ". Database::get_course_table(TABLE_DROPBOX_POST) ." $sql = "SELECT file_id FROM ".Database::get_course_table(TABLE_DROPBOX_POST)."
WHERE c_id = $course_id AND file_id = ".$id; WHERE c_id = $course_id AND file_id = ".$id;
$result = Database::query($sql); $result = Database::query($sql);
$count = Database::num_rows($result); $count = Database::num_rows($result);
@ -1212,7 +1212,7 @@ function store_feedback()
$id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FEEDBACK), $params); $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FEEDBACK), $params);
if ($id) { if ($id) {
$sql = "UPDATE ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ." SET feedback_id = iid WHERE iid = $id"; $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FEEDBACK)." SET feedback_id = iid WHERE iid = $id";
Database::query($sql); Database::query($sql);
} }
@ -1239,10 +1239,10 @@ function zip_download($fileList)
// note: we also have to add the check if the user has received or sent this file. // note: we also have to add the check if the user has received or sent this file.
$sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description $sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description
FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." file FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." file
INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." person INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON)." person
ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id) ON (person.file_id=file.id AND file.c_id = $course_id AND person.c_id = $course_id)
INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_POST) ." post INNER JOIN ".Database::get_course_table(TABLE_DROPBOX_POST)." post
ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id) ON (post.file_id = file.id AND post.c_id = $course_id AND file.c_id = $course_id)
WHERE WHERE
file.id IN (".implode(', ', $fileList).") AND file.id IN (".implode(', ', $fileList).") AND
@ -1339,7 +1339,7 @@ function generate_html_overview($files, $dont_show_columns = array(), $make_link
// Adding the content. // Adding the content.
$return .= "\n<tr>"; $return .= "\n<tr>";
foreach ($column as $column_key => $column_value) { foreach ($column as $column_key => $column_value) {
if (!in_array($column_value,$dont_show_columns)) { if (!in_array($column_value, $dont_show_columns)) {
$return .= "\n\t<td>"; $return .= "\n\t<td>";
if (in_array($column_value, $make_link)) { if (in_array($column_value, $make_link)) {
$return .= '<a href="'.$value[$column_value].'">'.$value[$column_value].'</a>'; $return .= '<a href="'.$value[$column_value].'">'.$value[$column_value].'</a>';
@ -1367,11 +1367,11 @@ function get_total_number_feedback($file_id = '')
{ {
$course_id = api_get_course_int_id(); $course_id = api_get_course_int_id();
$sql = "SELECT COUNT(feedback_id) AS total, file_id $sql = "SELECT COUNT(feedback_id) AS total, file_id
FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK) ." FROM ". Database::get_course_table(TABLE_DROPBOX_FEEDBACK)."
WHERE c_id = $course_id GROUP BY file_id"; WHERE c_id = $course_id GROUP BY file_id";
$result = Database::query($sql); $result = Database::query($sql);
$return = array(); $return = array();
while ($row=Database::fetch_array($result)) { while ($row = Database::fetch_array($result)) {
$return[$row['file_id']] = $row['total']; $return[$row['file_id']] = $row['total'];
} }
return $return; return $return;

@ -8,12 +8,12 @@
*/ */
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
$this_section=SECTION_COURSES; $this_section = SECTION_COURSES;
$_course = api_get_course_info(); $_course = api_get_course_info();
if (isset($_REQUEST["cancel"])) { if (isset($_REQUEST["cancel"])) {
if ($_REQUEST["cancel"]==get_lang('Cancel')) { if ($_REQUEST["cancel"] == get_lang('Cancel')) {
header("Location: exercise.php"); header("Location: exercise.php");
exit; exit;
} }
@ -24,7 +24,7 @@ $hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($
$is_allowedToEdit = api_is_allowed_to_edit(null, true); $is_allowedToEdit = api_is_allowed_to_edit(null, true);
// document path // document path
$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; $documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
// picture path // picture path
$picturePath = $documentPath.'/images'; $picturePath = $documentPath.'/images';
@ -38,21 +38,21 @@ if (!$is_allowedToEdit) {
} }
if (isset($_SESSION['gradebook'])) { if (isset($_SESSION['gradebook'])) {
$gradebook= $_SESSION['gradebook']; $gradebook = $_SESSION['gradebook'];
} }
if (!empty($gradebook) && $gradebook=='view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[]= array ( $interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook'), 'name' => get_lang('ToolGradebook'),
); );
} }
$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises')); $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
$nameTools = get_lang('adminHP'); $nameTools = get_lang('adminHP');
Display::display_header($nameTools,"Exercise"); Display::display_header($nameTools, "Exercise");
/** @todo probably wrong !!!! */ /** @todo probably wrong !!!! */
require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php'; require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
@ -62,7 +62,7 @@ require_once api_get_path(SYS_CODE_PATH).'/exercise/hotpotatoes.lib.php';
</h4> </h4>
<?php <?php
if (isset($newName)) { if (isset($newName)) {
if ($newName!="") { if ($newName != "") {
//alter database record for that test //alter database record for that test
SetComment($hotpotatoesName, $newName); SetComment($hotpotatoesName, $newName);
echo "<script> window.location='exercise.php'; </script>"; echo "<script> window.location='exercise.php'; </script>";

@ -97,7 +97,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') {
if (!empty($gradebook) && $gradebook == 'view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array( $interbreadcrumb[] = array(
'url' => '../gradebook/' . $_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
} }
@ -687,7 +687,7 @@ if (!empty($exerciseList)) {
$title = $cut_title; $title = $cut_title;
} }
$count_exercise_not_validated = (int)Event::count_exercise_result_not_validated( $count_exercise_not_validated = (int) Event::count_exercise_result_not_validated(
$my_exercise_id, $my_exercise_id,
$courseId, $courseId,
$session_id $session_id
@ -733,7 +733,7 @@ if (!empty($exerciseList)) {
); );
// Exercise results // Exercise results
$actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
// Export // Export
@ -815,7 +815,7 @@ if (!empty($exerciseList)) {
} }
} }
$actions .='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. $actions .= '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id'])); $actions .= Display::url(Display::return_icon('cd.gif', get_lang('CopyExercise')), '', array('onclick' => "javascript:if(!confirm('".addslashes(api_htmlentities(get_lang('AreYouSureToCopy'), ENT_QUOTES, $charset))." ".addslashes($row['title'])."?"."')) return false;", 'href' => 'exercise.php?'.api_get_cidreq().'&choice=copy_exercise&sec_token='.$token.'&exerciseId='.$row['id']));
} }
@ -1014,7 +1014,7 @@ if (!empty($exerciseList)) {
$item .= Display::tag('td', $actions, array('class' => 'td_actions')); $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
} else { } else {
if ($isDrhOfCourse) { if ($isDrhOfCourse) {
$actions ='<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'. $actions = '<a href="exercise_report.php?'.api_get_cidreq().'&exerciseId='.$row['id'].'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$item .= Display::tag('td', $actions, array('class' => 'td_actions')); $item .= Display::tag('td', $actions, array('class' => 'td_actions'));
} }
@ -1024,7 +1024,7 @@ if (!empty($exerciseList)) {
'tr', 'tr',
$item, $item,
array( array(
'id' => 'exercise_list_' . $my_exercise_id, 'id' => 'exercise_list_'.$my_exercise_id,
) )
); );
} }
@ -1090,7 +1090,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
Display::return_icon('hotpotatoes_s.png', "HotPotatoes"), Display::return_icon('hotpotatoes_s.png', "HotPotatoes"),
Display::url( Display::url(
$title, $title,
'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([ 'showinframes.php?'.api_get_cidreq().'&'.http_build_query([
'file' => $path, 'file' => $path,
'uid' => $userId 'uid' => $userId
]), ]),
@ -1105,7 +1105,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path
); );
$actions .='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. $actions .= '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
// if active // if active
@ -1114,7 +1114,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
$actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'. $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=disable&page='.$page.'&file='.$path.'">'.
Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).'</a>';
} else { // else if not active } else { // else if not active
$actions .=' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'. $actions .= ' <a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=enable&page='.$page.'&file='.$path.'">'.
Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).'</a>';
} }
$actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'. $actions .= '<a href="'.$exercisePath.'?'.api_get_cidreq().'&hpchoice=delete&file='.$path.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('AreYouSureToDeleteJS'), ENT_QUOTES, $charset).' '.$title."?").'\')) return false;">'.
@ -1136,7 +1136,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
'td', 'td',
Display::url( Display::url(
$title, $title,
'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([ 'showinframes.php?'.api_get_cidreq().'&'.http_build_query([
'file' => $path, 'file' => $path,
'cid' => api_get_course_id(), 'cid' => api_get_course_id(),
'uid' => $userId 'uid' => $userId
@ -1157,7 +1157,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) {
$item .= Display::tag('td', $attemptText); $item .= Display::tag('td', $attemptText);
if ($isDrhOfCourse) { if ($isDrhOfCourse) {
$actions ='<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'. $actions = '<a href="hotpotatoes_exercise_report.php?'.api_get_cidreq().'&path='.$path.'">'.
Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>'; Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).'</a>';
$item .= Display::tag('td', $actions, array('class' => 'td_actions')); $item .= Display::tag('td', $actions, array('class' => 'td_actions'));

@ -8,21 +8,21 @@
require_once __DIR__.'/../inc/global.inc.php'; require_once __DIR__.'/../inc/global.inc.php';
// the section (tabs) // the section (tabs)
$this_section=SECTION_COURSES; $this_section = SECTION_COURSES;
// notice for unauthorized people. // notice for unauthorized people.
api_protect_course_script(true); api_protect_course_script(true);
// breadcrumbs // breadcrumbs
$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises')); $interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises'));
// Tool name // Tool name
$nameTools=get_lang('AddQuestionToExercise'); $nameTools = get_lang('AddQuestionToExercise');
// The form // The form
$form = new FormValidator('add_question','post',api_get_self().'?'.api_get_cidreq()); $form = new FormValidator('add_question', 'post', api_get_self().'?'.api_get_cidreq());
// form title // form title
$form->addElement('header','',get_lang('AddQuestionToExercise')); $form->addElement('header', '', get_lang('AddQuestionToExercise'));
$question_list = Question::get_question_type_list(); $question_list = Question::get_question_type_list();
$question_list_options = array(); $question_list_options = array();
@ -98,7 +98,7 @@ if ($form->validate()) {
Display::display_header($nameTools); Display::display_header($nameTools);
echo '<div class="actions">'; echo '<div class="actions">';
echo '<a href="exercise.php?show=test">'.Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).'</a>'; echo '<a href="exercise.php?show=test">'.Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).'</a>';
echo '</div>'; echo '</div>';
// displaying the form // displaying the form

@ -11,15 +11,15 @@ GradebookUtils::block_students();
$selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0;
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?', 'url' => $_SESSION['gradebook_dest'].'?',
'name' => get_lang('Gradebook' 'name' => get_lang('Gradebook'
)); ));
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat, 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat,
'name' => get_lang('Details' 'name' => get_lang('Details'
)); ));
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.$selectCat, 'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&amp;selectcat='.$selectCat,
'name' => get_lang('GradebookQualifyLog') 'name' => get_lang('GradebookQualifyLog')
); );
@ -30,7 +30,7 @@ echo Display::page_header(get_lang('GradebookQualifyLog'));
$t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG); $t_linkeval_log = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
$t_user = Database::get_main_table(TABLE_MAIN_USER); $t_user = Database::get_main_table(TABLE_MAIN_USER);
$visible_log=Security::remove_XSS($_GET['visiblelog']); $visible_log = Security::remove_XSS($_GET['visiblelog']);
$evaledit = Evaluation :: load($visible_log); $evaledit = Evaluation :: load($visible_log);
$sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username $sql = "SELECT le.name,le.description,le.weight,le.visible,le.type,le.created_at,us.username
@ -45,8 +45,8 @@ while ($row = Database::fetch_row($result)) {
} }
foreach ($list_info as $key => $info_log) { foreach ($list_info as $key => $info_log) {
$list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A'; $list_info[$key][5] = ($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
$list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible'); $list_info[$key][3] = ($info_log[3] == 1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
} }
$parameters = array( $parameters = array(

@ -239,7 +239,7 @@ class AttendanceLink extends AbstractLink
$this->get_attendance_data(); $this->get_attendance_data();
$attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : ''; $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'] : ''; $attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') { if (isset($attendance_qualify_title) && $attendance_qualify_title != '') {
return $this->attendance_data['attendance_qualify_title']; return $this->attendance_data['attendance_qualify_title'];
} else { } else {
return $attendance_title; return $attendance_title;
@ -279,7 +279,7 @@ class AttendanceLink extends AbstractLink
$sql = 'SELECT * FROM '.$this->get_attendance_table().' att $sql = 'SELECT * FROM '.$this->get_attendance_table().' att
WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
$result = Database::query($sql); $result = Database::query($sql);
$row = Database::fetch_array($result,'ASSOC'); $row = Database::fetch_array($result, 'ASSOC');
$attendance_id = $row['id']; $attendance_id = $row['id'];
$url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id); $url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id);

@ -29,7 +29,7 @@ if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin())
array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300') array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300')
); );
$form->addButtonSave(get_lang('Ok'), 'faq_submit'); $form->addButtonSave(get_lang('Ok'), 'faq_submit');
$faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/faq.html'); $faq_content = @(string) file_get_contents(api_get_path(SYS_APP_PATH).'home/faq.html');
$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content))); $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
$form->setDefaults(array('faq_content' => $faq_content)); $form->setDefaults(array('faq_content' => $faq_content));
if ($form->validate()) { if ($form->validate()) {
@ -47,7 +47,7 @@ if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin())
$form->display(); $form->display();
} }
} else { } else {
$faq_content = @(string)file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file); $faq_content = @(string) file_get_contents(api_get_path(SYS_APP_PATH).'home/'.$faq_file);
$faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content))); $faq_content = api_to_system_encoding($faq_content, api_detect_encoding(strip_tags($faq_content)));
echo $faq_content; echo $faq_content;
} }

@ -13,8 +13,8 @@ api_protect_course_script();
$is_allowed_to_edit = api_is_allowed_to_edit(null, true); $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null; $isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null;
$learnpath_id = (int)$_REQUEST['lp_id']; $learnpath_id = (int) $_REQUEST['lp_id'];
$submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null; $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null;
$type = isset($_GET['type']) ? $_GET['type'] : null; $type = isset($_GET['type']) ? $_GET['type'] : null;
@ -32,7 +32,7 @@ if (isset($_SESSION['gradebook'])) {
} }
if (!empty($gradebook) && $gradebook == 'view') { if (!empty($gradebook) && $gradebook == 'view') {
$interbreadcrumb[] = array ( $interbreadcrumb[] = array(
'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'url' => '../gradebook/'.$_SESSION['gradebook_dest'],
'name' => get_lang('ToolGradebook') 'name' => get_lang('ToolGradebook')
); );
@ -56,12 +56,12 @@ switch ($type) {
); );
break; break;
default: default:
$interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewStep'));
break; break;
} }
if ($action == 'add_item' && $type == 'document') { if ($action == 'add_item' && $type == 'document') {
$interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated')); $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewDocumentCreated'));
} }
// Theme calls. // Theme calls.
@ -77,7 +77,7 @@ $lp_item = new learnpathItem($lp_item_id);
$form = new FormValidator( $form = new FormValidator(
'add_audio', 'add_audio',
'post', 'post',
api_get_self() . '?action=add_audio&id=' . $lp_item_id . '&' . api_get_cidreq().'&lp_id='.$learnpath_id, api_get_self().'?action=add_audio&id='.$lp_item_id.'&'.api_get_cidreq().'&lp_id='.$learnpath_id,
null, null,
array('enctype' => 'multipart/form-data') array('enctype' => 'multipart/form-data')
); );
@ -91,8 +91,8 @@ if (isset($lp_item->audio) && !empty($lp_item->audio)) {
$urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$lp_item->audio.'?'.api_get_cidreq(); $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document/audio/'.$lp_item->audio.'?'.api_get_cidreq();
if (!file_exists($file)) { if (!file_exists($file)) {
$file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'] . '/' . $lp_item->audio; $file = api_get_path(SYS_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'].'/'.$lp_item->audio;
$urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'] . '/' . $lp_item->audio.'?'.api_get_cidreq(); $urlFile = api_get_path(WEB_COURSE_PATH).$courseInfo['path'].'/document'.$lpPathInfo['dir'].'/'.$lp_item->audio.'?'.api_get_cidreq();
} }
} }
@ -108,10 +108,10 @@ $recordVoiceForm = Display::page_subheader(get_lang('RecordYourVoice'));
$page .= '<div id="doc_form" class="col-md-8">'; $page .= '<div id="doc_form" class="col-md-8">';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_JS_PATH) . 'rtc/RecordRTC.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'rtc/RecordRTC.js"></script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/recorder.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/recorder.js"></script>';
$htmlHeadXtra[] = '<script src="' . api_get_path(WEB_LIBRARY_PATH) . 'wami-recorder/gui.js"></script>'; $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'wami-recorder/gui.js"></script>';
$htmlHeadXtra[] = '<script type="text/javascript" src="' . api_get_path(WEB_LIBRARY_PATH) . 'swfobject/swfobject.js"></script>'; $htmlHeadXtra[] = '<script type="text/javascript" src="'.api_get_path(WEB_LIBRARY_PATH).'swfobject/swfobject.js"></script>';
$tpl = new Template(null); $tpl = new Template(null);
$tpl->assign('unique_file_id', api_get_unique_id()); $tpl->assign('unique_file_id', api_get_unique_id());
@ -133,7 +133,7 @@ if (!empty($file)) {
Display::getMediaPlayer($file, array('url' => $urlFile)). Display::getMediaPlayer($file, array('url' => $urlFile)).
"</div>"; "</div>";
$form->addElement('label', get_lang('Listen'), $audioPlayer); $form->addElement('label', get_lang('Listen'), $audioPlayer);
$url = api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq(); $url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?lp_id='.$_SESSION['oLP']->get_id().'&action=add_audio&id='.$lp_item_id.'&delete_file=1&'.api_get_cidreq();
$form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger'))); $form->addElement('label', null, Display::url(get_lang('RemoveAudio'), $url, array('class' => 'btn btn-danger')));
} else { } else {
$form->addElement('file', 'file'); $form->addElement('file', 'file');

@ -16,7 +16,7 @@ $xajax->registerFunction('search_courses');
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs // setting breadcrumbs
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList')); $interbreadcrumb[] = array('url' => 'session_list.php', 'name' => get_lang('SessionList'));
// Database Table Definitions // Database Table Definitions
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER); $tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -38,7 +38,7 @@ if (isset($_GET['add_type']) && $_GET['add_type'] != '') {
} }
if (!api_is_platform_admin() && !api_is_session_admin()) { if (!api_is_platform_admin() && !api_is_session_admin()) {
$sql = 'SELECT session_admin_id FROM ' . Database::get_main_table(TABLE_MAIN_SESSION) . ' WHERE id=' . $id_session; $sql = 'SELECT session_admin_id FROM '.Database::get_main_table(TABLE_MAIN_SESSION).' WHERE id='.$id_session;
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::result($rs, 0, 0) != $_user['user_id']) { if (Database::result($rs, 0, 0) != $_user['user_id']) {
api_not_allowed(true); api_not_allowed(true);
@ -100,7 +100,7 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$sql = "UPDATE $tbl_session SET session_category_id = $categoryId WHERE id in ($session_id) "; $sql = "UPDATE $tbl_session SET session_category_id = $categoryId WHERE id in ($session_id) ";
Database::query($sql); Database::query($sql);
header('Location: add_many_session_to_category.php?id_category=' . $categoryId . '&msg=ok'); header('Location: add_many_session_to_category.php?id_category='.$categoryId.'&msg=ok');
exit; exit;
} else { } else {
header('Location: add_many_session_to_category.php?msg=error'); header('Location: add_many_session_to_category.php?msg=error');
@ -128,8 +128,8 @@ $where = '';
$rows_category_session = array(); $rows_category_session = array();
if ((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category'])) { if ((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category'])) {
$where = 'WHERE session_category_id != ' . $categoryId .' OR session_category_id IS NULL'; $where = 'WHERE session_category_id != '.$categoryId.' OR session_category_id IS NULL';
$sql = 'SELECT id, name FROM ' . $tbl_session . ' WHERE session_category_id =' . $categoryId . ' ORDER BY name'; $sql = 'SELECT id, name FROM '.$tbl_session.' WHERE session_category_id ='.$categoryId.' ORDER BY name';
$result = Database::query($sql); $result = Database::query($sql);
$rows_category_session = Database::store_result($result); $rows_category_session = Database::store_result($result);
} }
@ -142,13 +142,13 @@ if (empty($rows_session_category)) {
} }
if (api_get_multiple_access_url()) { if (api_get_multiple_access_url()) {
$table_access_url_rel_session= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); $table_access_url_rel_session = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION);
$access_url_id = api_get_current_access_url_id(); $access_url_id = api_get_current_access_url_id();
$sql = "SELECT s.id, s.name FROM $tbl_session s INNER JOIN $table_access_url_rel_session u ON s.id = u.session_id $where AND u.access_url_id = $access_url_id ORDER BY name"; $sql = "SELECT s.id, s.name FROM $tbl_session s INNER JOIN $table_access_url_rel_session u ON s.id = u.session_id $where AND u.access_url_id = $access_url_id ORDER BY name";
} else { } else {
$sql = "SELECT id, name FROM $tbl_session $where ORDER BY name"; $sql = "SELECT id, name FROM $tbl_session $where ORDER BY name";
} }
$result=Database::query($sql); $result = Database::query($sql);
$rows_session = Database::store_result($result); $rows_session = Database::store_result($result);
?> ?>
<form name="formulaire" method="post" <form name="formulaire" method="post"
@ -156,7 +156,7 @@ $rows_session = Database::store_result($result);
if (!empty($_GET['add'])) { if (!empty($_GET['add'])) {
echo '&add=true'; echo '&add=true';
} ?>" style="margin:0px;"> } ?>" style="margin:0px;">
<?php echo '<legend>' . $tool_name . '</legend>'; ?> <?php echo '<legend>'.$tool_name.'</legend>'; ?>
<input type="hidden" name="formSent" value="1"/> <input type="hidden" name="formSent" value="1"/>
<?php <?php
if (!empty($errorMsg)) { if (!empty($errorMsg)) {
@ -194,8 +194,8 @@ if (!empty($OkMsg)) {
<option value="0" ></option> <option value="0" ></option>
<?php <?php
if (!empty($rows_session_category)) { if (!empty($rows_session_category)) {
foreach($rows_session_category as $category) { foreach ($rows_session_category as $category) {
if($category['id'] == $categoryId) if ($category['id'] == $categoryId)
echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>'; echo '<option value="'.$category['id'].'" selected>'.$category['name'].'</option>';
else else
echo '<option value="'.$category['id'].'">'.$category['name'].'</option>'; echo '<option value="'.$category['id'].'">'.$category['name'].'</option>';
@ -211,7 +211,7 @@ if (!empty($OkMsg)) {
<td align="center" width="45%"><b><?php echo get_lang('SessionListInCategory') ?> :</b></td> <td align="center" width="45%"><b><?php echo get_lang('SessionListInCategory') ?> :</b></td>
</tr> </tr>
<?php if($add_type == 'multiple') { ?> <?php if ($add_type == 'multiple') { ?>
<tr> <tr>
<td>&nbsp;</td></tr> <td>&nbsp;</td></tr>
<?php } ?> <?php } ?>
@ -220,9 +220,9 @@ if (!empty($OkMsg)) {
<div id="ajax_list_courses_multiple"> <div id="ajax_list_courses_multiple">
<select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:320px;"> <select id="origin" name="NoSessionCategoryList[]" multiple="multiple" size="20" style="width:320px;">
<?php <?php
foreach($rows_session as $enreg) { foreach ($rows_session as $enreg) {
?> ?>
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option> <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; if (in_array($enreg['id'], $CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option>
<?php } ?> <?php } ?>
</select></div> </select></div>
<?php unset($nosessionCourses); ?> <?php unset($nosessionCourses); ?>
@ -243,8 +243,8 @@ if (!empty($OkMsg)) {
<td width="45%" align="center"> <td width="45%" align="center">
<select id='destination' name="SessionCategoryList[]" multiple="multiple" size="20" style="width:320px;"> <select id='destination' name="SessionCategoryList[]" multiple="multiple" size="20" style="width:320px;">
<?php <?php
foreach($rows_category_session as $enreg) { ?> foreach ($rows_category_session as $enreg) { ?>
<option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'],ENT_QUOTES).'"'; if(in_array($enreg['id'],$CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option> <option value="<?php echo $enreg['id']; ?>" <?php echo 'title="'.htmlspecialchars($enreg['name'], ENT_QUOTES).'"'; if (in_array($enreg['id'], $CourseList)) echo 'selected="selected"'; ?>><?php echo $enreg['name']; ?></option>
<?php } ?> <?php } ?>
</select></td> </select></td>
</tr> </tr>

@ -154,7 +154,7 @@ if (api_is_course_admin() ||
survey_question_option.c_id = $course_id survey_question_option.c_id = $course_id
WHERE WHERE
survey_question.survey_id = '".intval($survey_id)."' AND survey_question.survey_id = '".intval($survey_id)."' AND
survey_question.question_id IN (".Database::escape_string(implode(',',$paged_questions[$_GET['show']]), null, false).") AND survey_question.question_id IN (".Database::escape_string(implode(',', $paged_questions[$_GET['show']]), null, false).") AND
survey_question.c_id = $course_id survey_question.c_id = $course_id
ORDER BY survey_question.sort, survey_question_option.sort ASC"; ORDER BY survey_question.sort, survey_question_option.sort ASC";
@ -191,7 +191,7 @@ if (api_is_course_admin() ||
// Displaying the form with the questions // Displaying the form with the questions
if (isset($_GET['show'])) { if (isset($_GET['show'])) {
$show = (int)$_GET['show'] + 1; $show = (int) $_GET['show'] + 1;
} else { } else {
$show = 0; $show = 0;
} }

@ -47,13 +47,13 @@ if ($surveyData['survey_type'] == 1) {
$sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).' $sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).'
WHERE WHERE
c_id = '.$course_id.' AND c_id = '.$course_id.' AND
survey_id = '.(int)$_GET['survey_id'].' LIMIT 1'; survey_id = '.(int) $_GET['survey_id'].' LIMIT 1';
$rs = Database::query($sql); $rs = Database::query($sql);
if (Database::num_rows($rs)===0) { if (Database::num_rows($rs) === 0) {
Display::addFlash( Display::addFlash(
Display::return_message(get_lang('YouNeedToCreateGroups')) Display::return_message(get_lang('YouNeedToCreateGroups'))
); );
header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int)$_GET['survey_id']); header('Location: '.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.(int) $_GET['survey_id']);
exit; exit;
} }
} }
@ -93,7 +93,7 @@ $possible_types = array(
// Actions // Actions
$actions = '<div class="actions">'; $actions = '<div class="actions">';
$actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.intval($_GET['survey_id']).'">'. $actions .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey.php?survey_id='.intval($_GET['survey_id']).'">'.
Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).'</a>'; Display::return_icon('back.png', get_lang('BackToSurvey'), '', ICON_SIZE_MEDIUM).'</a>';
$actions .= '</div>'; $actions .= '</div>';
// Checking if it is a valid type // Checking if it is a valid type
if (!in_array($_GET['type'], $possible_types)) { if (!in_array($_GET['type'], $possible_types)) {

@ -125,7 +125,7 @@ $form->addElement(
); );
$form->addElement('html', '<div id="check_mail">'); $form->addElement('html', '<div id="check_mail">');
$form->addElement('checkbox', 'send_mail','', get_lang('SendMail')); $form->addElement('checkbox', 'send_mail', '', get_lang('SendMail'));
$form->addElement('html', '</div>'); $form->addElement('html', '</div>');
$form->addElement('html', '<div id="mail_text_wrapper">'); $form->addElement('html', '<div id="mail_text_wrapper">');

@ -11,7 +11,7 @@ require_once __DIR__.'/../inc/global.inc.php';
// setting the section (for the tabs) // setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN; $this_section = SECTION_PLATFORM_ADMIN;
$id_session = (int)$_GET['id_session']; $id_session = (int) $_GET['id_session'];
SessionManager::protect_teacher_session_edit($id_session); SessionManager::protect_teacher_session_edit($id_session);
$tool_name = get_lang('SessionOverview'); $tool_name = get_lang('SessionOverview');
@ -59,7 +59,7 @@ if ($allowTutors === 'true') {
$rs = Database::query($sql); $rs = Database::query($sql);
$session_category = ''; $session_category = '';
if (Database::num_rows($rs)>0) { if (Database::num_rows($rs) > 0) {
$rows_session_category = Database::store_result($rs); $rows_session_category = Database::store_result($rs);
$rows_session_category = $rows_session_category[0]; $rows_session_category = $rows_session_category[0];
$session_category = $rows_session_category['name']; $session_category = $rows_session_category['name'];
@ -84,25 +84,25 @@ if ($allowTutors === 'true') {
break; break;
case 'delete': case 'delete':
$idChecked = $_GET['idChecked']; $idChecked = $_GET['idChecked'];
if(is_array($idChecked)) { if (is_array($idChecked)) {
$my_temp = array(); $my_temp = array();
foreach ($idChecked as $id){ foreach ($idChecked as $id) {
$courseInfo = api_get_course_info($id); $courseInfo = api_get_course_info($id);
$my_temp[]= $courseInfo['real_id'];// forcing the escape_string $my_temp[] = $courseInfo['real_id']; // forcing the escape_string
} }
$idChecked = $my_temp; $idChecked = $my_temp;
$idChecked = "'".implode("','", $idChecked)."'"; $idChecked = "'".implode("','", $idChecked)."'";
$result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)"); $result = Database::query("DELETE FROM $tbl_session_rel_course WHERE session_id='$id_session' AND c_id IN($idChecked)");
$nbr_affected_rows=Database::affected_rows($result); $nbr_affected_rows = Database::affected_rows($result);
Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)"); Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id='$id_session' AND c_id IN($idChecked)");
Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'"); Database::query("UPDATE $tbl_session SET nbr_courses=nbr_courses-$nbr_affected_rows WHERE id='$id_session'");
} }
if (!empty($_GET['class'])){ if (!empty($_GET['class'])) {
$result = Database::query("DELETE FROM $tbl_session_rel_class WHERE session_id='$id_session' AND class_id=".intval($_GET['class'])); $result = Database::query("DELETE FROM $tbl_session_rel_class WHERE session_id='$id_session' AND class_id=".intval($_GET['class']));
$nbr_affected_rows=Database::affected_rows($result); $nbr_affected_rows = Database::affected_rows($result);
Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$id_session'"); Database::query("UPDATE $tbl_session SET nbr_classes=nbr_classes-$nbr_affected_rows WHERE id='$id_session'");
} }
@ -112,7 +112,7 @@ if ($allowTutors === 'true') {
Database::query("UPDATE $tbl_session SET nbr_users=nbr_users-$nbr_affected_rows WHERE id='$id_session'"); Database::query("UPDATE $tbl_session SET nbr_users=nbr_users-$nbr_affected_rows WHERE id='$id_session'");
$result = Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id ='$id_session' AND user_id=".intval($_GET['user'])); $result = Database::query("DELETE FROM $tbl_session_rel_course_rel_user WHERE session_id ='$id_session' AND user_id=".intval($_GET['user']));
$nbr_affected_rows=Database::affected_rows($result); $nbr_affected_rows = Database::affected_rows($result);
Database::query("UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows WHERE session_id ='$id_session'"); Database::query("UPDATE $tbl_session_rel_course SET nbr_users=nbr_users-$nbr_affected_rows WHERE session_id ='$id_session'");
} }
@ -130,7 +130,7 @@ if ($allowTutors === 'true') {
<td><?php echo get_lang('GeneralCoach'); ?> :</td> <td><?php echo get_lang('GeneralCoach'); ?> :</td>
<td><?php echo api_get_person_name($session['firstname'], $session['lastname']).' ('.$session['username'].')' ?></td> <td><?php echo api_get_person_name($session['firstname'], $session['lastname']).' ('.$session['username'].')' ?></td>
</tr> </tr>
<?php if(!empty($session_category)) { ?> <?php if (!empty($session_category)) { ?>
<tr> <tr>
<td><?php echo get_lang('SessionCategory') ?></td> <td><?php echo get_lang('SessionCategory') ?></td>
<td><?php echo $session_category; ?></td> <td><?php echo $session_category; ?></td>
@ -140,7 +140,7 @@ if ($allowTutors === 'true') {
<td><?php echo get_lang('Date'); ?> :</td> <td><?php echo get_lang('Date'); ?> :</td>
<td> <td>
<?php <?php
if ($session['access_start_date'] == '00-00-0000' && $session['access_end_date']== '00-00-0000' ) { if ($session['access_start_date'] == '00-00-0000' && $session['access_end_date'] == '00-00-0000') {
echo get_lang('NoTimeLimits'); echo get_lang('NoTimeLimits');
} }
else { else {
@ -151,7 +151,7 @@ if ($allowTutors === 'true') {
$session['access_start_date'] = ''; $session['access_start_date'] = '';
} }
if ($session['access_end_date'] == '00-00-0000') { if ($session['access_end_date'] == '00-00-0000') {
$session['access_end_date'] =''; $session['access_end_date'] = '';
} else { } else {
$session['access_end_date'] = get_lang('Until').' '.$session['access_end_date']; $session['access_end_date'] = get_lang('Until').' '.$session['access_end_date'];
} }
@ -182,7 +182,7 @@ if ($allowTutors === 'true') {
<?php echo api_ucfirst(get_lang('SessionVisibility')) ?> : <?php echo api_ucfirst(get_lang('SessionVisibility')) ?> :
</td> </td>
<td> <td>
<?php if ($session['visibility']==1) echo get_lang('ReadOnly'); elseif($session['visibility']==2) echo get_lang('Visible');elseif($session['visibility']==3) echo api_ucfirst(get_lang('Invisible')) ?> <?php if ($session['visibility'] == 1) echo get_lang('ReadOnly'); elseif ($session['visibility'] == 2) echo get_lang('Visible'); elseif ($session['visibility'] == 3) echo api_ucfirst(get_lang('Invisible')) ?>
</td> </td>
</tr> </tr>
<?php <?php
@ -194,7 +194,7 @@ if ($allowTutors === 'true') {
echo '</td>'; echo '</td>';
echo '<td>'; echo '<td>';
$url_list = UrlManager::get_access_url_from_session($id_session); $url_list = UrlManager::get_access_url_from_session($id_session);
foreach($url_list as $url_data) { foreach ($url_list as $url_data) {
echo $url_data['url'].'<br />'; echo $url_data['url'].'<br />';
} }
echo '</td></tr>'; echo '</td></tr>';
@ -224,8 +224,8 @@ if ($allowTutors === 'true') {
WHERE c.id = sc.c_id WHERE c.id = sc.c_id
AND session_id='$id_session' AND session_id='$id_session'
ORDER BY title"; ORDER BY title";
$result=Database::query($sql); $result = Database::query($sql);
$courses=Database::store_result($result); $courses = Database::store_result($result);
foreach ($courses as $course) { foreach ($courses as $course) {
//select the number of users //select the number of users
@ -238,7 +238,7 @@ if ($allowTutors === 'true') {
srcru.session_id = '".intval($id_session)."'"; srcru.session_id = '".intval($id_session)."'";
$rs = Database::query($sql); $rs = Database::query($sql);
$course['nbr_users'] = Database::result($rs,0,0); $course['nbr_users'] = Database::result($rs, 0, 0);
// Get coachs of the courses in session // Get coachs of the courses in session
@ -264,7 +264,7 @@ if ($allowTutors === 'true') {
} }
if (count($coachs) > 0) { if (count($coachs) > 0) {
$coach = implode('<br />',$coachs); $coach = implode('<br />', $coachs);
} else { } else {
$coach = get_lang('None'); $coach = get_lang('None');
} }
@ -274,7 +274,7 @@ if ($allowTutors === 'true') {
// name of the course, that appeared in the default $interbreadcrumb // name of the course, that appeared in the default $interbreadcrumb
echo ' echo '
<tr> <tr>
<td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session),'</td> <td>'.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session), '</td>
<td>'.$coach.'</td> <td>'.$coach.'</td>
<td>'.$course['nbr_users'].'</td> <td>'.$course['nbr_users'].'</td>
@ -299,7 +299,7 @@ if ($allowTutors === 'true') {
</tr> </tr>
<?php <?php
if ($session['nbr_users']==0) { if ($session['nbr_users'] == 0) {
echo '<tr> echo '<tr>
<td colspan="2">'.get_lang('NoUsersForThisSession').'</td> <td colspan="2">'.get_lang('NoUsersForThisSession').'</td>
</tr>'; </tr>';
@ -330,7 +330,7 @@ if ($allowTutors === 'true') {
$user_link = ''; $user_link = '';
if (!empty($user['user_id'])) { if (!empty($user['user_id'])) {
$user_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'. $user_link = '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_information.php?user_id='.intval($user['user_id']).'">'.
api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']),ENT_QUOTES,$charset).' ('.$user['username'].')</a>'; api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']), ENT_QUOTES, $charset).' ('.$user['username'].')</a>';
} }
$link_to_add_user_in_url = ''; $link_to_add_user_in_url = '';

@ -229,14 +229,14 @@ class Skill
return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_BIG, null, true); return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_BIG, null, true);
} }
return api_get_path(WEB_UPLOAD_PATH) . 'badges/' . sha1($this->name) . '-small.png'; return api_get_path(WEB_UPLOAD_PATH).'badges/'.sha1($this->name).'-small.png';
} }
if (empty($this->icon)) { if (empty($this->icon)) {
return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_HUGE, null, true); return \Display::return_icon('badges-default.png', null, null, ICON_SIZE_HUGE, null, true);
} }
return api_get_path(WEB_UPLOAD_PATH) . "badges/{$this->icon}"; return api_get_path(WEB_UPLOAD_PATH)."badges/{$this->icon}";
} }
/** /**

@ -77,7 +77,7 @@ Display::display_header(get_lang('UserOnlineListSession'));
$time_limit = 60; $time_limit = 60;
} }
$online_time = time() - $time_limit*60; $online_time = time() - $time_limit * 60;
$current_date = api_get_utc_datetime($online_time); $current_date = api_get_utc_datetime($online_time);
$students_online = array(); $students_online = array();
@ -97,7 +97,7 @@ Display::display_header(get_lang('UserOnlineListSession'));
$result = Database::query($sql); $result = Database::query($sql);
while($user_list = Database::fetch_array($result)) { while ($user_list = Database::fetch_array($result)) {
$students_online[$user_list['access_user_id']] = $user_list; $students_online[$user_list['access_user_id']] = $user_list;
} }
} }

Loading…
Cancel
Save