Esempio n. 1
0
?>
                <?php 
// Include source if one was set
if ($Source = val('Source', $Discussion)) {
    echo ' ' . wrap(sprintf(t('via %s'), t($Source . ' Source', $Source)), 'span', array('class' => 'MItem MItem-Source')) . ' ';
}
// Category
if (c('Vanilla.Categories.Use')) {
    echo ' <span class="MItem Category">';
    echo ' ' . t('in') . ' ';
    echo anchor(htmlspecialchars($this->data('Discussion.Category')), categoryUrl($this->data('Discussion.CategoryUrlCode')));
    echo '</span> ';
}
// Include IP Address if we have permission
if ($Session->checkPermission('Garden.PersonalInfo.View')) {
    echo wrap(ipAnchor($Discussion->InsertIPAddress), 'span', array('class' => 'MItem IPAddress'));
}
$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);
Esempio n. 2
0
        // Output a definition list if a plugin passed us ordered data.
        if (count($this->EventArguments['ApplicantMeta'])) {
            foreach ($this->EventArguments['ApplicantMeta'] as $label => $value) {
                echo '<dt>' . htmlspecialchars($label) . '</dt><dd>' . htmlspecialchars($value) . '</dd>';
            }
        }
        // Only make a blockquote if we got a reason.
        if ($User->DiscoveryText) {
            echo Gdn_Format::text($User->DiscoveryText);
        }
        // Opportunity for plugins to do arbitrary appending.
        $this->fireEvent("AppendApplicantInfo");
        ?>
                    </td>
                    <td><?php 
        echo ipAnchor($User->InsertIPAddress);
        ?>
</td>
                    <td><?php 
        echo Gdn_Format::date($User->DateInserted);
        ?>
</td>
                    <td class="options">
                        <div class="btn-group">
                        <?php 
        echo anchor(dashboardSymbol('checkmark'), '/user/approve/' . $User->UserID, 'ApproveApplicant btn btn-icon', ['aria-label' => t('Approve'), 'title' => t('Approve')]);
        echo anchor(dashboardSymbol('delete'), '/user/decline/' . $User->UserID . '/' . $Session->TransientKey(), 'DeclineApplicant btn btn-icon', ['aria-label' => t('Decline'), 'title' => t('Decline')]);
        ?>
                        </div>
                    </td>
                </tr>
Esempio n. 3
0
    /**
     * Outputs a formatted comment.
     *
     * Prior to 2.1, this also output the discussion ("FirstComment") to the browser.
     * That has moved to the discussion.php view.
     *
     * @param DataSet $Comment .
     * @param Gdn_Controller $Sender .
     * @param Gdn_Session $Session .
     * @param int $CurrentOffet How many comments into the discussion we are (for anchors).
     */
    function writeComment($Comment, $Sender, $Session, $CurrentOffset)
    {
        // Whether to order the name & photo with the latter first.
        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;
        // Needed in writeCommentOptions()
        if ($Sender->data('Discussion', null) === null) {
            $discussionModel = new DiscussionModel();
            $discussion = $discussionModel->getID($Comment->DiscussionID);
            $Sender->setData('Discussion', $discussion);
        }
        // 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'));
        }
        // Include IP Address if we have permission
        if ($Session->checkPermission('Garden.PersonalInfo.View')) {
            echo wrap(ipAnchor($Comment->InsertIPAddress), 'span', array('class' => 'MItem IPAddress'));
        }
        $Sender->fireEvent('CommentInfo');
        $Sender->fireEvent('InsideCommentMeta');
        // DEPRECATED
        $Sender->fireEvent('AfterCommentMeta');
        // DEPRECATED
        ?>
                    </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');
    }