示例#1
0
function WriteComment($Comment, &$Sender, &$Session, $CurrentOffset)
{
    $Author = UserBuilder($Comment, 'Insert');
    $Sender->EventArguments['Comment'] =& $Comment;
    $Sender->Options = '';
    $CssClass = 'Item Comment';
    $CssClass .= $Comment->InsertUserID == $Session->UserID ? ' Mine' : '';
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
" id="Comment_<?php 
    echo $Comment->CommentID;
    ?>
">
   <?php 
    WriteOptions($Comment, $Sender, $Session);
    ?>
   <div class="Comment">
      <div class="Meta">
         <span class="Author">
            <?php 
    echo UserPhoto($Author);
    echo UserAnchor($Author);
    ?>
         </span>
         <span class="DateCreated">
            <?php 
    echo Format::Date($Comment->DateInserted);
    ?>
         </span>
         <span class="Permalink">
            <?php 
    echo Anchor(T('Permalink'), '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID, 'Permalink', array('name' => 'Item_' . $CurrentOffset));
    ?>
         </span>
         <?php 
    $Sender->FireEvent('AfterCommentMeta');
    ?>
      </div>
      <div class="Message"><?php 
    echo Format::To($Comment->Body, $Comment->Format);
    ?>
</div>
      <?php 
    $Sender->FireEvent('AfterCommentBody');
    ?>
   </div>
</li>
<?php 
}
示例#2
0
文件: preview.php 项目: kidmax/Garden
if (!defined('APPLICATION')) {
    exit;
}
if (property_exists($this, 'Discussion')) {
    ?>
<h2><?php 
    echo Format::Text($this->Discussion->Name);
    ?>
</h2>
<?php 
}
?>
<ul class="Discussion Preview">
   <li class="Comment">
      <ul class="Info">
         <li class="Author"><?php 
echo UserPhoto($this->Comment->InsertName, $this->Comment->InsertPhoto);
echo UserAnchor($this->Comment->InsertName);
?>
</li>
         <li class="Created"><?php 
echo Format::Date($this->Comment->DateInserted);
?>
</li>
      </ul>
      <div class="Body"><?php 
echo Format::To($this->Comment->Body, Gdn::Config('Garden.InputFormatter'));
?>
</div>
   </li>
</ul>
示例#3
0
    echo $Message->MessageID;
    ?>
"<?php 
    echo $Class == '' ? '' : ' class="' . $Class . '"';
    ?>
>
   <div class="ConversationMessage">
      <div class="Meta">
         <span class="Author">
            <?php 
    echo UserPhoto($Author, 'Photo');
    echo UserAnchor($Author, 'Name');
    ?>
         </span>
         <span class="DateCreated"><?php 
    echo Format::Date($Message->DateInserted);
    ?>
</span>
         <span class="ItemLink"><a name="Item_<?php 
    echo $CurrentOffset;
    ?>
" class="Item"></a></span>
      </div>
      <div class="Message"><?php 
    echo Format::To($Message->Body, $Format);
    ?>
</div>
   </div>
</li>
<?php 
}
示例#4
0
    public static function WriteReply(&$Sender, &$Session)
    {
        ?>
         <li class="Reply" id="Comment_<?php 
        echo $Sender->CurrentReply->CommentID;
        ?>
">
            <?php 
        // Delete comment
        if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
            echo Anchor(Gdn::Translate('Delete'), 'vanilla/discussion/deletecomment/' . $Sender->CurrentReply->CommentID . '/' . $Session->TransientKey(), 'DeleteReply');
        }
        ?>
            <ul class="Info<?php 
        echo $Sender->CurrentReply->InsertUserID == $Session->UserID ? ' Author' : '';
        ?>
">
               <li class="Author"><?php 
        $Author = UserBuilder($Sender->CurrentReply, 'Insert');
        echo UserPhoto($Author);
        echo UserAnchor($Author);
        ?>
</li>
               <li class="Created"><?php 
        echo Format::Date($Sender->CurrentReply->DateInserted);
        ?>
</li>
               <li class="Permalink"><?php 
        echo Anchor(Gdn::Translate('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, Gdn::Translate('Permalink'));
        ?>
</li>
            </ul>
            <div class="Body"><?php 
        echo Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format);
        ?>
</div>
         </li>
      <?php 
    }
示例#5
0
文件: message.php 项目: Valooo/Garden
<?php

if (!defined('APPLICATION')) {
    exit;
}
if (is_object($this->_Message)) {
    // todo: Wrap this string in a div with a "dismiss" link if necessary
    echo '<div class="DismissMessage' . ($this->_Message->CssClass == '' ? '' : ' ' . $this->_Message->CssClass) . '">';
    if ($this->_Message->AllowDismiss == '1') {
        $Session = Gdn::Session();
        echo Anchor('x', '/garden/messages/dismiss/' . $this->_Message->MessageID . '/' . $Session->TransientKey() . '?Target=' . $this->_Sender->SelfUrl, 'Close');
    }
    echo Format::To($this->_Message->Content, 'Html');
    echo '</div>';
}
示例#6
0
 /**
  * Returns the requested row index as the requested row type.
  *
  * @param int $RowIndex The row to return from the result set. It is zero-based.
  * @param string $FormatType The type of formatting to use on each of the result fields. Defaults to none.
  * @param string $RowType The format in which the result should be returned: object or array.
  */
 public function Row($RowIndex, $FormatType = '', $RowType = FALSE)
 {
     if ($RowType === FALSE) {
         $RowType = $this->DefaultDatasetType;
     }
     $Result = $this->Result('', $RowType);
     if (count($Result) == 0) {
         return $Result;
     }
     if (isset($Result[$RowIndex])) {
         return Format::To($Result[$RowIndex], $FormatType);
     }
     return FALSE;
 }
示例#7
0
function WriteComment($Comment, &$Sender, &$Session, $CurrentOffset)
{
    ?>
<li class="Comment<?php 
    echo $Comment->InsertUserID == $Session->UserID ? ' Mine' : '';
    ?>
" id="Comment_<?php 
    echo $Comment->CommentID;
    ?>
">
   <?php 
    $Sender->EventArguments['Comment'] =& $Comment;
    $Sender->Options = '';
    $IsFirstComment = $Comment->CommentID == $Sender->Discussion->FirstCommentID;
    if ($IsFirstComment && ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Vanilla.Discussions.Edit', $Sender->Discussion->CategoryID))) {
        // User can edit the discussion topic/first comment
        $Sender->Options .= '<li>' . Anchor('Edit', '/vanilla/post/editdiscussion/' . $Comment->DiscussionID, 'EditDiscussion') . '</li>';
    } else {
        if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Vanilla.Comments.Edit', $Sender->Discussion->CategoryID)) {
            // User can edit the comment
            $Sender->Options .= '<li>' . Anchor('Edit', '/vanilla/post/editcomment/' . $Comment->CommentID, 'EditComment') . '</li>';
        }
    }
    if ($IsFirstComment) {
        // Announce discussion
        if ($Session->CheckPermission('Vanilla.Discussions.Announce', $Sender->Discussion->CategoryID)) {
            $Sender->Options .= '<li>' . Anchor($Sender->Discussion->Announce == '1' ? 'Unannounce' : 'Announce', 'vanilla/discussion/announce/' . $Comment->DiscussionID . '/' . $Session->TransientKey(), 'AnnounceDiscussion') . '</li>';
        }
        // Sink discussion
        if ($Session->CheckPermission('Vanilla.Discussions.Sink', $Sender->Discussion->CategoryID)) {
            $Sender->Options .= '<li>' . Anchor($Sender->Discussion->Sink == '1' ? 'Unsink' : 'Sink', 'vanilla/discussion/sink/' . $Comment->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'SinkDiscussion') . '</li>';
        }
        // Close discussion
        if ($Session->CheckPermission('Vanilla.Discussions.Close', $Sender->Discussion->CategoryID)) {
            $Sender->Options .= '<li>' . Anchor($Sender->Discussion->Closed == '1' ? 'Reopen' : 'Close', 'vanilla/discussion/close/' . $Comment->DiscussionID . '/' . $Session->TransientKey() . '?Target=' . urlencode($Sender->SelfUrl), 'CloseDiscussion') . '</li>';
        }
        // Delete discussion
        if ($Session->CheckPermission('Vanilla.Discussions.Delete', $Sender->Discussion->CategoryID)) {
            $Sender->Options .= '<li>' . Anchor('Delete Discussion', 'vanilla/discussion/delete/' . $Comment->DiscussionID . '/' . $Session->TransientKey(), 'DeleteDiscussion') . '</li>';
        }
    } else {
        // Delete comment
        if ($Session->CheckPermission('Vanilla.Comments.Delete', $Sender->Discussion->CategoryID)) {
            $Sender->Options .= '<li>' . Anchor('Delete', 'vanilla/discussion/deletecomment/' . $Comment->CommentID . '/' . $Session->TransientKey() . '/?Target=' . urlencode($Sender->SelfUrl), 'DeleteComment') . '</li>';
        }
    }
    // Allow plugins to add options
    $Sender->FireEvent('CommentOptions');
    if ($Sender->Options != '') {
        ?>
   <ul class="Options">
      <li><strong><?php 
        echo Gdn::Translate('Options');
        ?>
</strong>
         <ul>
            <?php 
        echo $Sender->Options;
        ?>
         </ul>
      </li>
   </ul>
      <?php 
    }
    ?>
   <ul class="Info">
      <li class="Author">
         <?php 
    $Author = UserBuilder($Comment, 'Insert');
    echo UserPhoto($Author);
    echo UserAnchor($Author);
    ?>
      </li>
      <li class="Created">
         <?php 
    echo Format::Date($Comment->DateInserted);
    ?>
      </li>
      <li class="Permalink">
         <?php 
    echo Anchor(Gdn::Translate('Permalink'), '/discussion/comment/' . $Comment->CommentID . '/#Comment_' . $Comment->CommentID, 'Permalink', array('name' => 'Item_' . $CurrentOffset));
    ?>
      </li>
      <?php 
    $Sender->FireEvent('AfterCommentMeta');
    ?>
   </ul>
   <div class="Body"><?php 
    echo Format::To($Comment->Body, $Comment->Format);
    ?>
</div>
   <?php 
    $Sender->FireEvent('AfterCommentBody');
    ?>
</li>
<?php 
}