public static function getDateRangeAndLastN($period, $endDate, $defaultLastN = null)
    {
        if ($defaultLastN === null) {
            $defaultLastN = self::getDefaultLastN($period);
        }

        $lastNParamName = self::getLastNParamName($period);
        $lastN = Common::getRequestVar($lastNParamName, $defaultLastN, 'int');

        $site = new Site(Common::getRequestVar('idSite'));

        $dateRange = Range::getRelativeToEndDate($period, 'last' . $lastN, $endDate, $site);

        return array($dateRange, $lastN);
    }
public static function getDateRangeAndLastN($period, $endDate, $defaultLastN = null)
    {
        if ($defaultLastN === null) {
            $defaultLastN = self::getDefaultLastN($period);
        }

        $lastNParamName = self::getLastNParamName($period);
        $lastN = Common::getRequestVar($lastNParamName, $defaultLastN, 'int');

        $site = new Site(Common::getRequestVar('idSite'));

        $dateRange = Range::getRelativeToEndDate($period, 'last' . $lastN, $endDate, $site);

        return array($dateRange, $lastN);
    }
public static function getDateRangeAndLastN ( $ period , $ endDate , $ defaultLastN = null ) { if ( $ defaultLastN === null ) { $ defaultLastN = self :: getDefaultLastN ( $ period ) ; } $ lastNParamName = self :: getLastNParamName ( $ period ) ; $ lastN = Common :: getRequestVar ( $ lastNParamName , $ defaultLastN , 'int' ) ; $ site = new Site ( Common :: getRequestVar ( 'idSite' ) ) ; $ dateRange = Range :: getRelativeToEndDate ( $ period , 'last' . $ lastN , $ endDate , $ site ) ; return array ( $ dateRange , $ lastN ) ; }
Returns the entire date range and lastN value for the current request, based on
a period type and end date.

@param string $period The period type, 'day', 'week', 'month' or 'year'
@param string $endDate The end date.
@param int|null $defaultLastN The default lastN to use. If null, the result of
getDefaultLastN is used.
@return array An array w/ two elements. The first is a whole date range and the second
is the lastN number used, ie, array('2010-01-01,2012-01-02', 2).
Returns the entire date range and lastN value for the current request based on a period type and end date .