Minor - format code.

1.9.x
Julio Montoya 12 years ago
parent b1d2a52633
commit eef37cc635
  1. 90
      main/admin/add_users_to_usergroup.php

@ -21,8 +21,8 @@ $this_section = SECTION_PLATFORM_ADMIN;
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'));
$interbreadcrumb[]= array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
$interbreadcrumb[]= array('url' => 'usergroups.php','name' => get_lang('Classes'));
// Database Table Definitions
@ -30,7 +30,7 @@ $interbreadcrumb[]=array('url' => 'usergroups.php','name' => get_lang('Classes')
$tool_name=get_lang('SubscribeUsersToClass');
$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']);
}
@ -63,9 +63,9 @@ 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();
}
function checked_in_no_group(checked) {
@ -84,7 +84,6 @@ function change_select(val) {
</script>';
$form_sent = 0;
$errorMsg = '';
@ -94,7 +93,10 @@ if (is_array($extra_field_list)) {
foreach ($extra_field_list as $extra_field) {
//if is enabled to filter and is a "<select>" field type
if ($extra_field[8]==1 && $extra_field[2]==4 ) {
$new_field_list[] = array('name'=> $extra_field[3], 'variable'=>$extra_field[1], 'data'=> $extra_field[9]);
$new_field_list[] = array(
'name'=> $extra_field[3],
'variable' => $extra_field[1], 'data'=> $extra_field[9]
);
}
}
}
@ -103,7 +105,7 @@ $usergroup = new UserGroup();
$id = intval($_GET['id']);
$first_letter_user = '';
if ($_POST['form_sent']) {
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$elements_posted = $_POST['elements_in_name'];
$first_letter_user = $_POST['firstLetterUser'];
@ -129,7 +131,10 @@ if (is_array($extra_field_list)) {
if (UserManager::is_extra_field_available($new_field['variable'])) {
if (isset($_POST[$varname]) && $_POST[$varname]!='0') {
$use_extra_fields = true;
$extra_field_result[]= UserManager::get_extra_user_data_by_value($new_field['variable'], $_POST[$varname]);
$extra_field_result[] = UserManager::get_extra_user_data_by_value(
$new_field['variable'],
$_POST[$varname]
);
}
}
}
@ -139,9 +144,9 @@ if (is_array($extra_field_list)) {
if ($use_extra_fields) {
$final_result = array();
if (count($extra_field_result)>1) {
for($i=0;$i<count($extra_field_result)-1;$i++) {
for ($i=0;$i<count($extra_field_result)-1;$i++) {
if (is_array($extra_field_result[$i+1])) {
$final_result = array_intersect($extra_field_result[$i],$extra_field_result[$i+1]);
$final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]);
}
}
} else {
@ -161,7 +166,7 @@ $elements_not_in = $elements_in = array();
$complete_user_list = UserManager::get_user_list(array(), $order);
if (!empty($complete_user_list)) {
foreach($complete_user_list as $item) {
foreach ($complete_user_list as $item) {
if ($use_extra_fields) {
if (!in_array($item['user_id'], $final_result)) {
continue;
@ -192,7 +197,7 @@ if ($user_with_any_group) {
}
if (!empty($user_list)) {
foreach($user_list as $item) {
foreach ($user_list as $item) {
if ($use_extra_fields) {
if (!in_array($item['user_id'], $final_result)) {
continue;
@ -210,18 +215,13 @@ if (!empty($user_list)) {
$add_type == 'unique' ? true : false;
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_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">'.Display::return_icon('multiple.gif').get_lang('SessionAddTypeMultiple').'</a>';
}
echo '<div class="actions">';
echo '<a href="usergroups.php">'.Display::return_icon('back.png',get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '<a href="usergroups.php">'.
Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '<a href="usergroup_user_import.php">'.Display::return_icon('import_csv.png',get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '<a href="usergroup_user_import.php">'.
Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
?>
@ -255,13 +255,12 @@ if ($add_type=='multiple') {
}
}
}
echo Display::input('hidden','id',$id);
echo Display::input('hidden','form_sent','1');
echo Display::input('hidden','add_type',null);
if(!empty($errorMsg)) {
echo Display::input('hidden', 'id', $id);
echo Display::input('hidden', 'form_sent', '1');
echo Display::input('hidden', 'add_type', null);
if (!empty($errorMsg)) {
Display::display_normal_message($errorMsg);
}
?>
<div class="row">
@ -276,8 +275,15 @@ if(!empty($errorMsg)) {
?>
</select>
</div>
<?php echo Display::select('elements_not_in_name', $elements_not_in, '',array('class'=>'span5', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),false); ?>
<?php
echo Display::select(
'elements_not_in_name',
$elements_not_in,
'',
array('class'=>'span5', 'multiple'=>'multiple','id'=>'elements_not_in','size'=>'15px'),
false
);
?>
<br />
<label class="control-label">
<input type="checkbox" <?php if ($user_with_any_group) echo 'checked="checked"';?> onchange="checked_in_no_group(this.checked);" name="user_with_any_group" id="user_with_any_group_id">
@ -286,25 +292,33 @@ if(!empty($errorMsg)) {
</div>
<div class="span2">
<div style="padding-top:54px;width:auto;text-align: center;">
<button class="arrowr" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))"></button>
<button class="arrowr" type="button" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))" onclick="moveItem(document.getElementById('elements_not_in'), document.getElementById('elements_in'))">
</button>
<br /><br />
<button class="arrowl" type="button" onclick="moveItem(document.getElementById('elements_in'), document.getElementById('elements_not_in'))" onclick="moveItem(document.getElementById('elements_in'), document.getElementById('elements_not_in'))"></button>
<button class="arrowl" type="button" onclick="moveItem(document.getElementById('elements_in'), document.getElementById('elements_not_in'))" onclick="moveItem(document.getElementById('elements_in'), document.getElementById('elements_not_in'))">
</button>
</div>
</div>
<div class="span5">
<div class="multiple_select_header">
<b><?php echo get_lang('UsersInGroup') ?> :</b>
</div>
<?php
echo Display::select('elements_in_name[]', $elements_in, '', array('class'=>'span5', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),false );
echo Display::select(
'elements_in_name[]',
$elements_in,
'',
array('class'=>'span5', 'multiple'=>'multiple','id'=>'elements_in','size'=>'15px'),
false
);
unset($sessionUsersList);
?>
</div>
</div>
<?php
echo '<button class="save" type="button" value="" onclick="valide()" >'.get_lang('SubscribeUsersToClass').'</button>';
echo '<button class="save" type="button" value="" onclick="valide()" >'.
get_lang('SubscribeUsersToClass').'</button>';
?>
</form>
<script>
@ -335,7 +349,7 @@ function sortOptions(options) {
}
function mysort(a, b){
function mysort(a, b) {
if(a.text.toLowerCase() > b.text.toLowerCase()){
return 1;
}
@ -345,7 +359,7 @@ function mysort(a, b){
return 0;
}
function valide(){
function valide() {
var options = document.getElementById('elements_in').options;
for (i = 0 ; i<options.length ; i++)
options[i].selected = true;
@ -353,4 +367,4 @@ function valide(){
}
</script>
<?php
Display::display_footer();
Display::display_footer();

Loading…
Cancel
Save