Beispiel #1
0
/**
 * Display a column header with sort buttons
 *
 * @param string $field             Which field to display
 * @param array  $current_page_args All known query string arguments
 *                                  for the current page request; structured
 *                                  as an associative array of key/value pairs
 *
 * @author Steve Brown
 * @since 1.5.2
 */
function addAbookSort($field, $current_page_args)
{
    global $abook_sort_order, $nbsp;
    switch ($field) {
        case 'nickname':
            $str = _("Nickname");
            $alt = _("Sort by nickname");
            $down = 0;
            $up = 1;
            $has_sort = true;
            break;
        case 'fullname':
            $str = _("Name");
            $alt = _("Sort by name");
            $down = 2;
            $up = 3;
            $has_sort = true;
            break;
        case 'email':
            $str = _("E-mail");
            $alt = _("Sort by email");
            $down = 4;
            $up = 5;
            $has_sort = true;
            break;
        case 'info':
            $str = _("Info");
            $alt = _("Sort by info");
            $down = 6;
            $up = 7;
            $has_sort = true;
            break;
        default:
            return 'BAD SORT FIELD GIVEN: "' . $field . '"';
    }
    // show_abook_sort_button() creates a hyperlink (using hyperlink.tpl) that encompases an image, using a getImage() call
    return $str . ($has_sort ? $nbsp . show_abook_sort_button($abook_sort_order, $alt, $down, $up, $current_page_args) : '');
}
Beispiel #2
0
 /* List addresses */
 if (count($alist) > 0) {
     echo addForm($form_url, 'post', 'address_book_form');
     if ($abook->add_extra_field) {
         $abook_fields = 6;
     } else {
         $abook_fields = 5;
     }
     $count = 0;
     while (list($undef, $row) = each($alist)) {
         /* New table header for each backend */
         if ($prevbackend != $row['backend']) {
             if ($prevbackend < 0) {
                 echo html_tag('table', html_tag('tr', html_tag('td', addSubmit(_("Edit selected"), 'editaddr') . addSubmit(_("Delete selected"), 'deladdr') . addSubmit(_("Compose to selected"), 'compose_to', $javascript_on && $compose_new_win ? $compose_to_in_new_window_javascript : ''), 'center', '', "colspan=\"{$abook_fields}\"")) . html_tag('tr', html_tag('td', '&nbsp;<br />', 'center', '', 'colspan="5"')), 'center');
             }
             echo html_tag('table', html_tag('tr', html_tag('td', "\n" . '<strong>' . $row['source'] . '</strong>' . "\n", 'center', $color[0], 'colspan="2"')) . concat_hook_function('address_book_header', $row), 'center', '', 'width="95%"') . "\n" . html_tag('table', '', 'center', '', 'border="0" cellpadding="1" cellspacing="0" width="90%"') . html_tag('tr', "\n" . html_tag('th', '&nbsp;', 'left', '', 'width="1%"') . html_tag('th', _("Nickname") . show_abook_sort_button($abook_sort_order, _("sort by nickname"), 0, 1), 'left', '', 'width="10%"') . html_tag('th', _("Name") . show_abook_sort_button($abook_sort_order, _("sort by name"), 2, 3), 'left', '', 'width="10%"') . html_tag('th', _("E-mail") . show_abook_sort_button($abook_sort_order, _("sort by email"), 4, 5), 'left', '', 'width="10%"') . html_tag('th', _("Info") . show_abook_sort_button($abook_sort_order, _("sort by info"), 6, 7), 'left', '', 'width="10%"') . ($abook->add_extra_field ? html_tag('th', '&nbsp;', 'left', '', 'width="1%0"') : ''), '', $color[9]) . "\n";
             $line = 0;
             $headerprinted = true;
         }
         /* End of header */
         $prevbackend = $row['backend'];
         /* Print one row, with alternating color */
         if ($line % 2) {
             $tr_bgcolor = $color[12];
         } else {
             $tr_bgcolor = $color[4];
         }
         // Print special message if that's what we have
         // here instead of an actual address entry
         if (!empty($row['special_message'])) {
             echo html_tag('tr', '', '', $tr_bgcolor) . html_tag('td', $row['special_message'], 'center', '', 'colspan="5"') . "</tr>\n";
     plain_error_message($abook->error, $color);
     exit;
 }
 usort($alist, 'alistcmp');
 $prevbackend = -1;
 $headerprinted = false;
 echo html_tag('p', '<a href="#AddAddress">' . _("Add address") . '</a>', 'center') . "\n";
 /* List addresses */
 if (count($alist) > 0) {
     echo addForm($form_url, 'post');
     while (list($undef, $row) = each($alist)) {
         /* New table header for each backend */
         if ($prevbackend != $row['backend']) {
             if ($prevbackend < 0) {
                 echo html_tag('table', html_tag('tr', html_tag('td', addSubmit(_("Edit selected"), 'editaddr') . addSubmit(_("Delete selected"), 'deladdr'), 'center', '', 'colspan="5"')) . html_tag('tr', html_tag('td', '&nbsp;<br />', 'center', '', 'colspan="5"')), 'center');
                 echo "\n<!-- start of address book table -->\n" . html_tag('table', '', 'center', '', 'border="0" cellpadding="1" cellspacing="0" width="90%"') . html_tag('tr', "\n" . html_tag('th', '&nbsp;', 'left', '', 'width="1%"') . "\n" . html_tag('th', _("Nickname") . show_abook_sort_button($abook_sort_order, _("sort by nickname"), 0, 1), 'left', '', 'width="1%"') . "\n" . html_tag('th', _("Name") . show_abook_sort_button($abook_sort_order, _("sort by name"), 2, 3), 'left', '', 'width="1%"') . "\n" . html_tag('th', _("E-mail") . show_abook_sort_button($abook_sort_order, _("sort by email"), 4, 5), 'left', '', 'width="1%"') . "\n" . html_tag('th', _("Info") . show_abook_sort_button($abook_sort_order, _("sort by info"), 6, 7), 'left', '', 'width="1%"') . "\n", '', $color[9]) . "\n";
             }
             // Separate different backends with <hr />
             if ($prevbackend > 0) {
                 echo html_tag('tr', html_tag('td', "<hr />", 'center', '', 'colspan="5"'));
             }
             // Print backend name
             echo html_tag('tr', html_tag('td', "\n" . '<strong>' . $row['source'] . '</strong>' . "\n", 'center', $color[0], 'colspan="5"'));
             $line = 0;
             $headerprinted = true;
         }
         /* End of header */
         $prevbackend = $row['backend'];
         /* Check if this user is selected */
         $selected = in_array($row['backend'] . ':' . $row['nickname'], $defselected);
         /* Print one row, with alternating color */