Minor - format code.

1.9.x
Julio Montoya 11 years ago
parent bbc3a383c1
commit eca0ebbd1a
  1. 17
      main/admin/add_courses_to_session.php
  2. 32
      main/admin/add_courses_to_usergroup.php

@ -5,21 +5,21 @@
* @todo use formvalidator
*/
// name of the language file that needs to be included
// name of the language file that needs to be included.
$language_file = 'admin';
// resetting the course id
// resetting the course id.
$cidReset = true;
require_once '../inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH).'add_courses_to_session_functions.lib.php';
$id_session = isset($_GET['id_session']) ? intval($_GET['id_session']) : null;
$add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
SessionManager::protect_session_edit($id_session);
$xajax = new xajax();
//$xajax->debugOn();
$xajax->registerFunction (array('search_courses', 'AddCourseToSession', 'search_courses'));
// Setting the section (for the tabs)
@ -155,10 +155,11 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
$nbr_courses=count($CourseList);
Database::query("UPDATE $tbl_session SET nbr_courses=$nbr_courses WHERE id='$id_session'");
if (isset($_GET['add']))
if (isset($add)) {
header('Location: add_users_to_session.php?id_session='.$id_session.'&add=true');
else
} else {
header('Location: resume_session.php?id_session='.$id_session);
}
exit;
}
@ -166,11 +167,13 @@ if (isset($_POST['formSent']) && $_POST['formSent']) {
Display::display_header($tool_name);
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$add.'&add_type=unique">'.
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$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').'&nbsp;&nbsp;&nbsp;';
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
$link_add_type_multiple = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.$add.'&add_type=multiple">'.
Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
// the form header

@ -4,35 +4,31 @@
* @package chamilo.admin
*/
// name of the language file that needs to be included
// Name of the language file that needs to be included.
$language_file = array('admin', 'registration');
// resetting the course id
// Resetting the course id.
$cidReset = true;
// including some necessary files
// Including some necessary files.
require_once '../inc/global.inc.php';
require_once '../inc/lib/xajax/xajax.inc.php';
require_once api_get_path(LIBRARY_PATH).'usergroup.lib.php';
$xajax = new xajax();
//$xajax->debugOn();
$xajax->registerFunction('search');
// setting the section (for the tabs)
// Setting the section (for the tabs).
$this_section = SECTION_PLATFORM_ADMIN;
// Access restrictions
// Access restrictions.
api_protect_admin_script(true);
// setting breadcrumbs
// Setting breadcrumbs.
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes'));
// Database Table Definitions
// setting the name of the tool
// Setting the name of the tool.
$tool_name = get_lang('SubscribeClassToCourses');
$add_type = 'multiple';
@ -40,6 +36,8 @@ if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
$add_type = Security::remove_XSS($_REQUEST['add_type']);
}
$add = isset($_GET['add']) ? Security::remove_XSS($_GET['add']) : null;
$htmlHeadXtra[] = $xajax->getJavascript('../inc/lib/xajax/');
$htmlHeadXtra[] = '
<script>
@ -76,13 +74,13 @@ function validate_filter() {
}
</script>';
$form_sent = 0;
$errorMsg = '';
$sessions = array();
$usergroup = new UserGroup();
$id = intval($_GET['id']);
if ($_POST['form_sent']) {
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$elements_posted = $_POST['elements_in_name'];
if (!is_array($elements_posted)) {
@ -94,6 +92,7 @@ if ($_POST['form_sent']) {
exit;
}
}
$data = $usergroup->get($id);
$course_list_in = $usergroup->get_courses_by_usergroup($id);
$course_list = CourseManager::get_courses_list(0, 0, 'title', 'asc', -1, null, api_get_current_access_url_id());
@ -168,12 +167,12 @@ $xajax->processRequests();
Display::display_header($tool_name);
if ($add_type == 'multiple') {
$link_add_type_unique = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=unique">'.
$link_add_type_unique = '<a href="'.api_get_self().'?add='.$add.'&add_type=unique">'.
Display::return_icon('single.gif').get_lang('SessionAddTypeUnique').'</a>';
$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 = '<a href="'.api_get_self().'?id_session='.$id_session.'&add='.Security::remove_XSS($_GET['add']).'&add_type=multiple">'.
$link_add_type_multiple = '<a href="'.api_get_self().'?add='.$add.'&add_type=multiple">'.
Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
@ -186,8 +185,9 @@ echo '</div>';
<?php echo '<legend>'.$data['name'].': '.$tool_name.'</legend>';
$extra_field_list = array();
if ($add_type == 'multiple') {
if (is_array($extra_field_list)) {
if (is_array($extra_field_list) && !empty($extra_field_list)) {
if (is_array($new_field_list) && count($new_field_list) > 0) {
echo '<h3>'.get_lang('FilterUsers').'</h3>';
foreach ($new_field_list as $new_field) {

Loading…
Cancel
Save