Ejemplo n.º 1
0
function renderTree($parentChildArr, $categoriesArr, $route = 'socialmedia')
{
    foreach ($parentChildArr as $itemArr) {
        $id = $itemArr['child_id'];
        $slug = $categoriesArr[$id]['slug'];
        //printR($itemArr);
        //printR($parentChildArr);
        //printR($categoriesArr);
        echo "<ul class='parentCatUl'>";
        echo renderItem($itemArr, $categoriesArr, $route, $slug);
        echo "</ul>";
    }
}
 public function renderItem($item)
 {
     if (is_string($item)) {
         if ($item != strip_tags($item)) {
             return $item;
         }
         return Html::tag('div', $item);
     }
     $name = ArrayHelper::getValue($item, 'name', 'div');
     $content = ArrayHelper::getValue($item, 'content');
     if (is_array($content)) {
         $content = renderItem($content);
     }
     $options = ArrayHelper::getValue($item, 'options', []);
     return Html::tag($name, $content, $options);
 }
Ejemplo n.º 3
0
/**
 * 
 * @param INode $node
 * @param Menu $menu
 * @param bool$subMenu
 */
function renderItem(INode $node, Menu $menu)
{
    $htmlMenu = '<li>';
    if ($menu->isActive($node)) {
        $htmlMenu .= $node->getTitle();
    } else {
        $htmlMenu .= '<a ' . ($menu->isInActive($node) ? 'style="color:red;" ' : NULL) . 'href="?index=' . $node->getUrl() . '">' . $node->getTitle() . '</a>';
    }
    if ($node->hasChildren()) {
        $htmlMenu .= '<ul>';
        foreach ($node->getChildren() as $item) {
            $htmlMenu .= renderItem($item, $menu);
        }
        $htmlMenu .= '</ul>';
    }
    return $htmlMenu . '</li>';
}
Ejemplo n.º 4
0
/**
 * @param array|string $item
 * @return null|string
 */
function renderItem($item)
{
    $options = [];
    if (isset($item['visible']) && $item['visible'] !== true) {
        return null;
    }
    $anchor_options = [];
    if (!isset($item['items']) || empty($item['items'])) {
        $label = '';
        $subitems = '';
        if (isset($item['icon']) && !empty($item['icon'])) {
            $label .= $item['icon'] . ' ';
        }
        $label .= Html::tag('span', $item['label']);
        if (isset($item['badge'])) {
            if (!is_array($item['badge'])) {
                $item['badge'] = ['text' => $item['badge']];
            }
            $opt = ['class' => 'label pull-right'];
            if (isset($item['badge']['class'])) {
                Html::addCssClass($opt, $item['badge']['class']);
            }
            $label .= ' ' . Html::tag('small', $item['badge']['text'], $opt);
        }
    } else {
        $label = '';
        $subitems = '';
        if (isset($item['icon']) && !empty($item['icon'])) {
            $label .= $item['icon'] . ' ';
        }
        $label .= Html::tag('span', $item['label']) . FA::icon('angle-left')->pullRight();
        foreach ($item['items'] as $subitem) {
            $subitems .= renderItem($subitem);
        }
        $opt = ['class' => 'treeview-menu'];
        if (true === $item['selected']) {
            Html::addCssClass($opt, 'menu-open');
        }
        $subitems = Html::tag('ul', $subitems, $opt);
        Html::addCssClass($options, 'treeview');
    }
    if (true === $item['selected']) {
        Html::addCssClass($options, 'active');
    }
    return Html::tag('li', Html::a($label, $item['url'], $anchor_options) . $subitems, $options);
}
Ejemplo n.º 5
0
/**
 * View helper for formating category hierarchies with ul/li
 * 
 */
function renderItem($itemArr, $categoriesArr, $route)
{
    $id = $itemArr['child_id'];
    $out = "<span class='category_name'><a href='";
    //$out.= route($route);
    $out .= $route;
    $out .= "'>";
    $out .= $categoriesArr[$id]['display_name'];
    $out .= "</a></span>";
    if (isset($itemArr['children'])) {
        $out .= "<ul class='category_ul'>";
        foreach ($itemArr['children'] as $child) {
            $out .= "<li>" . renderItem($child, $categoriesArr, $route) . "</li>";
        }
        $out .= "</ul>";
    }
    return $out;
}
Ejemplo n.º 6
0
<?php

function renderItem($item)
{
    if (isset($item)) {
        ?>
  <li>
    <a href="<?php 
        echo $item['url'];
        ?>
"><?php 
        echo htmlspecialchars($item['title']);
        ?>
</a>
  </li>
<?php 
    }
}
?>

<ul>
<?php 
renderItem(array('url' => 'http://google.com/', 'title' => 'Google'));
renderItem(array('url' => 'http://www.baidu.com/', 'title' => '百度'));
?>
</ul>
Ejemplo n.º 7
0
                </div>
                <div class="pull-left info">
                    <p><?php 
echo $Account->name;
?>
</p>

                    <a href="#"><i class="fa fa-circle text-success"></i> Online</a>
                </div>
            </div>
            <!-- sidebar menu: : style can be found in sidebar.less -->
            <ul class="sidebar-menu">
                <li class="header">MAIN NAVIGATION</li>
                <?php 
foreach ($menu_items as $item) {
    echo renderItem($item);
}
?>
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>

    <div class="content-wrapper">
        <section class="content-header">
            <h1><?php 
echo $this->title;
?>
</h1>
        </section>
Ejemplo n.º 8
0
    protected function renderItem(JoomlaRokMenuNode &$item, RokMenuNodeTree &$menu)
    {
        $item_params = $item->getParams();
        //not so elegant solution to add subtext
        $item_subtext = $item_params->get('splitmenu_item_subtext', '');
        if ($item_subtext == '') {
            $item_subtext = false;
        } else {
            $item->addLinkClass('subtext');
        }
        ?>
        <li <?php 
        if ($item->hasListItemClasses()) {
            ?>
class="<?php 
            echo $item->getListItemClasses();
            ?>
"<?php 
        }
        ?>
 <?php 
        if ($item->hasCssId() && $this->activeid) {
            ?>
id="<?php 
            echo $item->getCssId();
            ?>
"<?php 
        }
        ?>
>
            <?php 
        if ($item->getType() == 'menuitem') {
            ?>
                <a <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasLink()) {
                ?>
href="<?php 
                echo $item->getLink();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasTarget()) {
                ?>
target="<?php 
                echo $item->getTarget();
                ?>
"<?php 
            }
            ?>
 <?php 
            if ($item->hasAttribute('onclick')) {
                ?>
onclick="<?php 
                echo $item->getAttribute('onclick');
                ?>
"<?php 
            }
            if ($item->hasLinkAttribs()) {
                ?>
 <?php 
                echo $item->getLinkAttribs();
            }
            ?>
>
                    <span>
                    <?php 
            echo $item->getTitle();
            ?>
                    <?php 
            if (!empty($item_subtext)) {
                ?>
                    <em><?php 
                echo $item_subtext;
                ?>
</em>
                    <?php 
            }
            ?>
                    <?php 
            if ($item->getParent() == 0 && $item->hasChildren()) {
                ?>
                    <span class="daddyicon"></span>
                    <?php 
            }
            ?>
					<?php 
            if ($item->getCssId()) {
                ?>
					<div class="arrow-indicator"></div>
					<?php 
            }
            ?>
                    </span>
                </a>
            <?php 
        } elseif ($item->getType() == 'separator') {
            ?>
                <span <?php 
            if ($item->hasLinkClasses()) {
                ?>
class="<?php 
                echo $item->getLinkClasses();
                ?>
 nolink"<?php 
            }
            ?>
>
                    <span>
                    <?php 
            echo $item->getTitle();
            ?>
                    <?php 
            if (!empty($item_subtext)) {
                ?>
                    <em><?php 
                echo $item_subtext;
                ?>
</em>
                    <?php 
            }
            ?>
                    <?php 
            if ($item->getParent() == 0 && $item->hasChildren()) {
                ?>
                    <span class="daddyicon"></span>
                    <?php 
            }
            ?>
                    </span>
                </span>
            <?php 
        }
        ?>
            <?php 
        if ($item->hasChildren()) {
            ?>
            <ul class="level<?php 
            echo intval($item->getLevel()) + 2;
            ?>
">
                <?php 
            foreach ($item->getChildren() as $child) {
                ?>
                    <?php 
                renderItem($child, $menu);
                ?>
                <?php 
            }
            ?>
            </ul>
            <?php 
        }
        ?>
        </li>
        <?php 
    }
Ejemplo n.º 9
0
@extends('app')

@section('content')

   <h2 class='site_subject'>NBA Social Media</h2>
        <?php 
foreach ($parentChildArr as $itemArr) {
    $route = 'socialmedia/' . $categoriesArr[$itemArr['child_id']]['slug'];
    echo renderItem($itemArr, $categoriesArr, $route);
}
?>
 
       
       
@endsection
Ejemplo n.º 10
0
/**
 * @param array|string $item
 * @return null|string
 */
function renderItem($item)
{
    $options = [];
    if ('|' === $item) {
        return Html::tag('li', null, ['class' => 'divider']);
    }
    if ($item['visible'] !== true) {
        return null;
    }
    if (true === $item['selected']) {
        Html::addCssClass($options, 'active');
    }
    $anchor_options = [];
    if (!isset($item['items']) || empty($item['items'])) {
        $label = '';
        $subitems = '';
        if (isset($item['icon'])) {
            $label .= FA::icon($item['icon']) . ' ';
        }
        $label .= $item['label'];
    } else {
        $label = '';
        $subitems = '';
        if (isset($item['icon'])) {
            $label .= FA::icon($item['icon']) . ' ';
        }
        $label .= $item['label'] . Html::tag('span', null, ['class' => 'caret']);
        foreach ($item['items'] as $subitem) {
            $subitems .= renderItem($subitem);
        }
        $subitems = Html::tag('ul', $subitems, ['class' => 'dropdown-menu', 'role' => 'menu']);
        Html::addCssClass($options, 'dropdown');
        Html::addCssClass($anchor_options, 'dropdown-toggle');
        $anchor_options['data-toggle'] = 'dropdown';
        $anchor_options['role'] = 'button';
        $anchor_options['aria-expanded'] = 'false';
    }
    return Html::tag('li', Html::a($label, $item['url'], $anchor_options) . $subitems, $options);
}
Ejemplo n.º 11
0
        $class .= ' parent';
    }
    if (!empty($class)) {
        $class = ' class="' . trim($class) . '"';
    }
    echo '<li' . $class . '>';
    // Render the menu item.
    renderItem($item->type, $item);
    // The next item is deeper.
    if ($item->deeper) {
        echo '<ul class="pushy-submenu no-bullet">';
        // Render the parent menu item.
        echo '<li' . $class . '>';
        // Reset $item->deeper so we don't get a chevron on the submenu
        $item->deeper = 0;
        renderItem($item->type, $item);
        echo '</li>';
        // End parent menu item
    } elseif ($item->shallower) {
        // The next item is shallower.
        echo '</li>';
        echo str_repeat('</ul><div class="pushy-close-submenu"></div></li>', $item->level_diff);
    } else {
        // The next item is on the same level.
        echo '</li>';
    }
}
?>
</ul>
<?php 
/**
Ejemplo n.º 12
0
<?php

require '../bootstrap.php';
require '../includes.php';
$mesh = getSDK();
$cart = $mesh->carts->createCart('E0E0F07D794746CA8A5956C6B5FD504F');
$cart->load();
// iterate over the cart itself
$contents = '';
foreach ($cart as $item) {
    $contents .= renderItem($item);
}
$products = '';
foreach ($cart->getProducts() as $product) {
    $products .= renderProduct($product);
}
echo theme('cart', array('items' => $contents, 'products' => $products, 'contentsCount' => $cart->getContentsCount(), 'productsCount' => $cart->getProductsCount()));
/**
 * display functions
 */
function renderItem(MESH\Commerce\Carts\CartItem $item)
{
    $products = '';
    foreach ($item->getProducts() as $product) {
        $products .= renderProduct($product);
    }
    return theme('cart-item', array('type' => $item->getType(), 'products' => $products));
}
function renderProduct(MESH\Commerce\Products\ListableProduct $product)
{
    return theme('product-item', array('name' => $product->getName(), 'main' => $product->getMainImage()->getResizedUrl(50, 50)));