From 699ede4dbe5f98df2676bb3251da1b179ad8f3dd Mon Sep 17 00:00:00 2001 From: Scrutinizer Auto-Fixer Date: Wed, 26 Apr 2017 13:22:15 +0000 Subject: [PATCH] Scrutinizer Auto-Fixes This commit consists of patches automatically generated for this project on https://scrutinizer-ci.com --- main/admin/user_information.php | 4 +- main/dropbox/dropbox_functions.inc.php | 82 +++++++++---------- main/exercise/adminhp.php | 18 ++-- main/exercise/exercise.php | 22 ++--- main/exercise/question_create.php | 14 ++-- main/gradebook/gradebook_showlog_eval.php | 12 +-- .../gradebook/lib/be/attendancelink.class.php | 6 +- main/help/faq.php | 4 +- main/lp/lp_add_audio.php | 26 +++--- main/session/add_many_session_to_category.php | 30 +++---- main/survey/preview.php | 4 +- main/survey/question.php | 8 +- main/survey/survey_invite.php | 8 +- main/user/resume_session.php | 46 +++++------ src/Chamilo/CoreBundle/Entity/Skill.php | 4 +- whoisonlinesession.php | 4 +- 16 files changed, 146 insertions(+), 146 deletions(-) diff --git a/main/admin/user_information.php b/main/admin/user_information.php index 7770a5f401..59dca79bb6 100755 --- a/main/admin/user_information.php +++ b/main/admin/user_information.php @@ -37,7 +37,7 @@ $interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdm $interbreadcrumb[] = array("url" => 'user_list.php', "name" => get_lang('UserList')); $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 = Database::get_main_table(TABLE_MAIN_COURSE); @@ -452,7 +452,7 @@ if (Database::num_rows($res) > 0) { $tools = ''. Display::return_icon('synthese_view.gif', get_lang('Overview')).''. ''. - Display::return_icon('course_home.gif', get_lang('CourseHomepage')).'' . + Display::return_icon('course_home.gif', get_lang('CourseHomepage')).''. ''. Display::return_icon('edit.gif', get_lang('Edit')).''; if ($course->status == STUDENT) { diff --git a/main/dropbox/dropbox_functions.inc.php b/main/dropbox/dropbox_functions.inc.php index 7e3c8cc720..44fc1483be 100755 --- a/main/dropbox/dropbox_functions.inc.php +++ b/main/dropbox/dropbox_functions.inc.php @@ -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 $ids = isset($_GET['id']) ? $_GET['id'] : array(); - if (count($ids)>0) { + if (count($ids) > 0) { $checked_file_ids = $_POST['id']; } else { foreach ($_POST as $key => $value) { @@ -133,7 +133,7 @@ function delete_category($action, $id, $user_id = null) } $cat = get_dropbox_category($id); - if (count($cat)==0) { + if (count($cat) == 0) { return false; } @@ -157,7 +157,7 @@ function delete_category($action, $id, $user_id = null) } // 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'"; Database::query($sql); @@ -241,7 +241,7 @@ function store_move($id, $target, $part) $return_message = get_lang('ReceivedFileMoved'); } 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)." WHERE c_id = $course_id AND @@ -276,7 +276,7 @@ function get_dropbox_categories($filter = '') $session_id = api_get_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"; $result = Database::query($sql); @@ -298,7 +298,7 @@ function get_dropbox_category($id) { $course_id = api_get_course_int_id(); 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."'"; $res = Database::query($sql); if ($res === false) { @@ -347,7 +347,7 @@ function store_addcategory() if (!isset($_POST['edit_id'])) { $session_id = api_get_session_id(); // 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 c_id = $course_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); 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); } @@ -419,7 +419,7 @@ function display_addcategory_form($category_name = '', $id = '', $action) if (isset($id) && $id != '') { // 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); $result = Database::query($sql); $row = Database::fetch_array($result); @@ -637,7 +637,7 @@ function display_add_form($viewReceivedCategory, $viewSentCategory, $view, $id = $full_name = $userInfo['complete_name'].$groupNameListToString; $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 $sql = "SELECT DISTINCT f.id, f.filename - FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f - LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " p + FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f + LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_PERSON)." p ON (f.id = p.file_id) WHERE p.user_id IS NULL AND f.c_id = $course_id @@ -754,14 +754,14 @@ function removeUnusedFiles() $result = Database::query($sql); while ($res = Database::fetch_array($result)) { //delete the selected files from the post and file tables - $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " - WHERE c_id = $course_id AND file_id = '" . $res['id'] . "'"; + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_POST)." + WHERE c_id = $course_id AND file_id = '".$res['id']."'"; Database::query($sql); - $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " - WHERE c_id = $course_id AND id ='" . $res['id'] . "'"; + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_FILE)." + WHERE c_id = $course_id AND id ='".$res['id']."'"; Database::query($sql); //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); $sql = "SELECT f.uploader_id - FROM " . Database::get_course_table(TABLE_DROPBOX_FILE) . " f - LEFT JOIN " . Database::get_course_table(TABLE_DROPBOX_POST) . " p + FROM " . Database::get_course_table(TABLE_DROPBOX_FILE)." f + 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) WHERE - p.dest_user_id = '" . $mailingPseudoId . "' AND + p.dest_user_id = '".$mailingPseudoId."' AND p.c_id = $course_id "; $result = Database::query($sql); @@ -813,21 +813,21 @@ function removeMoreIfMailing($file_id) // for all content files, replace mailingPseudoId by owner as uploader $file_id = intval($file_id); $sql = "SELECT p.dest_user_id - FROM " . Database::get_course_table(TABLE_DROPBOX_POST) . " p - WHERE c_id = $course_id AND p.file_id = '" . $file_id . "'"; + FROM " . Database::get_course_table(TABLE_DROPBOX_POST)." p + WHERE c_id = $course_id AND p.file_id = '".$file_id."'"; $result = Database::query($sql); if ($res = Database::fetch_array($result)) { $mailingPseudoId = $res['dest_user_id']; $mailId = get_mail_id_base(); if ($mailingPseudoId > $mailId) { - $sql = "DELETE FROM " . Database::get_course_table(TABLE_DROPBOX_PERSON) . " - WHERE c_id = $course_id AND user_id='" . $mailingPseudoId . "'"; + $sql = "DELETE FROM ".Database::get_course_table(TABLE_DROPBOX_PERSON)." + WHERE c_id = $course_id AND user_id='".$mailingPseudoId."'"; Database::query($sql); - $sql = "UPDATE " . Database::get_course_table(TABLE_DROPBOX_FILE) ." - SET uploader_id='" . api_get_user_id() . "' - WHERE c_id = $course_id AND uploader_id='" . $mailingPseudoId . "'"; + $sql = "UPDATE ".Database::get_course_table(TABLE_DROPBOX_FILE)." + SET uploader_id='" . api_get_user_id()."' + WHERE c_id = $course_id AND uploader_id='".$mailingPseudoId."'"; Database::query($sql); } } @@ -993,7 +993,7 @@ function store_add_dropbox($file = [], $work = null) } } } 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)) { @@ -1038,14 +1038,14 @@ function store_add_dropbox($file = [], $work = null) ), $recipent_temp['email'], get_lang('NewDropboxFileUploaded'), - get_lang('NewDropboxFileUploadedContent').' '.get_lang('SeeFile').''. + get_lang('NewDropboxFileUploadedContent').' '.get_lang('SeeFile').''. "\n\n". api_get_person_name( $_user['firstName'], $_user['lastName'], null, PERSON_NAME_EMAIL_ADDRESS - )."\n". get_lang('Email') ." : ".$_user['mail'], + )."\n".get_lang('Email')." : ".$_user['mail'], api_get_person_name( $_user['firstName'], $_user['lastName'], @@ -1156,12 +1156,12 @@ function user_can_download_file($id, $user_id) $id = intval($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; $result = Database::query($sql); $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; $result = Database::query($sql); $count = Database::num_rows($result); @@ -1175,12 +1175,12 @@ function check_if_file_exist($id) { $id = intval($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; $result = Database::query($sql); $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; $result = Database::query($sql); $count = Database::num_rows($result); @@ -1212,7 +1212,7 @@ function store_feedback() $id = Database::insert(Database::get_course_table(TABLE_DROPBOX_FEEDBACK), $params); 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); } @@ -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. $sql = "SELECT DISTINCT file.filename, file.title, file.author, file.description - FROM ". Database::get_course_table(TABLE_DROPBOX_FILE) ." file - INNER JOIN ". Database::get_course_table(TABLE_DROPBOX_PERSON) ." person + FROM ". Database::get_course_table(TABLE_DROPBOX_FILE)." file + 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) - 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) WHERE file.id IN (".implode(', ', $fileList).") AND @@ -1339,7 +1339,7 @@ function generate_html_overview($files, $dont_show_columns = array(), $make_link // Adding the content. $return .= "\n"; 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"; if (in_array($column_value, $make_link)) { $return .= ''.$value[$column_value].''; @@ -1367,11 +1367,11 @@ function get_total_number_feedback($file_id = '') { $course_id = api_get_course_int_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"; $result = Database::query($sql); $return = array(); - while ($row=Database::fetch_array($result)) { + while ($row = Database::fetch_array($result)) { $return[$row['file_id']] = $row['total']; } return $return; diff --git a/main/exercise/adminhp.php b/main/exercise/adminhp.php index 2ccb191b32..b79dcc68ce 100755 --- a/main/exercise/adminhp.php +++ b/main/exercise/adminhp.php @@ -8,12 +8,12 @@ */ require_once __DIR__.'/../inc/global.inc.php'; -$this_section=SECTION_COURSES; +$this_section = SECTION_COURSES; $_course = api_get_course_info(); if (isset($_REQUEST["cancel"])) { - if ($_REQUEST["cancel"]==get_lang('Cancel')) { + if ($_REQUEST["cancel"] == get_lang('Cancel')) { header("Location: exercise.php"); exit; } @@ -24,7 +24,7 @@ $hotpotatoesName = !empty($_REQUEST['hotpotatoesName']) ? Security::remove_XSS($ $is_allowedToEdit = api_is_allowed_to_edit(null, true); // document path -$documentPath=api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; +$documentPath = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document'; // picture path $picturePath = $documentPath.'/images'; @@ -38,21 +38,21 @@ if (!$is_allowedToEdit) { } if (isset($_SESSION['gradebook'])) { - $gradebook= $_SESSION['gradebook']; + $gradebook = $_SESSION['gradebook']; } -if (!empty($gradebook) && $gradebook=='view') { - $interbreadcrumb[]= array ( +if (!empty($gradebook) && $gradebook == 'view') { + $interbreadcrumb[] = array( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], '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'); -Display::display_header($nameTools,"Exercise"); +Display::display_header($nameTools, "Exercise"); /** @todo probably wrong !!!! */ 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'; window.location='exercise.php'; "; diff --git a/main/exercise/exercise.php b/main/exercise/exercise.php index fcf036541c..a2d117885a 100644 --- a/main/exercise/exercise.php +++ b/main/exercise/exercise.php @@ -97,7 +97,7 @@ if (!empty($_GET['gradebook']) && $_GET['gradebook'] == 'view') { if (!empty($gradebook) && $gradebook == 'view') { $interbreadcrumb[] = array( - 'url' => '../gradebook/' . $_SESSION['gradebook_dest'], + 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook') ); } @@ -687,7 +687,7 @@ if (!empty($exerciseList)) { $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, $courseId, $session_id @@ -733,7 +733,7 @@ if (!empty($exerciseList)) { ); // Exercise results - $actions .=''. + $actions .= ''. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).''; // Export @@ -815,7 +815,7 @@ if (!empty($exerciseList)) { } } - $actions .=''. + $actions .= ''. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).''; $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')); } else { if ($isDrhOfCourse) { - $actions =''. + $actions = ''. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).''; $item .= Display::tag('td', $actions, array('class' => 'td_actions')); } @@ -1024,7 +1024,7 @@ if (!empty($exerciseList)) { 'tr', $item, 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::url( $title, - 'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([ + 'showinframes.php?'.api_get_cidreq().'&'.http_build_query([ 'file' => $path, 'uid' => $userId ]), @@ -1105,7 +1105,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) { 'adminhp.php?'.api_get_cidreq().'&hotpotatoesName='.$path ); - $actions .=''. + $actions .= ''. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).''; // if active @@ -1114,7 +1114,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) { $actions .= ' '. Display::return_icon('visible.png', get_lang('Deactivate'), '', ICON_SIZE_SMALL).''; } else { // else if not active - $actions .=' '. + $actions .= ' '. Display::return_icon('invisible.png', get_lang('Activate'), '', ICON_SIZE_SMALL).''; } $actions .= ''. @@ -1136,7 +1136,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) { 'td', Display::url( $title, - 'showinframes.php?' . api_get_cidreq() . '&' . http_build_query([ + 'showinframes.php?'.api_get_cidreq().'&'.http_build_query([ 'file' => $path, 'cid' => api_get_course_id(), 'uid' => $userId @@ -1157,7 +1157,7 @@ if (isset($attribute['path']) && is_array($attribute['path'])) { $item .= Display::tag('td', $attemptText); if ($isDrhOfCourse) { - $actions =''. + $actions = ''. Display::return_icon('test_results.png', get_lang('Results'), '', ICON_SIZE_SMALL).''; $item .= Display::tag('td', $actions, array('class' => 'td_actions')); diff --git a/main/exercise/question_create.php b/main/exercise/question_create.php index e25add18c2..e2fa214c5d 100755 --- a/main/exercise/question_create.php +++ b/main/exercise/question_create.php @@ -8,21 +8,21 @@ require_once __DIR__.'/../inc/global.inc.php'; // the section (tabs) -$this_section=SECTION_COURSES; +$this_section = SECTION_COURSES; // notice for unauthorized people. api_protect_course_script(true); // breadcrumbs -$interbreadcrumb[]=array("url" => "exercise.php","name" => get_lang('Exercises')); +$interbreadcrumb[] = array("url" => "exercise.php", "name" => get_lang('Exercises')); // Tool name -$nameTools=get_lang('AddQuestionToExercise'); +$nameTools = get_lang('AddQuestionToExercise'); // 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->addElement('header','',get_lang('AddQuestionToExercise')); +$form->addElement('header', '', get_lang('AddQuestionToExercise')); $question_list = Question::get_question_type_list(); $question_list_options = array(); @@ -38,7 +38,7 @@ $form->addElement( ); //session id -$session_id = api_get_session_id(); +$session_id = api_get_session_id(); // the exercises $tbl_exercises = Database::get_course_table(TABLE_QUIZ_TEST); @@ -98,7 +98,7 @@ if ($form->validate()) { Display::display_header($nameTools); echo '
'; - echo ''.Display::return_icon('back.png', get_lang('BackToExercisesList'),'',ICON_SIZE_MEDIUM).''; + echo ''.Display::return_icon('back.png', get_lang('BackToExercisesList'), '', ICON_SIZE_MEDIUM).''; echo '
'; // displaying the form diff --git a/main/gradebook/gradebook_showlog_eval.php b/main/gradebook/gradebook_showlog_eval.php index 12d67c7b86..9f4624340e 100755 --- a/main/gradebook/gradebook_showlog_eval.php +++ b/main/gradebook/gradebook_showlog_eval.php @@ -11,15 +11,15 @@ GradebookUtils::block_students(); $selectCat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : 0; -$interbreadcrumb[] = array ( +$interbreadcrumb[] = array( 'url' => $_SESSION['gradebook_dest'].'?', 'name' => get_lang('Gradebook' )); -$interbreadcrumb[] = array ( +$interbreadcrumb[] = array( 'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectCat, 'name' => get_lang('Details' )); -$interbreadcrumb[] = array ( +$interbreadcrumb[] = array( 'url' => 'gradebook_showlog_eval.php?visiblelog='.Security::remove_XSS($_GET['visiblelog']).'&selectcat='.$selectCat, '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_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); $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) { - $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][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'); } $parameters = array( diff --git a/main/gradebook/lib/be/attendancelink.class.php b/main/gradebook/lib/be/attendancelink.class.php index 879e67491f..401847af28 100755 --- a/main/gradebook/lib/be/attendancelink.class.php +++ b/main/gradebook/lib/be/attendancelink.class.php @@ -164,7 +164,7 @@ class AttendanceLink extends AbstractLink } } else { // all students -> get average - $students = array(); // user list, needed to make sure we only + $students = array(); // user list, needed to make sure we only // take first attempts into account $rescount = 0; $sum = 0; @@ -239,7 +239,7 @@ class AttendanceLink extends AbstractLink $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'] : ''; - if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') { + if (isset($attendance_qualify_title) && $attendance_qualify_title != '') { return $this->attendance_data['attendance_qualify_title']; } else { return $attendance_title; @@ -279,7 +279,7 @@ class AttendanceLink extends AbstractLink $sql = 'SELECT * FROM '.$this->get_attendance_table().' att WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' '; $result = Database::query($sql); - $row = Database::fetch_array($result,'ASSOC'); + $row = Database::fetch_array($result, 'ASSOC'); $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); diff --git a/main/help/faq.php b/main/help/faq.php index 6221ee603f..9e41b0be11 100755 --- a/main/help/faq.php +++ b/main/help/faq.php @@ -29,7 +29,7 @@ if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin()) array('ToolbarSet' => 'FAQ', 'Width' => '100%', 'Height' => '300') ); $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))); $form->setDefaults(array('faq_content' => $faq_content)); if ($form->validate()) { @@ -47,7 +47,7 @@ if (!empty($_GET['edit']) && $_GET['edit'] == 'true' && api_is_platform_admin()) $form->display(); } } 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))); echo $faq_content; } diff --git a/main/lp/lp_add_audio.php b/main/lp/lp_add_audio.php index 340c753d61..9517e98257 100755 --- a/main/lp/lp_add_audio.php +++ b/main/lp/lp_add_audio.php @@ -13,8 +13,8 @@ api_protect_course_script(); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); -$isStudentView = isset($_REQUEST['isStudentView']) ? (int)$_REQUEST['isStudentView'] : null; -$learnpath_id = (int)$_REQUEST['lp_id']; +$isStudentView = isset($_REQUEST['isStudentView']) ? (int) $_REQUEST['isStudentView'] : null; +$learnpath_id = (int) $_REQUEST['lp_id']; $submit = isset($_POST['submit_button']) ? $_POST['submit_button'] : null; $type = isset($_GET['type']) ? $_GET['type'] : null; @@ -32,7 +32,7 @@ if (isset($_SESSION['gradebook'])) { } if (!empty($gradebook) && $gradebook == 'view') { - $interbreadcrumb[] = array ( + $interbreadcrumb[] = array( 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], 'name' => get_lang('ToolGradebook') ); @@ -56,12 +56,12 @@ switch ($type) { ); break; default: - $interbreadcrumb[]= array('url' => '#', 'name' => get_lang('NewStep')); + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewStep')); break; } if ($action == 'add_item' && $type == 'document') { - $interbreadcrumb[]= array ('url' => '#', 'name' => get_lang('NewDocumentCreated')); + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewDocumentCreated')); } // Theme calls. @@ -77,7 +77,7 @@ $lp_item = new learnpathItem($lp_item_id); $form = new FormValidator( 'add_audio', '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, 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(); if (!file_exists($file)) { - $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(); + $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(); } } @@ -108,10 +108,10 @@ $recordVoiceForm = Display::page_subheader(get_lang('RecordYourVoice')); $page .= '
'; -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; -$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; $tpl = new Template(null); $tpl->assign('unique_file_id', api_get_unique_id()); @@ -133,7 +133,7 @@ if (!empty($file)) { Display::getMediaPlayer($file, array('url' => $urlFile)). "
"; $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'))); } else { $form->addElement('file', 'file'); diff --git a/main/session/add_many_session_to_category.php b/main/session/add_many_session_to_category.php index ae340e6387..2f77cd75bf 100644 --- a/main/session/add_many_session_to_category.php +++ b/main/session/add_many_session_to_category.php @@ -16,7 +16,7 @@ $xajax->registerFunction('search_courses'); $this_section = SECTION_PLATFORM_ADMIN; // 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 $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()) { - $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); if (Database::result($rs, 0, 0) != $_user['user_id']) { 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) "; 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; } else { header('Location: add_many_session_to_category.php?msg=error'); @@ -128,8 +128,8 @@ $where = ''; $rows_category_session = array(); if ((isset($_POST['CategorySessionId']) && $_POST['formSent'] == 0) || isset($_GET['id_category'])) { - $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'; + $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'; $result = Database::query($sql); $rows_category_session = Database::store_result($result); } @@ -142,13 +142,13 @@ if (empty($rows_session_category)) { } 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(); $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 { $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); ?>
" style="margin:0px;"> -' . $tool_name . ''; ?> +'.$tool_name.''; ?> '.$category['name'].''; else echo ''; @@ -211,7 +211,7 @@ if (!empty($OkMsg)) { : - +   @@ -220,9 +220,9 @@ if (!empty($OkMsg)) {
@@ -243,8 +243,8 @@ if (!empty($OkMsg)) { diff --git a/main/survey/preview.php b/main/survey/preview.php index d6414c7a7f..791f878859 100755 --- a/main/survey/preview.php +++ b/main/survey/preview.php @@ -154,7 +154,7 @@ if (api_is_course_admin() || survey_question_option.c_id = $course_id WHERE 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 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 if (isset($_GET['show'])) { - $show = (int)$_GET['show'] + 1; + $show = (int) $_GET['show'] + 1; } else { $show = 0; } diff --git a/main/survey/question.php b/main/survey/question.php index 5439aace31..9791d7ed74 100755 --- a/main/survey/question.php +++ b/main/survey/question.php @@ -47,13 +47,13 @@ if ($surveyData['survey_type'] == 1) { $sql = 'SELECT id FROM '.Database::get_course_table(TABLE_SURVEY_QUESTION_GROUP).' WHERE 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); - if (Database::num_rows($rs)===0) { + if (Database::num_rows($rs) === 0) { Display::addFlash( 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; } } @@ -93,7 +93,7 @@ $possible_types = array( // Actions $actions = '
'; $actions .= ''. - Display::return_icon('back.png', get_lang('BackToSurvey'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('back.png', get_lang('BackToSurvey'), '', ICON_SIZE_MEDIUM).''; $actions .= '
'; // Checking if it is a valid type if (!in_array($_GET['type'], $possible_types)) { diff --git a/main/survey/survey_invite.php b/main/survey/survey_invite.php index 632de2d37c..cf48d24bcb 100755 --- a/main/survey/survey_invite.php +++ b/main/survey/survey_invite.php @@ -125,7 +125,7 @@ $form->addElement( ); $form->addElement('html', '
'); -$form->addElement('checkbox', 'send_mail','', get_lang('SendMail')); +$form->addElement('checkbox', 'send_mail', '', get_lang('SendMail')); $form->addElement('html', '
'); $form->addElement('html', '
'); @@ -213,8 +213,8 @@ if ($form->validate()) { ); // Saving the invitations for the additional users - $values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email - $temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators + $values['additional_users'] = $values['additional_users'].';'; // This is for the case when you enter only one email + $temp = str_replace(',', ';', $values['additional_users']); // This is to allow , and ; as email separators $additional_users = explode(';', $temp); for ($i = 0; $i < count($additional_users); $i++) { $additional_users[$i] = trim($additional_users[$i]); @@ -250,7 +250,7 @@ if ($form->validate()) { $total_invited.' '; $message .= get_lang('WereInvited'); - echo Display::return_message($message, 'normal', false); + echo Display::return_message($message, 'normal', false); if ($sendMail) { echo Display::return_message($total_count.' '.get_lang('InvitationsSend'), 'success', false); diff --git a/main/user/resume_session.php b/main/user/resume_session.php index 6488c2a692..a7af25e006 100755 --- a/main/user/resume_session.php +++ b/main/user/resume_session.php @@ -11,7 +11,7 @@ require_once __DIR__.'/../inc/global.inc.php'; // setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; -$id_session = (int)$_GET['id_session']; +$id_session = (int) $_GET['id_session']; SessionManager::protect_teacher_session_edit($id_session); $tool_name = get_lang('SessionOverview'); @@ -59,7 +59,7 @@ if ($allowTutors === 'true') { $rs = Database::query($sql); $session_category = ''; - if (Database::num_rows($rs)>0) { + if (Database::num_rows($rs) > 0) { $rows_session_category = Database::store_result($rs); $rows_session_category = $rows_session_category[0]; $session_category = $rows_session_category['name']; @@ -84,25 +84,25 @@ if ($allowTutors === 'true') { break; case 'delete': $idChecked = $_GET['idChecked']; - if(is_array($idChecked)) { + if (is_array($idChecked)) { $my_temp = array(); - foreach ($idChecked as $id){ + foreach ($idChecked as $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 = "'".implode("','", $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("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'])); - $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'"); } @@ -112,7 +112,7 @@ if ($allowTutors === 'true') { 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'])); - $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'"); } @@ -130,28 +130,28 @@ if ($allowTutors === 'true') { : - + - + : : - + '; echo ''; $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'].'
'; } echo ''; @@ -224,8 +224,8 @@ if ($allowTutors === 'true') { WHERE c.id = sc.c_id AND session_id='$id_session' ORDER BY title"; - $result=Database::query($sql); - $courses=Database::store_result($result); + $result = Database::query($sql); + $courses = Database::store_result($result); foreach ($courses as $course) { //select the number of users @@ -238,7 +238,7 @@ if ($allowTutors === 'true') { srcru.session_id = '".intval($id_session)."'"; $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 @@ -264,7 +264,7 @@ if ($allowTutors === 'true') { } if (count($coachs) > 0) { - $coach = implode('
',$coachs); + $coach = implode('
', $coachs); } else { $coach = get_lang('None'); } @@ -274,7 +274,7 @@ if ($allowTutors === 'true') { // name of the course, that appeared in the default $interbreadcrumb echo ' - '.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session),' + '.Display::url($course['title'].' ('.$course['visual_code'].')', api_get_path(WEB_COURSE_PATH).$course['code'].'/?id_session='.$id_session), ' '.$coach.' '.$course['nbr_users'].' @@ -299,7 +299,7 @@ if ($allowTutors === 'true') { '.get_lang('NoUsersForThisSession').' '; @@ -330,7 +330,7 @@ if ($allowTutors === 'true') { $user_link = ''; if (!empty($user['user_id'])) { $user_link = ''. - api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']),ENT_QUOTES,$charset).' ('.$user['username'].')'; + api_htmlentities(api_get_person_name($user['firstname'], $user['lastname']), ENT_QUOTES, $charset).' ('.$user['username'].')'; } $link_to_add_user_in_url = ''; diff --git a/src/Chamilo/CoreBundle/Entity/Skill.php b/src/Chamilo/CoreBundle/Entity/Skill.php index 3eba7c5dfc..acd05c5124 100644 --- a/src/Chamilo/CoreBundle/Entity/Skill.php +++ b/src/Chamilo/CoreBundle/Entity/Skill.php @@ -229,14 +229,14 @@ class Skill 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)) { 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}"; } /** diff --git a/whoisonlinesession.php b/whoisonlinesession.php index e2d4299c1e..f0ac0de856 100755 --- a/whoisonlinesession.php +++ b/whoisonlinesession.php @@ -77,7 +77,7 @@ Display::display_header(get_lang('UserOnlineListSession')); $time_limit = 60; } - $online_time = time() - $time_limit*60; + $online_time = time() - $time_limit * 60; $current_date = api_get_utc_datetime($online_time); $students_online = array(); @@ -97,7 +97,7 @@ Display::display_header(get_lang('UserOnlineListSession')); $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; } }