Minor - format code

pull/2487/head
jmontoyaa 9 years ago
parent 5a53873a32
commit 588493cf40
  1. 38
      main/admin/add_courses_to_usergroup.php

@ -3,6 +3,7 @@
/** /**
* @package chamilo.admin * @package chamilo.admin
*/ */
// Resetting the course id. // Resetting the course id.
$cidReset = true; $cidReset = true;
@ -26,7 +27,7 @@ $interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes
$tool_name = get_lang('SubscribeClassToCourses'); $tool_name = get_lang('SubscribeClassToCourses');
$add_type = 'multiple'; $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_type = Security::remove_XSS($_REQUEST['add_type']);
} }
@ -66,8 +67,8 @@ function validate_filter() {
} }
</script>'; </script>';
$form_sent = 0; $form_sent = 0;
$errorMsg = ''; $errorMsg = '';
$sessions = array(); $sessions = array();
$usergroup = new UserGroup(); $usergroup = new UserGroup();
$id = intval($_GET['id']); $id = intval($_GET['id']);
@ -89,10 +90,7 @@ if (isset($_POST['form_sent']) && $_POST['form_sent']) {
// Filters // Filters
$filters = array( $filters = array(
array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')), array('type' => 'text', 'name' => 'code', 'label' => get_lang('CourseCode')),
array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title')), array('type' => 'text', 'name' => 'title', 'label' => get_lang('Title'))
/*array('type' => 'text', 'name' => 'lastname', 'label' => get_lang('LastName')),
array('type' => 'text', 'name' => 'official_code', 'label' => get_lang('OfficialCode')),
array('type' => 'text', 'name' => 'email', 'label' => get_lang('Email'))*/
); );
$searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id); $searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
@ -123,7 +121,17 @@ if (!empty($filters) && !empty($filterData)) {
$data = $usergroup->get($id); $data = $usergroup->get($id);
$course_list_in = $usergroup->get_courses_by_usergroup($id, true); $course_list_in = $usergroup->get_courses_by_usergroup($id, true);
$course_list = CourseManager::get_courses_list(0, 0, 'title', 'asc', -1, null, api_get_current_access_url_id(), false, $conditions); $course_list = CourseManager::get_courses_list(
0,
0,
'title',
'asc',
-1,
null,
api_get_current_access_url_id(),
false,
$conditions
);
$elements_not_in = $elements_in = array(); $elements_not_in = $elements_in = array();
@ -140,7 +148,6 @@ if (!empty($course_list)) {
$ajax_search = $add_type == 'unique' ? true : false; $ajax_search = $add_type == 'unique' ? true : false;
//checking for extra field with filter on //checking for extra field with filter on
function search($needle,$type) function search($needle,$type)
{ {
global $elements_in; global $elements_in;
@ -148,7 +155,14 @@ function search($needle,$type)
$return = ''; $return = '';
if (!empty($needle) && !empty($type)) { if (!empty($needle) && !empty($type)) {
if ($type != 'single') { if ($type != 'single') {
$list = CourseManager::get_courses_list(0, 0, 2, 'ASC', -1, $needle); $list = CourseManager::get_courses_list(
0,
0,
2,
'ASC',
-1,
$needle
);
} }
if ($type != 'single') { if ($type != 'single') {
$return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">'; $return .= '<select id="elements_not_in" name="elements_not_in_name[]" multiple="multiple" size="15" style="width:360px;">';
@ -284,7 +298,6 @@ if (!empty($errorMsg)) {
<script type="text/javascript"> <script type="text/javascript">
function moveItem(origin , destination) { function moveItem(origin , destination) {
for(var i = 0 ; i<origin.options.length ; i++) { for(var i = 0 ; i<origin.options.length ; i++) {
if(origin.options[i].selected) { if(origin.options[i].selected) {
destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value); destination.options[destination.length] = new Option(origin.options[i].text,origin.options[i].value);
@ -298,7 +311,6 @@ function moveItem(origin , destination) {
} }
function sortOptions(options) { function sortOptions(options) {
newOptions = new Array(); newOptions = new Array();
for (i = 0 ; i<options.length ; i++) for (i = 0 ; i<options.length ; i++)
newOptions[i] = options[i]; newOptions[i] = options[i];
@ -307,7 +319,6 @@ function sortOptions(options) {
options.length = 0; options.length = 0;
for(i = 0 ; i < newOptions.length ; i++) for(i = 0 ; i < newOptions.length ; i++)
options[i] = newOptions[i]; options[i] = newOptions[i];
} }
function mysort(a, b){ function mysort(a, b){
@ -339,7 +350,6 @@ function loadUsersInSelect(select) {
xhr_object.open("POST", "loadUsersInSelect.ajax.php"); xhr_object.open("POST", "loadUsersInSelect.ajax.php");
xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); xhr_object.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
nosessionUsers = makepost(document.getElementById('elements_not_in')); nosessionUsers = makepost(document.getElementById('elements_not_in'));
sessionUsers = makepost(document.getElementById('elements_in')); sessionUsers = makepost(document.getElementById('elements_in'));
nosessionClasses = makepost(document.getElementById('origin_classes')); nosessionClasses = makepost(document.getElementById('origin_classes'));

Loading…
Cancel
Save