original_string: public function render(stdClass $user, \cm_info $cm, ?int $groupid, ?int $sortorder, ?int $pageno, ?int $pagesize) : string {
          global $PAGE;
  
          $forum = $this->forum;
  
          $forumexporter = $this->exporterfactory->get_forum_exporter(
              $user,
              $this->forum,
              $groupid
          );
  
          $pagesize = $this->get_page_size($pagesize);
          $pageno = $this->get_page_number($pageno);
  
          // Count all forum discussion posts.
          $alldiscussionscount = get_count_all_discussions($forum, $user, $groupid);
  
          // Get all forum discussions posts.
          $discussions = get_discussions($forum, $user, $groupid, $sortorder, $pageno, $pagesize);
  
          $forumview = [
              'forum' => (array) $forumexporter->export($this->renderer),
              'newdiscussionhtml' => $this->get_discussion_form($user, $cm, $groupid),
              'groupchangemenu' => groups_print_activity_menu(
                  $cm,
                  $this->urlfactory->get_forum_view_url_from_forum($forum),
                  true
              ),
              'hasmore' => ($alldiscussionscount > $pagesize),
              'notifications' => $this->get_notifications($user, $groupid),
              'settings' => [
                  'excludetext' => true,
                  'togglemoreicon' => true
              ]
          ];
  
          if (!$discussions) {
              return $this->renderer->render_from_template($this->template, $forumview);
          }
  
          if ($this->postprocessfortemplate !== null) {
              // We've got some post processing to do!
              $exportedposts = ($this->postprocessfortemplate) ($discussions, $user, $forum);
          }
  
          $baseurl = new \moodle_url($PAGE->url, array('o' => $sortorder));
  
          $forumview = array_merge(
              $forumview,
              [
                  'pagination' => $this->renderer->render(new \paging_bar($alldiscussionscount, $pageno, $pagesize, $baseurl, 'p')),
              ],
              $exportedposts
          );
  
          return $this->renderer->render_from_template($this->template, $forumview);
      }
code: public function render(stdClass $user, \cm_info $cm, ?int $groupid, ?int $sortorder, ?int $pageno, ?int $pagesize) : string {
          global $PAGE;
  
          $forum = $this->forum;
  
          $forumexporter = $this->exporterfactory->get_forum_exporter(
              $user,
              $this->forum,
              $groupid
          );
  
          $pagesize = $this->get_page_size($pagesize);
          $pageno = $this->get_page_number($pageno);
  
          // Count all forum discussion posts.
          $alldiscussionscount = get_count_all_discussions($forum, $user, $groupid);
  
          // Get all forum discussions posts.
          $discussions = get_discussions($forum, $user, $groupid, $sortorder, $pageno, $pagesize);
  
          $forumview = [
              'forum' => (array) $forumexporter->export($this->renderer),
              'newdiscussionhtml' => $this->get_discussion_form($user, $cm, $groupid),
              'groupchangemenu' => groups_print_activity_menu(
                  $cm,
                  $this->urlfactory->get_forum_view_url_from_forum($forum),
                  true
              ),
              'hasmore' => ($alldiscussionscount > $pagesize),
              'notifications' => $this->get_notifications($user, $groupid),
              'settings' => [
                  'excludetext' => true,
                  'togglemoreicon' => true
              ]
          ];
  
          if (!$discussions) {
              return $this->renderer->render_from_template($this->template, $forumview);
          }
  
          if ($this->postprocessfortemplate !== null) {
              // We've got some post processing to do!
              $exportedposts = ($this->postprocessfortemplate) ($discussions, $user, $forum);
          }
  
          $baseurl = new \moodle_url($PAGE->url, array('o' => $sortorder));
  
          $forumview = array_merge(
              $forumview,
              [
                  'pagination' => $this->renderer->render(new \paging_bar($alldiscussionscount, $pageno, $pagesize, $baseurl, 'p')),
              ],
              $exportedposts
          );
  
          return $this->renderer->render_from_template($this->template, $forumview);
      }
code_tokens: public function render ( stdClass $ user , \ cm_info $ cm , ? int $ groupid , ? int $ sortorder , ? int $ pageno , ? int $ pagesize ) : string { global $ PAGE ; $ forum = $ this -> forum ; $ forumexporter = $ this -> exporterfactory -> get_forum_exporter ( $ user , $ this -> forum , $ groupid ) ; $ pagesize = $ this -> get_page_size ( $ pagesize ) ; $ pageno = $ this -> get_page_number ( $ pageno ) ; // Count all forum discussion posts. $ alldiscussionscount = get_count_all_discussions ( $ forum , $ user , $ groupid ) ; // Get all forum discussions posts. $ discussions = get_discussions ( $ forum , $ user , $ groupid , $ sortorder , $ pageno , $ pagesize ) ; $ forumview = [ 'forum' => ( array ) $ forumexporter -> export ( $ this -> renderer ) , 'newdiscussionhtml' => $ this -> get_discussion_form ( $ user , $ cm , $ groupid ) , 'groupchangemenu' => groups_print_activity_menu ( $ cm , $ this -> urlfactory -> get_forum_view_url_from_forum ( $ forum ) , true ) , 'hasmore' => ( $ alldiscussionscount > $ pagesize ) , 'notifications' => $ this -> get_notifications ( $ user , $ groupid ) , 'settings' => [ 'excludetext' => true , 'togglemoreicon' => true ] ] ; if ( ! $ discussions ) { return $ this -> renderer -> render_from_template ( $ this -> template , $ forumview ) ; } if ( $ this -> postprocessfortemplate !== null ) { // We've got some post processing to do! $ exportedposts = ( $ this -> postprocessfortemplate ) ( $ discussions , $ user , $ forum ) ; } $ baseurl = new \ moodle_url ( $ PAGE -> url , array ( 'o' => $ sortorder ) ) ; $ forumview = array_merge ( $ forumview , [ 'pagination' => $ this -> renderer -> render ( new \ paging_bar ( $ alldiscussionscount , $ pageno , $ pagesize , $ baseurl , 'p' ) ) , ] , $ exportedposts ) ; return $ this -> renderer -> render_from_template ( $ this -> template , $ forumview ) ; }
docstring: Render for the specified user.
  
  @param   stdClass    $user The user to render for
  @param   cm_info     $cm The course module info for this discussion list
  @param   int         $groupid The group to render
  @param   int         $sortorder The sort order to use when selecting the discussions in the list
  @param   int         $pageno The zero-indexed page number to use
  @param   int         $pagesize The number of discussions to show on the page
  @return  string      The rendered content for display
docstring_tokens: Render for the specified user .