public static function get_favourites_info_for_user(int $userid, \context $context,
                                                        string $component, string $itemtype, int $itemid) {
        global $DB;

        $params = [
            'userid' => $userid,
            'component' => $component,
            'itemtype' => $itemtype,
            'itemid' => $itemid,
            'contextid' => $context->id
        ];

        if (!$favourited = $DB->get_record('favourite', $params)) {
            return;
        }

        return [
            'starred' => transform::yesno(true),
            'ordering' => $favourited->ordering,
            'timecreated' => transform::datetime($favourited->timecreated),
            'timemodified' => transform::datetime($favourited->timemodified)
        ];
    }
public static function get_favourites_info_for_user(int $userid, \context $context,
                                                        string $component, string $itemtype, int $itemid) {
        global $DB;

        $params = [
            'userid' => $userid,
            'component' => $component,
            'itemtype' => $itemtype,
            'itemid' => $itemid,
            'contextid' => $context->id
        ];

        if (!$favourited = $DB->get_record('favourite', $params)) {
            return;
        }

        return [
            'starred' => transform::yesno(true),
            'ordering' => $favourited->ordering,
            'timecreated' => transform::datetime($favourited->timecreated),
            'timemodified' => transform::datetime($favourited->timemodified)
        ];
    }
public static function get_favourites_info_for_user ( int $ userid , \ context $ context , string $ component , string $ itemtype , int $ itemid ) { global $ DB ; $ params = [ 'userid' => $ userid , 'component' => $ component , 'itemtype' => $ itemtype , 'itemid' => $ itemid , 'contextid' => $ context -> id ] ; if ( ! $ favourited = $ DB -> get_record ( 'favourite' , $ params ) ) { return ; } return [ 'starred' => transform :: yesno ( true ) , 'ordering' => $ favourited -> ordering , 'timecreated' => transform :: datetime ( $ favourited -> timecreated ) , 'timemodified' => transform :: datetime ( $ favourited -> timemodified ) ] ; }
Get favourites data for the specified user in the specified component, item type and item ID.

@param int $userid The id of the user in scope.
@param \context $context The context to which data is scoped.
@param string $component The favourite's component name.
@param string $itemtype The favourite's item type.
@param int $itemid The favourite's item ID.
@return array|null
Get favourites data for the specified user in the specified component item type and item ID .