From 8c3eb89c3d4041660a807ae1b956a23f8ceca5ea Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 2 Dec 2014 08:53:15 +0100 Subject: [PATCH] Minor - format code. --- main/admin/course_create_content.php | 22 +++--------- main/admin/course_information.php | 5 +-- main/admin/course_intro_pdf_import.php | 49 +++++++++++++------------- main/admin/course_list.php | 10 +++--- main/admin/course_request_accepted.php | 17 ++++----- main/admin/course_request_edit.php | 10 +++--- main/admin/course_request_rejected.php | 47 +++++++++--------------- main/admin/course_request_review.php | 39 ++++++++++---------- main/admin/course_user_import.php | 16 ++++----- main/admin/course_virtual.php | 1 + 10 files changed, 89 insertions(+), 127 deletions(-) diff --git a/main/admin/course_create_content.php b/main/admin/course_create_content.php index 5aae8943a0..f3e2a942bb 100755 --- a/main/admin/course_create_content.php +++ b/main/admin/course_create_content.php @@ -6,10 +6,6 @@ * @author Bart Mollet * @package chamilo.admin */ -/** - * INIT SECTION - */ - // name of the language file that needs to be included $language_file = 'admin'; include ('../inc/global.inc.php'); @@ -20,26 +16,16 @@ $tool_name = get_lang('DummyCourseCreator'); $interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); Display::display_header($tool_name); //api_display_tool_title($tool_name); -if(api_get_setting('server_type') != 'test') -{ +if (api_get_setting('server_type') != 'test') { echo get_lang('DummyCourseOnlyOnTestServer'); -} -elseif( isset($_POST['action'])) -{ +} elseif( isset($_POST['action'])) { require_once('../coursecopy/classes/DummyCourseCreator.class.php'); $dcc = new DummyCourseCreator(); $dcc->create_dummy_course($_POST['course_code']); echo get_lang('Done'); -} -else -{ +} else { echo get_lang('DummyCourseDescription'); echo '
'; } -/* -============================================================================== - FOOTER -============================================================================== -*/ + Display::display_footer(); -?> diff --git a/main/admin/course_information.php b/main/admin/course_information.php index f9f20773e7..4860d9ef4f 100755 --- a/main/admin/course_information.php +++ b/main/admin/course_information.php @@ -5,9 +5,6 @@ * @author Bart Mollet * @package chamilo.admin */ -/** - * INIT SECTION - */ // name of the language file that needs to be included $language_file = 'admin'; @@ -110,7 +107,7 @@ $table->display(); echo Display::page_header(get_lang('Users')); $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $table_user = Database :: get_main_table(TABLE_MAIN_USER); -$sql = "SELECT *,cu.status as course_status +$sql = "SELECT *,cu.status as course_status FROM $table_course_user cu, $table_user u"; if (api_is_multiple_url_enabled()) { $sql .= " INNER JOIN ".Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER)." url_rel_user diff --git a/main/admin/course_intro_pdf_import.php b/main/admin/course_intro_pdf_import.php index ca86f730e5..3027d4a792 100755 --- a/main/admin/course_intro_pdf_import.php +++ b/main/admin/course_intro_pdf_import.php @@ -5,15 +5,14 @@ * uploaded in each course * @package chamilo.admin */ -/** - * Initialization - */ + $language_file = array('admin', 'document'); $cidReset = true; require '../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; api_protect_admin_script(); -// temporary configuration of in which folder to upload the file in each course. Should default to '', and start with a '/' and end without it, if defined +// temporary configuration of in which folder to upload the file in each course. +// Should default to '', and start with a '/' and end without it, if defined $subDir = ''; //require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; @@ -41,7 +40,7 @@ if ($_POST['formSent']) { } else { $errors = import_pdfs($courses, $subDir); if (count($errors) == 0) { - error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__); + error_log('Course intros imported successfully in '.__FILE__.', line '.__LINE__); } } } @@ -58,25 +57,25 @@ if (count($errors) != 0) { Display :: display_confirmation_message('CourseIntroductionsAllImportesSuccessfully', false); } ?> -
- -
- -
- -
-
-
-
- -
-
- -
-
-

+
+ +
+ +
+ +
+
+
+
+ +
+
+ +
+
+

-
+
 CourseCode_NameOfDocument_CourseName.pdf
 e.g.
@@ -84,7 +83,7 @@ MAT101_Introduction_Mathematics-101.pdf
 MAT102_Introduction_Mathematics-102.pdf
 ENG101_Introduction_English-101.pdf
 
-
+
'.Display::return_icon('synthese_view.gif', get_lang('Info')).' '. //''.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. // This is not the preferable way to go to the homepage. ''.Display::return_icon('course_home.gif', get_lang('CourseHomepage')).' '. @@ -386,4 +384,4 @@ $tpl = new Template($tool_name); $tpl->assign('actions', $actions); $tpl->assign('message', $message); $tpl->assign('content', $content); -$tpl->display_one_col_template(); \ No newline at end of file +$tpl->display_one_col_template(); diff --git a/main/admin/course_request_accepted.php b/main/admin/course_request_accepted.php index ce01348caa..506233006f 100755 --- a/main/admin/course_request_accepted.php +++ b/main/admin/course_request_accepted.php @@ -11,8 +11,6 @@ * @author Ivan Tcholakov (technical adaptation for Chamilo 1.8.8), 2010 */ -/* INIT SECTION */ - // Language files that need to be included. $language_file = array('admin', 'create_course'); @@ -78,13 +76,10 @@ if ($course_validation_feature) { break; } } - } else { - - $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; - $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); - $is_error_message = true; - + $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; + $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); + $is_error_message = true; } /** @@ -129,10 +124,12 @@ function get_request_data($from, $number_of_items, $column, $direction) { /** * Actions in the list: edit, accept, delete. */ -function modify_filter($id) { +function modify_filter($id) +{ $code = CourseRequestManager::get_course_request_code($id); $result = ''.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).''. ' '.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).''; + return $result; } @@ -174,7 +171,7 @@ echo ''; // Create a sortable table with the course data. $table = new SortableTable('course_requests_accepted', 'get_number_of_requests', 'get_request_data', 5, 20, 'DESC'); -$table->set_additional_parameters($parameters); +//$table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('Code')); $table->set_header(2, get_lang('Title')); diff --git a/main/admin/course_request_edit.php b/main/admin/course_request_edit.php index cb8494cbfb..4c2f8f91a1 100755 --- a/main/admin/course_request_edit.php +++ b/main/admin/course_request_edit.php @@ -7,8 +7,6 @@ * @author Ivan Tcholakov , 2010 */ -// Initialization section. - // Language files that need to be included. $language_file = array('admin', 'create_course'); @@ -161,9 +159,9 @@ if ($course_validation_feature) { // Detection which submit button has been pressed. $submit_button = isset($_POST['save_button']) ? 'save_button' : (isset($_POST['accept_button']) ? 'accept_button' - : (isset($_POST['reject_button']) ? 'reject_button' - : (isset($_POST['ask_info_button']) ? 'ask_info_button' - : 'submit_button'))); + : (isset($_POST['reject_button']) ? 'reject_button' + : (isset($_POST['ask_info_button']) ? 'ask_info_button' + : 'submit_button'))); // Check the course code for avoiding duplication. $course_code_ok = $course_request_values['wanted_code'] == $course_request_info['code'] @@ -226,7 +224,6 @@ if ($course_validation_feature) { } $message = implode(' ', $message); - $back_url = get_caller_name($caller); if ($message != '') { $back_url = api_add_url_param($back_url, 'message='.urlencode(Security::remove_XSS($message)), false); @@ -259,6 +256,7 @@ function get_caller_name($caller_id) { case 2: return 'course_request_rejected.php'; } + return 'course_request_review.php'; } diff --git a/main/admin/course_request_rejected.php b/main/admin/course_request_rejected.php index e938ab8122..e67cfa8179 100755 --- a/main/admin/course_request_rejected.php +++ b/main/admin/course_request_rejected.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** - * A list containig the rejected course requests + * A list containing the rejected course requests * @package chamilo.admin * @author José Manuel Abuin Mosquera , 2010 * @author Bruno Rubio Gayo , 2010 @@ -11,8 +11,6 @@ * @author Ivan Tcholakov (technical adaptation for Chamilo 1.8.8), 2010 */ -/* INIT SECTION */ - // Language files that need to be included. $language_file = array('admin', 'create_course'); @@ -62,12 +60,10 @@ if ($course_validation_feature) { $message = sprintf(get_lang('CourseRequestAcceptanceFailed'), $course_request_code); $is_error_message = true; } - } - - /** - * Sending to the teacher a request for additional information about the proposed course. - */ - elseif (!empty($request_info)) { + } elseif (!empty($request_info)) { + /** + * Sending to the teacher a request for additional information about the proposed course. + */ $course_request_code = CourseRequestManager::get_course_request_code($request_info); $result = CourseRequestManager::ask_for_additional_info($request_info); if ($result) { @@ -77,12 +73,10 @@ if ($course_validation_feature) { $message = sprintf(get_lang('CourseRequestInfoFailed'), $course_request_code); $is_error_message = true; } - } - - /** - * Deletion of a course request. - */ - elseif (!empty($delete_course_request)) { + } elseif (!empty($delete_course_request)) { + /** + * Deletion of a course request. + */ $course_request_code = CourseRequestManager::get_course_request_code($delete_course_request); $result = CourseRequestManager::delete_course_request($delete_course_request); if ($result) { @@ -92,12 +86,10 @@ if ($course_validation_feature) { $message = sprintf(get_lang('CourseRequestDeletionFailed'), $course_request_code); $is_error_message = true; } - } - - /** - * Form actions: delete. - */ - elseif (isset($_POST['action'])) { + } elseif (isset($_POST['action'])) { + /** + * Form actions: delete. + */ switch ($_POST['action']) { // Delete selected courses case 'delete_course_requests' : @@ -113,13 +105,10 @@ if ($course_validation_feature) { break; } } - } else { - - $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; - $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); - $is_error_message = true; - + $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; + $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); + $is_error_message = true; } /** @@ -136,8 +125,6 @@ function get_request_data($from, $number_of_items, $column, $direction) { global $keyword; $course_request_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST); - $users_table = Database :: get_main_table(TABLE_MAIN_USER); - $course_users_table = Database :: get_main_table(TABLE_MAIN_COURSE_USER); $sql = "SELECT id AS col0, code AS col1, @@ -219,7 +206,7 @@ echo ''; // Create a sortable table with the course data. $table = new SortableTable('course_requests_rejected', 'get_number_of_requests', 'get_request_data', 5, 20, 'DESC'); -$table->set_additional_parameters($parameters); +//$table->set_additional_parameters($parameters); $table->set_header(0, '', false); $table->set_header(1, get_lang('Code')); $table->set_header(2, get_lang('Title')); diff --git a/main/admin/course_request_review.php b/main/admin/course_request_review.php index 03b2a854ea..cad5165b6c 100755 --- a/main/admin/course_request_review.php +++ b/main/admin/course_request_review.php @@ -2,7 +2,7 @@ /* For licensing terms, see /license.txt */ /** - * A list containig the pending course requests + * A list containing the pending course requests * @package chamilo.admin * @author José Manuel Abuin Mosquera , 2010 * Centro de Supercomputacion de Galicia (CESGA) @@ -10,8 +10,6 @@ * @author Ivan Tcholakov (technical adaptation for Chamilo 1.8.8), 2010 */ -/* INIT SECTION */ - // Language files that need to be included. $language_file = array('admin', 'create_course'); @@ -34,7 +32,7 @@ require_once api_get_path(LIBRARY_PATH).'fileManage.lib.php'; // The delete action should be deactivated in this page. // Better reject the target request, after that you can delete it. -define(DELETE_ACTION_ENABLED, false); +// see DELETE_ACTION_ENABLED constant in main_api.lib.php // A check whether the course validation feature is enabled. $course_validation_feature = api_get_setting('course_validation') == 'true'; @@ -82,7 +80,6 @@ if ($course_validation_feature) { /** * Sending to the teacher a request for additional information about the proposed course. */ - $course_request_code = CourseRequestManager::get_course_request_code($request_info); $result = CourseRequestManager::ask_for_additional_info($request_info); if ($result) { @@ -124,26 +121,25 @@ if ($course_validation_feature) { break; } } - } else { - - $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; - $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); - $is_error_message = true; - + $link_to_setting = api_get_path(WEB_CODE_PATH).'admin/settings.php?category=Platform#course_validation'; + $message = sprintf(get_lang('PleaseActivateCourseValidationFeature'), sprintf('%s', $link_to_setting, get_lang('EnableCourseValidation'))); + $is_error_message = true; } /** * Get the number of courses which will be displayed. */ -function get_number_of_requests() { +function get_number_of_requests() +{ return CourseRequestManager::count_course_requests(COURSE_REQUEST_PENDING); } /** * Get course data to display */ -function get_request_data($from, $number_of_items, $column, $direction) { +function get_request_data($from, $number_of_items, $column, $direction) +{ global $keyword; $course_request_table = Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST); @@ -155,7 +151,8 @@ function get_request_data($from, $number_of_items, $column, $direction) { tutor_name AS col4, request_date AS col5, id AS col6 - FROM $course_request_table WHERE status = ".COURSE_REQUEST_PENDING; + FROM $course_request_table + WHERE status = ".COURSE_REQUEST_PENDING; } else { $sql = "SELECT code AS col0, @@ -164,7 +161,8 @@ function get_request_data($from, $number_of_items, $column, $direction) { tutor_name AS col3, request_date AS col4, id AS col5 - FROM $course_request_table WHERE status = ".COURSE_REQUEST_PENDING; + FROM $course_request_table + WHERE status = ".COURSE_REQUEST_PENDING; } if ($keyword != '') { @@ -190,7 +188,8 @@ function get_request_data($from, $number_of_items, $column, $direction) { /** * Enlace a la ficha del profesor */ -function email_filter($teacher) { +function email_filter($teacher) +{ $sql = "SELECT user_id FROM ".Database :: get_main_table(TABLE_MAIN_COURSE_REQUEST)." WHERE tutor_name LIKE '".$teacher."'"; $res = Database::query($sql); $info = Database::fetch_array($res); @@ -200,7 +199,8 @@ function email_filter($teacher) { /** * Actions in the list: edit, accept, reject, request additional information. */ -function modify_filter($id) { +function modify_filter($id) +{ $code = CourseRequestManager::get_course_request_code($id); $result = ''.Display::return_icon('edit.gif', get_lang('Edit'), array('style' => 'vertical-align: middle;')).''. ' '.Display::return_icon('accept.png', get_lang('AcceptThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ANewCourseWillBeCreated'), $code), ENT_QUOTES)).'\')) return false;'),16).''. @@ -211,6 +211,7 @@ function modify_filter($id) { if (DELETE_ACTION_ENABLED) { $result .= ' '.Display::return_icon('delete.gif', get_lang('DeleteThisCourseRequest'), array('style' => 'vertical-align: middle;', 'onclick' => 'javascript: if (!confirm(\''.addslashes(api_htmlentities(sprintf(get_lang('ACourseRequestWillBeDeleted'), $code), ENT_QUOTES)).'\')) return false;')).''; } + return $result; } @@ -254,7 +255,7 @@ echo ''; // Create a sortable table with the course data. $offet = DELETE_ACTION_ENABLED ? 1 : 0; $table = new SortableTable('course_requests_review', 'get_number_of_requests', 'get_request_data', 4 + $offet, 20, 'DESC'); -$table->set_additional_parameters($parameters); +//$table->set_additional_parameters($parameters); if (DELETE_ACTION_ENABLED) { $table->set_header(0, '', false); } @@ -271,6 +272,4 @@ if (DELETE_ACTION_ENABLED) { } $table->display(); -/* FOOTER */ - Display :: display_footer(); diff --git a/main/admin/course_user_import.php b/main/admin/course_user_import.php index bda55ca334..c48282c74e 100755 --- a/main/admin/course_user_import.php +++ b/main/admin/course_user_import.php @@ -211,19 +211,19 @@ if (count($errors) != 0) { // Displaying the form. $form->display(); ?> -

:

-
+

:

+
 UserName;CourseCode;Status
 jdoe;course01;
 
-adam;course01;
+    adam;course01;
 
-'; -echo STUDENT.': '.get_lang('Student').'
'; -?> -
+ '; + echo STUDENT.': '.get_lang('Student').'
'; + ?> +