diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 923fa5704e..581d573d89 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -2410,7 +2410,7 @@ class Display $style = !in_array($type, $typeList) ? 'default' : $type; if (!empty($id)) { - $id = " id = $id "; + $id = " id='$id'"; } return ' diff --git a/main/inc/lib/notebook.lib.php b/main/inc/lib/notebook.lib.php index cfcbfd034d..7e983d9859 100755 --- a/main/inc/lib/notebook.lib.php +++ b/main/inc/lib/notebook.lib.php @@ -107,7 +107,7 @@ class NotebookManager } // Database table definition - $t_notebook = Database::get_course_table(TABLE_NOTEBOOK); + $table = Database::get_course_table(TABLE_NOTEBOOK); $course_id = api_get_course_int_id(); $sql = "SELECT @@ -115,7 +115,7 @@ class NotebookManager title AS note_title, description AS note_comment, session_id AS session_id - FROM $t_notebook + FROM $table WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' "; $result = Database::query($sql); if (Database::num_rows($result) != 1) { @@ -189,11 +189,11 @@ class NotebookManager } // Database table definition - $t_notebook = Database::get_course_table(TABLE_NOTEBOOK); + $table = Database::get_course_table(TABLE_NOTEBOOK); $course_id = api_get_course_int_id(); - $sql = "DELETE FROM $t_notebook + $sql = "DELETE FROM $table WHERE c_id = $course_id AND notebook_id='".intval($notebook_id)."' AND @@ -261,7 +261,7 @@ class NotebookManager } // Database table definition - $t_notebook = Database::get_course_table(TABLE_NOTEBOOK); + $table = Database::get_course_table(TABLE_NOTEBOOK); $order_by = " ORDER BY ".$notebookView." $sort_direction "; // Condition for the session @@ -270,7 +270,7 @@ class NotebookManager $cond_extra = $notebookView == 'update_date' ? " AND update_date <> ''" : " "; $course_id = api_get_course_int_id(); - $sql = "SELECT * FROM $t_notebook + $sql = "SELECT * FROM $table WHERE c_id = $course_id AND user_id = '".api_get_user_id()."' diff --git a/main/inc/lib/skill.visualizer.lib.php b/main/inc/lib/skill.visualizer.lib.php index 2ef048650d..d988c77dc2 100755 --- a/main/inc/lib/skill.visualizer.lib.php +++ b/main/inc/lib/skill.visualizer.lib.php @@ -30,8 +30,8 @@ class SkillVisualizer */ public function __construct($skills, $type = 'read') { - $this->skills = $skills; - $this->type = $type; + $this->skills = $skills; + $this->type = $type; $this->center_x = intval($this->offset_x + $this->canvas_x / 2 - $this->block_size / 2); } diff --git a/main/inc/lib/social.lib.php b/main/inc/lib/social.lib.php index f9752e049a..d09109a986 100755 --- a/main/inc/lib/social.lib.php +++ b/main/inc/lib/social.lib.php @@ -1434,7 +1434,7 @@ class SocialManager extends UserManager $messageId, $fileComment = '' ) { - $tbl_message_attach = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); + $table = Database::get_main_table(TABLE_MESSAGE_ATTACHMENT); // create directory $social = '/social/'; @@ -1475,7 +1475,7 @@ class SocialManager extends UserManager 'message_id' => $messageId, 'size' => $fileAttach['size'], ]; - Database::insert($tbl_message_attach, $params); + Database::insert($table, $params); $flag = true; } diff --git a/main/survey/create_new_survey.php b/main/survey/create_new_survey.php index dc7518d8ca..291ea526f8 100755 --- a/main/survey/create_new_survey.php +++ b/main/survey/create_new_survey.php @@ -81,7 +81,9 @@ if ($_GET['action'] == 'edit' && isset($survey_id) && is_numeric($survey_id)) { if ($link_info) { $defaults['category_id'] = $link_info['category_id']; - if ($sql_result_array = Database::fetch_array(Database::query('SELECT weight FROM '.$table_gradebook_link.' WHERE id='.$gradebook_link_id))) { + if ($sql_result_array = Database::fetch_array( + Database::query('SELECT weight FROM '.$table_gradebook_link.' WHERE id='.$gradebook_link_id)) + ) { $defaults['survey_qualify_gradebook'] = $gradebook_link_id; $defaults['survey_weight'] = number_format($sql_result_array['weight'], 2, '.', ''); } @@ -325,9 +327,7 @@ if ($form->validate()) { } else { // Displaying the header Display::display_header($tool_name); - $form->display(); } -// Footer -Display :: display_footer(); +Display::display_footer(); diff --git a/main/survey/fillsurvey.php b/main/survey/fillsurvey.php index a82ac5635a..681ca6765c 100755 --- a/main/survey/fillsurvey.php +++ b/main/survey/fillsurvey.php @@ -6,10 +6,14 @@ use ChamiloSession as Session; /** * @package chamilo.survey * @author unknown, the initial survey that did not make it in 1.8 because of bad code - * @author Patrick Cool , Ghent University: cleanup, refactoring and rewriting large parts of the code - * @author Julio Montoya , Chamilo: Personality Test modification and rewriting large parts of the code as well - * @todo check if the user already filled the survey and if this is the case then the answers have to be updated and not stored again. - * @todo performance could be improved if not the survey_id was stored with the invitation but the survey_code + * @author Patrick Cool , Ghent University: cleanup, + * refactoring and rewriting large parts of the code + * @author Julio Montoya , Chamilo: Personality Test + * modification and rewriting large parts of the code as well + * @todo check if the user already filled the survey and if this + * is the case then the answers have to be updated and not stored again. + * @todo performance could be improved if not the survey_id was + * stored with the invitation but the survey_code */ // Unsetting the course id (because it is in the URL) diff --git a/main/survey/question.php b/main/survey/question.php index d268555d7b..36cb694efa 100755 --- a/main/survey/question.php +++ b/main/survey/question.php @@ -4,8 +4,8 @@ /** * @package chamilo.survey * @author unknown, the initial survey that did not make it in 1.8 because of bad code - * @author Patrick Cool , Ghent University: cleanup, refactoring and rewriting large parts of the code - * @version $Id: question.php 21734 2009-07-02 17:12:41Z cvargas1 $ + * @author Patrick Cool , Ghent University: cleanup, + * refactoring and rewriting large parts of the code */ require_once __DIR__.'/../inc/global.inc.php'; diff --git a/main/survey/reporting.php b/main/survey/reporting.php index ca7ee4d281..1cc241ced4 100755 --- a/main/survey/reporting.php +++ b/main/survey/reporting.php @@ -4,8 +4,8 @@ /** * @package chamilo.survey * @author unknown, the initial survey that did not make it in 1.8 because of bad code - * @author Patrick Cool , Ghent University: cleanup, refactoring and rewriting large parts of the code - * @version $Id: reporting.php 21652 2009-06-27 17:07:35Z herodoto $ + * @author Patrick Cool , Ghent University: cleanup, + * refactoring and rewriting large parts of the code * * @todo The question has to be more clearly indicated (same style as when filling the survey) */ diff --git a/main/survey/survey.download.inc.php b/main/survey/survey.download.inc.php index f9b1cca496..5e621c7eed 100755 --- a/main/survey/survey.download.inc.php +++ b/main/survey/survey.download.inc.php @@ -4,7 +4,6 @@ /** * @package chamilo.survey * @author Arnaud Ligot - * @version $Id: $ * * A small peace of code to enable user to access images included into survey * which are accessible by non authenticated users. This file is included @@ -43,7 +42,8 @@ function check_download_survey($course, $invitation, $doc_url) exit; } - // Very basic security check: check if a text field from a survey/answer/option contains the name of the document requested + // Very basic security check: check if a text field from + // a survey/answer/option contains the name of the document requested // Fetch survey ID // If this is the case there will be a language choice $sql = "SELECT * FROM $table_survey diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index b95cd59ea0..94e59640a9 100755 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -489,7 +489,6 @@ class SurveyManager } $gradebook_link_type = 8; - $link_info = GradebookUtils::isResourceInCourseGradebook( $courseCode, $gradebook_link_type, @@ -991,7 +990,6 @@ class SurveyManager } // Getting the information of the question options - $result = Database::query($sqlOption); while ($row = Database::fetch_array($result, 'ASSOC')) { /** @todo this should be renamed to options instead of answers */ @@ -1364,7 +1362,7 @@ class SurveyManager * This function is normally only called when a survey is deleted * * @param int $survey_id the id of the survey that has to be deleted - * @return true + * @return bool * * @author Patrick Cool , Ghent University * @version January 2007 @@ -1392,6 +1390,8 @@ class SurveyManager // Deleting all the answers on this survey self::delete_all_survey_answers($survey_id); + + return true; } /** diff --git a/main/ticket/assign_tickets.php b/main/ticket/assign_tickets.php index e58673d343..e3925e7274 100644 --- a/main/ticket/assign_tickets.php +++ b/main/ticket/assign_tickets.php @@ -51,7 +51,8 @@ echo '
echo '
'; echo '
@@ -60,7 +61,8 @@ echo '
echo '
'; echo '
diff --git a/main/ticket/new_ticket.php b/main/ticket/new_ticket.php index 5b23af76c3..04e9ce6317 100644 --- a/main/ticket/new_ticket.php +++ b/main/ticket/new_ticket.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** - * @package chamilo.plugin.ticket + * @package chamilo.ticket */ $cidReset = true; @@ -403,7 +403,7 @@ $form->addLabel('', '
'); $form->addLabel( '', ' - ' . get_lang('AddOneMoreFile').' + '.get_lang('AddOneMoreFile').' ('.sprintf(get_lang('MaximunFileSizeX'), format_file_size(api_get_setting('message_max_upload_filesize'))).') ' diff --git a/main/tracking/course_log_events.php b/main/tracking/course_log_events.php index 34b502a8c3..a1c88cf022 100644 --- a/main/tracking/course_log_events.php +++ b/main/tracking/course_log_events.php @@ -9,7 +9,8 @@ require_once __DIR__.'/../inc/global.inc.php'; $this_section = SECTION_COURSES; // Access restrictions. -$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor(); +$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || + api_is_session_admin() || api_is_drh() || api_is_course_tutor(); if (!$is_allowedToTrack) { api_not_allowed(true); diff --git a/main/tracking/course_log_groups.php b/main/tracking/course_log_groups.php index eeff8d13d2..2963fb317b 100644 --- a/main/tracking/course_log_groups.php +++ b/main/tracking/course_log_groups.php @@ -14,7 +14,8 @@ if ($from == 'myspace') { } // Access restrictions. -$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor(); +$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || + api_is_session_admin() || api_is_drh() || api_is_course_tutor(); if (!$is_allowedToTrack) { api_not_allowed(true); @@ -109,16 +110,16 @@ $htmlHeadXtra[] = api_get_jqgrid_js(); $htmlHeadXtra[] = ' '; diff --git a/main/tracking/course_log_resources.php b/main/tracking/course_log_resources.php index 9664021ee8..e4cffde8e0 100755 --- a/main/tracking/course_log_resources.php +++ b/main/tracking/course_log_resources.php @@ -19,7 +19,8 @@ if ($from == 'myspace') { } // Access restrictions. -$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor(); +$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || + api_is_session_admin() || api_is_drh() || api_is_course_tutor(); if (!$is_allowedToTrack) { api_not_allowed(true); diff --git a/main/tracking/course_log_tools.php b/main/tracking/course_log_tools.php index c414300fe5..a01ce67256 100755 --- a/main/tracking/course_log_tools.php +++ b/main/tracking/course_log_tools.php @@ -23,7 +23,8 @@ if ($from == 'myspace') { } // Access restrictions. -$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || api_is_session_admin() || api_is_drh() || api_is_course_tutor(); +$is_allowedToTrack = api_is_platform_admin() || api_is_allowed_to_create_course() || + api_is_session_admin() || api_is_drh() || api_is_course_tutor(); if (!$is_allowedToTrack) { api_not_allowed(); diff --git a/main/upload/form.document.php b/main/upload/form.document.php index fcb557a05f..14b3811de0 100755 --- a/main/upload/form.document.php +++ b/main/upload/form.document.php @@ -11,25 +11,25 @@ * Just display the form needed to upload a SCORM and give its settings */ $nameTools = get_lang('FileUpload'); -$interbreadcrumb[] = ["url"=>"../lp/lp_controller.php?action=list", "name"=> get_lang(TOOL_DOCUMENT)]; +$interbreadcrumb[] = ["url" => "../lp/lp_controller.php?action=list", "name" => get_lang(TOOL_DOCUMENT)]; Display::display_header($nameTools, "Doc"); -//show the title +// Show the title api_display_tool_title($nameTools.$add_group_to_title); ?>
-
- - - - -
+
+ + + + +

addElement('checkbox', 'use_max_score', null, get_lang('UseMaxScore100')); } - -/* This is a special section that has to be enabled in specific cases - * PLEASE DO NOT REMOVE -$list = get_zip_files_in_garbage(); -if (count($list)>0) { - $select_file_name = &$form->addElement( - 'select', - 'file_name', - get_lang('Or').' '.api_strtolower(get_lang('UploadLocalFileFromGarbageDir')) - ); - foreach($list as $file){ - $select_file_name->addOption($file, $file); - } - $form->addElement('submit', 'submit', get_lang('Download')); -} else { - $text_empty = &$form->addElement( - 'text', - 'empty', - get_lang('Or').' '.api_strtolower(get_lang('UploadLocalFileFromGarbageDir')) - ); - $defaults["empty"] = get_lang('Empty'); - $text_empty->freeze(); -}*/ - $form->addButtonUpload(get_lang('Upload')); -/* -TODO: check the pens plugin is enabled before using it -if (is_dir(api_get_path(PLUGIN_PATH)."/pens")) { - require_once api_get_path(PLUGIN_PATH)."/pens/chamilo_pens.php"; - $list = ChamiloPens::findAll(); - if (count($list) > 0) { - $select_pens = $form->addElement('select', 'pens_package', get_lang('Or').' '.get_lang('select a PENS package')); - foreach ($list as $package) { - $select_pens->addOption($package->getPackageName(), $package->getPackageName()); - } - } -} -*/ - // the default values for the form $defaults = ['index_document' => 'checked="checked"', 'use_max_score' => 1]; $form->setDefaults($defaults); diff --git a/main/upload/upload_ppt.php b/main/upload/upload_ppt.php index f7bd44ffb0..7aecdaba50 100755 --- a/main/upload/upload_ppt.php +++ b/main/upload/upload_ppt.php @@ -32,7 +32,13 @@ if (isset($_POST['convert'])) { foreach ($values as $value) { $value = trim($value); if (!empty($value)) { - add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $o_ppt->lp_id, $value); + add_specific_field_value( + $specific_field['id'], + api_get_course_id(), + TOOL_LEARNPATH, + $o_ppt->lp_id, + $value + ); } } } diff --git a/main/upload/upload_word.php b/main/upload/upload_word.php index 9f4a701cbb..3a57990e4f 100755 --- a/main/upload/upload_word.php +++ b/main/upload/upload_word.php @@ -50,7 +50,13 @@ if (isset($_POST['convert'])) { foreach ($values as $value) { $value = trim($value); if (!empty($value)) { - add_specific_field_value($specific_field['id'], api_get_course_id(), TOOL_LEARNPATH, $o_doc->lp_id, $value); + add_specific_field_value( + $specific_field['id'], + api_get_course_id(), + TOOL_LEARNPATH, + $o_doc->lp_id, + $value + ); } } } @@ -81,7 +87,8 @@ $interbreadcrumb[] = ["url"=>"../lp/lp_controller.php?action=list", "name"=> get $nameTools = get_lang("WoogieConversionPowerPoint"); Display :: display_header($nameTools); -echo ''.get_lang("WelcomeWoogieSubtitle").'
'; +echo ''. + get_lang("WelcomeWoogieSubtitle").'
'; $message = get_lang("WelcomeWoogieConverter"); echo '
'; $s_style = "border-width: 1px; @@ -112,11 +119,13 @@ $s_style_error = "border-width: 1px; echo '
-'.$alt_text.'
'.$message.'
'; +'.$alt_text.'
+
'.$message.'
'; if (!empty($errorMessage)) { echo '
- '.$alt_text.'
'.$errorMessage.'
'; + '.$alt_text.'
+
'.$errorMessage.'
'; } $form = new FormValidator('update_course', 'POST', '', '', 'style="margin: 0;"'); @@ -174,9 +183,9 @@ $form->addElement('hidden', 'split_steps', 'per_page'); $form->addElement('submit', 'convert', get_lang('ConvertToLP'), 'class="convert_button"'); $form->addElement('hidden', 'woogie', 'true'); $form->addProgress(); -$defaults = ['split_steps'=>'per_page', 'index_document'=>'checked="checked"']; -$form -> setDefaults($defaults); +$defaults = ['split_steps' => 'per_page', 'index_document' => 'checked="checked"']; +$form->setDefaults($defaults); // display the form -$form -> display(); +$form->display(); Display::display_footer(); diff --git a/main/user/add_users_to_session.php b/main/user/add_users_to_session.php index a7e52a83b6..2cf8133042 100755 --- a/main/user/add_users_to_session.php +++ b/main/user/add_users_to_session.php @@ -201,7 +201,7 @@ if ($allowTutors == 'true') { } } - $xajax_response -> addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return)); + $xajax_response->addAssign('ajax_list_users_single', 'innerHTML', api_utf8_encode($return)); } else { $return .= ''; - $xajax_response -> addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return)); + $xajax_response->addAssign('ajax_list_users_multiple', 'innerHTML', api_utf8_encode($return)); } } @@ -217,14 +217,12 @@ if ($allowTutors == 'true') { } $xajax->processRequests(); - $htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/'); $htmlHeadXtra[] = ''; - $form_sent = 0; $firstLetterUser = $firstLetterSession = ''; $UserList = $SessionList = []; @@ -288,9 +284,7 @@ if ($allowTutors == 'true') { $session_info = SessionManager::fetch($id_session); Display::display_header($tool_name); - $nosessionUsersList = $sessionUsersList = []; - $ajax_search = $add_type === 'unique' ? true : false; $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname, username' : ' ORDER BY lastname, firstname, username'; @@ -473,18 +467,21 @@ if ($allowTutors == 'true') { } if ($add_type === 'multiple') { - $link_add_type_unique = ''.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').''; + $link_add_type_unique = ''. + Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').''; $link_add_type_multiple = Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple'); } else { $link_add_type_unique = Display::return_icon('single.gif').get_lang('SessionAddTypeUnique'); - $link_add_type_multiple = ''.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').''; + $link_add_type_multiple = ''. + Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').''; } $link_add_group = ''. Display::return_icon('multiple.gif', get_lang('RegistrationByUsersGroups')).get_lang('RegistrationByUsersGroups').''; ?>
 |  | 
-
: - : @@ -653,7 +649,6 @@ if ($allowTutors == 'true') { document.forms.formulaire.submit(); } - function loadUsersInSelect(select) { var xhr_object = null; diff --git a/main/user/classes.php b/main/user/classes.php index 47706dc315..c69d6d4843 100755 --- a/main/user/classes.php +++ b/main/user/classes.php @@ -46,8 +46,8 @@ if (!empty($usergroup_list)) { } } -Display :: display_header($tool_name, 'Classes'); +Display::display_header($tool_name, 'Classes'); echo $content; -Display :: display_footer(); +Display::display_footer(); diff --git a/main/user/resume_session.php b/main/user/resume_session.php index d0238d9555..cde7582894 100755 --- a/main/user/resume_session.php +++ b/main/user/resume_session.php @@ -238,8 +238,7 @@ if ($allowTutors === 'true') { $result = Database::query($sql); $courses = Database::store_result($result); foreach ($courses as $course) { - //select the number of users - + // Select the number of users $sql = "SELECT count(*) FROM $tbl_session_rel_user sru, $tbl_session_rel_course_rel_user srcru WHERE srcru.user_id = sru.user_id AND