Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 67... Línea 67...
67
     * @param int|null $ordering optional ordering integer used for sorting the favourites in an area.
67
     * @param int|null $ordering optional ordering integer used for sorting the favourites in an area.
68
     * @return favourite the favourite, once created.
68
     * @return favourite the favourite, once created.
69
     * @throws \moodle_exception if the component name is invalid, or if the repository encounters any errors.
69
     * @throws \moodle_exception if the component name is invalid, or if the repository encounters any errors.
70
     */
70
     */
71
    public function create_favourite(string $component, string $itemtype, int $itemid, \context $context,
71
    public function create_favourite(string $component, string $itemtype, int $itemid, \context $context,
72
            int $ordering = null): favourite {
72
            ?int $ordering = null): favourite {
73
        // Access: Any component can ask to favourite something, we can't verify access to that 'something' here though.
73
        // Access: Any component can ask to favourite something, we can't verify access to that 'something' here though.
Línea 74... Línea 74...
74
 
74
 
75
        // Validate the component name.
75
        // Validate the component name.
76
        if (!in_array($component, \core_component::get_component_names())) {
76
        if (!in_array($component, \core_component::get_component_names())) {
Línea 263... Línea 263...
263
     * @param string $component the frankenstyle component name.
263
     * @param string $component the frankenstyle component name.
264
     * @param string $itemtype the type of the favourited item.
264
     * @param string $itemtype the type of the favourited item.
265
     * @param \context|null $context the context of the item which was favourited.
265
     * @param \context|null $context the context of the item which was favourited.
266
     * @return int
266
     * @return int
267
     */
267
     */
268
    public function count_favourites_by_type(string $component, string $itemtype, \context $context = null) {
268
    public function count_favourites_by_type(string $component, string $itemtype, ?\context $context = null) {
269
        $criteria = [
269
        $criteria = [
270
            'userid' => $this->userid,
270
            'userid' => $this->userid,
271
            'component' => $component,
271
            'component' => $component,
272
            'itemtype' => $itemtype
272
            'itemtype' => $itemtype
273
        ];
273
        ];