1 pièce(s) jointe(s)
comment afficher le résultat de ma recherche
Bonjour,
je souhaite modifier le résultat d'une recherche dans une liste d'adresse e-mail mais je n'arrive pas a voir ce qu'il y a dedans.
voici une image pour essayer d'expliquer ce que je souhaite faire:
http://www.developpez.net/forums/att...hmentid=83863&
stc=1&d=1318857176
comme il y a un peu de javascript, je ne sais pas si je poste sur le bon forum.
le résultat se trouve en dessous du nombre d'utilisateur.
voici le bout de code que je pense avoir trouvé
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
$i=0;
if (!empty($searchtext)) {
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
echo "</optgroup>\n";
} else {
if ($usercount > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else {
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
}
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?> |
j'ai essayer de faire un
Code:
1 2 3 4 5
|
//....
if (!empty($searchtext)) {
var_dump($searchtext);
//... |
mais je n'ai pas le résutat de la rechercher, j'ai aussi essayer avec un print_r()
voici le code entier
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
<h1>test moteur</h1>
<form id="assignform" method="post" action="">
<div style="text-align:center;">
<label for="extendperiod"><?php print_string('enrolperiod') ?></label> <?php choose_from_menu($periodmenu, "extendperiod", $defaultperiod, $unlimitedperiod); ?>
<label for="extendbase"><?php print_string('startingfrom') ?></label> <?php choose_from_menu($basemenu, "extendbase", 3, ""); ?>
<input type="hidden" name="previoussearch" value="<?php p($previoussearch) ?>" />
<input type="hidden" name="userid" value="<?php p($userid) ?>" />
<input type="hidden" name="courseid" value="<?php p($courseid) ?>" />
<input type="hidden" name="sesskey" value="<?php p(sesskey()) ?>" />
<input type="hidden" name="contextid" value="<?php p($contextid) ?>" />
<input type="hidden" name="roleid" value="<?php p($roleid) ?>" />
<table summary="" style="margin-left:auto;margin-right:auto" border="0" cellpadding="5" cellspacing="0">
<tr>
<td valign="top">
<label for="removeselect"><?php print_string('existingusers', 'role', count($contextusers)); ?></label>
<br />
<select name="removeselect[]" size="20" id="removeselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=false;
getElementById('assignform').addselect.selectedIndex=-1;">
<?php
$i = 0;
foreach ($contextusers as $contextuser) {
$fullname = fullname($contextuser, true);
if ($contextuser->hidden) {
$hidden=' ('.get_string('hiddenassign').') ';
} else {
$hidden="";
}
echo "<option value=\"$contextuser->id\">".$fullname.", ".$contextuser->email.$hidden."</option>\n";
$i++;
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?>
</select></td>
<td valign="top">
<br />
<label title="<?php print_string('hiddenassign') ?>">
<input type="checkbox" name="hidden" value="1" />
<img src="<?php echo $CFG->pixpath; ?>/t/hide.gif" alt="<?php print_string('hiddenassign') ?>" class="hide-show-image" />
<?php helpbutton('hiddenassign', get_string('hiddenassign')); ?>
</label>
<?php check_theme_arrows(); ?>
<p class="arrow_button">
<input name="add" id="add" type="submit" value="<?php echo $THEME->larrow.' '.get_string('add'); ?>" title="<?php print_string('add'); ?>" /><br />
<input name="remove" id="remove" type="submit" value="<?php echo get_string('remove').' '.$THEME->rarrow; ?>" title="<?php print_string('remove'); ?>" />
</p>
</td>
<td valign="top">
<label for="addselect"><?php print_string('potentialusers', 'role', $usercount); ?></label>
<br />
<select name="addselect[]" size="20" id="addselect" multiple="multiple"
onfocus="getElementById('assignform').add.disabled=false;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;">
<?php
$i=0;
if (!empty($searchtext)) {
echo "<optgroup label=\"$strsearchresults (" . $usercount . ")\">\n";
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
echo "</optgroup>\n";
} else {
if ($usercount > MAX_USERS_PER_PAGE) {
echo '<optgroup label="'.get_string('toomanytoshow').'"><option></option></optgroup>'."\n"
.'<optgroup label="'.get_string('trysearching').'"><option></option></optgroup>'."\n";
} else {
while ($user = rs_fetch_next_record($availableusers)) {
$fullname = fullname($user, true);
echo "<option value=\"$user->id\">".$fullname.", ".$user->email."</option>\n";
$i++;
}
}
}
if ($i==0) {
echo '<option/>'; // empty select breaks xhtml strict
}
?>
</select>
<br />
<label for="searchtext" class="accesshide"><?php p($strsearch) ?></label>
<input type="text" name="searchtext" id="searchtext" size="30" value="<?php p($searchtext, true) ?>"
onfocus ="getElementById('assignform').add.disabled=true;
getElementById('assignform').remove.disabled=true;
getElementById('assignform').removeselect.selectedIndex=-1;
getElementById('assignform').addselect.selectedIndex=-1;"
onkeydown = "var keyCode = event.which ? event.which : event.keyCode;
if (keyCode == 13) {
getElementById('assignform').previoussearch.value=1;
getElementById('assignform').submit();
} " />
<input name="search" id="search" type="submit" value="<?php p($strsearch) ?>" />
<?php
if (!empty($searchtext)) {
echo '<input name="showall" id="showall" type="submit" value="'.$strshowall.'" />'."\n";
}
?>
</td>
</tr>
</table>
</div>
</form> |