public static function get_prediction($predictionid, $requirelogin = false) {
        global $DB;

        if (!$predictionobj = $DB->get_record('analytics_predictions', array('id' => $predictionid))) {
            throw new \moodle_exception('errorpredictionnotfound', 'analytics');
        }

        $context = \context::instance_by_id($predictionobj->contextid, IGNORE_MISSING);
        if (!$context) {
            throw new \moodle_exception('errorpredictioncontextnotavailable', 'analytics');
        }

        if ($requirelogin) {
            list($context, $course, $cm) = get_context_info_array($predictionobj->contextid);
            require_login($course, false, $cm);
        }

        self::check_can_list_insights($context);

        $model = new \core_analytics\model($predictionobj->modelid);
        $sampledata = $model->prediction_sample_data($predictionobj);
        $prediction = new \core_analytics\prediction($predictionobj, $sampledata);

        return array($model, $prediction, $context);
    }
public static function get_prediction($predictionid, $requirelogin = false) {
        global $DB;

        if (!$predictionobj = $DB->get_record('analytics_predictions', array('id' => $predictionid))) {
            throw new \moodle_exception('errorpredictionnotfound', 'analytics');
        }

        $context = \context::instance_by_id($predictionobj->contextid, IGNORE_MISSING);
        if (!$context) {
            throw new \moodle_exception('errorpredictioncontextnotavailable', 'analytics');
        }

        if ($requirelogin) {
            list($context, $course, $cm) = get_context_info_array($predictionobj->contextid);
            require_login($course, false, $cm);
        }

        self::check_can_list_insights($context);

        $model = new \core_analytics\model($predictionobj->modelid);
        $sampledata = $model->prediction_sample_data($predictionobj);
        $prediction = new \core_analytics\prediction($predictionobj, $sampledata);

        return array($model, $prediction, $context);
    }
public static function get_prediction ( $ predictionid , $ requirelogin = false ) { global $ DB ; if ( ! $ predictionobj = $ DB -> get_record ( 'analytics_predictions' , array ( 'id' => $ predictionid ) ) ) { throw new \ moodle_exception ( 'errorpredictionnotfound' , 'analytics' ) ; } $ context = \ context :: instance_by_id ( $ predictionobj -> contextid , IGNORE_MISSING ) ; if ( ! $ context ) { throw new \ moodle_exception ( 'errorpredictioncontextnotavailable' , 'analytics' ) ; } if ( $ requirelogin ) { list ( $ context , $ course , $ cm ) = get_context_info_array ( $ predictionobj -> contextid ) ; require_login ( $ course , false , $ cm ) ; } self :: check_can_list_insights ( $ context ) ; $ model = new \ core_analytics \ model ( $ predictionobj -> modelid ) ; $ sampledata = $ model -> prediction_sample_data ( $ predictionobj ) ; $ prediction = new \ core_analytics \ prediction ( $ predictionobj , $ sampledata ) ; return array ( $ model , $ prediction , $ context ) ; }
Returns a prediction

@param int $predictionid
@param bool $requirelogin
@return array array($model, $prediction, $context)
Returns a prediction