Esempio n. 1
0
    echo Anchor(htmlspecialchars($this->Data('Discussion.Category')), CategoryUrl($this->Data('Discussion.CategoryUrlCode')));
    echo '</span> ';
}
$this->FireEvent('DiscussionInfo');
$this->FireEvent('AfterDiscussionMeta');
// DEPRECATED
?>
         </div>
      </div>
      <?php 
$this->FireEvent('BeforeDiscussionBody');
?>
      <div class="Item-BodyWrap">
         <div class="Item-Body">
            <div class="Message">   
               <?php 
echo FormatBody($Discussion);
?>
            </div>
            <?php 
$this->FireEvent('AfterDiscussionBody');
WriteReactions($Discussion);
if (GetValue('Attachments', $Discussion)) {
    WriteAttachments($Discussion->Attachments);
}
?>
         </div>
      </div>
   </div>
</div>
    function writeComment($Comment, $Sender, $Session, $CurrentOffset)
    {
        static $UserPhotoFirst = NULL;
        if ($UserPhotoFirst === null) {
            $UserPhotoFirst = c('Vanilla.Comment.UserPhotoFirst', true);
        }
        $Author = Gdn::userModel()->getID($Comment->InsertUserID);
        //UserBuilder($Comment, 'Insert');
        $Permalink = val('Url', $Comment, '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID);
        // Set CanEditComments (whether to show checkboxes)
        if (!property_exists($Sender, 'CanEditComments')) {
            $Sender->CanEditComments = $Session->checkPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && c('Vanilla.AdminCheckboxes.Use');
        }
        // Prep event args
        $CssClass = CssClass($Comment, $CurrentOffset);
        $Sender->EventArguments['Comment'] =& $Comment;
        $Sender->EventArguments['Author'] =& $Author;
        $Sender->EventArguments['CssClass'] =& $CssClass;
        $Sender->EventArguments['CurrentOffset'] = $CurrentOffset;
        $Sender->EventArguments['Permalink'] = $Permalink;
        // DEPRECATED ARGUMENTS (as of 2.1)
        $Sender->EventArguments['Object'] =& $Comment;
        $Sender->EventArguments['Type'] = 'Comment';
        // First comment template event
        $Sender->fireEvent('BeforeCommentDisplay');
        ?>
        <li class="<?php 
        echo $CssClass;
        ?>
" id="<?php 
        echo 'Comment_' . $Comment->CommentID;
        ?>
">
            <div class="Comment">

                <?php 
        // Write a stub for the latest comment so it's easy to link to it from outside.
        if ($CurrentOffset == Gdn::controller()->data('_LatestItem')) {
            echo '<span id="latest"></span>';
        }
        ?>
                <div class="Options">
                    <?php 
        WriteCommentOptions($Comment);
        ?>
                </div>
                <?php 
        $Sender->fireEvent('BeforeCommentMeta');
        ?>
                <div class="Item-Header CommentHeader">
                    <div class="AuthorWrap">
            <span class="Author">
               <?php 
        if ($UserPhotoFirst) {
            echo userPhoto($Author);
            echo userAnchor($Author, 'Username');
        } else {
            echo userAnchor($Author, 'Username');
            echo userPhoto($Author);
        }
        echo FormatMeAction($Comment);
        $Sender->fireEvent('AuthorPhoto');
        ?>
            </span>
            <span class="AuthorInfo">
               <?php 
        echo ' ' . WrapIf(htmlspecialchars(val('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle'));
        echo ' ' . WrapIf(htmlspecialchars(val('Location', $Author)), 'span', array('class' => 'MItem AuthorLocation'));
        $Sender->fireEvent('AuthorInfo');
        ?>
            </span>
                    </div>
                    <div class="Meta CommentMeta CommentInfo">
            <span class="MItem DateCreated">
               <?php 
        echo anchor(Gdn_Format::date($Comment->DateInserted, 'html'), $Permalink, 'Permalink', array('name' => 'Item_' . $CurrentOffset, 'rel' => 'nofollow'));
        ?>
            </span>
                        <?php 
        echo DateUpdated($Comment, array('<span class="MItem">', '</span>'));
        ?>
                        <?php 
        // Include source if one was set
        if ($Source = val('Source', $Comment)) {
            echo wrap(sprintf(t('via %s'), t($Source . ' Source', $Source)), 'span', array('class' => 'MItem Source'));
        }
        $Sender->fireEvent('CommentInfo');
        $Sender->fireEvent('InsideCommentMeta');
        // DEPRECATED
        $Sender->fireEvent('AfterCommentMeta');
        // DEPRECATED
        // Include IP Address if we have permission
        if ($Session->checkPermission('Garden.PersonalInfo.View')) {
            echo wrap(IPAnchor($Comment->InsertIPAddress), 'span', array('class' => 'MItem IPAddress'));
        }
        ?>
                    </div>
                </div>
                <div class="Item-BodyWrap">
                    <div class="Item-Body">
                        <div class="Message">
                            <?php 
        echo FormatBody($Comment);
        ?>
                        </div>
                        <?php 
        $Sender->fireEvent('AfterCommentBody');
        WriteReactions($Comment);
        if (val('Attachments', $Comment)) {
            WriteAttachments($Comment->Attachments);
        }
        ?>
                    </div>
                </div>
            </div>
        </li>
        <?php 
        $Sender->fireEvent('AfterComment');
    }