$elipsis_printed = true; } } elseif ($page == $page_num) { $pager_html .= '<b>' . ($page_num + 1) . '</b>'; $pager_html .= ' '; $elipsis_printed = false; } else { $query_string = array_to_query_string($_GET, array('page')); $query_string .= '&page=' . $page_num; $pager_html .= "<a href=\"search.php?{$query_string}\">" . ($page_num + 1) . "</a>"; $pager_html .= ' '; $elipsis_printed = false; } } if ($page + 1 < $total_pages) { $query_string = array_to_query_string($_GET, array('page')); $query_string .= '&page=' . ($page + 1); $pager_html .= "<a title=\"" . sprintf(_('Page %d'), $page + 2) . "\" href=\"search.php?{$query_string}\">››</a>"; } else { $pager_html .= "››"; } } if (0 == $count) { printf('<center><h2>%s</h2></center>', _('The search found no results.')); } else { if (trim($pager_html)) { printf('<center>%s</center>', $pager_html); } echo '<br />'; flush(); if ($format == 'list') {
private function drawResultsTable($base, $results) { $server = $this->getServer(); echo '<table class="result" border="0">'; echo '<tr>'; printf('<td>%s: <b>%s</b><br/><br/><div class="execution_time">(%s %s)</div></td>', _('Entries found'), number_format($results), $this->template->resultsdata[$base]['time'], _('seconds')); if ($_SESSION[APPCONFIG]->isCommandAvailable('script', 'export') && $_SESSION[APPCONFIG]->isCommandAvailable('script', 'export_form')) { $href = htmlspecialchars(sprintf('cmd.php?cmd=export_form&server_id=%s&scope=%s&dn=%s&filter=%s&attributes=%s', $server->getIndex(), $this->template->resultsdata[$base]['scope'], $base, rawurlencode($this->template->resultsdata[$base]['filter']), rawurlencode(implode(', ', $this->template->resultsdata[$base]['attrs'])))); printf('<td style="text-align: right; width: 85%%"><small>[ <a href="%s"><img src="%s/save.png" alt="Save" /> %s</a> ]</small>', $href, IMGDIR, _('export results')); } printf('<small>[ <img src="%s/rename.png" alt="rename" /> %s:', IMGDIR, _('Format')); foreach (array('list', 'table') as $f) { echo ' '; if (get_request('format', 'REQUEST', false, $_SESSION[APPCONFIG]->getValue('search', 'display')) == $f) { printf('<b>%s</b>', _($f)); } else { $query_string = htmlspecialchars(sprintf('%s&format=%s&show=%s&focusbase=%s', array_to_query_string($_GET, array('format', 'meth')), $f, $this->getAjaxRef($base), $base)); if (isAjaxEnabled()) { printf('<a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>', $query_string, $query_string, _('Loading Search'), _($f)); } else { printf('<a href="cmd.php?%s">%s</a>', $query_string, _($f)); } } } echo ' ]</small>'; echo '<br />'; printf('<small>%s: <b>%s</b></small>', _('Base DN'), htmlspecialchars($base)); echo '<br />'; printf('<small>%s: <b>%s</b></small>', _('Filter performed'), htmlspecialchars($this->template->resultsdata[$base]['filter'])); echo '</td>'; echo '</tr>'; echo '</table>'; }
/** * Present a list of available templates for creating and editing LDAP entries */ protected function drawTemplateChoice() { if (DEBUGTMP) { printf('<font size=-2>%s</font><br />', __METHOD__); } $this->drawTitle(); $this->drawSubTitle(); echo "\n"; switch ($this->getMode()) { case 'creation': $msg = _('Select a template for the creation process'); break; case 'modification': $msg = _('Select a template to edit the entry'); break; } $avail_templates = $this->getTemplates(); $templates = $avail_templates->getTemplates($this->getMode(), $this->getModeContainer()); printf('<h3 style="text-align: center;">%s</h3>', $msg); $href_parms = array_to_query_string($_GET, array('meth')); printf('<form id="template_choice_form" action="cmd.php?%s" method="post">', htmlspecialchars($href_parms)); echo "\n\n"; if (count($_POST)) { echo '<div>'; foreach ($_POST as $p => $v) { printf('<input type="hidden" name="%s" value="%s" />', $p, $v); } echo '</div>'; echo "\n\n"; } echo '<table class="forminput" width="100%" border="0">'; echo '<tr>'; printf('<td class="heading" style="vertical-align: top">%s:</td>', _('Templates')); echo '<td>'; echo '<table>'; $i = -1; $nb_templates = count($templates); if ($this->haveDefaultTemplate()) { $nb_templates++; } foreach ($templates as $name => $details) { $i++; $isInValid = $details->isInValid(); # Balance the columns properly if ($nb_templates % 2 == 0 && $i == intval($nb_templates / 2) || $nb_templates % 2 == 1 && $i == intval($nb_templates / 2) + 1) { echo '</table></td><td><table>'; } echo "\n"; echo '<tr>'; if ($isInValid) { printf('<td class="icon"><img src="%s/disabled.png" alt="Disabled" /></td>', IMGDIR); } else { if (isAjaxEnabled()) { printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="return ajDISPLAY(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>', htmlspecialchars($details->getID()), htmlspecialchars($details->getID()), htmlspecialchars($href_parms), $details->getID(), str_replace('\'', '\\\'', _('Retrieving DN'))); } else { printf('<td><input type="radio" name="template" value="%s" id="%s" onclick="document.getElementById(\'template_choice_form\').submit()" /></td>', htmlspecialchars($details->getID()), htmlspecialchars($details->getID())); } } printf('<td class="icon"><label for="%s"><img src="%s" alt="" /></label></td>', htmlspecialchars($details->getID()), $details->getIcon()); printf('<td class="label"><label for="%s">', htmlspecialchars($details->getID())); if ($isInValid) { printf('<span id="%s" style="color: gray"><acronym title="%s">', htmlspecialchars($details->getID()), _($isInValid)); } echo _($details->getTitle()); if ($isInValid) { echo '</acronym></span>'; } echo '</label></td>'; echo '</tr>'; } echo "\n"; # Default template if ($this->haveDefaultTemplate()) { $i++; # Balance the columns properly if ($nb_templates % 2 == 0 && $i == intval($nb_templates / 2) || $nb_templates % 2 == 1 && $i == intval($nb_templates / 2) + 1) { echo '</table></td><td><table>'; } echo '<tr>'; if (isAjaxEnabled()) { printf('<td><input type="radio" name="template" value="none" id="none" onclick="return ajDISPLAY(\'BODY\',\'%s&template=%s\',\'%s\');" /></td>', htmlspecialchars($href_parms), 'none', str_replace('\'', '\\\'', _('Retrieving DN'))); } else { echo '<td><input type="radio" name="template" value="none" id="none" onclick="document.getElementById(\'template_choice_form\').submit()" /></td>'; } printf('<td class="icon"><label for="none"><img src="%s/ldap-default.png" alt="" /></label></td>', IMGDIR); printf('<td class="label"><label for="none">%s</label></td>', _('Default')); echo '</tr>'; } echo '</table>'; echo '</td></tr>'; echo '</table>'; echo '</form>'; }