original_string: public static function get_available_completion_tabs($courseorid) {
          $tabs = [];
  
          $courseid = is_object($courseorid) ? $courseorid->id : $courseorid;
          $coursecontext = context_course::instance($courseid);
  
          if (has_capability('moodle/course:update', $coursecontext)) {
              $tabs[] = new tabobject(
                  'completion',
                  new moodle_url('/course/completion.php', ['id' => $courseid]),
                  new lang_string('coursecompletion', 'completion')
              );
          }
  
          if (has_capability('moodle/course:manageactivities', $coursecontext)) {
              $tabs[] = new tabobject(
                  'defaultcompletion',
                  new moodle_url('/course/defaultcompletion.php', ['id' => $courseid]),
                  new lang_string('defaultcompletion', 'completion')
              );
          }
  
          if (self::can_edit_bulk_completion($courseorid)) {
              $tabs[] = new tabobject(
                  'bulkcompletion',
                  new moodle_url('/course/bulkcompletion.php', ['id' => $courseid]),
                  new lang_string('bulkactivitycompletion', 'completion')
              );
          }
  
          return $tabs;
      }
code: public static function get_available_completion_tabs($courseorid) {
          $tabs = [];
  
          $courseid = is_object($courseorid) ? $courseorid->id : $courseorid;
          $coursecontext = context_course::instance($courseid);
  
          if (has_capability('moodle/course:update', $coursecontext)) {
              $tabs[] = new tabobject(
                  'completion',
                  new moodle_url('/course/completion.php', ['id' => $courseid]),
                  new lang_string('coursecompletion', 'completion')
              );
          }
  
          if (has_capability('moodle/course:manageactivities', $coursecontext)) {
              $tabs[] = new tabobject(
                  'defaultcompletion',
                  new moodle_url('/course/defaultcompletion.php', ['id' => $courseid]),
                  new lang_string('defaultcompletion', 'completion')
              );
          }
  
          if (self::can_edit_bulk_completion($courseorid)) {
              $tabs[] = new tabobject(
                  'bulkcompletion',
                  new moodle_url('/course/bulkcompletion.php', ['id' => $courseid]),
                  new lang_string('bulkactivitycompletion', 'completion')
              );
          }
  
          return $tabs;
      }
code_tokens: public static function get_available_completion_tabs ( $ courseorid ) { $ tabs = [ ] ; $ courseid = is_object ( $ courseorid ) ? $ courseorid -> id : $ courseorid ; $ coursecontext = context_course :: instance ( $ courseid ) ; if ( has_capability ( 'moodle/course:update' , $ coursecontext ) ) { $ tabs [ ] = new tabobject ( 'completion' , new moodle_url ( '/course/completion.php' , [ 'id' => $ courseid ] ) , new lang_string ( 'coursecompletion' , 'completion' ) ) ; } if ( has_capability ( 'moodle/course:manageactivities' , $ coursecontext ) ) { $ tabs [ ] = new tabobject ( 'defaultcompletion' , new moodle_url ( '/course/defaultcompletion.php' , [ 'id' => $ courseid ] ) , new lang_string ( 'defaultcompletion' , 'completion' ) ) ; } if ( self :: can_edit_bulk_completion ( $ courseorid ) ) { $ tabs [ ] = new tabobject ( 'bulkcompletion' , new moodle_url ( '/course/bulkcompletion.php' , [ 'id' => $ courseid ] ) , new lang_string ( 'bulkactivitycompletion' , 'completion' ) ) ; } return $ tabs ; }
docstring: Gets the available completion tabs for the current course and user.
  
  @param stdClass|int $courseorid the course object or id.
  @return tabobject[]
docstring_tokens: Gets the available completion tabs for the current course and user .