From 93cae24e1d23530c38fb26a836004f7753328eb7 Mon Sep 17 00:00:00 2001 From: jmontoya Date: Thu, 10 Mar 2016 09:07:09 +0100 Subject: [PATCH] Format code, use Session class, use Display::addFlash function. --- main/admin/access_urls.php | 118 ++++++++++++++++-------------- main/admin/careers.php | 26 ++++--- main/admin/group_list.php | 18 +---- main/admin/skills_import.php | 17 +---- main/admin/user_import.php | 15 ++-- main/admin/user_list.php | 62 ++++++---------- main/admin/user_update_import.php | 30 ++++---- main/course_progress/index.php | 19 +++-- main/group/group.php | 5 +- main/group/group_space.php | 2 +- main/inc/lib/career.lib.php | 6 +- main/inc/lib/display.lib.php | 4 + 12 files changed, 154 insertions(+), 168 deletions(-) diff --git a/main/admin/access_urls.php b/main/admin/access_urls.php index 9c33db5fc0..de844d2ac2 100755 --- a/main/admin/access_urls.php +++ b/main/admin/access_urls.php @@ -6,6 +6,7 @@ * @author Julio Montoya * @author Yannick Warnier */ + $cidReset = true; require_once '../inc/global.inc.php'; $this_section = SECTION_PLATFORM_ADMIN; @@ -14,8 +15,8 @@ $this_section = SECTION_PLATFORM_ADMIN; api_protect_global_admin_script(); if (!api_get_multiple_access_url()) { - header('Location: index.php'); - exit; + header('Location: index.php'); + exit; } $interbreadcrumb[] = array ("url" => 'index.php', 'name' => get_lang('PlatformAdmin')); @@ -27,61 +28,60 @@ $current_access_url_id = api_get_current_access_url_id(); $url_list = UrlManager::get_url_data(); // Actions -if (isset ($_GET['action'])) { +if (isset($_GET['action'])) { if ($_GET['action'] == 'show_message') { Display :: display_normal_message(Security::remove_XSS(stripslashes($_GET['message']))); } - $check = Security::check_token('get'); - if ($check) { - $url_id = intval($_GET['url_id']); - - switch ($_GET['action']) { - case 'delete_url': - $result = UrlManager::delete($url_id); - if ($result) { - Display :: display_normal_message(get_lang('URLDeleted')); - } else { - Display :: display_error_message(get_lang('CannotDeleteURL')); - } - break; - case 'lock': - UrlManager::set_url_status('lock', $url_id); - Display::display_normal_message(get_lang('URLInactive')); - break; - case 'unlock': - UrlManager::set_url_status('unlock', $url_id); - Display::display_normal_message(get_lang('URLActive')); - break; - case 'register': - // we are going to register the admin - if (api_is_platform_admin()) { - if ($current_access_url_id!=-1) { - $url_str = ''; - foreach ($url_list as $my_url) { - if (!in_array($my_url['id'], $my_user_url_list)) { - UrlManager::add_user_to_url(api_get_user_id(), $my_url['id']); - $url_str.=$my_url['url'].'
'; - } + $url_id = intval($_GET['url_id']); + + switch ($_GET['action']) { + case 'delete_url': + $result = UrlManager::delete($url_id); + if ($result) { + Display :: display_normal_message(get_lang('URLDeleted')); + } else { + Display :: display_error_message(get_lang('CannotDeleteURL')); + } + break; + case 'lock': + UrlManager::set_url_status('lock', $url_id); + Display::display_normal_message(get_lang('URLInactive')); + break; + case 'unlock': + UrlManager::set_url_status('unlock', $url_id); + Display::display_normal_message(get_lang('URLActive')); + break; + case 'register': + // we are going to register the admin + if (api_is_platform_admin()) { + if ($current_access_url_id!=-1) { + $url_str = ''; + foreach ($url_list as $my_url) { + if (!in_array($my_url['id'], $my_user_url_list)) { + UrlManager::add_user_to_url(api_get_user_id(), $my_url['id']); + $url_str.=$my_url['url'].'
'; } - Display :: display_normal_message(get_lang('AdminUserRegisteredToThisURL').': '.$url_str.'
',false); } + Display:: display_normal_message( + get_lang('AdminUserRegisteredToThisURL').': '.$url_str.'
', + false + ); } - break; - } + } + break; } - Security::clear_token(); + } $parameters['sec_token'] = Security::get_token(); -// checking if the admin is registered in all sites - -$url_string=''; +// Checking if the admin is registered in all sites +$url_string = ''; $my_user_url_list = api_get_access_url_from_user(api_get_user_id()); foreach ($url_list as $my_url) { - if (!in_array($my_url['id'], $my_user_url_list)){ - $url_string.=$my_url['url'].'
'; + if (!in_array($my_url['id'], $my_user_url_list)) { + $url_string .= $my_url['url'].'
'; } } if(!empty($url_string)) { @@ -94,16 +94,27 @@ if ($current_access_url_id==-1) { } elseif(api_is_platform_admin()) { $quant= UrlManager::relation_url_user_exist(api_get_user_id(),$current_access_url_id); if ($quant==0) { - Display :: display_warning_message(''.get_lang('ClickToRegisterAdmin').'',false); + Display:: display_warning_message( + ''.get_lang('ClickToRegisterAdmin').'', + false + ); } } // action menu echo '
'; -echo Display::url(Display::return_icon('new_link.png', get_lang('AddUrl'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/access_url_edit.php'); -echo Display::url(Display::return_icon('user.png', get_lang('ManageUsers'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php'); -echo Display::url(Display::return_icon('course.png', get_lang('ManageCourses'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_courses_to_url.php'); -//echo Display::url(Display::return_icon('session.png', get_lang('ManageSessions'), array(), ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH).'admin/access_url_edit_sessions_to_url.php'); +echo Display::url( + Display::return_icon('new_link.png', get_lang('AddUrl'), array(), ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH).'admin/access_url_edit.php' +); +echo Display::url( + Display::return_icon('user.png', get_lang('ManageUsers'), array(), ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH).'admin/access_url_edit_users_to_url.php' +); +echo Display::url( + Display::return_icon('course.png', get_lang('ManageCourses'), array(), ICON_SIZE_MEDIUM), + api_get_path(WEB_CODE_PATH).'admin/access_url_edit_courses_to_url.php' +); $userGroup = new UserGroup(); if ($userGroup->getUseMultipleUrl()) { @@ -122,10 +133,9 @@ if (isMultipleUrlSupport()) { echo '
'; -//$table = new SortableTable('urls', 'url_count_mask', 'get_url_data_mask',2); $sortable_data = UrlManager::get_url_data(); $urls = array(); -foreach ($sortable_data as $row) { +foreach ($sortable_data as $row) { //title $url = Display::url($row['url'], $row['url'], array('target'=>'_blank')); $description = $row['description']; @@ -144,21 +154,21 @@ foreach ($sortable_data as $row) { if ($row['id']=='1') { $status = Display::return_icon($image.'.gif', get_lang(ucfirst($action))); } else { - $status = ''.Display::return_icon($image.'.gif', get_lang(ucfirst($action))).''; + $status = ''. + Display::return_icon($image.'.gif', get_lang(ucfirst($action))).''; } // Actions $url_id = $row['id']; $actions = Display::url(Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL), "access_url_edit.php?url_id=$url_id"); if ($url_id != '1') { - $actions .= ''.Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; + $actions .= ''. + Display::return_icon('delete.png', get_lang('Delete'), array(), ICON_SIZE_SMALL).''; } $urls[] = array($url, $description, $status, $actions); } $table = new SortableTableFromArrayConfig($urls, 2, 50, 'urls'); $table->set_additional_parameters($parameters); - -//$table->set_header(0, ''); $table->set_header(0, 'URL'); $table->set_header(1, get_lang('Description')); $table->set_header(2, get_lang('Active')); diff --git a/main/admin/careers.php b/main/admin/careers.php index 1f16ff011e..8eb2ab2947 100755 --- a/main/admin/careers.php +++ b/main/admin/careers.php @@ -1,6 +1,8 @@ 'careers.php','name' => get_lang('Careers')); + $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers')); $tool_name = get_lang('Add'); } elseif ($action == 'edit') { - $interbreadcrumb[]=array('url' => 'careers.php','name' => get_lang('Careers')); - $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit')); + $interbreadcrumb[] = array('url' => 'careers.php', 'name' => get_lang('Careers')); + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit')); $tool_name = get_lang('Edit'); } else { $tool_name = get_lang('Careers'); @@ -104,10 +106,10 @@ switch ($action) { if (api_get_session_id() != 0 && !api_is_allowed_to_session_edit(false, true)) { api_not_allowed(); } - $_SESSION['notebook_view'] = 'creation_date'; + Session::write('notebook_view', 'creation_date'); $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']); - $form = $career->returnForm($url, 'add'); + $form = $career->return_form($url, 'add'); // The validation or display if ($form->validate()) { @@ -122,7 +124,7 @@ switch ($action) { } else { echo '
'; echo ''. - Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).''; echo '
'; $form->addElement('hidden', 'sec_token'); $form->setConstants(array('sec_token' => $token)); @@ -132,7 +134,7 @@ switch ($action) { case 'edit': // Action handling: Editing $url = api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&id='.intval($_GET['id']); - $form = $career->returnForm($url, 'edit'); + $form = $career->return_form($url, 'edit'); // The validation or display if ($form->validate()) { @@ -144,9 +146,15 @@ switch ($action) { if ($res) { Display::display_confirmation_message(get_lang('CareerUpdated')); if ($values['status'] && !$old_status) { - Display::display_confirmation_message(sprintf(get_lang('CareerXUnarchived'), $values['name']), false); + Display::display_confirmation_message( + sprintf(get_lang('CareerXUnarchived'), $values['name']), + false + ); } elseif (!$values['status'] && $old_status) { - Display::display_confirmation_message(sprintf(get_lang('CareerXArchived'), $values['name']), false); + Display::display_confirmation_message( + sprintf(get_lang('CareerXArchived'), $values['name']), + false + ); } } } diff --git a/main/admin/group_list.php b/main/admin/group_list.php index 88f829cd27..14dd3b3795 100755 --- a/main/admin/group_list.php +++ b/main/admin/group_list.php @@ -315,19 +315,7 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') { $check = Security::check_token('get'); if ($check) { switch ($_GET['action']) { - case 'show_message' : - if (!empty($_GET['warn'])) { - // to prevent too long messages - if ($_GET['warn'] == 'session_message') { - $_GET['warn'] = $_SESSION['session_message_import_users']; - } - Display::display_warning_message(urldecode($_GET['warn']), false); - } - if (!empty($_GET['message'])) { - Display :: display_confirmation_message(stripslashes($_GET['message'])); - } - break; - case 'delete_group' : + case 'delete_group': if (api_is_platform_admin()) { if (GroupPortalManager :: delete($_GET['group_id'])) { Display :: display_confirmation_message(get_lang('GroupDeleted')); @@ -336,11 +324,11 @@ if (isset($_GET['search']) && $_GET['search'] == 'advanced') { } } break; - case 'lock' : + case 'lock': $message = lock_unlock_user('lock', $_GET['user_id']); Display :: display_normal_message($message); break; - case 'unlock'; + case 'unlock': $message = lock_unlock_user('unlock', $_GET['user_id']); Display :: display_normal_message($message); break; diff --git a/main/admin/skills_import.php b/main/admin/skills_import.php index 5f87e5a9db..b7f1ad7efa 100755 --- a/main/admin/skills_import.php +++ b/main/admin/skills_import.php @@ -7,9 +7,8 @@ * section here: http://en.wikipedia.org/wiki/Personal_knowledge_management */ - $cidReset = true; -require '../inc/global.inc.php'; +require_once '../inc/global.inc.php'; /** * Validate the imported data. @@ -19,7 +18,6 @@ require '../inc/global.inc.php'; function validate_data($skills) { $errors = array(); - $skills = array(); // 1. Check if mandatory fields are set. $mandatory_fields = array('id', 'parent_id', 'name'); foreach ($skills as $index => $skill) { @@ -87,6 +85,7 @@ function parse_csv_data($file) foreach ($skills as $index => $skill) { $skills[$index] = $skill; } + return $skills; } @@ -195,7 +194,7 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) { $error_kind_file = true; } - // List skill id whith error. + // List skill id with error. $skills_to_insert = $skill_id_error = array(); if (is_array($errors)) { foreach ($errors as $my_errors) { @@ -234,19 +233,9 @@ if (!empty($_POST['formSent']) && $_FILES['import_file']['size'] !== 0) { $warning_message .= ''; } - // if the warning message is too long then we display the warning message trough a session - if (!empty($warning_message) && api_strlen($warning_message) > 150) { - $_SESSION['session_message_import_skills'] = $warning_message; - $warning_message = 'session_message'; - } - if ($error_kind_file) { $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); - } else { - //header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skills_import.php?action=show_message&warn='.urlencode($warning_message).'&message='.urlencode($see_message_import).'&sec_token='.$tok); - //exit; } - } Display :: display_header($tool_name); diff --git a/main/admin/user_import.php b/main/admin/user_import.php index a001d222b2..1e8e6ec23c 100644 --- a/main/admin/user_import.php +++ b/main/admin/user_import.php @@ -405,6 +405,7 @@ if (isset($_POST['formSent']) && $_POST['formSent'] AND $see_message_import = get_lang('FileImported'); } + $warning_message = ''; if (count($errors) != 0) { $warning_message = '
    '; foreach ($errors as $index => $error_user) { @@ -422,25 +423,21 @@ if (isset($_POST['formSent']) && $_POST['formSent'] AND } // if the warning message is too long then we display the warning message trough a session + Display::addFlash(Display::return_message($warning_message, 'warning', false)); - $_SESSION['session_message_import_users'] = $warning_message; - $warning_message = 'session_message'; + Display::addFlash(Display::return_message($see_message_import, 'confirmation', false)); if ($error_kind_file) { - $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); + Display::addFlash(Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error', false)); } else { - header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=show_message&warn='.urlencode($warning_message).'&message='.urlencode($see_message_import).'&sec_token='.$tok); + header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?sec_token='.$tok); exit; } } Display :: display_header($tool_name); -if (!empty($error_message)) { - Display::display_error_message($error_message); -} - -$form = new FormValidator('user_import','post','user_import.php'); +$form = new FormValidator('user_import', 'post', api_get_self()); $form->addElement('header', '', $tool_name); $form->addElement('hidden', 'formSent'); $form->addElement('file', 'import_file', get_lang('ImportFileLocation')); diff --git a/main/admin/user_list.php b/main/admin/user_list.php index 0af645f4df..962f4a4baa 100755 --- a/main/admin/user_list.php +++ b/main/admin/user_list.php @@ -2,9 +2,9 @@ /* For licensing terms, see /license.txt */ /** - @author Bart Mollet - @author Julio Montoya BeezNest 2011 -* @package chamilo.admin + * @author Bart Mollet + * @author Julio Montoya BeezNest 2011 + * @package chamilo.admin */ use ChamiloSession as Session; @@ -41,7 +41,8 @@ function load_course_list (div_course,my_user_id) { } }); } -function load_session_list (div_session,my_user_id) { + +function load_session_list(div_session, my_user_id) { $.ajax({ contentType: "application/x-www-form-urlencoded", beforeSend: function(objeto) { @@ -156,7 +157,8 @@ api_protect_admin_script(true); * @param boolean $is_count Whether to count, or get data * @return string SQL query */ -function prepare_user_sql_query($is_count) { +function prepare_user_sql_query($is_count) +{ $sql = ""; $user_table = Database::get_main_table(TABLE_MAIN_USER); $admin_table = Database::get_main_table(TABLE_MAIN_ADMIN); @@ -185,7 +187,7 @@ function prepare_user_sql_query($is_count) { // adding the filter to see the user's only of the current access_url if ((api_is_platform_admin() || api_is_session_admin()) && api_get_multiple_access_url()) { - $access_url_rel_user_table= Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); + $access_url_rel_user_table = Database :: get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); $sql.= " INNER JOIN $access_url_rel_user_table url_rel_user ON (u.id=url_rel_user.user_id)"; } @@ -239,8 +241,8 @@ function prepare_user_sql_query($is_count) { if (isset($keywordListValues['keyword_status']) && $keywordListValues['keyword_status'] == PLATFORM_ADMIN ) { - $query_admin_table = " , $admin_table a "; - $keyword_admin = ' AND a.user_id = u.id '; + $query_admin_table = " , $admin_table a "; + $keyword_admin = ' AND a.user_id = u.id '; $keywordListValues['keyword_status'] = '%'; } @@ -264,7 +266,7 @@ function prepare_user_sql_query($is_count) { if (isset($keyword_active) && !isset($keyword_inactive)) { $sql .= " AND u.active='1'"; - } elseif(isset($keyword_inactive) && !isset($keyword_active)) { + } elseif (isset($keyword_inactive) && !isset($keyword_active)) { $sql .= " AND u.active='0'"; } $sql .= " ) "; @@ -281,14 +283,14 @@ function prepare_user_sql_query($is_count) { } /** -* Make sure this function is protected because it does NOT check password! -* -* This function defines globals. -* @param int $userId + * Make sure this function is protected because it does NOT check password! + * + * This function defines globals. + * @param int $userId * -* @return bool False on failure, redirection on success -* @author Evie Embrechts -* @author Yannick Warnier + * @return bool False on failure, redirection on success + * @author Evie Embrechts + * @author Yannick Warnier */ function loginUser($userId) { @@ -307,7 +309,7 @@ function loginUser($userId) $lastname = $userInfo['lastname']; if (api_is_western_name_order()) { - $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname,$lastname, $userId); + $message = sprintf(get_lang('AttemptingToLoginAs'),$firstname, $lastname, $userId); } else { $message = sprintf(get_lang('AttemptingToLoginAs'), $lastname, $firstname, $userId); } @@ -354,7 +356,8 @@ function loginUser($userId) * Get the total number of users on the platform * @see SortableTable#get_total_number_of_items() */ -function get_number_of_users() { +function get_number_of_users() +{ $sql = prepare_user_sql_query(true); $res = Database::query($sql); @@ -663,26 +666,7 @@ if (!empty($action)) { $message = Display::return_message($message, 'confirmation'); } break; - case 'show_message' : - if (!empty($_GET['warn'])) { - // to prevent too long messages - if ($_GET['warn'] == 'session_message') { - $_GET['warn'] = $_SESSION['session_message_import_users']; - } - if (isset($_GET['warn']) && !empty($_GET['warn'])) { - $message .= Display::return_message( - Security::remove_XSS($_GET['warn']), - 'warning', - false - ); - } - } - if (!empty($_GET['message'])) { - $message .= Display::return_message(stripslashes($_GET['message']), 'confirmation'); - } - - break; - case 'delete_user' : + case 'delete_user': if (api_is_platform_admin()) { $user_to_delete = $_GET['user_id']; $current_user_id = api_get_user_id(); @@ -698,7 +682,7 @@ if (!empty($action)) { } } break; - case 'delete' : + case 'delete': if (api_is_platform_admin()) { $number_of_selected_users = count($_POST['id']); $number_of_deleted_users = 0; diff --git a/main/admin/user_update_import.php b/main/admin/user_update_import.php index 24522033b0..19b82ed7b6 100644 --- a/main/admin/user_update_import.php +++ b/main/admin/user_update_import.php @@ -406,14 +406,12 @@ if (isset($_POST['formSent']) && $_POST['formSent'] AND $_FILES['import_file'][' } // if the warning message is too long then we display the warning message trough a session - - $_SESSION['session_message_import_users'] = $warning_message; - $warning_message = 'session_message'; + Display::addFlash(Display::return_message($warning_message, 'warning', false)); if ($error_kind_file) { - $error_message = get_lang('YouMustImportAFileAccordingToSelectedOption'); + Display::addFlash(Display::return_message(get_lang('YouMustImportAFileAccordingToSelectedOption'), 'error', false)); } else { - header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=show_message&warn='.urlencode($warning_message).'&message='.urlencode($see_message_import).'&sec_token='.$tok); + header('Location: '.api_get_path(WEB_CODE_PATH).'admin/user_list.php?sec_token='.$tok); exit; } @@ -424,8 +422,8 @@ if (!empty($error_message)) { Display::display_error_message($error_message); } -$form = new FormValidator('user_update_import','post','user_update_import.php'); -$form->addElement('header', '', $tool_name); +$form = new FormValidator('user_update_import', 'post', api_get_self()); +$form->addElement('header', $tool_name); $form->addElement('hidden', 'formSent'); $form->addElement('file', 'import_file', get_lang('ImportFileLocation')); @@ -457,14 +455,14 @@ if ($count_fields > 0) { } ?> -

    :

    - -
    -
    -                UserName;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId;
    -                xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx; 0) echo implode(';', $list_reponse).';'; ?>xxx1|xxx2|xxx3;1;
    -
    -
    -

    :

    + +
    +
    +            UserName;LastName;FirstName;Email;NewUserName;Password;AuthSource;OfficialCode;PhoneNumber;Status;ExpiryDate;Active;Language;Courses;ClassId;
    +            xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;xxx;user/teacher/drh;0000-00-00 00:00:00;0/1;xxx; 0) echo implode(';', $list_reponse).';'; ?>xxx1|xxx2|xxx3;1;
    +
    +
    +

    @@ -60,7 +63,7 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') { } if ($action == 'thematic_details' || $action == 'thematic_list') { - $_SESSION['thematic_control'] = $action; + Session::write('thematic_control', $action); } // get thematic id @@ -181,22 +184,24 @@ function check_per_custom_date(obj) { } '; +$thematicControl = Session::read('thematic_control'); + if ($action == 'thematic_list') { $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); } if ($action == 'thematic_add') { - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection')); } if ($action == 'thematic_edit') { - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection')); } if ($action == 'thematic_details') { $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); } if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') { - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); if (!empty($thematic_data)) { $interbreadcrumb[] = array( 'url' => '#', @@ -205,7 +210,7 @@ if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') { } } if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')'); if ($description_type >= ADD_THEMATIC_PLAN) { $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc')); @@ -214,11 +219,11 @@ if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { } } if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') { - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); } if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance')); } diff --git a/main/group/group.php b/main/group/group.php index 2e5c0eb015..3a7076d218 100755 --- a/main/group/group.php +++ b/main/group/group.php @@ -1,6 +1,8 @@ "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".$_SESSION['_cid']."_".$_SESSION['_gid']."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"", + 'url' => "javascript: void(0);\" onclick=\"window.open('../chat/chat.php?".api_get_cidreq()."&toolgroup=".$current_group['id']."','window_chat_group_".api_get_course_id()."_".api_get_group_id()."','height=380, width=625, left=2, top=2, toolbar=no, menubar=no, scrollbars=yes, resizable=yes, location=no, directories=no, status=no') \"", 'content' => Display::return_icon('chat.png', get_lang('Chat'), array(), 32) ); } else { diff --git a/main/inc/lib/career.lib.php b/main/inc/lib/career.lib.php index 5657ebe88a..71dc277f84 100755 --- a/main/inc/lib/career.lib.php +++ b/main/inc/lib/career.lib.php @@ -96,7 +96,7 @@ class Career extends Model * @todo the form should be auto generated * @param string $url * @param string $action add, edit - * @return obj form validator obj + * @return FormValidator */ public function return_form($url, $action) { @@ -130,9 +130,9 @@ class Career extends Model $form->freeze('created_at'); } if ($action == 'edit') { - $form->addButtonSave(get_lang('Modify'),'submit'); + $form->addButtonSave(get_lang('Modify'), 'submit'); } else { - $form->addButtonCreate(get_lang('Add'),'submit'); + $form->addButtonCreate(get_lang('Add'), 'submit'); } // Setting the defaults diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 59bb1676d3..a949c13693 100755 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -523,6 +523,10 @@ class Display */ public static function return_message($message, $type = 'normal', $filter = true) { + if (empty($message)) { + return ''; + } + if ($filter) { $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding()); }