if ($ChildCategories != '') { $ChildCategories .= ', '; } $ChildCategories .= anchor(Gdn_Format::text($Category->Name), CategoryUrl($Category)); } else { if ($Category->DisplayAs === 'Heading') { $CatList .= '<li id="Category_' . $CategoryID . '" class="CategoryHeading ' . $CssClass . '"> <div class="ItemContent Category"><div class="Options">' . getOptions($Category, $this) . '</div>' . Gdn_Format::text($Category->Name) . '</div> </li>'; $Alt = FALSE; } else { $LastComment = UserBuilder($Category, 'Last'); $AltCss = $Alt ? ' Alt' : ''; $Alt = !$Alt; $CatList .= '<li id="Category_' . $CategoryID . '" class="' . $CssClass . '"> <div class="ItemContent Category">' . '<div class="Options">' . getOptions($Category, $this) . '</div>' . CategoryPhoto($Category) . '<div class="TitleWrap">' . anchor(Gdn_Format::text($Category->Name), CategoryUrl($Category), 'Title') . '</div> <div class="CategoryDescription">' . $Category->Description . '</div> <div class="Meta"> <span class="MItem RSS">' . anchor(img('applications/dashboard/design/images/rss.gif', array('alt' => T('RSS Feed'))), '/categories/' . $Category->UrlCode . '/feed.rss', '', array('title' => T('RSS Feed'))) . '</span> <span class="MItem DiscussionCount">' . sprintf(PluralTranslate($Category->CountDiscussions, '%s discussion html', '%s discussions html', t('%s discussion'), t('%s discussions')), BigPlural($Category->CountDiscussions, '%s discussion')) . '</span> <span class="MItem CommentCount">' . sprintf(PluralTranslate($Category->CountComments, '%s comment html', '%s comments html', t('%s comment'), t('%s comments')), BigPlural($Category->CountComments, '%s comment')) . '</span>'; if ($Category->LastTitle != '') { $CatList .= '<span class="MItem LastDiscussionTitle">' . sprintf(t('Most recent: %1$s by %2$s'), anchor(Gdn_Format::text(sliceString($Category->LastTitle, 40)), $Category->LastUrl), userAnchor($LastComment)) . '</span>' . '<span class="MItem LastCommentDate">' . Gdn_Format::date($Category->LastDateInserted) . '</span>'; } // If this category is one level above the max display depth, and it // has children, add a replacement string for them. if ($MaxDisplayDepth > 0 && $Category->Depth == $MaxDisplayDepth - 1 && $Category->TreeRight - $Category->TreeLeft > 1) { $CatList .= '{ChildCategories}'; } $CatList .= '</div> </div>
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"> <div class="Wrap"> <?php echo GetOptions($Row); echo CategoryPhoto($Row); echo "<{$H}>"; echo anchor(htmlspecialchars($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 } ?> </div> </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'); if (isset($Row['LastCategoryID'])) { $LastCategory = CategoryModel::categories($Row['LastCategoryID']); echo ' <span>', sprintf('in %s', anchor($LastCategory['Name'], CategoryUrl($LastCategory, '', '//'))), '</span>'; } ?> </div> <?php } ?> </div> </td> </tr> <?php if ($WriteChildren === 'rows') { foreach ($Children as $ChildRow) { WriteTableRow($ChildRow, $Depth + 1); } } }
// (yes yes ugly) if (!empty($Category->CssClass)) { preg_match('/\\bfa-(fa-[\\w-]+)\\b/', $Category->CssClass, $categoryFaIcon); } if (isset($categoryFaIcon[1])) { $faIcon = $categoryFaIcon[1]; } else { $faIcon = "fa-align-justify"; } $CatList .= '<li id="Category_' . $CategoryID . '" class="' . $CssClass . '"> <div class="row ItemContent Category"> <div class="col-md-7"> <div class="category-fa-icon-outer"> <i class="fa ' . $faIcon . ' category-fa-icon"></i> </div> ' . CategoryPhoto($Category) . '<div class="TitleWrap">' . Anchor(Gdn_Format::Text($Category->Name), CategoryUrl($Category), 'Title') . '</div> <div class="CategoryDescription">' . $Category->Description . '</div>'; // If this category is one level above the max display depth, and it // has children, add a replacement string for them. if ($MaxDisplayDepth > 0 && $Category->Depth == $MaxDisplayDepth - 1 && $Category->TreeRight - $Category->TreeLeft > 1) { $CatList .= '{ChildCategories}'; } $CatList .= ' </div> <div class="col-md-5 text-right"> ' . GetOptions($Category, $this) . ' <div class="Meta">'; $lastPostsInner = array(); if ($Category->LastTitle != '') { $lastPostsInner[] = $lastPosts[$Category->CategoryID]; }