コード例 #1
0
ファイル: templateHelper.php プロジェクト: ForAEdesWeb/AEW1
 public static function getCategory($pid, $maxLevel = -1, $sub = '')
 {
     static $res = array();
     if ($maxLevel == '-1') {
         $maxLevel = '999999';
     }
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('a.id AS id, a.title as title');
     $query->from('#__categories AS a');
     $query->join('LEFT', $db->quoteName('#__categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt');
     // Filter by the type
     $query->where('a.extension =' . $db->quote('com_content'));
     $query->where('a.parent_id = ' . $pid);
     $query->where('a.published = 1');
     if ($maxLevel) {
         $query->where('a.level <= ' . (int) $maxLevel);
     }
     $query->group('a.id, a.title, a.level, a.lft, a.rgt');
     $query->order('a.lft ASC');
     // Get the options.
     $db->setQuery($query);
     $rows = $db->loadObjectList();
     foreach ($rows as $row) {
         $row->url = ContentHelperRoute::getCategoryRoute($row->id);
         $row->title = $sub . $row->title;
         array_push($res, $row);
         if (DecorHelper::getChildCategory($row->id, $maxLevel)) {
             DecorHelper::getCategory($row->id, $maxLevel, $sub != '' ? $sub . '-' : '-');
         }
     }
     return $res;
 }
コード例 #2
0
ファイル: masonrylayout.php プロジェクト: ForAEdesWeb/AEW1
 * ------------------------------------------------------------------------
 */
defined('_JEXEC') or die;
JHtml::addIncludePath(JPATH_COMPONENT . '/helpers');
JHtml::addIncludePath(T3_PATH . '/html/com_content');
JHtml::addIncludePath(dirname(dirname(__FILE__)));
JHtml::_('behavior.caption');
//register the helper class
JLoader::register('DecorHelper', T3_TEMPLATE_PATH . '/templateHelper.php');
//template params
$tplparams = JFactory::getApplication()->getTemplate(true)->params;
//Load grid items
DecorHelper::loadGridItems();
$catparent = '';
if ($this->maxLevel != 0) {
    $catparent = DecorHelper::getCategory($this->category->id, $this->maxLevel);
}
$bloglayout = isset($_COOKIE['blog-layout']) ? $_COOKIE['blog-layout'] : '0';
?>

<div class="ja-masonry-wrap">
<!-- Add toolbar change grid -->
<div class="toobar-grid">
    <h3><?php 
echo JText::_('TPL_FILTER_PROJECT');
?>
</h3>
    <!-- Filter by category -->
    <?php 
if ($catparent) {
    ?>