public function prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false,
            $isinsightuser = false) {
        global $CFG, $USER;

        $parentactions = parent::prediction_actions($prediction, $includedetailsaction);

        if (!$isinsightuser && $USER->id != $prediction->get_prediction_data()->sampleid) {
            return $parentactions;
        }

        // We force a lookahead of 30 days so we are sure that the upcoming activities due are shown.
        $url = new \moodle_url('/calendar/view.php', ['view' => 'upcoming', 'lookahead' => '30']);
        $pix = new \pix_icon('i/calendar', get_string('upcomingevents', 'calendar'));
        $action = new \core_analytics\prediction_action('viewupcoming', $prediction,
            $url, $pix, get_string('upcomingevents', 'calendar'));

        return array_merge([$action], $parentactions);
    }
public function prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false,
            $isinsightuser = false) {
        global $CFG, $USER;

        $parentactions = parent::prediction_actions($prediction, $includedetailsaction);

        if (!$isinsightuser && $USER->id != $prediction->get_prediction_data()->sampleid) {
            return $parentactions;
        }

        // We force a lookahead of 30 days so we are sure that the upcoming activities due are shown.
        $url = new \moodle_url('/calendar/view.php', ['view' => 'upcoming', 'lookahead' => '30']);
        $pix = new \pix_icon('i/calendar', get_string('upcomingevents', 'calendar'));
        $action = new \core_analytics\prediction_action('viewupcoming', $prediction,
            $url, $pix, get_string('upcomingevents', 'calendar'));

        return array_merge([$action], $parentactions);
    }
public function prediction_actions ( \ core_analytics \ prediction $ prediction , $ includedetailsaction = false , $ isinsightuser = false ) { global $ CFG , $ USER ; $ parentactions = parent :: prediction_actions ( $ prediction , $ includedetailsaction ) ; if ( ! $ isinsightuser && $ USER -> id != $ prediction -> get_prediction_data ( ) -> sampleid ) { return $ parentactions ; } // We force a lookahead of 30 days so we are sure that the upcoming activities due are shown. $ url = new \ moodle_url ( '/calendar/view.php' , [ 'view' => 'upcoming' , 'lookahead' => '30' ] ) ; $ pix = new \ pix_icon ( 'i/calendar' , get_string ( 'upcomingevents' , 'calendar' ) ) ; $ action = new \ core_analytics \ prediction_action ( 'viewupcoming' , $ prediction , $ url , $ pix , get_string ( 'upcomingevents' , 'calendar' ) ) ; return array_merge ( [ $ action ] , $ parentactions ) ; }
Adds a view upcoming events action.

@param \core_analytics\prediction $prediction
@param mixed $includedetailsaction
@param bool $isinsightuser
@return \core_analytics\prediction_action[]
Adds a view upcoming events action .