public function getAnnotationManager($fetch = false, $date = false, $period = false, $lastN = false)
    {
        $this->checkSitePermission();

        if ($date === false) {
            $date = Common::getRequestVar('date', false);
        }

        if ($period === false) {
            $period = Common::getRequestVar('period', 'day');
        }

        if ($lastN === false) {
            $lastN = Common::getRequestVar('lastN', false);
        }

        // create & render the view
        $view = new View('@Annotations/getAnnotationManager');

        $allAnnotations = Request::processRequest(
            'Annotations.getAll', array('date' => $date, 'period' => $period, 'lastN' => $lastN));
        $view->annotations = empty($allAnnotations[$this->idSite]) ? array() : $allAnnotations[$this->idSite];

        $view->period = $period;
        $view->lastN = $lastN;

        list($startDate, $endDate) = API::getDateRangeForPeriod($date, $period, $lastN);
        $view->startDate = $startDate->toString();
        $view->endDate = $endDate->toString();

        if ($startDate->toString() !== $endDate->toString()) {
            $view->selectedDate = Date::today()->toString();
        } else {
            $view->selectedDate = $endDate->toString();
        }

        $dateFormat = Date::DATE_FORMAT_SHORT;
        $view->startDatePretty = $startDate->getLocalized($dateFormat);
        $view->endDatePretty = $endDate->getLocalized($dateFormat);

        $view->canUserAddNotes = AnnotationList::canUserAddNotesFor($this->idSite);

        return $view->render();
    }
public function getAnnotationManager($fetch = false, $date = false, $period = false, $lastN = false)
    {
        $this->checkSitePermission();

        if ($date === false) {
            $date = Common::getRequestVar('date', false);
        }

        if ($period === false) {
            $period = Common::getRequestVar('period', 'day');
        }

        if ($lastN === false) {
            $lastN = Common::getRequestVar('lastN', false);
        }

        // create & render the view
        $view = new View('@Annotations/getAnnotationManager');

        $allAnnotations = Request::processRequest(
            'Annotations.getAll', array('date' => $date, 'period' => $period, 'lastN' => $lastN));
        $view->annotations = empty($allAnnotations[$this->idSite]) ? array() : $allAnnotations[$this->idSite];

        $view->period = $period;
        $view->lastN = $lastN;

        list($startDate, $endDate) = API::getDateRangeForPeriod($date, $period, $lastN);
        $view->startDate = $startDate->toString();
        $view->endDate = $endDate->toString();

        if ($startDate->toString() !== $endDate->toString()) {
            $view->selectedDate = Date::today()->toString();
        } else {
            $view->selectedDate = $endDate->toString();
        }

        $dateFormat = Date::DATE_FORMAT_SHORT;
        $view->startDatePretty = $startDate->getLocalized($dateFormat);
        $view->endDatePretty = $endDate->getLocalized($dateFormat);

        $view->canUserAddNotes = AnnotationList::canUserAddNotesFor($this->idSite);

        return $view->render();
    }
public function getAnnotationManager ( $ fetch = false , $ date = false , $ period = false , $ lastN = false ) { $ this -> checkSitePermission ( ) ; if ( $ date === false ) { $ date = Common :: getRequestVar ( 'date' , false ) ; } if ( $ period === false ) { $ period = Common :: getRequestVar ( 'period' , 'day' ) ; } if ( $ lastN === false ) { $ lastN = Common :: getRequestVar ( 'lastN' , false ) ; } // create & render the view $ view = new View ( '@Annotations/getAnnotationManager' ) ; $ allAnnotations = Request :: processRequest ( 'Annotations.getAll' , array ( 'date' => $ date , 'period' => $ period , 'lastN' => $ lastN ) ) ; $ view -> annotations = empty ( $ allAnnotations [ $ this -> idSite ] ) ? array ( ) : $ allAnnotations [ $ this -> idSite ] ; $ view -> period = $ period ; $ view -> lastN = $ lastN ; list ( $ startDate , $ endDate ) = API :: getDateRangeForPeriod ( $ date , $ period , $ lastN ) ; $ view -> startDate = $ startDate -> toString ( ) ; $ view -> endDate = $ endDate -> toString ( ) ; if ( $ startDate -> toString ( ) !== $ endDate -> toString ( ) ) { $ view -> selectedDate = Date :: today ( ) -> toString ( ) ; } else { $ view -> selectedDate = $ endDate -> toString ( ) ; } $ dateFormat = Date :: DATE_FORMAT_SHORT ; $ view -> startDatePretty = $ startDate -> getLocalized ( $ dateFormat ) ; $ view -> endDatePretty = $ endDate -> getLocalized ( $ dateFormat ) ; $ view -> canUserAddNotes = AnnotationList :: canUserAddNotesFor ( $ this -> idSite ) ; return $ view -> render ( ) ; }
Controller action that returns HTML displaying annotations for a site and
specific date range.

Query Param Input:
- idSite: The ID of the site to get annotations for. Only one allowed.
- date: The date to get annotations for. If lastN is not supplied, this is the start date,
otherwise the start date in the last period.
- period: The period type.
- lastN: If supplied, the last N # of periods will be included w/ the range specified
by date + period.

Output:
- HTML displaying annotations for a specific range.

@param bool $fetch True if the annotation manager should be returned as a string,
false if it should be echo-ed.
@param bool|string $date Override for 'date' query parameter.
@param bool|string $period Override for 'period' query parameter.
@param bool|string $lastN Override for 'lastN' query parameter.
@return string|void
Controller action that returns HTML displaying annotations for a site and specific date range .