diff --git a/main/course_progress/thematic_advance.php b/main/course_progress/thematic_advance.php index 30ea5d3a9c..350625294c 100755 --- a/main/course_progress/thematic_advance.php +++ b/main/course_progress/thematic_advance.php @@ -30,10 +30,10 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { $form->addElement('hidden', 'action', $action); if (!empty($thematic_advance_id)) { - $form->addElement('hidden', 'thematic_advance_id',$thematic_advance_id); + $form->addElement('hidden', 'thematic_advance_id', $thematic_advance_id); } if (!empty($thematic_id)) { - $form->addElement('hidden', 'thematic_id',$thematic_id); + $form->addElement('hidden', 'thematic_id', $thematic_id); } $radios = array(); @@ -80,14 +80,30 @@ if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { } if (count($attendance_select) > 1) { - $form->addElement('select', 'attendance_select', get_lang('Attendances'), $attendance_select, array('id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)')); + $form->addElement( + 'select', + 'attendance_select', + get_lang('Attendances'), + $attendance_select, + array('id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)') + ); } else { - $form->addElement('label', get_lang('Attendances'), ''.get_lang('ThereAreNoAttendancesInsideCourse').''); + $form->addElement( + 'label', + get_lang('Attendances'), + ''.get_lang('ThereAreNoAttendancesInsideCourse').'' + ); } $form->addElement('html', '
'); if (!empty($calendar_select)) { - $form->addElement('select', 'start_date_by_attendance', get_lang('StartDate'), $calendar_select, array('id'=>'start_date_select_calendar')); + $form->addElement( + 'select', + 'start_date_by_attendance', + get_lang('StartDate'), + $calendar_select, + array('id' => 'start_date_select_calendar') + ); } $form->addElement('html', '
'); $form->addElement('html', ''); diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php index 43525bed29..fdc5da6ead 100755 --- a/main/course_progress/thematic_controller.php +++ b/main/course_progress/thematic_controller.php @@ -39,7 +39,7 @@ class ThematicController $data = array(); $check = Security::check_token('request'); $thematic_id = isset($_REQUEST['thematic_id']) ? intval($_REQUEST['thematic_id']) : null; - $displayHeader = (!empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header') ? false : true; + $displayHeader = !empty($_REQUEST['display']) && $_REQUEST['display'] === 'no_header' ? false : true; if ($check) { switch ($action) { diff --git a/main/create_course/add_course.php b/main/create_course/add_course.php index f67fccbba1..520fc31562 100755 --- a/main/create_course/add_course.php +++ b/main/create_course/add_course.php @@ -11,7 +11,6 @@ * "Course validation" feature, technical adaptation for Chamilo 1.8.8: * @author Ivan Tcholakov */ -use \ChamiloSession as Session; // Flag forcing the "current course" reset. $cidReset = true; @@ -26,7 +25,7 @@ $this_section = SECTION_COURSES; // true - the new course is requested only and it is created after approval; // false - the new course is created immediately, after filling this form. $course_validation_feature = false; -if (api_get_setting('course_validation') == 'true' && !api_is_platform_admin()) { +if (api_get_setting('course_validation') === 'true' && !api_is_platform_admin()) { $course_validation_feature = true; } @@ -49,10 +48,7 @@ $tool_name = $course_validation_feature ? get_lang('CreateCourseRequest') : get_ $tpl = new Template($tool_name); -if ( - api_get_setting('allow_users_to_create_courses') == 'false' && - !api_is_platform_admin() -) { +if (api_get_setting('allow_users_to_create_courses') === 'false' && !api_is_platform_admin()) { api_not_allowed(true); } @@ -123,7 +119,6 @@ $form->addRule( ); // The teacher -//array(get_lang('Professor'), null), null, array('size' => '60', 'disabled' => 'disabled')); $titular = & $form->addElement('hidden', 'tutor_name', ''); if ($course_validation_feature) { @@ -361,7 +356,7 @@ if ($form->validate()) { false ); // Display the form. - $content = $form->return_form(); + $content = $form->returnForm(); } } } else { @@ -371,7 +366,7 @@ if ($form->validate()) { false ); // Display the form. - $content = $form->return_form(); + $content = $form->returnForm(); } } else { if (!$course_validation_feature) { diff --git a/main/dropbox/dropbox_class.inc.php b/main/dropbox/dropbox_class.inc.php index 9c223622f4..d6f8ddf0ff 100755 --- a/main/dropbox/dropbox_class.inc.php +++ b/main/dropbox/dropbox_class.inc.php @@ -54,7 +54,8 @@ class Dropbox_Work public $upload_date; public $last_upload_date; public $isOldWork; - public $feedback_date, $feedback; + public $feedback_date; + public $feedback; /** * Constructor calls private functions to create a new work or retreive an existing work from DB @@ -126,7 +127,7 @@ class Dropbox_Work 'description' => $this->description, 'author' => $this->author, 'last_upload_date' => $this->last_upload_date, - 'session_id' => api_get_session_id(), + 'session_id' => api_get_session_id() ]; Database::update( @@ -220,9 +221,10 @@ class Dropbox_Work // Getting the feedback on the work. if ($action == 'viewfeedback' AND $this->id == $_GET['id']) { $feedback2 = array(); - $sql_feedback = "SELECT * FROM ".$dropbox_cnf['tbl_feedback']." - WHERE c_id = $course_id AND file_id='".$id."' ORDER BY feedback_id ASC"; - $result = Database::query($sql_feedback); + $sql = "SELECT * FROM ".$dropbox_cnf['tbl_feedback']." + WHERE c_id = $course_id AND file_id='".$id."' + ORDER BY feedback_id ASC"; + $result = Database::query($sql); while ($row_feedback = Database::fetch_array($result)) { $row_feedback['feedback'] = Security::remove_XSS($row_feedback['feedback']); $feedback2[] = $row_feedback; @@ -381,7 +383,6 @@ class Dropbox_SentWork extends Dropbox_Work WHERE c_id = $course_id AND file_id = ".intval($id).""; $result = Database::query($sql); while ($res = Database::fetch_array($result, 'ASSOC')) { - // Check for deleted users $dest_user_id = $res['dest_user_id']; $user_info = api_get_user_info($dest_user_id); @@ -571,7 +572,7 @@ class Dropbox_Person /** * Deletes all the received work of this person */ - function deleteAllReceivedWork() + public function deleteAllReceivedWork() { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -589,7 +590,7 @@ class Dropbox_Person * Deletes all the received categories and work of this person * @param integer $id */ - function deleteReceivedWorkFolder($id) + public function deleteReceivedWorkFolder($id) { $dropbox_cnf = getDropboxConf(); $course_id = api_get_course_int_id(); @@ -612,7 +613,7 @@ class Dropbox_Person * * @param integer $id */ - function deleteReceivedWork($id) + public function deleteReceivedWork($id) { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -642,7 +643,7 @@ class Dropbox_Person /** * Deletes all the sent dropbox files of this person */ - function deleteAllSentWork() + public function deleteAllSentWork() { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -661,7 +662,7 @@ class Dropbox_Person * * @param unknown_type $id */ - function deleteSentWork($id) + public function deleteSentWork($id) { $course_id = api_get_course_int_id(); $dropbox_cnf = getDropboxConf(); @@ -696,7 +697,7 @@ class Dropbox_Person * @param string $id * @param string $text */ - function updateFeedback($id, $text) + public function updateFeedback($id, $text) { $course_id = api_get_course_int_id(); $_course = api_get_course_info(); @@ -760,7 +761,7 @@ class Dropbox_Person * @param string $type * @param string $value */ - function filter_received_work($type, $value) + public function filter_received_work($type, $value) { $dropbox_cnf = getDropboxConf(); $new_received_work = array(); diff --git a/main/exercise/exercise.php b/main/exercise/exercise.php index 7c76278dd5..0dd1689507 100644 --- a/main/exercise/exercise.php +++ b/main/exercise/exercise.php @@ -223,7 +223,12 @@ if ($is_allowedToEdit) { // deletes an exercise if ($exercise_action_locked == false) { $objExerciseTmp->delete(); - $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 1, $exerciseId, api_get_session_id()); + $link_info = GradebookUtils::isResourceInCourseGradebook( + api_get_course_id(), + 1, + $exerciseId, + api_get_session_id() + ); if ($link_info !== false) { GradebookUtils::remove_resource_from_course_gradebook($link_info['id']); } diff --git a/main/forum/forumfunction.inc.php b/main/forum/forumfunction.inc.php index a1e0094f77..2a0a307eb1 100755 --- a/main/forum/forumfunction.inc.php +++ b/main/forum/forumfunction.inc.php @@ -136,7 +136,7 @@ function handle_forum_and_forumcategories($lp_id = null) for ($i = 0; $i < count($list_threads); $i++) { deleteForumCategoryThread('thread', $list_threads[$i]['thread_id']); - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 5, intval($list_threads[$i]['thread_id']), @@ -2366,7 +2366,7 @@ function updateThread($values) $sessionId = api_get_session_id(); $courseId = api_get_course_id(); - $linkInfo = GradebookUtils::is_resource_in_course_gradebook( + $linkInfo = GradebookUtils::isResourceInCourseGradebook( $courseId, LINK_FORUM_THREAD, $id, @@ -2636,7 +2636,7 @@ function store_thread($current_forum, $values, $courseInfo = array(), $showMessa Session::erase('breadcrumbs'); Session::erase('addedresource'); Session::erase('addedresourceid'); - + if ($showMessage) { Display::addFlash(Display::return_message($message, 'success', false)); } @@ -3520,7 +3520,12 @@ function show_edit_post_form( $form->addElement('label', ''.get_lang('AlterQualifyThread').''); $form->addElement('checkbox', 'thread_qualify_gradebook', '', get_lang('QualifyThreadGradebook'), 'onclick="javascript: if(this.checked){document.getElementById(\'options_field\').style.display = \'block\';}else{document.getElementById(\'options_field\').style.display = \'none\';}"'); - $link_info = GradebookUtils::is_resource_in_course_gradebook(api_get_course_id(), 5, $_GET['thread'], api_get_session_id()); + $link_info = GradebookUtils::isResourceInCourseGradebook( + api_get_course_id(), + 5, + $_GET['thread'], + api_get_session_id() + ); if (!empty($link_info)) { $defaults['thread_qualify_gradebook'] = true; $defaults['category_id'] = $link_info['category_id']; diff --git a/main/forum/viewforum.php b/main/forum/viewforum.php index dad2b115ff..bbfa27367a 100755 --- a/main/forum/viewforum.php +++ b/main/forum/viewforum.php @@ -193,7 +193,7 @@ if ( $message = deleteForumCategoryThread($_GET['content'], $_GET['id']); // Delete link - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 5, intval($_GET['id']), diff --git a/main/gradebook/certificate_report.php b/main/gradebook/certificate_report.php index 38930081d9..8098c826bf 100644 --- a/main/gradebook/certificate_report.php +++ b/main/gradebook/certificate_report.php @@ -1,12 +1,13 @@ * @package chamilo.gradebook */ -use ChamiloSession as Session; $cidReset = true; diff --git a/main/gradebook/get_badges.php b/main/gradebook/get_badges.php index f477cc8908..5b918792ee 100644 --- a/main/gradebook/get_badges.php +++ b/main/gradebook/get_badges.php @@ -57,9 +57,11 @@ $tpl = new Template(get_lang('Badges'), false, false); $tpl->assign( 'content', - "" + "" ); $tpl->display_one_col_template(); diff --git a/main/gradebook/gradebook.php b/main/gradebook/gradebook.php index f8919e83df..ed96babf4c 100755 --- a/main/gradebook/gradebook.php +++ b/main/gradebook/gradebook.php @@ -1,9 +1,11 @@ +$htmlHeadXtra[] = ''; api_block_anonymous_users(); -$htmlHeadXtra[]= ''; /* MAIN CODE */ -if (isset($_GET['f']) && $_GET['f']=='social') { +if (isset($_GET['f']) && $_GET['f'] === 'social') { $this_section = SECTION_SOCIAL; $interbreadcrumb[]= array ('url' => api_get_path(WEB_PATH).'main/social/home.php','name' => get_lang('Social')); $interbreadcrumb[]= array ('url' => '#','name' => get_lang('Outbox')); @@ -66,13 +62,17 @@ if (isset($_GET['f']) && $_GET['f']=='social') { $actions = ''; if (api_get_setting('extended_profile') == 'true') { if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { - $actions .= ''.Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; + $actions .= ''. + Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; } if (api_get_setting('allow_message_tool') == 'true') { //echo ''.Display::return_icon('inbox.png').' '.get_lang('Messages').''; - $actions .= ''.Display::return_icon('message_new.png',get_lang('ComposeMessage')).''; - $actions .= ''.Display::return_icon('inbox.png',get_lang('Inbox')).''; - $actions .= ''.Display::return_icon('outbox.png',get_lang('Outbox')).''; + $actions .= ''. + Display::return_icon('message_new.png',get_lang('ComposeMessage')).''; + $actions .= ''. + Display::return_icon('inbox.png',get_lang('Inbox')).''; + $actions .= ''. + Display::return_icon('outbox.png',get_lang('Outbox')).''; } } @@ -81,7 +81,7 @@ $info_delete_outbox =array(); $info_delete_outbox = isset($_GET['form_delete_outbox']) ? explode(',',$_GET['form_delete_outbox']) : ''; $count_delete_outbox = count($info_delete_outbox) - 1; -if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0])=='delete') { +if (isset($info_delete_outbox[0]) && trim($info_delete_outbox[0]) == 'delete') { for ($i = 1; $i <= $count_delete_outbox; $i++) { MessageManager::delete_message_by_user_sender(api_get_user_id(),$info_delete_outbox[$i]); } diff --git a/main/messages/view_message.php b/main/messages/view_message.php index f0d19244c7..8c0c5512c9 100755 --- a/main/messages/view_message.php +++ b/main/messages/view_message.php @@ -27,11 +27,11 @@ if (isset($_GET['f']) && $_GET['f']=='social') { if (api_get_setting('extended_profile') == 'true') { $social_right_content .= '
'; - if (api_get_setting('allow_social_tool') == 'true' && api_get_setting('allow_message_tool') == 'true') { + if (api_get_setting('allow_social_tool') === 'true' && api_get_setting('allow_message_tool') === 'true') { $social_right_content .= ''. Display::return_icon('shared_profile.png', get_lang('ViewSharedProfile')).''; } - if (api_get_setting('allow_message_tool') == 'true') { + if (api_get_setting('allow_message_tool') === 'true') { $social_right_content .= ''. Display::return_icon('message_new.png',get_lang('ComposeMessage')).''; $social_right_content .= ''. @@ -56,7 +56,7 @@ if (empty($_GET['id'])) { $message = ''; // LEFT COLUMN -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { // Block Social Menu $social_menu_block = SocialManager::show_social_menu($show_menu); } @@ -72,7 +72,7 @@ $tpl = new Template(get_lang('View')); // Block Social Avatar SocialManager::setSocialUserBlock($tpl, $user_id, $show_menu); -if (api_get_setting('allow_social_tool') == 'true') { +if (api_get_setting('allow_social_tool') === 'true') { $tpl->assign('social_menu_block', $social_menu_block); $tpl->assign('social_right_content', $social_right_content); $social_layout = $tpl->get_template('social/inbox.tpl'); diff --git a/main/mySpace/user_edit.php b/main/mySpace/user_edit.php index e342b89363..7944a89b73 100644 --- a/main/mySpace/user_edit.php +++ b/main/mySpace/user_edit.php @@ -2,7 +2,6 @@ /* For licensing terms, see /license.txt */ // including necessary libraries -$language_file = array('admin', 'registration'); $cidReset = true; require_once '../inc/global.inc.php'; @@ -181,7 +180,7 @@ if ($form->validate()) { api_get_setting('administratorTelephone')."\n" . get_lang('Email') ." : ".api_get_setting('emailAdministrator'); $emailbody = nl2br($emailbody); - + api_mail_html( api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), $email, diff --git a/main/notebook/index.php b/main/notebook/index.php index 229ff75278..c265cca06c 100755 --- a/main/notebook/index.php +++ b/main/notebook/index.php @@ -7,7 +7,6 @@ * refactoring and tighter integration */ -// Including the global initialization file require_once '../inc/global.inc.php'; $current_course_tool = TOOL_NOTEBOOK; @@ -20,12 +19,12 @@ api_protect_course_script(true); // Additional javascript $htmlHeadXtra[] = NotebookManager::javascript_notebook(); -$htmlHeadXtra[] = ''; @@ -35,12 +34,14 @@ $tool = TOOL_NOTEBOOK; // Tracking Event::event_access_tool(TOOL_NOTEBOOK); +$action = isset($_GET['action']) ? $_GET['action'] : ''; + // Tool name -if (isset($_GET['action']) && $_GET['action'] == 'addnote') { +if ($action === 'addnote') { $tool = 'NoteAddNew'; $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); } -if (isset($_GET['action']) && $_GET['action'] == 'editnote') { +if ($action === 'editnote') { $tool = 'ModifyNote'; $interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('ToolNotebook')); } @@ -52,7 +53,7 @@ Display::display_header(get_lang(ucfirst($tool))); Display::display_introduction_section(TOOL_NOTEBOOK); // Action handling: Adding a note -if (isset($_GET['action']) && $_GET['action'] == 'addnote') { +if ($action === 'addnote') { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } @@ -103,7 +104,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { $form->setConstants(array('sec_token' => $token)); $form->display(); } -} elseif (isset($_GET['action']) && $_GET['action'] == 'editnote' && is_numeric($_GET['notebook_id'])) { +} elseif ($action === 'editnote' && is_numeric($_GET['notebook_id'])) { // Action handling: Editing a note if (!empty($_GET['isStudentView'])) { @@ -112,12 +113,15 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { } // Initialize the object - $form = new FormValidator('note', 'post', api_get_self().'?action='.Security::remove_XSS($_GET['action']).'¬ebook_id='.Security::remove_XSS($_GET['notebook_id'])); + $form = new FormValidator( + 'note', + 'post', + api_get_self().'?action='.Security::remove_XSS($_GET['action']).'¬ebook_id='.intval($_GET['notebook_id']) + ); // Setting the form elements $form->addElement('header', '', get_lang('ModifyNote')); $form->addElement('hidden', 'notebook_id'); $form->addElement('text', 'note_title', get_lang('NoteTitle'), array('size' => '100')); - //$form->applyFilter('note_title', 'html_filter'); $form->addElement('html_editor', 'note_comment', get_lang('NoteComment'), null, api_is_allowed_to_edit() ? array('ToolbarSet' => 'Notebook', 'Width' => '100%', 'Height' => '300') : array('ToolbarSet' => 'NotebookStudent', 'Width' => '100%', 'Height' => '300', 'UserStatus' => 'student') @@ -154,7 +158,7 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { $form->setConstants(array('sec_token' => $token)); $form->display(); } -} elseif (isset($_GET['action']) && $_GET['action'] == 'deletenote' && is_numeric($_GET['notebook_id'])) { +} elseif ($action === 'deletenote' && is_numeric($_GET['notebook_id'])) { // Action handling: deleting a note $res = NotebookManager::delete_note(Security::remove_XSS($_GET['notebook_id'])); @@ -164,28 +168,26 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { NotebookManager::display_notes(); } elseif ( - isset($_GET['action']) && $_GET['action'] == 'changeview' && - in_array($_GET['view'], array('creation_date', 'update_date', 'title')) - ) { + $action === 'changeview' && in_array($_GET['view'], array('creation_date', 'update_date', 'title')) ) { // Action handling: changing the view (sorting order) switch ($_GET['view']) { case 'creation_date': - if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') { + if (!$_GET['direction'] || $_GET['direction'] == 'ASC') { Display::display_confirmation_message(get_lang('NotesSortedByCreationDateAsc')); } else { Display::display_confirmation_message(get_lang('NotesSortedByCreationDateDESC')); } break; case 'update_date': - if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') { + if (!$_GET['direction'] || $_GET['direction'] == 'ASC') { Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateAsc')); } else { Display::display_confirmation_message(get_lang('NotesSortedByUpdateDateDESC')); } break; case 'title': - if (!$_GET['direction'] OR $_GET['direction'] == 'ASC') { + if (!$_GET['direction'] || $_GET['direction'] == 'ASC') { Display::display_confirmation_message(get_lang('NotesSortedByTitleAsc')); } else { Display::display_confirmation_message(get_lang('NotesSortedByTitleDESC')); @@ -198,5 +200,4 @@ if (isset($_GET['action']) && $_GET['action'] == 'addnote') { NotebookManager::display_notes(); } -// Footer Display::display_footer(); diff --git a/main/search/search_suggestions.php b/main/search/search_suggestions.php index 5f382544b4..63c63db01b 100755 --- a/main/search/search_suggestions.php +++ b/main/search/search_suggestions.php @@ -10,11 +10,10 @@ require_once dirname(__FILE__) . '/../inc/global.inc.php'; function get_suggestions_from_search_engine($q) { -// if (strlen($q)<2) { return null;} global $charset; $json = []; - $table_sfv = Database :: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); + $table_sfv = Database:: get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES); $q = Database::escape_string($q); $cid = api_get_course_id(); $sql_add = ''; @@ -78,8 +77,8 @@ function get_suggestions_from_search_engine($q) // will create a copy as Yannick - Car - Speed // in $output[3] $c = count($output); - for ($i=0;$i<$c; $i++) { - $output[($c+$i)] = $current_field_val; + for ($i = 0; $i < $c; $i++) { + $output[($c + $i)] = $current_field_val; } } else { //no identical field id, continue as usual @@ -87,7 +86,7 @@ function get_suggestions_from_search_engine($q) if ($c == 0) { $output[] = $row2['value'].' - '; } else { - foreach ($output as $i=>$out) { + foreach ($output as $i => $out) { //use the latest combination of fields $output[$i] .= $row2['value'].' - '; } @@ -98,7 +97,7 @@ function get_suggestions_from_search_engine($q) foreach ($output as $i=>$out) { if (api_stristr($out,$q) === false) {continue;} $s = api_convert_encoding(substr($out, 0, -3), 'UTF-8', $charset); - if (!in_array($s,$more_sugg)) { + if (!in_array($s, $more_sugg)) { $more_sugg[] = $s; $json[] = [ 'id' => $s, @@ -115,6 +114,8 @@ function get_suggestions_from_search_engine($q) } $q = strtolower($_GET["term"]); -if (!$q) return; +if (!$q) { + return; +} //echo $q . "| value\n"; get_suggestions_from_search_engine($q); diff --git a/main/session/about.php b/main/session/about.php index 57800f9e3a..27f52d42a1 100644 --- a/main/session/about.php +++ b/main/session/about.php @@ -1,14 +1,16 @@ * @package chamilo.session */ -use Chamilo\CoreBundle\Entity\ExtraField; -use Chamilo\CourseBundle\Entity\CCourseDescription; -use \Chamilo\CoreBundle\Entity\SequenceResource; $cidReset = true; @@ -24,18 +26,12 @@ if (!$session) { api_not_allowed(true); } -$sessionCourses = $entityManager->getRepository('ChamiloCoreBundle:Session') - ->getCoursesOrderedByPosition($session); - $courses = []; - -$entityManager = Database::getManager(); +$sessionCourses = $entityManager->getRepository('ChamiloCoreBundle:Session')->getCoursesOrderedByPosition($session); $fieldsRepo = $entityManager->getRepository('ChamiloCoreBundle:ExtraField'); $fieldTagsRepo = $entityManager->getRepository('ChamiloCoreBundle:ExtraFieldRelTag'); $userRepo = $entityManager->getRepository('ChamiloUserBundle:User'); -$sequenceResourceRepo = $entityManager->getRepository( - 'ChamiloCoreBundle:SequenceResource' -); +$sequenceResourceRepo = $entityManager->getRepository('ChamiloCoreBundle:SequenceResource'); $tagField = $fieldsRepo->findOneBy([ 'extraFieldType' => ExtraField::COURSE_FIELD_TYPE, diff --git a/main/session/add_courses_to_session.php b/main/session/add_courses_to_session.php index 025a962861..57079d83b1 100644 --- a/main/session/add_courses_to_session.php +++ b/main/session/add_courses_to_session.php @@ -5,6 +5,7 @@ * @package chamilo.admin * @todo use formvalidator */ + // resetting the course id. $cidReset = true; @@ -206,162 +207,162 @@ if (!api_is_platform_admin() && api_is_teacher()) { unset($Courses); ?> -
> - - +> + + - -
-
- - - -
- -
- -
- +
+
+ + -
-
- -
- : - - -
- -
- - -
- -
- -
- -
-
- -
- - +
+ -
- -
- - '; - if (isset($_GET['add'])) { - echo ''; - } else { - echo ''; - } - echo '
'; +
+ +
+ +
+
+ +
+ : + + +
+ +
+ + +
+ +
+ +
+ +
+
+ +
+ +
+
-
-
- - + '; + if (isset($_GET['add'])) { + echo ''; + } else { + echo ''; + } + echo '
'; + ?> +
- - + document.forms.formulaire.submit(); + } + - function delete_friend (element_div) { id_image=$(element_div).attr("id"); user_id=id_image.split("_"); diff --git a/main/social/group_add.php b/main/social/group_add.php index a6be89a798..3bd1b283ca 100755 --- a/main/social/group_add.php +++ b/main/social/group_add.php @@ -6,16 +6,15 @@ * @author Julio Montoya */ -$language_file= 'userInfo'; $cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); -if (api_get_setting('allow_social_tool') !='true') { +if (api_get_setting('allow_social_tool') !== 'true') { api_not_allowed(); } -if (api_get_setting('allow_students_to_create_groups_in_social') == 'false' && !api_is_allowed_to_edit()) { +if (api_get_setting('allow_students_to_create_groups_in_social') === 'false' && !api_is_allowed_to_edit()) { api_not_allowed(); } diff --git a/main/social/group_edit.php b/main/social/group_edit.php index edfba8f23b..af026847ba 100755 --- a/main/social/group_edit.php +++ b/main/social/group_edit.php @@ -6,13 +6,11 @@ * @author Julio Montoya */ -// Language files that should be included -$language_file = array('userInfo'); $cidReset = true; require_once '../inc/global.inc.php'; api_block_anonymous_users(); -if (api_get_setting('allow_social_tool') != 'true') { +if (api_get_setting('allow_social_tool') !== 'true') { api_not_allowed(); } diff --git a/main/social/group_view.php b/main/social/group_view.php index fada715bb8..c40bd49b13 100644 --- a/main/social/group_view.php +++ b/main/social/group_view.php @@ -6,12 +6,11 @@ */ $cidReset = true; -$language_file = array('userInfo'); require_once '../inc/global.inc.php'; api_block_anonymous_users(); -if (api_get_setting('allow_social_tool') !='true') { +if (api_get_setting('allow_social_tool') !== 'true') { api_not_allowed(); } diff --git a/main/social/group_waiting_list.php b/main/social/group_waiting_list.php index 7d62e477f6..b492dbeda1 100755 --- a/main/social/group_waiting_list.php +++ b/main/social/group_waiting_list.php @@ -7,7 +7,6 @@ */ $cidReset = true; -$language_file = array('userInfo'); require_once '../inc/global.inc.php'; api_block_anonymous_users(); diff --git a/main/social/groups.php b/main/social/groups.php index 1451673e23..42bf025f64 100755 --- a/main/social/groups.php +++ b/main/social/groups.php @@ -7,12 +7,11 @@ */ $cidReset = true; -$language_file = array('userInfo'); require_once '../inc/global.inc.php'; api_block_anonymous_users(); -if (api_get_setting('allow_social_tool') !='true') { +if (api_get_setting('allow_social_tool') !== 'true') { api_not_allowed(); } $join_url = ''; @@ -66,14 +65,14 @@ if (is_array($results) && count($results) > 0) { $result['description'] = Security::remove_XSS($result['description'], STUDENT, true); $my_group_list[] = $id; $name = cut($result['name'], GROUP_TITLE_LENGTH, true); - + if ($result['relation_type'] == GROUP_USER_PERMISSION_ADMIN) { $name .= ' '.Display::return_icon('social_group_admin.png', get_lang('Admin'), array('style'=>'vertical-align:middle')); } elseif ($result['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) { $name .= ' '.Display::return_icon('social_group_moderator.png', get_lang('Moderator'), array('style'=>'vertical-align:middle')); } $url = '
' . $name . ''; - + $count_users_group = count($usergroup->get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000)); if ($count_users_group == 1 ) { $count_users_group = $count_users_group.' '.get_lang('Member'); @@ -83,7 +82,7 @@ if (is_array($results) && count($results) > 0) { $picture = $usergroup->get_picture_group($result['id'], $result['picture'],80); $result['picture'] = ''; - + $members = Display::returnFontAwesomeIcon('user').$count_users_group; $html = '
'; $html .= '
'; @@ -101,7 +100,7 @@ if (is_array($results) && count($results) > 0) { } $html .= '
'; $html .= '
'; - + $grid_item_2 = $html; $grid_my_groups[]= array($grid_item_2); } @@ -116,7 +115,7 @@ foreach ($results as $result) { $result['description'] = Security::remove_XSS($result['description'], STUDENT, true); $id = $result['id']; $name = cut($result['name'], GROUP_TITLE_LENGTH, true); - + $count_users_group = count($usergroup->get_users_by_group($id, false, array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR), 0 , 1000)); if ($count_users_group == 1 ) { $count_users_group = $count_users_group.' '.get_lang('Member'); @@ -125,11 +124,11 @@ foreach ($results as $result) { } $url = '' . $name . ''; - + $picture = $usergroup->get_picture_group($result['id'], $result['picture'],80); $result['picture'] = ''; $members = Display::returnFontAwesomeIcon('user').$count_users_group; - + $html = '
'; $html .= '
'; $html .= $result['picture']; @@ -149,12 +148,12 @@ foreach ($results as $result) { if (!in_array($id,$my_group_list)) { $html .= ''.get_lang('JoinGroup').' '; } - + $html .= '
'.$join_url.'
'; $html .= '
'; $html .= '
'; - - + + $grid_item_2 = $html; $grid_newest_groups[]= array($grid_item_2); @@ -179,7 +178,7 @@ if (is_array($results) && count($results) > 0) { } $url = '' . $name . ''; - + $picture = $usergroup->get_picture_group($result['id'], $result['picture'],80); $result['picture'] = ''; diff --git a/main/social/home.php b/main/social/home.php index 115e4235a6..969b702ab5 100755 --- a/main/social/home.php +++ b/main/social/home.php @@ -206,7 +206,14 @@ if (count($sessionList) > 0) { $social_session_block = $sessionList; } -$social_group_block = Display::panelCollapse(get_lang('Group'), $social_group_block, 'sm-groups', null, 'grups-acordion', 'groups-collapse'); +$social_group_block = Display::panelCollapse( + get_lang('Group'), + $social_group_block, + 'sm-groups', + null, + 'grups-acordion', + 'groups-collapse' +); $tpl = new Template(get_lang('SocialNetwork')); diff --git a/main/social/invitations.php b/main/social/invitations.php index 77983011e5..c950786842 100755 --- a/main/social/invitations.php +++ b/main/social/invitations.php @@ -10,7 +10,7 @@ require_once '../inc/global.inc.php'; api_block_anonymous_users(); -if (api_get_setting('allow_social_tool') !='true') { +if (api_get_setting('allow_social_tool') !== 'true') { api_not_allowed(); } diff --git a/main/social/message_for_group_form.inc.php b/main/social/message_for_group_form.inc.php index d17d27ae4d..3e790bf3e0 100755 --- a/main/social/message_for_group_form.inc.php +++ b/main/social/message_for_group_form.inc.php @@ -21,7 +21,7 @@ if (isset($_REQUEST['user_friend'])) { $info_path_friend=array(); $userfriend_id = intval($_REQUEST['user_friend']); $info_user_friend = api_get_user_info($userfriend_id); - $info_path_friend = UserManager::get_user_picture_path_by_id($userfriend_id,'web'); + $info_path_friend = UserManager::get_user_picture_path_by_id($userfriend_id, 'web'); } $group_id = isset($_GET['group_id']) ? intval($_GET['group_id']) : null; @@ -73,11 +73,11 @@ $form->addElement('hidden', 'token', $tok); $tpl = new Template(get_lang('Groups')); -if (api_get_setting('allow_message_tool')=='true') { +if (api_get_setting('allow_message_tool') === 'true') { // Normal message $user_info = api_get_user_info($userfriend_id); $height = 180; - if ($allowed_action == 'add_message_group') { + if ($allowed_action === 'add_message_group') { $form->addElement('text', 'title', get_lang('Title')); $height = 140; } diff --git a/main/social/my_skills_report.php b/main/social/my_skills_report.php index 6a8a620230..101b4c919b 100644 --- a/main/social/my_skills_report.php +++ b/main/social/my_skills_report.php @@ -1,10 +1,12 @@ * @package chamilo.social.skill */ + require_once '../inc/global.inc.php'; $isStudent = api_is_student(); @@ -27,8 +29,8 @@ $tableRows = array(); $tpl = new Template(get_lang('Skills')); $tplPath = null; -$tpl->assign('allowSkillsTool', api_get_setting('allow_skills_tool') == 'true'); -$tpl->assign('allowDrhSkillsManagement', api_get_setting('allow_hr_skills_management') == 'true'); +$tpl->assign('allowSkillsTool', api_get_setting('allow_skills_tool') === 'true'); +$tpl->assign('allowDrhSkillsManagement', api_get_setting('allow_hr_skills_management') === 'true'); if ($isStudent) { $sql = "SELECT s.name, sru.acquired_skill_at, c.title, c.directory diff --git a/main/social/skills_tree.php b/main/social/skills_tree.php index 0091fce4d9..7b8acaf787 100755 --- a/main/social/skills_tree.php +++ b/main/social/skills_tree.php @@ -12,7 +12,7 @@ $this_section = SECTION_MYPROFILE; api_block_anonymous_users(); -if (api_get_setting('allow_skills_tool') != 'true') { +if (api_get_setting('allow_skills_tool') !== 'true') { api_not_allowed(); } diff --git a/main/social/skills_wheel.php b/main/social/skills_wheel.php index 0bbc1abf70..8dd4faae8c 100755 --- a/main/social/skills_wheel.php +++ b/main/social/skills_wheel.php @@ -10,7 +10,7 @@ require_once '../inc/global.inc.php'; $this_section = SECTION_SOCIAL; -if (api_get_setting('allow_skills_tool') != 'true') { +if (api_get_setting('allow_skills_tool') !== 'true') { api_not_allowed(); } diff --git a/main/survey/create_new_survey.php b/main/survey/create_new_survey.php index d626f7ecad..ba8ba4e5b9 100755 --- a/main/survey/create_new_survey.php +++ b/main/survey/create_new_survey.php @@ -71,7 +71,7 @@ if ($_GET['action'] == 'edit' && isset($survey_id) && is_numeric($survey_id)) { $defaults['survey_id'] = $survey_id; $defaults['anonymous'] = $survey_data['anonymous']; - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( $course_id, $gradebook_link_type, $survey_id, diff --git a/main/survey/survey.lib.php b/main/survey/survey.lib.php index f208e3d261..2e08758557 100755 --- a/main/survey/survey.lib.php +++ b/main/survey/survey.lib.php @@ -463,7 +463,7 @@ class SurveyManager $gradebook_link_type = 8; - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( $courseCode, $gradebook_link_type, $survey_id, diff --git a/main/work/edit_work.php b/main/work/edit_work.php index fd3608ceae..aacb8288ab 100755 --- a/main/work/edit_work.php +++ b/main/work/edit_work.php @@ -50,7 +50,7 @@ $defaults['new_dir'] = Security::remove_XSS($title); $there_is_a_end_date = false; if (Gradebook::is_active()) { - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), LINK_STUDENTPUBLICATION, $workId diff --git a/main/work/work.lib.php b/main/work/work.lib.php index 8105dcf426..144a103134 100755 --- a/main/work/work.lib.php +++ b/main/work/work.lib.php @@ -331,7 +331,7 @@ function getWorkList($id, $my_folder_data, $add_in_where_query = null) $group_id = api_get_group_id(); $is_allowed_to_edit = api_is_allowed_to_edit(null, true); - $linkInfo = GradebookUtils::is_resource_in_course_gradebook( + $linkInfo = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 3, $id, @@ -840,7 +840,7 @@ function deleteDirWork($id) WHERE c_id = $course_id AND publication_id = $id"; Database::query($sql); - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( api_get_course_id(), 3, $id, @@ -4013,7 +4013,7 @@ function updatePublicationAssignment($workId, $params, $courseInfo, $groupId) if (!empty($params['category_id'])) { - $link_info = GradebookUtils::is_resource_in_course_gradebook( + $link_info = GradebookUtils::isResourceInCourseGradebook( $courseInfo['code'], LINK_STUDENTPUBLICATION, $workId, diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php index 30e45c8e69..197069af89 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AgendaStudent.php @@ -10,9 +10,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class AgendaStudent extends Basic { - - public $plugins = array( - ); + public $plugins = array(); /** * Get the toolbar config @@ -116,5 +114,4 @@ class AgendaStudent extends Basic ['Toolbarswitch'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php index fe5cf4212a..c2d623147f 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Announcements.php @@ -10,7 +10,6 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; */ class Announcements extends Basic { - /** * Get the toolbar config * @return array @@ -75,5 +74,4 @@ class Announcements extends Basic ['Toolbarswitch'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php index 077f6dfa72..077163665d 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/AssessmentsIntroduction.php @@ -5,7 +5,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; /** * AssessmentsIntroduction toolbar configuration - * + * * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar */ class AssessmentsIntroduction extends Basic @@ -61,5 +61,4 @@ class AssessmentsIntroduction extends Basic ['Toolbarswitch'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/Editor.php b/src/Chamilo/CoreBundle/Component/Editor/Editor.php index 41f17f1ce5..9224a9a009 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/Editor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/Editor.php @@ -137,6 +137,7 @@ class Editor array('\r', '\n', '\x3c', '\x3e', '\x26'), addslashes($var) ).'"'; + break; case 'array': // Arrays in JSON can't be associative. If the array is empty or if it // has sequential whole number keys starting with 0, it's not associative @@ -149,6 +150,7 @@ class Editor return '[ '.implode(', ', $output).' ]'; } + break; case 'object': // Otherwise, fall through to convert the array as an object. $output = array();