/**
 * Prints the table header for the messages list view
 *
 * @param array $aMailbox
 */
function printHeader($aMailbox)
{
    global $index_order, $internal_date_sort, $color;
    if ($aMailbox['SORT_METHOD'] != 'THREAD') {
        $showsort = true;
    } else {
        $showsort = false;
    }
    echo html_tag('tr', '', 'center', $color[5]);
    /* calculate the width of the subject column based on the
     * widths of the other columns */
    $widths = array(1 => 1, 2 => 25, 3 => 5, 4 => 0, 5 => 1, 6 => 5);
    $subjectwidth = 100;
    foreach ($index_order as $item) {
        $subjectwidth -= $widths[$item];
    }
    foreach ($index_order as $item) {
        switch ($item) {
            case 1:
                /* checkbox */
                echo html_tag('td', get_selectall_link($aMailbox), '', '', 'width="1%"');
                break;
            case 5:
                /* flags */
                echo html_tag('td', '', '', '', 'width="1%"');
                break;
            case 2:
                /* from */
                if (handleAsSent($aMailbox['NAME'])) {
                    echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("To") . '</b>';
                    if ($showsort) {
                        ShowSortButton($aMailbox, SQSORT_TO_ASC, SQSORT_TO_DEC);
                    }
                } else {
                    echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("From") . '</b>';
                    if ($showsort) {
                        ShowSortButton($aMailbox, SQSORT_FROM_ASC, SQSORT_FROM_DEC);
                    }
                }
                echo "</td>\n";
                break;
            case 3:
                /* date */
                echo html_tag('td', '', 'left', '', 'width="5%" nowrap') . '<b>' . _("Date") . '</b>';
                if ($showsort) {
                    if ($internal_date_sort) {
                        ShowSortButton($aMailbox, SQSORT_INT_DATE_ASC, SQSORT_INT_DATE_DEC);
                    } else {
                        ShowSortButton($aMailbox, SQSORT_DATE_ASC, SQSORT_DATE_DEC);
                    }
                }
                echo "</td>\n";
                break;
            case 4:
                /* subject */
                echo html_tag('td', '', 'left', '', 'width="' . $subjectwidth . '%"') . '<b>' . _("Subject") . '</b>';
                if ($showsort) {
                    ShowSortButton($aMailbox, SQSORT_SUBJ_ASC, SQSORT_SUBJ_DEC);
                }
                echo "</td>\n";
                break;
            case 6:
                /* size */
                echo html_tag('td', '', 'center', '', 'width="5%" nowrap') . '<b>' . _("Size") . '</b>';
                if ($showsort) {
                    ShowSortButton($aMailbox, SQSORT_SIZE_ASC, SQSORT_SIZE_DEC);
                }
                echo "</td>\n";
                break;
        }
    }
    echo "</tr>\n";
}
Пример #2
0
function printHeader($mailbox, $sort, $color, $showsort = true)
{
    global $index_order;
    echo html_tag('tr', '', 'center', $color[5]);
    /* calculate the width of the subject column based on the
     * widths of the other columns */
    $widths = array(1 => 1, 2 => 25, 3 => 5, 4 => 0, 5 => 1, 6 => 5);
    $subjectwidth = 100;
    foreach ($index_order as $item) {
        $subjectwidth -= $widths[$item];
    }
    foreach ($index_order as $item) {
        switch ($item) {
            case 1:
                /* checkbox */
            /* checkbox */
            case 5:
                /* flags */
                echo html_tag('td', '&nbsp;', '', '', 'width="1%"');
                break;
            case 2:
                /* from */
                if (handleAsSent($mailbox)) {
                    echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("To") . '</b>';
                } else {
                    echo html_tag('td', '', 'left', '', 'width="25%"') . '<b>' . _("From") . '</b>';
                }
                if ($showsort) {
                    ShowSortButton($sort, $mailbox, 2, 3);
                }
                echo "</td>\n";
                break;
            case 3:
                /* date */
                echo html_tag('td', '', 'left', '', 'width="5%" nowrap') . '<b>' . _("Date") . '</b>';
                if ($showsort) {
                    ShowSortButton($sort, $mailbox, 0, 1);
                }
                echo "</td>\n";
                break;
            case 4:
                /* subject */
                echo html_tag('td', '', 'left', '', 'width="' . $subjectwidth . '%"') . '<b>' . _("Subject") . '</b>';
                if ($showsort) {
                    ShowSortButton($sort, $mailbox, 4, 5);
                }
                echo "</td>\n";
                break;
            case 6:
                /* size */
                echo html_tag('td', '', 'left', '', 'width="5%" nowrap') . '<b>' . _("Size") . '</b>';
                if ($showsort) {
                    ShowSortButton($sort, $mailbox, 8, 9);
                }
                echo "</td>\n";
                break;
        }
    }
    echo "</tr>\n";
}