original_string: public static function plan_viewed($planorid) {
          static::require_enabled();
          $plan = $planorid;
          if (!is_object($plan)) {
              $plan = new plan($plan);
          }
  
          // First we do a permissions check.
          if (!$plan->can_read()) {
              $context = context_user::instance($plan->get('userid'));
              throw new required_capability_exception($context, 'moodle/competency:planview', 'nopermissions', '');
          }
  
          // Trigger a template viewed event.
          \core\event\competency_plan_viewed::create_from_plan($plan)->trigger();
  
          return true;
      }
code: public static function plan_viewed($planorid) {
          static::require_enabled();
          $plan = $planorid;
          if (!is_object($plan)) {
              $plan = new plan($plan);
          }
  
          // First we do a permissions check.
          if (!$plan->can_read()) {
              $context = context_user::instance($plan->get('userid'));
              throw new required_capability_exception($context, 'moodle/competency:planview', 'nopermissions', '');
          }
  
          // Trigger a template viewed event.
          \core\event\competency_plan_viewed::create_from_plan($plan)->trigger();
  
          return true;
      }
code_tokens: public static function plan_viewed ( $ planorid ) { static :: require_enabled ( ) ; $ plan = $ planorid ; if ( ! is_object ( $ plan ) ) { $ plan = new plan ( $ plan ) ; } // First we do a permissions check. if ( ! $ plan -> can_read ( ) ) { $ context = context_user :: instance ( $ plan -> get ( 'userid' ) ) ; throw new required_capability_exception ( $ context , 'moodle/competency:planview' , 'nopermissions' , '' ) ; } // Trigger a template viewed event. \ core \ event \ competency_plan_viewed :: create_from_plan ( $ plan ) -> trigger ( ) ; return true ; }
docstring: Plan event viewed.
  
  @param mixed $planorid The id or the plan.
  @return boolean
docstring_tokens: Plan event viewed .