function writeModuleDiscussion($Discussion, $Px = 'Bookmark', $showPhotos = false) { ?> <li id="<?php echo "{$Px}_{$Discussion->DiscussionID}"; ?> " class="<?php echo CssClass($Discussion); ?> "> <?php if ($showPhotos) { $firstUser = userBuilder($Discussion, 'First'); echo userPhoto($firstUser, ['LinkClass' => 'IndexPhoto']); } ?> <span class="Options"> <?php // echo OptionsList($Discussion); echo BookmarkButton($Discussion); ?> </span> <div class="Title"><?php echo anchor(Gdn_Format::text($Discussion->Name, false), DiscussionUrl($Discussion) . ($Discussion->CountCommentWatch > 0 ? '#Item_' . $Discussion->CountCommentWatch : ''), 'DiscussionLink'); ?> </div> <div class="Meta DiscussionsModuleMeta"> <?php $Last = new stdClass(); $Last->UserID = $Discussion->LastUserID; $Last->Name = $Discussion->LastName; echo NewComments($Discussion); $translation = pluralTranslate($Discussion->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')); echo '<span class="MItem">' . Gdn_Format::date($Discussion->LastDate, 'html') . UserAnchor($Last) . '</span>'; echo '<span class="MItem CountComments Hidden">' . sprintf($translation, $Discussion->CountComments) . '</span>'; ?> </div> </li> <?php }
/** * * * @param $Discussion * @param $Sender * @param $Session */ function writeDiscussion($Discussion, $Sender, $Session) { $CssClass = CssClass($Discussion); $DiscussionUrl = $Discussion->Url; $Category = CategoryModel::categories($Discussion->CategoryID); if ($Session->UserID) { $DiscussionUrl .= '#latest'; } $Sender->EventArguments['DiscussionUrl'] =& $DiscussionUrl; $Sender->EventArguments['Discussion'] =& $Discussion; $Sender->EventArguments['CssClass'] =& $CssClass; $First = UserBuilder($Discussion, 'First'); $Last = UserBuilder($Discussion, 'Last'); $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; static $FirstDiscussion = true; if (!$FirstDiscussion) { $Sender->fireEvent('BetweenDiscussion'); } else { $FirstDiscussion = false; } $Discussion->CountPages = ceil($Discussion->CountComments / $Sender->CountCommentsPerPage); ?> <li id="Discussion_<?php echo $Discussion->DiscussionID; ?> " class="<?php echo $CssClass; ?> "> <?php if (!property_exists($Sender, 'CanEditDiscussions')) { $Sender->CanEditDiscussions = val('PermsDiscussionsEdit', CategoryModel::categories($Discussion->CategoryID)) && c('Vanilla.AdminCheckboxes.Use'); } $Sender->fireEvent('BeforeDiscussionContent'); ?> <span class="Options"> <?php echo optionsList($Discussion); echo bookmarkButton($Discussion); ?> </span> <div class="ItemContent Discussion"> <div class="Title"> <?php echo adminCheck($Discussion, array('', ' ')) . anchor($DiscussionName, $DiscussionUrl); $Sender->fireEvent('AfterDiscussionTitle'); ?> </div> <div class="Meta Meta-Discussion"> <?php writeTags($Discussion); ?> <span class="MItem MCount ViewCount"><?php printf(pluralTranslate($Discussion->CountViews, '%s view html', '%s views html', t('%s view'), t('%s views')), bigPlural($Discussion->CountViews, '%s view')); ?> </span> <span class="MItem MCount CommentCount"><?php printf(pluralTranslate($Discussion->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), bigPlural($Discussion->CountComments, '%s comment')); ?> </span> <span class="MItem MCount DiscussionScore Hidden"><?php $Score = $Discussion->Score; if ($Score == '') { $Score = 0; } printf(plural($Score, '%s point', '%s points', bigPlural($Score, '%s point'))); ?> </span> <?php echo newComments($Discussion); $Sender->fireEvent('AfterCountMeta'); if ($Discussion->LastCommentID != '') { echo ' <span class="MItem LastCommentBy">' . sprintf(t('Most recent by %1$s'), userAnchor($Last)) . '</span> '; echo ' <span class="MItem LastCommentDate">' . Gdn_Format::date($Discussion->LastDate, 'html') . '</span>'; } else { echo ' <span class="MItem LastCommentBy">' . sprintf(t('Started by %1$s'), userAnchor($First)) . '</span> '; echo ' <span class="MItem LastCommentDate">' . Gdn_Format::date($Discussion->FirstDate, 'html'); if ($Source = val('Source', $Discussion)) { echo ' ' . sprintf(t('via %s'), t($Source . ' Source', $Source)); } echo '</span> '; } if ($Sender->data('_ShowCategoryLink', true) && c('Vanilla.Categories.Use') && $Category) { echo wrap(anchor(htmlspecialchars($Discussion->Category), CategoryUrl($Discussion->CategoryUrlCode)), 'span', array('class' => 'MItem Category ' . $Category['CssClass'])); } $Sender->fireEvent('DiscussionMeta'); ?> </div> </div> <?php $Sender->fireEvent('AfterDiscussionContent'); ?> </li> <?php }