Example #1
0
function WriteActivity($Activity, &$Sender, &$Session, $Comment)
{
    ?>
<li id="Activity_<?php 
    echo $Activity->ActivityID;
    ?>
" class="Activity<?php 
    echo ' ' . $Activity->ActivityType;
    ?>
"><?php 
    if ($Session->IsValid() && ($Session->UserID == $Activity->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete'))) {
        echo Anchor('Delete', 'garden/activity/delete/' . $Activity->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'Delete');
    }
    if ($Activity->ActivityPhoto != '' && $Activity->ShowIcon == '1') {
        if ($Activity->InsertUserID == $Session->UserID) {
            echo '<a href="' . Url('/garden/profile/' . urlencode($Activity->ActivityName)) . '">' . $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto) . '</a>';
        } else {
            echo $Sender->Html->Image('uploads/n' . $Activity->ActivityPhoto);
        }
    }
    ?>
<h3><?php 
    echo Format::ActivityHeadline($Activity, $Sender->ProfileUserID);
    ?>
<em><?php 
    echo Format::Date($Activity->DateInserted);
    ?>
</em><?php 
    echo $Activity->AllowComments == '1' && $Session->IsValid() ? ' ' . Anchor('Comment', '#CommentForm_' . $Activity->ActivityID, 'CommentOption') : '';
    ?>
</h3><?php 
    if ($Activity->Story != '') {
        ?>
<blockquote><?php 
        echo $Activity->Story;
        // story should be cleaned before being saved.
        ?>
</blockquote>
   <?php 
    }
    if ($Activity->AllowComments == '1') {
        // If there are comments, show them
        if (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
            ?>
<ul class="Comments"><?php 
            while (is_object($Comment) && $Comment->CommentActivityID == $Activity->ActivityID) {
                if (is_object($Comment)) {
                    WriteActivityComment($Comment, $Sender, $Session);
                }
                $Comment = $Sender->CommentData->NextRow();
            }
        } else {
            ?>
<ul class="Comments Hidden"><?php 
        }
        if ($Session->IsValid()) {
            ?>
            <li class="CommentForm">
            <?php 
            echo Anchor('Write a comment', '/garden/activity/comment/' . $Activity->ActivityID, 'CommentLink');
            $CommentForm = new Form();
            $CommentForm->SetModel($Sender->ActivityModel);
            $CommentForm->AddHidden('ActivityID', $Activity->ActivityID);
            $CommentForm->AddHidden('Return', Gdn_Url::Request());
            echo $CommentForm->Open(array('action' => Url('/garden/activity/comment'), 'class' => 'Hidden'));
            echo $CommentForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
            echo $CommentForm->Close('Comment');
            ?>
</li>
         <?php 
        }
        ?>
         </ul>
      <?php 
    }
    ?>
</li>
<?php 
}
Example #2
0
 public function DiscussionController_CommentBodyAfter_Handler(&$Sender)
 {
     $Session = Gdn::Session();
     $Comment = $Sender->EventArguments['Comment'];
     if (is_object($Sender->CurrentReply) && $Sender->CurrentReply->ReplyCommentID == $Comment->CommentID) {
         echo '<ul class="Replies">';
         while (is_object($Sender->CurrentReply) && $Sender->CurrentReply->ReplyCommentID == $Comment->CommentID) {
             VanillaCommentRepliesPlugin::WriteReply($Sender, $Session);
             $Sender->CurrentReply = $Sender->ReplyData->NextRow();
         }
     } else {
         echo '<ul class="Replies Hidden">';
     }
     if ($Session->IsValid() && $Sender->Discussion->Closed == '0') {
         echo '<li class="ReplyForm">';
         echo Anchor('Write a reply', '/vanilla/post/reply/' . $Comment->CommentID, 'ReplyLink Hidden');
         $ReplyForm = new Form();
         $ReplyForm->SetModel($this->ReplyModel);
         $ReplyForm->AddHidden('ReplyCommentID', $Comment->CommentID);
         echo $ReplyForm->Open(array('action' => Url('/vanilla/post/reply'), 'class' => 'Hidden'));
         echo $ReplyForm->TextBox('Body', array('MultiLine' => TRUE, 'value' => ''));
         echo $ReplyForm->Close('Reply');
         echo '</li>';
     }
     echo '</ul>';
 }