2009-06-30 09:22:30 +00:00
|
|
|
<?php
|
2009-06-30 11:46:44 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/lib/search_form_predefined.php,v 1.10.2.1 2007/12/26 09:26:33 wurley Exp $
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @package phpLDAPadmin
|
|
|
|
*/
|
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '<form action="cmd.php" method="get" class="search">';
|
|
|
|
echo '<input type="hidden" name="cmd" value="search" />';
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<input type="hidden" name="search" value="true" />';
|
|
|
|
echo '<input type="hidden" name="form" value="predefined" />';
|
2009-06-30 10:46:00 +00:00
|
|
|
printf('<input type="hidden" name="format" value="%s" />',$entry['format']);
|
|
|
|
printf('<input type="hidden" name="server_id" value="%s" />',$ldapserver->server_id);
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '<table class="search" border=0>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
if ($entry['predefined'])
|
|
|
|
$selected_q_number = intval($entry['predefined']);
|
2009-06-30 09:22:30 +00:00
|
|
|
else
|
2009-06-30 10:26:08 +00:00
|
|
|
$selected_q_number = null;
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
printf('<tr><td class="title" colspan=2>%s</td></tr>',_('Predefined Searches'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 11:46:44 +00:00
|
|
|
$ss = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'simple_search');
|
|
|
|
$as = $_SESSION[APPCONFIG]->isCommandAvailable('search', 'advanced_search');
|
2009-06-30 10:46:00 +00:00
|
|
|
if ($ss | $as) {
|
|
|
|
echo '<tr><td class="subtitle" colspan=2>(';
|
|
|
|
if ($ss) {
|
|
|
|
printf('<a href="cmd.php?cmd=search&server_id=%s&form=simple">%s</a>', $ldapserver->server_id,_('Simple Search Form'));
|
|
|
|
if ($as) echo ' | ';
|
|
|
|
}
|
|
|
|
if ($as) {
|
|
|
|
printf('<a href="cmd.php?cmd=search&server_id=%s&form=advanced">%s</a>', $ldapserver->server_id,_('Advanced Search Form'));
|
|
|
|
}
|
|
|
|
echo ')</td></tr>';
|
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '<tr><td colspan=2> </td></tr>';
|
|
|
|
|
2009-06-30 11:46:44 +00:00
|
|
|
if (! isset($_SESSION[APPCONFIG]->queries) || ! is_array($_SESSION[APPCONFIG]->queries) || count($_SESSION[APPCONFIG]->queries) == 0) {
|
2009-06-30 10:46:00 +00:00
|
|
|
printf('<tr><td>%s</td></tr>',_('No queries have been defined in config.php.'));
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
} else {
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '<tr>';
|
|
|
|
printf('<td><small>%s: </small></td>',_('Select a predefined search'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '<td>';
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '<select name="predefined">';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 11:46:44 +00:00
|
|
|
foreach ($_SESSION[APPCONFIG]->queries as $q_number => $q) {
|
2009-06-30 10:26:08 +00:00
|
|
|
if ($selected_q_number === $q_number)
|
|
|
|
$selected = ' selected';
|
|
|
|
else
|
|
|
|
$selected = '';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
printf('<option value="%s"%s>%s</option>',$q_number,$selected,htmlspecialchars($q['name']));
|
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
echo '</select>';
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '</td></tr>';
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '<tr><td colspan=2> </td></tr>';
|
|
|
|
printf('<tr><td colspan=2><center><input type="submit" value="%s" /></center></td></tr>',_('Search'));
|
2009-06-30 10:26:08 +00:00
|
|
|
}
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
echo '</table></form>';
|
2009-06-30 10:26:08 +00:00
|
|
|
?>
|