original_string: public function get_activities_list() {
          $activities = array();
  
          // For site just return site errors option.
          $sitecontext = context_system::instance();
          if ($this->course->id == SITEID && has_capability('report/log:view', $sitecontext)) {
              $activities["site_errors"] = get_string("siteerrors");
              return $activities;
          }
  
          $modinfo = get_fast_modinfo($this->course);
          if (!empty($modinfo->cms)) {
              $section = 0;
              $thissection = array();
              foreach ($modinfo->cms as $cm) {
                  if (!$cm->uservisible || !$cm->has_view()) {
                      continue;
                  }
                  if ($cm->sectionnum > 0 and $section <> $cm->sectionnum) {
                      $activities[] = $thissection;
                      $thissection = array();
                  }
                  $section = $cm->sectionnum;
                  $modname = strip_tags($cm->get_formatted_name());
                  if (core_text::strlen($modname) > 55) {
                      $modname = core_text::substr($modname, 0, 50)."...";
                  }
                  if (!$cm->visible) {
                      $modname = "(".$modname.")";
                  }
                  $key = get_section_name($this->course, $cm->sectionnum);
                  if (!isset($thissection[$key])) {
                      $thissection[$key] = array();
                  }
                  $thissection[$key][$cm->id] = $modname;
              }
              if (!empty($thissection)) {
                  $activities[] = $thissection;
              }
          }
          return $activities;
      }
code: public function get_activities_list() {
          $activities = array();
  
          // For site just return site errors option.
          $sitecontext = context_system::instance();
          if ($this->course->id == SITEID && has_capability('report/log:view', $sitecontext)) {
              $activities["site_errors"] = get_string("siteerrors");
              return $activities;
          }
  
          $modinfo = get_fast_modinfo($this->course);
          if (!empty($modinfo->cms)) {
              $section = 0;
              $thissection = array();
              foreach ($modinfo->cms as $cm) {
                  if (!$cm->uservisible || !$cm->has_view()) {
                      continue;
                  }
                  if ($cm->sectionnum > 0 and $section <> $cm->sectionnum) {
                      $activities[] = $thissection;
                      $thissection = array();
                  }
                  $section = $cm->sectionnum;
                  $modname = strip_tags($cm->get_formatted_name());
                  if (core_text::strlen($modname) > 55) {
                      $modname = core_text::substr($modname, 0, 50)."...";
                  }
                  if (!$cm->visible) {
                      $modname = "(".$modname.")";
                  }
                  $key = get_section_name($this->course, $cm->sectionnum);
                  if (!isset($thissection[$key])) {
                      $thissection[$key] = array();
                  }
                  $thissection[$key][$cm->id] = $modname;
              }
              if (!empty($thissection)) {
                  $activities[] = $thissection;
              }
          }
          return $activities;
      }
code_tokens: public function get_activities_list ( ) { $ activities = array ( ) ; // For site just return site errors option. $ sitecontext = context_system :: instance ( ) ; if ( $ this -> course -> id == SITEID && has_capability ( 'report/log:view' , $ sitecontext ) ) { $ activities [ "site_errors" ] = get_string ( "siteerrors" ) ; return $ activities ; } $ modinfo = get_fast_modinfo ( $ this -> course ) ; if ( ! empty ( $ modinfo -> cms ) ) { $ section = 0 ; $ thissection = array ( ) ; foreach ( $ modinfo -> cms as $ cm ) { if ( ! $ cm -> uservisible || ! $ cm -> has_view ( ) ) { continue ; } if ( $ cm -> sectionnum > 0 and $ section <> $ cm -> sectionnum ) { $ activities [ ] = $ thissection ; $ thissection = array ( ) ; } $ section = $ cm -> sectionnum ; $ modname = strip_tags ( $ cm -> get_formatted_name ( ) ) ; if ( core_text :: strlen ( $ modname ) > 55 ) { $ modname = core_text :: substr ( $ modname , 0 , 50 ) . "..." ; } if ( ! $ cm -> visible ) { $ modname = "(" . $ modname . ")" ; } $ key = get_section_name ( $ this -> course , $ cm -> sectionnum ) ; if ( ! isset ( $ thissection [ $ key ] ) ) { $ thissection [ $ key ] = array ( ) ; } $ thissection [ $ key ] [ $ cm -> id ] = $ modname ; } if ( ! empty ( $ thissection ) ) { $ activities [ ] = $ thissection ; } } return $ activities ; }
docstring: Helper function to return list of activities to show in selection filter.
  
  @return array list of activities.
docstring_tokens: Helper function to return list of activities to show in selection filter .