Adding advanced option js code + fixing page. see BT#7060

1.9.x
Julio Montoya 11 years ago
parent 320cf3e521
commit e45918cb26
  1. 20
      main/admin/add_users_to_usergroup.php
  2. 25
      main/template/default/layout/footer.tpl

@ -107,7 +107,7 @@ $first_letter_user = '';
if (isset($_POST['form_sent']) && $_POST['form_sent']) {
$form_sent = $_POST['form_sent'];
$elements_posted = $_POST['elements_in_name'];
$elements_posted = isset($_POST['elements_in_name']) ? $_POST['elements_in_name'] : null;
$first_letter_user = $_POST['firstLetterUser'];
if (!is_array($elements_posted)) {
@ -163,11 +163,18 @@ $filters = array(
);
$searchForm = new FormValidator('search', 'get', api_get_self().'?id='.$id);
//$searchForm->addElement('html', '<table>');
$searchForm->add_header(get_lang('FilterUser'));
$renderer =& $searchForm->defaultRenderer();
$searchForm->addElement('hidden', 'id', $id);
foreach ($filters as $param) {
//$searchForm->addElement('html', '<tr>');
$searchForm->addElement($param['type'], $param['name'], $param['label']);
//$searchForm->addElement('html', '</tr>');
}
$searchForm->addElement('button', 'submit', get_lang('Search'));
//$searchForm->addElement('html', '</table>');
$filterData = array();
if ($searchForm->validate()) {
@ -176,7 +183,7 @@ if ($searchForm->validate()) {
$data = $usergroup->get($id);
$list_in = $usergroup->get_users_by_usergroup($id);
$list_all = $usergroup->get_users_by_usergroup();
$list_all = $usergroup->get_users_by_usergroup();
$order = array('lastname');
if (api_is_western_name_order()) {
@ -186,7 +193,7 @@ if (api_is_western_name_order()) {
$conditions = array();
if (!empty($first_letter_user)) {
$conditions['lastname'] = $conditions;
$conditions['lastname'] = $first_letter_user;
}
if (!empty($filters) && !empty($filterData)) {
@ -262,14 +269,15 @@ echo '<div class="actions">';
echo '<a href="usergroups.php">'.
Display::return_icon('back.png', get_lang('Back'), array(), ICON_SIZE_MEDIUM).'</a>';
echo Display::url(get_lang('AdvancedSearch'), '#', array('class' => 'advanced_options', 'id' => 'advanced_search'));
echo '<a href="usergroup_user_import.php">'.
Display::return_icon('import_csv.png', get_lang('Import'), array(), ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
echo Display::page_subheader(get_lang('FilterUser'));
echo '<div id="advanced_search_options" style="display:none">';
$searchForm->display();
echo '</div>';
?>
<form name="formulaire" method="post" action="<?php echo api_get_self(); ?>?id=<?php echo $id; if(!empty($_GET['add'])) echo '&add=true' ; ?>" style="margin:0px;">
<?php

@ -60,8 +60,33 @@
{% raw %}
<script>
$("form").on("click", ' .advanced_parameters', function() {
var id = $(this).attr('id') + '_options';
var button = $(this);
$("#"+id).toggle(function() {
button.toggleClass('active');
});
});
/* Makes row highlighting possible */
$(document).ready( function() {
/**
* Advanced options
* Usage
* <a id="link" href="url">Advanced</a>
* <div id="link_options">
* hidden content :)
* </div>
* */
$(".advanced_options").on("click", function() {
var id = $(this).attr('id') + '_options';
var button = $(this);
$("#"+id).toggle(function() {
button.toggleClass('active');
});
});
// Chosen select
$(".chzn-select").chosen({

Loading…
Cancel
Save