original_string: public function podiumReport($post = null)
      {
          try {
              if (empty($post)) {
                  throw new Exception('Reported post missing');
              }
              $logged = User::loggedId();
              $this->sender_id = $logged;
              $this->topic = Yii::t('podium/view', 'Complaint about the post #{id}', ['id' => $post->id]);
              if (Podium::getInstance()->podiumConfig->get('use_wysiwyg') == '0') {
                  $this->content .= "\n\n---\n"
                              . '[' . Yii::t('podium/view', 'Direct link to this post') . '](' . Url::to(['forum/show', 'id' => $post->id]) . ')'
                              . "\n\n---\n"
                              . '**' . Yii::t('podium/view', 'Post contents') . '**'
                              . $post->content;
              } else {
                  $this->content .= '<hr>'
                              . Html::a(Yii::t('podium/view', 'Direct link to this post'), ['forum/show', 'id' => $post->id])
                              . '<hr>'
                              . '<p>' . Yii::t('podium/view', 'Post contents') . '</p>'
                              . '<blockquote>' . $post->content . '</blockquote>';
              }
              $this->sender_status = self::STATUS_DELETED;
              if (!$this->save()) {
                  throw new Exception('Saving complaint error!');
              }
  
              $receivers = [];
              $mods = $post->forum->mods;
              $stamp = time();
              foreach ($mods as $mod) {
                  if ($mod != $logged) {
                      $receivers[] = [$this->id, $mod, self::STATUS_NEW, $stamp, $stamp];
                  }
              }
              if (empty($receivers)) {
                  throw new Exception('No one to send report to');
              }
              if (!Podium::getInstance()->db->createCommand()->batchInsert(
                      MessageReceiver::tableName(),
                      ['message_id', 'receiver_id', 'receiver_status', 'created_at', 'updated_at'],
                      $receivers
                  )->execute()) {
                  throw new Exception('Reports saving error!');
              }
  
              Podium::getInstance()->podiumCache->delete('user.newmessages');
              Log::info('Post reported', $post->id, __METHOD__);
              return true;
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code: public function podiumReport($post = null)
      {
          try {
              if (empty($post)) {
                  throw new Exception('Reported post missing');
              }
              $logged = User::loggedId();
              $this->sender_id = $logged;
              $this->topic = Yii::t('podium/view', 'Complaint about the post #{id}', ['id' => $post->id]);
              if (Podium::getInstance()->podiumConfig->get('use_wysiwyg') == '0') {
                  $this->content .= "\n\n---\n"
                              . '[' . Yii::t('podium/view', 'Direct link to this post') . '](' . Url::to(['forum/show', 'id' => $post->id]) . ')'
                              . "\n\n---\n"
                              . '**' . Yii::t('podium/view', 'Post contents') . '**'
                              . $post->content;
              } else {
                  $this->content .= '<hr>'
                              . Html::a(Yii::t('podium/view', 'Direct link to this post'), ['forum/show', 'id' => $post->id])
                              . '<hr>'
                              . '<p>' . Yii::t('podium/view', 'Post contents') . '</p>'
                              . '<blockquote>' . $post->content . '</blockquote>';
              }
              $this->sender_status = self::STATUS_DELETED;
              if (!$this->save()) {
                  throw new Exception('Saving complaint error!');
              }
  
              $receivers = [];
              $mods = $post->forum->mods;
              $stamp = time();
              foreach ($mods as $mod) {
                  if ($mod != $logged) {
                      $receivers[] = [$this->id, $mod, self::STATUS_NEW, $stamp, $stamp];
                  }
              }
              if (empty($receivers)) {
                  throw new Exception('No one to send report to');
              }
              if (!Podium::getInstance()->db->createCommand()->batchInsert(
                      MessageReceiver::tableName(),
                      ['message_id', 'receiver_id', 'receiver_status', 'created_at', 'updated_at'],
                      $receivers
                  )->execute()) {
                  throw new Exception('Reports saving error!');
              }
  
              Podium::getInstance()->podiumCache->delete('user.newmessages');
              Log::info('Post reported', $post->id, __METHOD__);
              return true;
          } catch (Exception $e) {
              Log::error($e->getMessage(), null, __METHOD__);
          }
          return false;
      }
code_tokens: public function podiumReport ( $ post = null ) { try { if ( empty ( $ post ) ) { throw new Exception ( 'Reported post missing' ) ; } $ logged = User :: loggedId ( ) ; $ this -> sender_id = $ logged ; $ this -> topic = Yii :: t ( 'podium/view' , 'Complaint about the post #{id}' , [ 'id' => $ post -> id ] ) ; if ( Podium :: getInstance ( ) -> podiumConfig -> get ( 'use_wysiwyg' ) == '0' ) { $ this -> content .= "\n\n---\n" . '[' . Yii :: t ( 'podium/view' , 'Direct link to this post' ) . '](' . Url :: to ( [ 'forum/show' , 'id' => $ post -> id ] ) . ')' . "\n\n---\n" . '**' . Yii :: t ( 'podium/view' , 'Post contents' ) . '**' . $ post -> content ; } else { $ this -> content .= '<hr>' . Html :: a ( Yii :: t ( 'podium/view' , 'Direct link to this post' ) , [ 'forum/show' , 'id' => $ post -> id ] ) . '<hr>' . '<p>' . Yii :: t ( 'podium/view' , 'Post contents' ) . '</p>' . '<blockquote>' . $ post -> content . '</blockquote>' ; } $ this -> sender_status = self :: STATUS_DELETED ; if ( ! $ this -> save ( ) ) { throw new Exception ( 'Saving complaint error!' ) ; } $ receivers = [ ] ; $ mods = $ post -> forum -> mods ; $ stamp = time ( ) ; foreach ( $ mods as $ mod ) { if ( $ mod != $ logged ) { $ receivers [ ] = [ $ this -> id , $ mod , self :: STATUS_NEW , $ stamp , $ stamp ] ; } } if ( empty ( $ receivers ) ) { throw new Exception ( 'No one to send report to' ) ; } if ( ! Podium :: getInstance ( ) -> db -> createCommand ( ) -> batchInsert ( MessageReceiver :: tableName ( ) , [ 'message_id' , 'receiver_id' , 'receiver_status' , 'created_at' , 'updated_at' ] , $ receivers ) -> execute ( ) ) { throw new Exception ( 'Reports saving error!' ) ; } Podium :: getInstance ( ) -> podiumCache -> delete ( 'user.newmessages' ) ; Log :: info ( 'Post reported' , $ post -> id , __METHOD__ ) ; return true ; } catch ( Exception $ e ) { Log :: error ( $ e -> getMessage ( ) , null , __METHOD__ ) ; } return false ; }
docstring: Performs post report sending to moderators.
  @param Post $post reported post
  @return bool
  @since 0.2
docstring_tokens: Performs post report sending to moderators .