Example #1
0
function WriteDiscussion($Discussion, &$Sender, &$Session, $Alt)
{
    $CssClass = 'Item';
    $CssClass .= $Discussion->Bookmarked == '1' ? ' Bookmarked' : '';
    $CssClass .= $Alt . ' ';
    $CssClass .= $Discussion->Announce == '1' ? ' Announcement' : '';
    $CssClass .= $Discussion->Closed == '1' ? ' Closed' : '';
    $CssClass .= $Discussion->InsertUserID == $Session->UserID ? ' Mine' : '';
    $CssClass .= $Discussion->CountUnreadComments > 0 && $Session->IsValid() ? ' New' : '';
    $Sender->EventArguments['Discussion'] =& $Discussion;
    $Sender->FireEvent('BeforeDiscussionName');
    $DiscussionName = Gdn_Format::Text($Discussion->Name);
    if ($DiscussionName == '') {
        $DiscussionName = T('Blank Discussion Topic');
    }
    static $FirstDiscussion = TRUE;
    if (!$FirstDiscussion) {
        $Sender->FireEvent('BetweenDiscussion');
    } else {
        $FirstDiscussion = FALSE;
    }
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    echo UserPhoto(UserBuilder($Discussion, 'First'));
    ?>
   <div class="ItemContent Discussion">
      <?php 
    echo Anchor($DiscussionName, '/discussion/' . $Discussion->DiscussionID . '/' . Gdn_Format::Url($Discussion->Name) . ($Discussion->CountCommentWatch > 0 && C('Vanilla.Comments.AutoOffset') ? '/#Item_' . $Discussion->CountCommentWatch : ''), 'Title');
    ?>
      <?php 
    $Sender->FireEvent('AfterDiscussionTitle');
    ?>
      <div class="Meta">
         <span class="Author"><?php 
    echo $Discussion->FirstName;
    ?>
</span>
         <?php 
    echo '<span class="Counts' . ($Discussion->CountUnreadComments > 0 ? ' NewCounts' : '') . '">' . ($Discussion->CountUnreadComments > 0 ? $Discussion->CountUnreadComments . '/' : '') . $Discussion->CountComments . '</span>';
    if ($Discussion->LastCommentID != '') {
        echo '<span class="LastCommentBy">' . sprintf(T('Latest %1$s'), $Discussion->LastName) . '</span> ';
    }
    echo '<span class="LastCommentDate">' . Gdn_Format::Date($Discussion->LastDate) . '</span> ';
    ?>
      </div>
   </div>
</li>
<?php 
}
Example #2
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 
}
    public function ToString($Results)
    {
        $UserIDs = array();
        foreach ($Results as $Row) {
            $UserIDs[] = $Row->{SS_ATTR_USERID};
            ///IMPORTANT, this is lowercase since grab results directly from sphinx
        }
        // print_r($Return); die;
        $Sql = clone Gdn::Sql();
        $Users = $Sql->Select('Photo, UserID, Name')->From('User')->WhereIn('UserID', $UserIDs)->Get()->ResultObject();
        ob_start();
        ?>
        <div id="People" class="Box People">
            <h4 class="Header"><?php 
        echo T('People');
        ?>
</h4>
            <ul class="PanelInfo PanelDiscussions">
                <?php 
        foreach ($Users as $Row) {
            ?>
                    <li class="Item">
                        <?php 
            $User = UserBuilder($Row);
            ?>
                        <?php 
            echo UserPhoto($User);
            echo UserAnchor($User);
            ?>
                    </li>
                <?php 
        }
        ?>
            </ul>
        </div>
        <?php 
        $String = ob_get_contents();
        @ob_end_clean();
        return $String;
    }
 /**
  * Renders the reaction record for a specific item
  * 
  * @param int $ID
  * @param string $Type 'discussion', 'activity', or 'comment'
  */
 function RenderReactionRecord($ID, $Type)
 {
     $Reactions = Yaga::ReactionModel()->GetRecord($ID, $Type);
     $Limit = C('Yaga.Reactions.RecordLimit');
     $ReactionCount = count($Reactions);
     $i = 0;
     foreach ($Reactions as $Reaction) {
         $i++;
         // Limit the record if there are a lot of reactions
         if ($i <= $Limit || $Limit <= 0) {
             $User = Gdn::UserModel()->GetID($Reaction->UserID);
             $DateTitle = sprintf(T('Yaga.Reactions.RecordFormat'), $User->Name, $Reaction->Name, Gdn_Format::Date($Reaction->DateInserted, '%B %e, %Y'));
             $String = UserPhoto($User, array('Size' => 'Small', 'title' => $DateTitle));
             $String .= '<span class="ReactSprite Reaction-' . $Reaction->ActionID . ' ' . $Reaction->CssClass . '"></span>';
             $Wrapttributes = array('class' => 'UserReactionWrap', 'data-userid' => $User->UserID, 'title' => $DateTitle);
             echo Wrap($String, 'span', $Wrapttributes);
         }
         if ($Limit > 0 && $i >= $ReactionCount && $ReactionCount > $Limit) {
             echo Plural($ReactionCount - $Limit, 'Yaga.Reactions.RecordLimit.Single', 'Yaga.Reactions.RecordLimit.Plural');
         }
     }
 }
Example #5
0
?>
" class="<?php 
echo $CssClass;
?>
">
   <div class="Discussion">
      <div class="Item-Header DiscussionHeader">
         <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($Discussion);
?>
            </span>
            <span class="AuthorInfo">
               <?php 
echo WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle'));
echo WrapIf(htmlspecialchars(GetValue('Location', $Author)), 'span', array('class' => 'MItem AuthorLocation'));
$this->FireEvent('AuthorInfo');
?>
            </span>
         </div>
         <div class="Meta DiscussionMeta">
            <span class="MItem DateCreated">
               <?php 
Example #6
0
    $Class = trim($Class);
    $Format = empty($Message->Format) ? 'Display' : $Message->Format;
    $Author = UserBuilder($Message, 'Insert');
    ?>
<li id="<?php 
    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);
    ?>
Example #7
0
?>
<ul class="PopList Popin">
<?php 
if (count($this->Data('Discussions'))) {
    ?>
      <li class="Item Title">
         <?php 
    echo Wrap($this->Data('Title'), 'strong');
    ?>
      </li>
      <?php 
    foreach ($this->Data('Discussions') as $Row) {
        ?>
      <li class="Item">
         <div class="Author Photo"><?php 
        echo UserPhoto($Row, array('Px' => 'First'));
        ?>
</div>
         <div class="ItemContent">
            <b class="Subject"><?php 
        echo Anchor($Row->Name, $Row->Url . '#latest');
        ?>
</b>
            <div class="Meta">
               <?php 
        echo ' <span class="MItem">' . Plural($Row->CountComments, '%s comment', '%s comments') . '</span> ';
        if ($Row->CountUnreadComments === TRUE) {
            echo ' <strong class="HasNew"> ' . T('new') . '</strong> ';
        } elseif ($Row->CountUnreadComments > 0) {
            echo ' <strong class="HasNew"> ' . Plural($Row->CountUnreadComments, '%s new', '%s new plural') . '</strong> ';
        }
Example #8
0
                if (!isset($PhotoUser)) {
                    $PhotoUser = $User;
                }
                $Subject = ConcatSep(', ', $Subject, FormatUsername($User, 'You'));
            }
        }
        if (!isset($PhotoUser)) {
            $PhotoUser = UserBuilder($Row, 'LastMessage');
        }
        ?>
   <li class="Item" rel="<?php 
        echo Url("/messages/{$Row['ConversationID']}#latest");
        ?>
">
      <div class="Author Photo"><?php 
        echo UserPhoto($PhotoUser);
        ?>
</div>
      <div class="ItemContent">
         <b class="Subject"><?php 
        echo Anchor($Subject, "/messages/{$Row['ConversationID']}#latest");
        ?>
</b>
         <?php 
        $Excerpt = SliceString(Gdn_Format::PlainText($Row['LastBody'], $Row['LastFormat']), 80);
        echo Wrap(nl2br($Excerpt), 'div', array('class' => 'Excerpt'));
        ?>
         <div class="Meta">
            <?php 
        echo ' <span class="MItem">' . Plural($Row['CountMessages'], '%s message', '%s messages') . '</span> ';
        if ($Row['CountNewMessages'] > 0) {
Example #9
0
">
   <h2 class="H"><?php 
echo T($Editing ? 'Edit Comment' : 'Leave a Comment');
?>
</h2>
   <div class="CommentFormWrap">
      <div class="Form-HeaderWrap">
         <div class="Form-Header">
            <span class="Author">
               <?php 
if (C('Vanilla.Comment.UserPhotoFirst', TRUE)) {
    echo UserPhoto($Session->User);
    echo UserAnchor($Session->User, 'Username');
} else {
    echo UserAnchor($Session->User, 'Username');
    echo UserPhoto($Session->User);
}
?>
            </span>
         </div>
      </div>
      <div class="Form-BodyWrap">
         <div class="Form-Body">
            <div class="FormWrapper FormWrapper-Condensed">
               <?php 
echo $this->Form->Open();
echo $this->Form->Errors();
//               $CommentOptions = array('MultiLine' => TRUE, 'format' => GetValueR('Comment.Format', $this));
$this->FireEvent('BeforeBodyField');
echo $this->Form->BodyBox('Body', array('Table' => 'Comment', 'tabindex' => 1));
$this->FireEvent('AfterBodyField');
Example #10
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(T('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 Gdn_Format::Date($Sender->CurrentReply->DateInserted);
        ?>
</li>
               <li class="Permalink"><?php 
        echo Anchor(T('Permalink'), '/discussion/comment/' . (isset($Sender->CurrentComment) ? $Sender->CurrentComment->CommentID : $Sender->ReplyCommentID) . '/#Comment_' . $Sender->CurrentReply->CommentID, T('Permalink'));
        ?>
</li>
            </ul>
            <div class="Body"><?php 
        echo Gdn_Format::To($Sender->CurrentReply->Body, $Sender->CurrentReply->Format);
        ?>
</div>
         </li>
      <?php 
    }
/**
 * $Object is either a Comment or the original Discussion.
 */
function WriteComment($Object, $Sender, $Session, $CurrentOffset) {
   $Alt = ($CurrentOffset % 2) != 0;

   $Author = UserBuilder($Object, 'Insert');
   $Type = property_exists($Object, 'CommentID') ? 'Comment' : 'Discussion';
	$Sender->EventArguments['Object'] = $Object;
   $Sender->EventArguments['Type'] = $Type;
   $Sender->EventArguments['Author'] = $Author;
   $CssClass = 'Item Comment';
   $Permalink = GetValue('Url', $Object, FALSE);

   if ($Type == 'Comment') {
      $Sender->EventArguments['Comment'] = $Object;   
      $Id = 'Comment_'.$Object->CommentID;
      if ($Permalink === FALSE)
         $Permalink = '/discussion/comment/'.$Object->CommentID.'/#Comment_'.$Object->CommentID;
   } else {
      $Sender->EventArguments['Discussion'] = $Object;   
      $CssClass .= ' FirstComment';
      $Id = 'Discussion_'.$Object->DiscussionID;
      if ($Permalink === FALSE)
         $Permalink = '/discussion/'.$Object->DiscussionID.'/'.Gdn_Format::Url($Object->Name).'/p1';
   }
   $Sender->EventArguments['CssClass'] = &$CssClass;
   $Sender->Options = '';
   $CssClass .= $Object->InsertUserID == $Session->UserID ? ' Mine' : '';

   if ($Alt)
      $CssClass .= ' Alt';
   $Alt = !$Alt;
	
	if (!property_exists($Sender, 'CanEditComments'))
		$Sender->CanEditComments = $Session->CheckPermission('Vanilla.Comments.Edit', TRUE, 'Category', 'any') && C('Vanilla.AdminCheckboxes.Use');
		
   $Sender->FireEvent('BeforeCommentDisplay');
?>
<li class="<?php echo $CssClass; ?>" id="<?php echo $Id; ?>">
   <div class="Comment">
      <div class="Meta">
         <?php $Sender->FireEvent('BeforeCommentMeta'); ?>
         <span class="Author">
            <?php
            echo UserPhoto($Author);
            echo UserAnchor($Author);
            ?>
         </span>
         <span class="DateCreated">
            <?php
            echo Anchor(Gdn_Format::Date($Object->DateInserted), $Permalink, 'Permalink', array('name' => 'Item_'.($CurrentOffset+1), 'rel' => 'nofollow'));
            ?>
         </span>
         <?php
			WriteOptionList($Object, $Sender, $Session);
			if ($Type == 'Comment' && $Sender->CanEditComments) {
				if (!property_exists($Sender, 'CheckedComments'))
					$Sender->CheckedComments = $Session->GetAttribute('CheckedComments', array());
					
				$ItemSelected = InSubArray($Id, $Sender->CheckedComments);
				echo '<div class="Administration"><input type="checkbox" name="'.$Type.'ID[]" value="'.$Id.'"'.($ItemSelected?' checked="checked"':'').' /></div>';
			}
			?>
         <div class="CommentInfo">
            <?php $Sender->FireEvent('CommentInfo'); ?>
         </div>
         <?php $Sender->FireEvent('AfterCommentMeta'); ?>
      </div>
      <div class="Message">
			<?php 
            $Sender->FireEvent('BeforeCommentBody'); 
			   $Object->FormatBody = Gdn_Format::To($Object->Body, $Object->Format);
			   $Sender->FireEvent('AfterCommentFormat');
			   $Object = $Sender->EventArguments['Object'];
			   echo $Object->FormatBody;
			?>
		</div>
      <?php $Sender->FireEvent('AfterCommentBody'); ?>
   </div>
</li>
<?php
	$Sender->FireEvent('AfterComment');
}
Example #12
0
    function WriteTableRow($Row, $Depth = 1)
    {
        $Children = $Row['Children'];
        $WriteChildren = FALSE;
        if (!empty($Children)) {
            if ($Depth + 1 >= C('Vanilla.Categories.MaxDisplayDepth')) {
                $WriteChildren = 'list';
            } else {
                $WriteChildren = 'rows';
            }
        }
        $H = 'h' . ($Depth + 1);
        ?>
   <tr class="<?php 
        echo CssClass($Row);
        ?>
">
      <td class="CategoryName">
         <?php 
        echo GetOptions($Row);
        echo "<{$H}>";
        echo Anchor($Row['Name'], $Row['Url']);
        Gdn::Controller()->EventArguments['Category'] = $Row;
        Gdn::Controller()->FireEvent('AfterCategoryTitle');
        echo "</{$H}>";
        ?>
         <div class="CategoryDescription">
            <?php 
        echo $Row['Description'];
        ?>
         </div>
         <?php 
        if ($WriteChildren === 'list') {
            ?>
         <div class="ChildCategories">
            <?php 
            echo Wrap(T('Child Categories') . ': ', 'b');
            echo CategoryString($Children, $Depth + 1);
            ?>
         </div>
         <?php 
        }
        ?>
      </td>
      <td class="BigCount CountDiscussions">
         <div class="Wrap">
            <?php 
        //            echo "({$Row['CountDiscussions']})";
        echo BigPlural($Row['CountAllDiscussions'], '%s discussion');
        ?>
         </div>
      </td>
      <td class="BigCount CountComments">
         <div class="Wrap">
            <?php 
        //            echo "({$Row['CountComments']})";
        echo BigPlural($Row['CountAllComments'], '%s comment');
        ?>
         </div>
      </td>
      <td class="BlockColumn LatestPost">
         <div class="Block Wrap">
            <?php 
        if ($Row['LastTitle']) {
            ?>
            <?php 
            echo UserPhoto($Row, array('Size' => 'Small', 'Px' => 'Last'));
            echo Anchor(SliceString(Gdn_Format::Text($Row['LastTitle']), 100), $Row['LastUrl'], 'BlockTitle LatestPostTitle', array('title' => html_entity_decode($Row['LastTitle'])));
            ?>
            <div class="Meta">
               <?php 
            echo UserAnchor($Row, 'UserLink MItem', 'Last');
            ?>
               <span class="Bullet">•</span>
               <?php 
            echo Anchor(Gdn_Format::Date($Row['LastDateInserted'], 'html'), $Row['LastUrl'], 'CommentDate MItem');
            ?>
            </div>
            <?php 
        }
        ?>
         </div>
      </td>
   </tr>
   <?php 
        if ($WriteChildren === 'rows') {
            foreach ($Children as $ChildRow) {
                WriteTableRow($ChildRow, $Depth + 1);
            }
        }
    }
 /**
  * Display user photo for first user in each discussion.
  */
 protected function DisplayPhoto($Sender)
 {
     // Build user object & output photo
     $FirstUser = UserBuilder($Sender->EventArguments['Discussion'], 'First');
     echo UserPhoto($FirstUser);
 }
Example #14
0
 function WriteCommentFormHeader()
 {
     $Session = Gdn::Session();
     if (C('Vanilla.Comment.UserPhotoFirst', TRUE)) {
         echo UserPhoto($Session->User);
         echo UserAnchor($Session->User, 'Username');
     } else {
         echo UserAnchor($Session->User, 'Username');
         echo UserPhoto($Session->User);
     }
 }
function WriteClassic($Results, $WriteText, $CssClass)
{
    if (sizeof($Results) == 0) {
        //make sure there is something here
        return '';
    }
    ob_start();
    ?>
    <div class="SphinxSearch">
        <ul class="DataList">
            <?php 
    foreach ($Results as $Row) {
        ?>
                <?php 
        $Author->Photo = $Row->UserPhoto;
        $Author->Name = $Row->UserName;
        $Author->UserID = $Row->UserID;
        $TitleURL = $Row->IsComment ? 'discussion/comment/' . $Row->CommentID . '/#Comment_' . $Row->CommentID : DiscussionLink($Row, FALSE);
        //if the comment is from the orignal discussion poster, simply link to the front page of that
        ?>
                <li class="Item">
                    <div class="ItemContent">
                        <h4 class="Title"><?php 
        echo Anchor($Row->Title, $TitleURL, FALSE, array('class' => 'HasToolTip'));
        ?>
</h4>
                        <?php 
        if ($WriteText) {
            ?>
                            <div class="Message Excerpt">
                                <?php 
            //echo nl2br(SliceString($Row->Body, SS_BODY_LIMIT));  This seemed to make MARKDOWN posts look correct - JJB
            ?>
                                 <?php 
            echo SliceString($Row->Body, SS_BODY_LIMIT);
            ?>
                            </div>
                        <?php 
        }
        ?>
                        <div class="Meta">
                            <span class="MItem"><?php 
        echo UserPhoto($Author, array('LinkClass' => '', 'ImageClass' => 'ProfilePhotoSmall PhotoWrap'));
        ?>
</span>
                            <span class="MItem"><?php 
        echo Anchor($Row->UserName, UserUrl($Author));
        ?>
</span>
                            <span class="MItem"><?php 
        echo Anchor(Gdn_Format::Date($Row->DateInserted), 'discussion/' . $Row->DiscussionID . '/' . Gdn_Format::Url($Row->Title) . '/p1');
        ?>
</span>
                            <span class="MItem"><?php 
        echo Anchor($Row->CatName, 'discussion/' . $Row->DiscussionID . '/' . Gdn_Format::Url($Row->Title) . '/p1');
        ?>
</span>
                        </div>
                    </div>
                </li>

            <?php 
    }
    ?>
        </ul>
    </div>
    <?php 
    $String = ob_get_contents();
    @ob_end_clean();
    return $String;
}
Example #16
0
/**
 * $Object is either a Comment or the original Discussion.
 */
function WriteComment($Object, $Sender, $Session, $CurrentOffset)
{
    $Author = UserBuilder($Object, 'Insert');
    $Type = property_exists($Object, 'CommentID') ? 'Comment' : 'Discussion';
    $Sender->EventArguments['Object'] = $Object;
    $Sender->EventArguments['Type'] = $Type;
    $Sender->EventArguments['Author'] = $Author;
    $CssClass = 'Item Comment';
    if ($Type == 'Comment') {
        $Sender->EventArguments['Comment'] = $Object;
        $Id = 'Comment_' . $Object->CommentID;
        $Permalink = '/discussion/comment/' . $Object->CommentID . '/#Comment_' . $Object->CommentID;
    } else {
        $Sender->EventArguments['Discussion'] = $Object;
        $CssClass .= ' FirstComment';
        $Id = 'Discussion_' . $Object->DiscussionID;
        $Permalink = '/discussion/' . $Object->DiscussionID . '/' . Gdn_Format::Url($Object->Name) . '/p1';
    }
    $Sender->Options = '';
    $CssClass .= $Object->InsertUserID == $Session->UserID ? ' Mine' : '';
    $Sender->FireEvent('BeforeCommentDisplay');
    ?>
<li class="<?php 
    echo $CssClass;
    ?>
" id="<?php 
    echo $Id;
    ?>
">
   <div class="Comment">
      <div class="Meta">
         <?php 
    $Sender->FireEvent('BeforeCommentMeta');
    ?>
         <span class="Author">
            <?php 
    echo UserPhoto($Author);
    echo UserAnchor($Author);
    ?>
         </span>
         <span class="DateCreated">
            <?php 
    echo Gdn_Format::Date($Object->DateInserted);
    ?>
         </span>
         <span class="Permalink">
            <?php 
    echo Anchor(T('Permalink'), $Permalink, 'Permalink', array('name' => 'Item_' . ($CurrentOffset + 1), 'rel' => 'nofollow'));
    ?>
         </span>
         <?php 
    WriteOptionList($Object, $Sender, $Session);
    ?>
         <?php 
    $Sender->FireEvent('AfterCommentMeta');
    ?>
      </div>
      <div class="Message">
			<?php 
    $Sender->FireEvent('BeforeCommentBody');
    ?>
			<p><?php 
    echo Gdn_Format::To($Object->Body, $Object->Format);
    ?>
</p>
		</div>
      <?php 
    $Sender->FireEvent('AfterCommentBody');
    ?>
   </div>
</li>
<?php 
    $Sender->FireEvent('AfterComment');
}
function WriteSleek($Results, $WriteText, $CssClass)
{
    $String = '';
    $Total = sizeof($Results);
    if ($Total == 0) {
        return $String;
        //return an empty string if no results
    }
    $Cols = 1;
    //two columns
    $j = 0;
    $Count = ceil($Total / $Cols);
    //number of rows for the first column
    $Org = $Count;
    ob_start();
    ?>
    <div class="SphinxSearch Sleek">
        <ul class="<?php 
    echo $CssClass;
    ?>
">
            <?php 
    for ($i = 0; $i < $Cols; $i++) {
        ?>
                <?php 
        while ($Count--) {
            ?>
                    <?php 
            $Row = $Results[$j];
            $Author->Photo = $Row->UserPhoto;
            $Author->Name = $Row->UserName;
            $Author->UserID = $Row->UserID;
            $Row->CountCommentWatch = $Row->CountComments;
            //for discussion link
            $TitleURL = $Row->IsComment ? 'discussion/comment/' . $Row->CommentID . '/#Comment_' . $Row->CommentID : DiscussionLink($Row, FALSE);
            //if the comment is from the orignal discussion poster, simply link to the front page of that
            ?>
                    <li class="Item">
                        <div class="ItemContent">
                            <div class="UserInfo">
                                <div class="Contact">
                                    <div class="UserNameContainer">
                                        <?php 
            echo UserPhoto($Author, array('ImageClass' => 'ProfilePhotoSmall'));
            ?>
                                        <div class="DiscussionInfo">
                                            <h4 class="Title"><?php 
            echo Anchor($Row->Title . Wrap(htmlspecialchars(SliceString($Row->DiscussionBody, SS_PREVIEW_BODY_LIMIT)), 'span', array('class' => 'ToolTip')), $TitleURL, FALSE, array('class' => 'HasToolTip'));
            ?>
</h4>
                                            <div class="Meta">
                                                <span class="MItem"><?php 
            echo Anchor($Row->CatName, 'categories/' . $Row->CatUrlCode);
            ?>
</span>
                                                <span class="MItem"><?php 
            echo UserAnchor($Author);
            ?>
</span>
                                                <span class="MItem"><?php 
            echo Anchor(Gdn_Format::Date($Row->DateInserted), $TitleURL);
            ?>
</span>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="StatsBlock">
                                    <dl class="Stats">
                                        <dt>Replies:</dt>
                                        <dd><?php 
            echo Gdn_Format::BigNumber($Row->CountComments);
            ?>
</dd>
                                        <dt>Views:</dt>
                                        <dd class="Views"><?php 
            echo Gdn_Format::BigNumber($Row->CountViews);
            ?>
</dd>
                                    </dl>
                                </div>
                            </div>
                            <?php 
            if ($WriteText) {
                ?>
                                <div class="Message Excerpt">
                                    <?php 
                echo nl2br(SliceString($Row->Body, SS_BODY_LIMIT));
                ?>
                                </div>
                            <?php 
            }
            ?>
                            <?php 
            $j++;
            ?>
                        </div>
                    </li>
                <?php 
        }
        ?>
                <?php 
        $Count = floor($Total / $Cols);
        ?>
            <?php 
    }
    ?>
        </ul>
        <div style="clear: both"></div>
    </div>
    <?php 
    $String = ob_get_contents();
    @ob_end_clean();
    return $String;
}
Example #18
0
        ?>
		<div class="ItemContent">
			<?php 
        echo Anchor(Gdn_Format::Text($Row->Title), $Row->Url, 'Title');
        ?>
			<div class="Message Excerpt"><?php 
        if ($SearchTerm) {
            echo MarkString($SearchTerm, $Row->Summary);
        } else {
            echo $Row->Summary;
        }
        ?>
</div>
         <div class="Item-Footer">
            <?php 
        echo UserPhoto($Row, array('Size' => 'Small')) . ' ' . UserAnchor($Row);
        ?>
            <span class="Meta"><span class="MItem">
               <?php 
        echo Anchor(Gdn_Format::Date($Row->DateInserted, 'html'), $Row->Url);
        if (isset($Row->CategoryID)) {
            $Category = CategoryModel::Categories($Row->CategoryID);
            if ($Category) {
                $Url = CategoryUrl($Category);
                echo ' in ' . Anchor($Category['Name'], $Url, 'Category');
            }
        }
        ?>
            </span></span>
         </span>
		</div>
Example #19
0
// Spam & Moderation Queue
if ($Session->CheckPermission('Garden.Settings.Manage') || $Session->CheckPermission('Garden.Moderation.Manage')) {
    $LogModel = new LogModel();
    $SpamCount = $LogModel->GetOperationCount('spam');
    $ModerationCount = $LogModel->GetOperationCount('moderate');
    $DashboardCount += $SpamCount + $ModerationCount;
}
// Applicant Count
if ($Session->CheckPermission('Garden.Applicants.Manage')) {
    $RoleModel = new RoleModel();
    $ApplicantCount = $RoleModel->GetApplicantCount();
    $DashboardCount += $ApplicantCount;
}
if ($Session->IsValid()) {
    echo '<div class="MeBox' . $CssClass . '">';
    echo UserPhoto($User);
    echo '<div class="WhoIs">';
    echo UserAnchor($User, 'Username');
    echo '<div class="MeMenu">';
    // Notifications
    $CountNotifications = $User->CountNotifications;
    $CNotifications = is_numeric($CountNotifications) && $CountNotifications > 0 ? '<span class="Alert">' . $CountNotifications . '</span>' : '';
    echo '<span class="ToggleFlyout" rel="/profile/notificationspopin">';
    echo Anchor(Sprite('SpNotifications', 'Sprite Sprite16') . Wrap(T('Notifications'), 'em') . $CNotifications, UserUrl($User), 'MeButton FlyoutButton', array('title' => T('Notifications')));
    echo Sprite('SpFlyoutHandle', 'Arrow');
    echo '<div class="Flyout FlyoutMenu"></div></span>';
    // Inbox
    if (Gdn::ApplicationManager()->CheckApplication('Conversations')) {
        $CountInbox = GetValue('CountUnreadConversations', Gdn::Session()->User);
        $CInbox = is_numeric($CountInbox) && $CountInbox > 0 ? ' <span class="Alert">' . $CountInbox . '</span>' : '';
        echo '<span class="ToggleFlyout" rel="/messages/popin">';
 /**
  * Grabs all new notifications and adds them to the sender's inform queue.
  *
  * This method gets called by dashboard's hooks file to display new
  * notifications on every pageload. 
  *
  * @since 2.0.18
  * @access public
  *
  * @param object $Sender The object calling this method.
  */
 public static function InformNotifications($Sender)
 {
     $Session = Gdn::Session();
     if (!$Session->IsValid()) {
         return;
     }
     // Set the user's DateLastInform attribute to now. This value can be used
     // by addons to determine if their inform messages have already been sent.
     $InformLastActivityID = $Session->GetAttribute('Notifications.InformLastActivityID', 0);
     // Allow pluggability
     $Sender->EventArguments['InformLastActivityID'] =& $InformLastActivityID;
     $Sender->FireEvent('BeforeInformNotifications');
     // Retrieve default preferences
     $Preferences = array();
     $DefaultPreferences = C('Preferences.Popup', array());
     foreach ($DefaultPreferences as $Preference => $Val) {
         if ($Val) {
             $Preferences[] = $Preference;
         }
     }
     //		$User = Gdn::Database()->SQL()->Select('Preferences')->From('User')->Where('UserID', $Session->UserID)->Get()->FirstRow();
     //      if ($User) {
     //         $PrefData = Gdn_Format::Unserialize($User->Preferences);
     //			foreach ($PrefData as $Pref => $Val) {
     //				if (substr($Pref, 0, 6) == 'Popup.') {
     //					$Pref = substr($Pref, 6);
     //					if ($Val) {
     //						$Preferences[] = $Pref;
     //					} else {
     //						if (in_array($Pref, $Preferences))
     //							unset($Preferences[array_search($Pref, $Preferences)]);
     //					}
     //				}
     //			}
     //		}
     //		if (count($Preferences) > 0) {
     // Grab the activity type ids for the desired notification prefs.
     $ActivityTypeIDs = array();
     //         $ActivityTypes = array();
     $Data = Gdn::Database()->SQL()->GetWhere('ActivityType', array('Notify' => TRUE))->ResultArray();
     //  ->WhereIn('Name', $Preferences)->Get();
     foreach ($Data as $ActivityType) {
         if (Gdn::Session()->GetPreference("Popup.{$ActivityType['Name']}", C("Preferences.Popup.{$ActivityType['Name']}", TRUE))) {
             $ActivityTypeIDs[] = $ActivityType['ActivityTypeID'];
             //               $ActivityTypes[] = $ActivityType['Name'];
         }
     }
     if (count($ActivityTypeIDs) > 0) {
         // Retrieve new notifications
         $ActivityModel = new ActivityModel();
         $NotificationData = $ActivityModel->GetNotificationsSince($Session->UserID, $InformLastActivityID, $ActivityTypeIDs);
         $InformLastActivityID = -1;
         // Add (no more than 5) notifications to the inform stack
         foreach ($NotificationData->Result() as $Notification) {
             // Make sure the user wants to be notified of this
             //					if (!in_array($Notification->ActivityType, $Preferences)) {
             //                  continue;
             //               }
             $UserPhoto = UserPhoto(UserBuilder($Notification, 'Activity'), 'Icon');
             $ActivityType = explode(' ', $Notification->ActivityType);
             $ActivityType = $ActivityType[0];
             $Excerpt = $Notification->Story;
             if (in_array($ActivityType, array('WallComment', 'AboutUpdate'))) {
                 $Excerpt = Gdn_Format::Display($Excerpt);
             }
             // Inform the user of new messages
             $Sender->InformMessage($UserPhoto . Wrap(Gdn_Format::ActivityHeadline($Notification, $Session->UserID), 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . ($UserPhoto == '' ? '' : ' HasIcon'));
             // Assign the most recent activity id
             if ($InformLastActivityID == -1) {
                 $InformLastActivityID = $Notification->ActivityID;
             }
         }
     }
     //		}
     if ($InformLastActivityID > 0) {
         Gdn::UserModel()->SaveAttribute($Session->UserID, 'Notifications.InformLastActivityID', $InformLastActivityID);
     }
 }
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<div class="Box Moderators">
    <?php 
echo panelHeading(t('Moderators'));
?>
    <ul class="PanelInfo">
        <?php 
foreach ($this->ModeratorData[0]->Moderators as $Mod) {
    $Mod = UserBuilder($Mod);
    echo '<li>' . UserPhoto($Mod, 'Small') . ' ' . UserAnchor($Mod) . '</li>';
}
?>
    </ul>
</div>
<?php

if (!defined('APPLICATION')) {
    exit;
}
?>
<div class="Box InThisConversation">
   <h4><?php 
echo T('In this Conversation');
?>
</h4>
   <ul class="PanelInfo">
   <?php 
$Result = $this->Data->Result();
foreach ($this->Data->Result() as $User) {
    echo '<li>';
    if (GetValue('Deleted', $User)) {
        echo Wrap(UserPhoto($User, array('ImageClass' => 'ProfilePhotoSmall')) . ' ' . UserAnchor($User, 'UserLink'), 'del', array('title' => sprintf(T('%s has left this conversation.'), htmlspecialchars(GetValue('Name', $User)))));
    } else {
        echo UserPhoto($User, array('ImageClass' => 'ProfilePhotoSmall')) . ' ' . UserAnchor($User, 'UserLink');
    }
    echo '</li>';
}
?>
   </ul>
</div>
Example #23
0
    /**
     * Writes a discussion in table row format.
     */
    function WriteDiscussionRow($Discussion, &$Sender, &$Session, $Alt2)
    {
        if (!property_exists($Sender, 'CanEditDiscussions')) {
            $Sender->CanEditDiscussions = GetValue('PermsDiscussionsEdit', CategoryModel::Categories($Discussion->CategoryID)) && C('Vanilla.AdminCheckboxes.Use');
        }
        $CssClass = CssClass($Discussion);
        $DiscussionUrl = $Discussion->Url;
        if ($Session->UserID) {
            $DiscussionUrl .= '#latest';
        }
        $Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl;
        $Sender->EventArguments['Discussion'] =& $Discussion;
        $Sender->EventArguments['CssClass'] =& $CssClass;
        $First = UserBuilder($Discussion, 'First');
        if ($Discussion->LastUserID) {
            $Last = UserBuilder($Discussion, 'Last');
        } else {
            $Last = $First;
        }
        //   $Sender->EventArguments['FirstUser'] = &$First;
        //   $Sender->EventArguments['LastUser'] = &$Last;
        //
        //   $Sender->FireEvent('BeforeDiscussionName');
        $DiscussionName = $Discussion->Name;
        if ($DiscussionName == '') {
            $DiscussionName = T('Blank Discussion Topic');
        }
        $Sender->EventArguments['DiscussionName'] =& $DiscussionName;
        $Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage);
        $FirstPageUrl = DiscussionUrl($Discussion, 1);
        $LastPageUrl = DiscussionUrl($Discussion, FALSE) . '#latest';
        ?>
<tr id="Discussion_<?php 
        echo $Discussion->DiscussionID;
        ?>
" class="<?php 
        echo $CssClass;
        ?>
">
   <?php 
        echo AdminCheck($Discussion, array('<td class="CheckBoxColumn"><div class="Wrap">', '</div></td>'));
        ?>
	<td class="DiscussionName">
		<div class="Wrap">
         <span class="Options">
            <?php 
        echo OptionsList($Discussion);
        echo BookmarkButton($Discussion);
        ?>
         </span>
			<?php 
        echo Anchor($DiscussionName, $DiscussionUrl, 'Title') . ' ';
        $Sender->FireEvent('AfterDiscussionTitle');
        WriteMiniPager($Discussion);
        echo NewComments($Discussion);
        if ($Sender->Data('_ShowCategoryLink', TRUE)) {
            echo CategoryLink($Discussion, ' ' . T('in') . ' ');
        }
        // Other stuff that was in the standard view that you may want to display:
        echo '<div class="Meta Meta-Discussion">';
        WriteTags($Discussion);
        echo '</div>';
        //			if ($Source = GetValue('Source', $Discussion))
        //				echo ' '.sprintf(T('via %s'), T($Source.' Source', $Source));
        //
        ?>
		</div>
	</td>
	<td class="BlockColumn BlockColumn-User FirstUser">
		<div class="Block Wrap">
			<?php 
        echo UserPhoto($First, array('Size' => 'Small'));
        echo UserAnchor($First, 'UserLink BlockTitle');
        echo '<div class="Meta">';
        echo Anchor(Gdn_Format::Date($Discussion->FirstDate, 'html'), $FirstPageUrl, 'CommentDate MItem');
        echo '</div>';
        ?>
		</div>
   </td>
	<td class="BigCount CountComments">
      <div class="Wrap">
         <?php 
        // Exact Number
        // echo number_format($Discussion->CountComments);
        // Round Number
        echo BigPlural($Discussion->CountComments, '%s comment');
        ?>
      </div>
	</td>
	<td class="BigCount CountViews">
      <div class="Wrap">
         <?php 
        // Exact Number
        // echo number_format($Discussion->CountViews);
        // Round Number
        echo BigPlural($Discussion->CountViews, '%s view');
        ?>
      </div>
	</td>
	<td class="BlockColumn BlockColumn-User LastUser">
		<div class="Block Wrap">
			<?php 
        if ($Last) {
            echo UserPhoto($Last, array('Size' => 'Small'));
            echo UserAnchor($Last, 'UserLink BlockTitle');
            echo '<div class="Meta">';
            echo Anchor(Gdn_Format::Date($Discussion->LastDate, 'html'), $LastPageUrl, 'CommentDate MItem');
            echo '</div>';
        } else {
            echo '&nbsp;';
        }
        ?>
		</div>
	</td>
</tr>
<?php 
    }
Example #24
0
function WriteActivityComment($Comment, &$Sender, &$Session)
{
    $Author = UserBuilder($Comment, 'Insert');
    $PhotoAnchor = UserPhoto($Author, 'Photo');
    $CssClass = 'Item ActivityComment ActivityComment';
    if ($PhotoAnchor != '') {
        $CssClass .= ' HasPhoto';
    }
    ?>
<li id="ActivityComment_<?php 
    echo $Comment['ActivityCommentID'];
    ?>
" class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($PhotoAnchor != '') {
        ?>
   <div class="Author Photo"><?php 
        echo $PhotoAnchor;
        ?>
</div>
   <?php 
    }
    ?>
   <div class="ItemContent ActivityComment">
      <?php 
    echo UserAnchor($Author, 'Title Name');
    ?>
      <div class="Excerpt"><?php 
    echo Gdn_Format::To($Comment['Body'], $Comment['Format']);
    ?>
</div>
      <div class="Meta">
         <span class="DateCreated"><?php 
    echo Gdn_Format::Date($Comment['DateInserted'], 'html');
    ?>
</span>
         <?php 
    if ($Session->UserID == $Comment['InsertUserID'] || $Session->CheckPermission('Garden.Activity.Delete')) {
        echo Anchor(T('Delete'), "dashboard/activity/deletecomment?id={$Comment['ActivityCommentID']}&tk=" . $Session->TransientKey() . '&target=' . urlencode(Gdn_Url::Request()), 'DeleteComment');
    }
    ?>
      </div>
   </div>
</li>
<?php 
}
Example #25
0
    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 = GetValue('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;
        // 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);
        ?>
            </span>
            <span class="AuthorInfo">
               <?php 
        echo ' ' . WrapIf(htmlspecialchars(GetValue('Title', $Author)), 'span', array('class' => 'MItem AuthorTitle'));
        $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 
        // Include source if one was set
        if ($Source = GetValue('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.Moderation.Manage')) {
            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);
        ?>
         </div>
      </div>
   </div>
</li>
<?php 
        $Sender->FireEvent('AfterComment');
    }
Example #26
0
?>
<ol id="search-results" class="DataList DataList-Search" start="<?php 
echo $this->Data('From');
?>
">
   <?php 
foreach ($this->Data('SearchResults') as $Row) {
    ?>
   <li class="Item Item-Search">
      <h3><?php 
    echo Anchor(htmlspecialchars($Row['Title']), $Row['Url']);
    ?>
</h3>
      <div class="Item-Body Media">
         <?php 
    $Photo = UserPhoto($Row, array('LinkClass' => 'Img'));
    if ($Photo) {
        echo $Photo;
    }
    ?>
         <div class="Media-Body">
            <div class="Meta">
            <?php 
    echo ' <span class="MItem-Author">' . sprintf(T('by %s'), UserAnchor($Row)) . '</span>';
    echo Bullet(' ');
    echo ' <span clsss="MItem-DateInserted">' . Gdn_Format::Date($Row['DateInserted'], 'html') . '</span> ';
    if (isset($Row['Breadcrumbs'])) {
        echo Bullet(' ');
        echo ' <span class="MItem-Location">' . Gdn_Theme::Breadcrumbs($Row['Breadcrumbs'], FALSE) . '</span> ';
    }
    if (isset($Row['Notes'])) {
Example #27
0
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>
Example #28
0
        $Class .= ' New';
    }
    if ($Conversation->LastMessagePhoto != '') {
        $Class .= ' HasPhoto';
    }
    $Class = trim($Class);
    $Name = $Session->UserID == $Conversation->LastMessageUserID ? 'You' : $Conversation->LastMessageName;
    $JumpToItem = $Conversation->CountMessages - $Conversation->CountNewMessages;
    ?>
<li<?php 
    echo $Class == '' ? '' : ' class="' . $Class . '"';
    ?>
>
   <?php 
    $LastAuthor = UserBuilder($Conversation, 'LastMessage');
    echo UserPhoto($LastAuthor, 'Photo');
    ?>
   <div>
      <?php 
    echo UserAnchor($LastAuthor, 'Name');
    echo Anchor(SliceString(Format::Text($Conversation->LastMessage), 100), '/messages/' . $Conversation->ConversationID . '/#Item_' . $JumpToItem, 'Message');
    echo '<div class="Meta">';
    echo Format::Date($Conversation->DateLastMessage);
    echo '<span>&bull;</span>';
    printf(Gdn::Translate(Plural($Conversation->CountMessages, '%s message', '%s messages')), $Conversation->CountMessages);
    if ($Conversation->CountNewMessages > 0) {
        echo '<span>&bull;</span>';
        echo '<em>';
        printf(Gdn::Translate('%s new'), $Conversation->CountNewMessages);
        echo '</em>';
    }
Example #29
0
function WriteActivityComment($Comment, &$Sender, &$Session)
{
    $Author = UserBuilder($Comment, 'Activity');
    $PhotoAnchor = UserPhoto($Author, 'Photo');
    $CssClass = 'Item ActivityComment Condensed ' . $Comment->ActivityType;
    if ($PhotoAnchor != '') {
        $CssClass .= ' HasPhoto';
    }
    ?>
<li id="Activity_<?php 
    echo $Comment->ActivityID;
    ?>
" class="<?php 
    echo $CssClass;
    ?>
">
   <?php 
    if ($PhotoAnchor != '') {
        ?>
   <div class="Author Photo"><?php 
        echo $PhotoAnchor;
        ?>
</div>
   <?php 
    }
    ?>
   <div class="ItemContent ActivityComment">
      <?php 
    echo UserAnchor($Author, 'Title Name');
    ?>
      <div class="Excerpt"><?php 
    echo Gdn_Format::Display($Comment->Story);
    ?>
</div>
      <div class="Meta">
         <span class="DateCreated"><?php 
    echo Gdn_Format::Date($Comment->DateInserted);
    ?>
</span>
         <?php 
    if ($Session->UserID == $Comment->InsertUserID || $Session->CheckPermission('Garden.Activity.Delete')) {
        echo Anchor(T('Delete'), 'dashboard/activity/delete/' . $Comment->ActivityID . '/' . $Session->TransientKey() . '?Return=' . urlencode(Gdn_Url::Request()), 'DeleteComment');
    }
    ?>
      </div>
   </div>
</li>
<?php 
}
   $this->EventArguments['Conversation'] = $Conversation;
?>
<li class="<?php echo $CssClass; ?>">
   <?php
   $Names = '';
   $PhotoUser = NULL;
   foreach ($Conversation->Participants as $User) {
      if (GetValue('UserID', $User) == Gdn::Session()->UserID)
         continue;
      $Names = ConcatSep(', ', $Names, GetValue('Name', $User));
      if (!$PhotoUser && GetValue('Photo', $User))
         $PhotoUser = $User;
   }
   ?>
   <?php if ($PhotoUser) { ?>
   <div class="Photo"><?php echo UserPhoto($PhotoUser); ?></div>
   <?php } ?>
   <div class="ItemContent Conversation">
      <?php
      $Url = '/messages/'.$Conversation->ConversationID.'/#Item_'.$JumpToItem;

      if ($Names) {
         echo '<h3 class="Users">', Anchor(htmlspecialchars($Names), $Url), '</h3>';
      }
      if ($SubjectsVisible && $Subject = GetValue('Subject', $Conversation)) {
         echo '<div class="Subject"><b>'.Anchor(htmlspecialchars($Subject), $Url).'</b></div>';
      }
      ?>
      <div class="Excerpt"><?php echo Anchor($Message, $Url, 'Message'); ?></div>
      <div class="Meta">
         <?php