Beispiel #1
0
    /**
     * Returns the "Quick Links" navigation HTML for the top right corner of
     * the Activities page.
     *
     * @return string "Quick Links" HTML
     */
    public function getQuickLinks()
    {
        $today = array(
            'month' => date('n'),
            'day'   => date('j'),
            'year'  => date('Y')
        );

        $yesterdayTimeStamp = DateUtility::subtractDaysFromDate(time(), 1);
        $yesterday = array(
            'month' => date('n', $yesterdayTimeStamp),
            'day'   => date('j', $yesterdayTimeStamp),
            'year'  => date('Y', $yesterdayTimeStamp)
        );

        $baseURL = sprintf(
            '%s?m=activity&a=viewByDate&getback=getback',
            CATSUtility::getIndexName()
        );

        $quickLinks[0] = sprintf(
            '<a href="%s&amp;startMonth=%s&amp;startDay=%s&amp;startYear=%s&amp;endMonth=%s&amp;endDay=%s&amp;endYear=%s">Today</a>',
            $baseURL,
            $today['month'],
            $today['day'],
            $today['year'],
            $today['month'],
            $today['day'],
            $today['year']
        );

        $quickLinks[1] = sprintf(
            '<a href="%s&amp;startMonth=%s&amp;startDay=%s&amp;startYear=%s&amp;endMonth=%s&amp;endDay=%s&amp;endYear=%s">Yesterday</a>',
            $baseURL,
            $yesterday['month'],
            $yesterday['day'],
            $yesterday['year'],
            $yesterday['month'],
            $yesterday['day'],
            $yesterday['year']
        );

        $quickLinks[2] = sprintf(
            '<a href="%s&amp;period=lastweek">Last Week</a>',
            $baseURL
        );

        $quickLinks[3] = sprintf(
            '<a href="%s&amp;period=lastmonth">Last Month</a>',
            $baseURL
        );

        $quickLinks[4] = sprintf(
            '<a href="%s&amp;period=lastsixmonths">Last 6 Months</a>',
            $baseURL
        );

        $quickLinks[5] = sprintf(
            '<a href="%s&amp;period=all">All</a>',
            $baseURL
        );

        return implode(' | ', $quickLinks);
    }