public function get_predictions_contexts($skiphidden = true) {
        global $DB, $USER;

        $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                  JOIN {context} ctx ON ctx.id = ap.contextid
                 WHERE ap.modelid = :modelid";
        $params = array('modelid' => $this->model->id);

        if ($skiphidden) {
            $sql .= " AND NOT EXISTS (
              SELECT 1
                FROM {analytics_prediction_actions} apa
               WHERE apa.predictionid = ap.id AND apa.userid = :userid AND (apa.actionname = :fixed OR apa.actionname = :notuseful)
            )";
            $params['userid'] = $USER->id;
            $params['fixed'] = \core_analytics\prediction::ACTION_FIXED;
            $params['notuseful'] = \core_analytics\prediction::ACTION_NOT_USEFUL;
        }

        return $DB->get_records_sql($sql, $params);
    }
public function get_predictions_contexts($skiphidden = true) {
        global $DB, $USER;

        $sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                  JOIN {context} ctx ON ctx.id = ap.contextid
                 WHERE ap.modelid = :modelid";
        $params = array('modelid' => $this->model->id);

        if ($skiphidden) {
            $sql .= " AND NOT EXISTS (
              SELECT 1
                FROM {analytics_prediction_actions} apa
               WHERE apa.predictionid = ap.id AND apa.userid = :userid AND (apa.actionname = :fixed OR apa.actionname = :notuseful)
            )";
            $params['userid'] = $USER->id;
            $params['fixed'] = \core_analytics\prediction::ACTION_FIXED;
            $params['notuseful'] = \core_analytics\prediction::ACTION_NOT_USEFUL;
        }

        return $DB->get_records_sql($sql, $params);
    }
public function get_predictions_contexts ( $ skiphidden = true ) { global $ DB , $ USER ; $ sql = "SELECT DISTINCT ap.contextid FROM {analytics_predictions} ap
                  JOIN {context} ctx ON ctx.id = ap.contextid
                 WHERE ap.modelid = :modelid" ; $ params = array ( 'modelid' => $ this -> model -> id ) ; if ( $ skiphidden ) { $ sql .= " AND NOT EXISTS (
              SELECT 1
                FROM {analytics_prediction_actions} apa
               WHERE apa.predictionid = ap.id AND apa.userid = :userid AND (apa.actionname = :fixed OR apa.actionname = :notuseful)
            )" ; $ params [ 'userid' ] = $ USER -> id ; $ params [ 'fixed' ] = \ core_analytics \ prediction :: ACTION_FIXED ; $ params [ 'notuseful' ] = \ core_analytics \ prediction :: ACTION_NOT_USEFUL ; } return $ DB -> get_records_sql ( $ sql , $ params ) ; }
Get the contexts with predictions.

@param bool $skiphidden Skip hidden predictions
@return \stdClass[]
Get the contexts with predictions .