public static function template_viewed($templateorid) {
        static::require_enabled();
        $template = $templateorid;
        if (!is_object($template)) {
            $template = new template($template);
        }

        // First we do a permissions check.
        if (!$template->can_read()) {
            throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview',
                'nopermissions', '');
        }

        // Trigger a template viewed event.
        \core\event\competency_template_viewed::create_from_template($template)->trigger();

        return true;
    }
public static function template_viewed($templateorid) {
        static::require_enabled();
        $template = $templateorid;
        if (!is_object($template)) {
            $template = new template($template);
        }

        // First we do a permissions check.
        if (!$template->can_read()) {
            throw new required_capability_exception($template->get_context(), 'moodle/competency:templateview',
                'nopermissions', '');
        }

        // Trigger a template viewed event.
        \core\event\competency_template_viewed::create_from_template($template)->trigger();

        return true;
    }
public static function template_viewed ( $ templateorid ) { static :: require_enabled ( ) ; $ template = $ templateorid ; if ( ! is_object ( $ template ) ) { $ template = new template ( $ template ) ; } // First we do a permissions check. if ( ! $ template -> can_read ( ) ) { throw new required_capability_exception ( $ template -> get_context ( ) , 'moodle/competency:templateview' , 'nopermissions' , '' ) ; } // Trigger a template viewed event. \ core \ event \ competency_template_viewed :: create_from_template ( $ template ) -> trigger ( ) ; return true ; }
Template event viewed.

Requires moodle/competency:templateview capability at the system context.

@param mixed $templateorid The id or the template.
@return boolean
Template event viewed .