示例#1
0
文件: table.php 项目: R-J/vanilla
/**
 * "Table" layout for discussions. Mimics more traditional forum discussion layout.
 */
$Session = Gdn::session();
include_once $this->fetchViewLocation('helper_functions', 'discussions', 'vanilla');
include_once $this->fetchViewLocation('table_functions', 'discussions', 'vanilla');
/**
 * Render the page.
 */
$PagerOptions = array('Wrapper' => '<div %1$s>%2$s</div>', 'RecordCount' => $this->data('CountDiscussions'), 'CurrentRecords' => $this->data('Discussions')->numRows());
if ($this->data('_PagerUrl')) {
    $PagerOptions['Url'] = $this->data('_PagerUrl');
}
echo '<h1 class="H HomepageTitle">' . $this->data('Title') . '</h1>';
$Description = $this->data('Category.Description', $this->Description());
echo wrapIf(Gdn_Format::htmlFilter($Description), 'div', array('class' => 'P PageDescription'));
$this->fireEvent('AfterDescription');
include $this->fetchViewLocation('Subtree', 'Categories', 'Vanilla');
echo '<div class="PageControls Top">';
PagerModule::write($PagerOptions);
echo Gdn_Theme::Module('NewDiscussionModule', $this->data('_NewDiscussionProperties', array('CssClass' => 'Button Action Primary')));
$this->fireEvent('PageControls');
echo '</div>';
if ($this->DiscussionData->numRows() > 0 || isset($this->AnnounceData) && is_object($this->AnnounceData) && $this->AnnounceData->numRows() > 0) {
    ?>
    <div class="DataTableWrap">
        <table class="DataTable DiscussionsTable">
            <thead>
            <?php 
    WriteDiscussionHeading();
    ?>
示例#2
0
            <span class="Author">
                <?php 
if ($UserPhotoFirst) {
    echo userPhoto($Author);
    echo userAnchor($Author, 'Username');
} else {
    echo userAnchor($Author, 'Username');
    echo userPhoto($Author);
}
echo formatMeAction($Discussion);
?>
            </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'));
$this->fireEvent('AuthorInfo');
?>
            </span>
            </div>
            <div class="Meta DiscussionMeta">
            <span class="MItem DateCreated">
                <?php 
echo anchor(Gdn_Format::date($Discussion->DateInserted, 'html'), $Discussion->Url, 'Permalink', array('rel' => 'nofollow'));
?>
            </span>
                <?php 
echo dateUpdated($Discussion, array('<span class="MItem">', '</span>'));
?>
                <?php 
// Include source if one was set
示例#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');
    }
示例#4
0
<?php

if (!defined('APPLICATION')) {
    exit;
}
echo wrap(t($this->data('Title')), 'h1');
echo '<div class="Wrap">';
echo $this->Form->open();
echo $this->Form->errors();
echo wrapIf(t($this->data('Status')), 'div', ['class' => 'Info']);
switch ($this->data('Step')) {
    case 'scan':
        // Display the scan of the structure.
        if (!empty($this->Data['CapturedSql'])) {
            $CapturedSql = (array) $this->Data['CapturedSql'];
            if (count($CapturedSql) > 0) {
                ?>
                <div class="Info"><?php 
                echo t('The following structure changes are required for your database.');
                ?>
</div>
                <?php 
                echo '<pre class="Sql">';
                $First = TRUE;
                foreach ($this->Data['CapturedSql'] as $Sql) {
                    if ($First) {
                        $First = FALSE;
                    } else {
                        echo "\n\n";
                    }
                    $Sql = trim(trim($Sql), ';') . ';';
<?php

if (!defined('APPLICATION')) {
    exit;
}
echo wrap(t($this->data('Title')), 'h1');
echo '<div class="Wrap">';
echo $this->Form->open();
echo $this->Form->errors();
echo wrapIf(t($this->data('Status')), 'div', array('class' => 'Info'));
switch ($this->data('Step')) {
    case 'scan':
        // Display the scan of the structure.
        if (!empty($this->Data['CapturedSql'])) {
            $CapturedSql = (array) $this->Data['CapturedSql'];
            $Url = 'dashboard/utility/structure/' . $this->Data['ApplicationName'] . '/0/' . (int) $this->Data['Drop'] . '/' . (int) $this->Data['Explicit'];
            if (count($CapturedSql) > 0) {
                ?>
                <div class="Info"><?php 
                echo t('The following structure changes are required for your database.');
                ?>
</div>
                <?php 
                echo '<pre class="Sql">';
                $First = TRUE;
                foreach ($this->Data['CapturedSql'] as $Sql) {
                    if ($First) {
                        $First = FALSE;
                    } else {
                        echo "\n\n";
                    }