Minor - format code.

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

@ -5,22 +5,22 @@
* @todo use formvalidator
*/
// name of the language file that needs to be included
$language_file='admin';
// 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'));
$xajax->registerFunction (array('search_courses', 'AddCourseToSession', 'search_courses'));
// Setting the section (for the tabs)
$this_section = SECTION_PLATFORM_ADMIN;
@ -28,7 +28,7 @@ $this_section = SECTION_PLATFORM_ADMIN;
// setting breadcrumbs
$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'session_list.php','name' => get_lang('SessionList'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session,"name" => get_lang('SessionOverview'));
$interbreadcrumb[] = array('url' => "resume_session.php?id_session=".$id_session, "name" => get_lang('SessionOverview'));
// Database Table Definitions
$tbl_session_rel_course_rel_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
@ -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,42 +4,40 @@
* @package chamilo.admin
*/
// name of the language file that needs to be included
$language_file = array('admin','registration');
// 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
$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]=array('url' => 'usergroups.php','name' => get_lang('Classes'));
// Database Table Definitions
// Setting breadcrumbs.
$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes'));
// setting the name of the tool
$tool_name=get_lang('SubscribeClassToCourses');
// Setting the name of the tool.
$tool_name = get_lang('SubscribeClassToCourses');
$add_type = 'multiple';
if(isset($_REQUEST['add_type']) && $_REQUEST['add_type']!=''){
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>
@ -70,23 +68,23 @@ function remove_item(origin) {
}
function validate_filter() {
document.formulaire.add_type.value = \''.$add_type.'\';
document.formulaire.form_sent.value=0;
document.formulaire.submit();
document.formulaire.add_type.value = \''.$add_type.'\';
document.formulaire.form_sent.value=0;
document.formulaire.submit();
}
</script>';
$form_sent = 0;
$errorMsg = '';
$sessions=array();
$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)) {
$elements_posted=array();
$elements_posted = array();
}
if ($form_sent == 1) {
$usergroup->subscribe_courses_to_usergroup($id, $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>';
if ($add_type=='multiple') {
if (is_array($extra_field_list)) {
$extra_field_list = array();
if ($add_type == 'multiple') {
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