From f3bd28615069aeae9e2d337601d3feb4d3461f96 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Thu, 4 Sep 2014 12:38:41 +0200 Subject: [PATCH] Minor - format code. --- main/admin/add_many_session_to_category.php | 39 ++++------- main/admin/course_import.php | 4 +- main/admin/session_category_edit.php | 77 +++++++++++++-------- 3 files changed, 64 insertions(+), 56 deletions(-) diff --git a/main/admin/add_many_session_to_category.php b/main/admin/add_many_session_to_category.php index d4291b32ce..9c1bf15857 100755 --- a/main/admin/add_many_session_to_category.php +++ b/main/admin/add_many_session_to_category.php @@ -15,7 +15,7 @@ require_once api_get_path(LIBRARY_PATH).'add_many_session_to_category_functions. require_once api_get_path(LIBRARY_PATH).'sessionmanager.lib.php'; $xajax = new xajax(); -$xajax -> registerFunction ('search_courses'); +$xajax->registerFunction('search_courses'); // setting the section (for the tabs) $this_section = SECTION_PLATFORM_ADMIN; @@ -36,12 +36,12 @@ $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE) $tbl_course = Database::get_main_table(TABLE_MAIN_COURSE); // setting the name of the tool -$tool_name= get_lang('SubscribeSessionsToCategory'); -$id_session=intval($_GET['id_session']); +$tool_name = get_lang('SubscribeSessionsToCategory'); +$id_session = isset($_GET['id_session']) ? intval($_GET['id_session']) : null; $add_type = 'multiple'; -if(isset($_GET['add_type']) && $_GET['add_type']!=''){ - $add_type = Security::remove_XSS($_REQUEST['add_type']); +if (isset($_GET['add_type']) && $_GET['add_type'] != '') { + $add_type = Security::remove_XSS($_REQUEST['add_type']); } if (!api_is_platform_admin() && !api_is_session_admin()) { @@ -147,7 +147,7 @@ if (api_get_multiple_access_url()) { $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); $rows_session = Database::store_result($result); ?> @@ -167,10 +167,10 @@ if(!empty($OkMsg)) { Display::display_confirmation_message($OkMsg); //main API } -/* - * - * The a/b/c Filter is not a priority - * +/* + * + * The a/b/c Filter is not a priority + * * : @@ -228,19 +228,9 @@ if(!empty($OkMsg)) { - - -

-





'.get_lang('SubscribeSessionsToCategory').''; @@ -258,7 +248,6 @@ if(!empty($OkMsg)) { 'index.php',"name" => get_lang('PlatformAdmin')); -$interbreadcrumb[]=array('url' => "session_category_list.php","name" => get_lang('ListSessionCategory')); +$interbreadcrumb[] = array( + 'url' => 'index.php', + "name" => get_lang('PlatformAdmin') +); +$interbreadcrumb[] = array( + 'url' => "session_category_list.php", + "name" => get_lang('ListSessionCategory') +); + $sql = "SELECT * FROM $tbl_session_category WHERE id='".$id."' ORDER BY name"; $result=Database::query($sql); if (!$infos=Database::fetch_array($result)) { @@ -38,24 +42,38 @@ if (!api_is_platform_admin() && $infos['session_admin_id']!=$_user['user_id'] && api_not_allowed(true); } -if ($_POST['formSent']) { - $formSent=1; - $name= $_POST['name']; - $year_start= $_POST['year_start']; - $month_start=$_POST['month_start']; - $day_start=$_POST['day_start']; - $year_end=$_POST['year_end']; - $month_end=$_POST['month_end']; - $day_end=$_POST['day_end']; - $return = SessionManager::edit_category_session($id, $name, $year_start, $month_start, $day_start, $year_end, $month_end, $day_end); - if ($return == strval(intval($return))) { - header('Location: session_category_list.php?action=show_message&message='.urlencode(get_lang('SessionCategoryUpdate'))); - exit(); - } +if (isset($_POST['formSent']) && $_POST['formSent']) { + $formSent = 1; + $name = $_POST['name']; + $year_start = $_POST['year_start']; + $month_start = $_POST['month_start']; + $day_start = $_POST['day_start']; + $year_end = $_POST['year_end']; + $month_end = $_POST['month_end']; + $day_end = $_POST['day_end']; + $return = SessionManager::edit_category_session( + $id, + $name, + $year_start, + $month_start, + $day_start, + $year_end, + $month_end, + $day_end + ); + if ($return == strval(intval($return))) { + header( + 'Location: session_category_list.php?action=show_message&message=' . urlencode( + get_lang('SessionCategoryUpdate') + ) + ); + exit(); + } } -$thisYear=date('Y'); -$thisMonth=date('m'); -$thisDay=date('d'); + +$thisYear = date('Y'); +$thisMonth = date('m'); +$thisDay = date('d'); // display the header Display::display_header($tool_name); @@ -63,7 +81,7 @@ if (!empty($return)) { Display::display_error_message($return,false); } ?> -
+ @@ -216,7 +234,8 @@ for($i=$thisYear-5;$i <= ($thisYear+5);$i++)
  - +