original_string: private function prepare_post($post, $fileoutputextras=null) {
          global $DB;
          static $users;
          if (empty($users)) {
              $users = array($this->user->id => $this->user);
          }
          if (!array_key_exists($post->userid, $users)) {
              $users[$post->userid] = $DB->get_record('user', array('id' => $post->userid));
          }
          // add the user object on to the post so we can pass it to the leap writer if necessary
          $post->author = $users[$post->userid];
          $viewfullnames = true;
          // format the post body
          $options = portfolio_format_text_options();
          $format = $this->get('exporter')->get('format');
          $formattedtext = format_text($post->message, $post->messageformat, $options, $this->get('course')->id);
          $formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->modcontext->id, 'mod_forum', 'post', $post->id, $format);
  
          $output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">';
  
          $output .= '<tr class="header"><td>';// can't print picture.
          $output .= '</td>';
  
          if ($post->parent) {
              $output .= '<td class="topic">';
          } else {
              $output .= '<td class="topic starter">';
          }
          $output .= '<div class="subject">'.format_string($post->subject).'</div>';
  
          $fullname = fullname($users[$post->userid], $viewfullnames);
          $by = new stdClass();
          $by->name = $fullname;
          $by->date = userdate($post->modified, '', core_date::get_user_timezone($this->user));
          $output .= '<div class="author">'.get_string('bynameondate', 'forum', $by).'</div>';
  
          $output .= '</td></tr>';
  
          $output .= '<tr><td class="left side" valign="top">';
  
          $output .= '</td><td class="content">';
  
          $output .= $formattedtext;
  
          if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id]) && count($this->keyedfiles[$post->id]) > 0) {
              $output .= '<div class="attachments">';
              $output .= '<br /><b>' .  get_string('attachments', 'forum') . '</b>:<br /><br />';
              foreach ($this->keyedfiles[$post->id] as $file) {
                  $output .= $format->file_output($file)  . '<br/ >';
              }
              $output .= "</div>";
          }
  
          $output .= '</td></tr></table>'."\n\n";
  
          return $output;
      }
code: private function prepare_post($post, $fileoutputextras=null) {
          global $DB;
          static $users;
          if (empty($users)) {
              $users = array($this->user->id => $this->user);
          }
          if (!array_key_exists($post->userid, $users)) {
              $users[$post->userid] = $DB->get_record('user', array('id' => $post->userid));
          }
          // add the user object on to the post so we can pass it to the leap writer if necessary
          $post->author = $users[$post->userid];
          $viewfullnames = true;
          // format the post body
          $options = portfolio_format_text_options();
          $format = $this->get('exporter')->get('format');
          $formattedtext = format_text($post->message, $post->messageformat, $options, $this->get('course')->id);
          $formattedtext = portfolio_rewrite_pluginfile_urls($formattedtext, $this->modcontext->id, 'mod_forum', 'post', $post->id, $format);
  
          $output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">';
  
          $output .= '<tr class="header"><td>';// can't print picture.
          $output .= '</td>';
  
          if ($post->parent) {
              $output .= '<td class="topic">';
          } else {
              $output .= '<td class="topic starter">';
          }
          $output .= '<div class="subject">'.format_string($post->subject).'</div>';
  
          $fullname = fullname($users[$post->userid], $viewfullnames);
          $by = new stdClass();
          $by->name = $fullname;
          $by->date = userdate($post->modified, '', core_date::get_user_timezone($this->user));
          $output .= '<div class="author">'.get_string('bynameondate', 'forum', $by).'</div>';
  
          $output .= '</td></tr>';
  
          $output .= '<tr><td class="left side" valign="top">';
  
          $output .= '</td><td class="content">';
  
          $output .= $formattedtext;
  
          if (is_array($this->keyedfiles) && array_key_exists($post->id, $this->keyedfiles) && is_array($this->keyedfiles[$post->id]) && count($this->keyedfiles[$post->id]) > 0) {
              $output .= '<div class="attachments">';
              $output .= '<br /><b>' .  get_string('attachments', 'forum') . '</b>:<br /><br />';
              foreach ($this->keyedfiles[$post->id] as $file) {
                  $output .= $format->file_output($file)  . '<br/ >';
              }
              $output .= "</div>";
          }
  
          $output .= '</td></tr></table>'."\n\n";
  
          return $output;
      }
code_tokens: private function prepare_post ( $ post , $ fileoutputextras = null ) { global $ DB ; static $ users ; if ( empty ( $ users ) ) { $ users = array ( $ this -> user -> id => $ this -> user ) ; } if ( ! array_key_exists ( $ post -> userid , $ users ) ) { $ users [ $ post -> userid ] = $ DB -> get_record ( 'user' , array ( 'id' => $ post -> userid ) ) ; } // add the user object on to the post so we can pass it to the leap writer if necessary $ post -> author = $ users [ $ post -> userid ] ; $ viewfullnames = true ; // format the post body $ options = portfolio_format_text_options ( ) ; $ format = $ this -> get ( 'exporter' ) -> get ( 'format' ) ; $ formattedtext = format_text ( $ post -> message , $ post -> messageformat , $ options , $ this -> get ( 'course' ) -> id ) ; $ formattedtext = portfolio_rewrite_pluginfile_urls ( $ formattedtext , $ this -> modcontext -> id , 'mod_forum' , 'post' , $ post -> id , $ format ) ; $ output = '<table border="0" cellpadding="3" cellspacing="0" class="forumpost">' ; $ output .= '<tr class="header"><td>' ; // can't print picture. $ output .= '</td>' ; if ( $ post -> parent ) { $ output .= '<td class="topic">' ; } else { $ output .= '<td class="topic starter">' ; } $ output .= '<div class="subject">' . format_string ( $ post -> subject ) . '</div>' ; $ fullname = fullname ( $ users [ $ post -> userid ] , $ viewfullnames ) ; $ by = new stdClass ( ) ; $ by -> name = $ fullname ; $ by -> date = userdate ( $ post -> modified , '' , core_date :: get_user_timezone ( $ this -> user ) ) ; $ output .= '<div class="author">' . get_string ( 'bynameondate' , 'forum' , $ by ) . '</div>' ; $ output .= '</td></tr>' ; $ output .= '<tr><td class="left side" valign="top">' ; $ output .= '</td><td class="content">' ; $ output .= $ formattedtext ; if ( is_array ( $ this -> keyedfiles ) && array_key_exists ( $ post -> id , $ this -> keyedfiles ) && is_array ( $ this -> keyedfiles [ $ post -> id ] ) && count ( $ this -> keyedfiles [ $ post -> id ] ) > 0 ) { $ output .= '<div class="attachments">' ; $ output .= '<br /><b>' . get_string ( 'attachments' , 'forum' ) . '</b>:<br /><br />' ; foreach ( $ this -> keyedfiles [ $ post -> id ] as $ file ) { $ output .= $ format -> file_output ( $ file ) . '<br/ >' ; } $ output .= "</div>" ; } $ output .= '</td></tr></table>' . "\n\n" ; return $ output ; }
docstring: this is a very cut down version of what is in forum_make_mail_post
  
  @global object
  @param int $post
  @return string
docstring_tokens: this is a very cut down version of what is in forum_make_mail_post