Render navbar menu

@param  AbstractContainer $container Container to render
@param  array             $options   Options for controlling rendering
@return string
492660
protected function renderNavbarMenu(AbstractContainer $container, array $options)
    {
        // Create iterator
        $iterator = new \RecursiveIteratorIterator($container, \RecursiveIteratorIterator::SELF_FIRST);
        $iterator->setMaxDepth(self::MAX_RENDER_DEPTH);

        // Add pages
        $html      = '';
        $prevDepth = -1;
        foreach ($iterator as $page) {
            if (!$this->accept($page)) {
                continue;
            }
            // Create navbar page
            $depth = $iterator->getDepth();
            $html .= $this->renderNavbarMenuPage($page, $options, $depth, $prevDepth);

            // Store depth for next iteration
            $prevDepth = $depth;
        }

        // Check if any html was created
        if ($html) {
            // Close open ul/li tags
            for ($i = $prevDepth + 1; $i > 0; $i--) {
                $html .= '</li></ul>';
            }
        }

        return $html;
    }
153973
public function renderForm($options = NULL) {

	//Verify if user send options if not I declare
	if(is_null($options))
	{
	  	$options = array(
		  	'button_type' => 'image',
		  	'button_class' => 'btn-paid-khipu',
		  	'button_submit' => array( 'options' => array(
										
										'value' => 'Pagar con Khipu'
										)),
		  	'button_image' => array( 'options' => array(
										'size' => '100x50',
										'url' => NULL,
										))


	  );
	}

	$values = $this->getFormLabels();
	$html = new \DOMDocument();
	$html->formatOutput = true;

	$form = $html->createElement('form');
	$form->setAttribute('action', $this->getApiUrl());
	$form->setAttribute('method', 'POST');
	foreach($values as $name => $value) {
	  	$input_hidden = $html->createElement('input');
	  	$input_hidden->setAttribute('type', 'hidden');
	  	$input_hidden->setAttribute('name', $name);
	  	$input_hidden->setAttribute('value', $value);
	  	$form->appendChild($input_hidden);
	}
	$input_hidden = $html->createElement('input');
	$input_hidden->setAttribute('type', 'hidden');
	$input_hidden->setAttribute('name', 'agent');
	$input_hidden->setAttribute('value', $this->agent);
	$form->appendChild($input_hidden);

	if($options['button_type'] === 'image')
	{
	  	//Verify if user use custom URL
	  	if(! is_null($options['button_image']['options']['url']) )
	  	{
			$submit = $html->createElement('input');
	  		$submit->setAttribute('class', $options['button_class']);
			$submit->setAttribute('type', 'image');
			$submit->setAttribute('src', $options['button_image']['options']['url']);
	  	}
	  	else
	  	{
	  		//We use default khipu button
		  	$buttons = Khipu::getButtonsKhipu();
		  	if (isset($buttons[$options['button_image']['options']['size']])) {
				$button = $buttons[$options['button_image']['options']['size']];
		  	}
		  	else {
				$button = $buttons['100x50'];
		  	}
		  	$submit = $html->createElement('input');
	  		$submit->setAttribute('class', $options['button_class']);
		  	$submit->setAttribute('type', 'image');
		  	$submit->setAttribute('src', $button);
	  	}
	  
	}
	else
	{
	  	$submit = $html->createElement('input');
	  	$submit->setAttribute('type', 'submit');
	  	$submit->setAttribute('class', $options['button_class']);
	  	$submit->setAttribute('value', $options['button_submit']['options']['value']);
	}

	$form->appendChild($submit);

	$html->appendChild($form);

	return $html->saveHTML();
  }
642419
public function createPageNode(array $options = array())
    {
        $node = new MenuNode();
        $node->type = MenuNode::TYPE_PAGE;

        if (isset($options['label'])) {
            $node->label = $options['label'];
        }

        if (isset($options['translate_label'])) {
            $node->translateLabel = $options['translate_label'];
        }

        if (isset($options['icon'])) {
            $node->iconClass = $options['icon'];
        }

        if (isset($options['roles'])) {
            $node->roles = ArrayUtils::to_array($options['roles']);
        }

        if (isset($options['action'])) {
            $action = $options['action'];

            if (is_array($action)) {
                if (isset($action['target'])) {
                    $node->target = $action['target'];
                }

                if (isset($options['url'])) {
                    $node->url = $options['url'];
                }

                if (isset($action['route'])) {
                    $node->route = $action['route'];
                    $node->routeParams = (isset($action['params']) && is_array($action['params'])) ? $action['params'] : array();
                    $node->url = $this->container->get('router')->generate($node->route, $node->routeParams);
                }
            } else {
                $node->route = $action;
                $node->url = $this->container->get('router')->generate($node->route);
            }
        }

        return $node;
    }
633315
public static function renderCss($options = []) {
		$result = '';
		$list = [];
		$css = Application::get(array('layout', 'css'));
		if (!empty($css)) {
			asort($css);
			foreach ($css as $k=>$v) {
				$script = $k . (strpos($k, '?') !== false ? '&' : '?') . self::getVersion();
				$list[] = $script;
				$result.= '<link href="' . $script . '" rel="stylesheet" type="text/css" />';
			}
		}
		// list is needed for ajax form reloads
		if (!empty($options['return_list'])) {
			return $list;
		}
		return $result;
	}
732064
public function render(\Zend_View_Abstract $view)
    {
        $html = '';
        $glue = $this->getGlue();

        foreach ($this->getIterator() as $key => $item) {
            $html .= $glue;

            if ($item instanceof \Gems_Menu_SubMenuItem) {
                $item = $this->toActionLink($key);
            }

            $html .= \MUtil_Html::renderAny($view, $item);
        }

        return substr($html, strlen($glue));
    }
237313
protected function _render($nav) {
		extract($nav);
		$items = Navigation::order(Navigation::items($path));

		if (empty($items)) {
			return false;
		}

		$defaults = array($this->_tag => array(), $this->_tags[$this->_tag] => array(), 'a' => array());
		$list = array();

		foreach ($items as $key => $options) {
			$title = Inflector::humanize($key);
			extract($options);
			$htmlAttributes = Hash::merge($defaults, $htmlAttributes);

			Reveal::addRule('Page.current', array('self', '__isPageCurrent'), Router::normalize($url));
			if (Reveal::is('Page.current')) {
				$class = 'active';
				if (!empty($htmlAttributes[$this->_tags[$this->_tag]]['class'])) {
					$class = $htmlAttributes[$this->_tags[$this->_tag]]['class'] . ' ' . $class;
				}
				$htmlAttributes = Hash::merge($htmlAttributes, array($this->_tags[$this->_tag] => compact('class')));
			}

			if (method_exists($this->Html, 'icon') && !empty($icon) && count(explode(' ', $icon)) == 1) {
				$icon = $this->Html->icon($icon);
			}

			$title = $icon . $title;

			// Link-ify item's title when it does not match the current page.
			if (!empty($url)) {
				// Allow for link tag customization using `HtmlHelper::loadConfig()`.
				$configPath = dirname(__FILE__) . DS . 'Navigation' . DS;
				$reset = false;

				if (!empty($htmlAttributes['a']['tag'])) {
					$this->Html->loadConfig($htmlAttributes['a']['tag'], $configPath);
					$reset = true;
					unset($htmlAttributes['a']['tag']);
				}

				if (isset($url['prefix']) && false === $url['prefix'] && !empty($this->_View->request->prefix)) {
					$url[$this->_View->request->prefix] = false;
				}

				if (is_array($url) && !isset($url['plugin'])) {
					$url['plugin'] = null;
				}

				$title = $this->Html->link($title, $url, $htmlAttributes['a'], $confirmMessage);
				$reset && $this->Html->loadConfig('reset', $configPath);
			}

			if (!empty($children)) {
				// if (!)$title = $this->Html->tag('span', $title, array('class' => 'title'));
				$title .= $this->_render(array('path' => "$path.$key.children", 'attrs' => $htmlAttributes[$this->_tag]));
			}
			$list[] = $this->Html->tag($this->_tags[$this->_tag], $title, $htmlAttributes[$this->_tags[$this->_tag]]);
		}

		return $this->Html->tag($this->_tag, implode('', $list), $attrs);
	}
885287
public function renderItem($label, $options = array())
    {
        if ($this->tagName === 'nav') {
            $url         = ArrayHelper::removeValue($options, 'href', '#');
            $htmlOptions = ArrayHelper::removeValue($options, 'options', array());
            echo \CHtml::openTag('li', $htmlOptions);
            echo \CHtml::link($label, $url);
            echo \CHtml::closeTag('li');
        } else {
            $htmlOptions = ArrayHelper::removeValue($options, 'options', array());
            echo \CHtml::tag('a', array_merge($htmlOptions, $options), $label);
        }
    }
752028
function menu($menus)
    {
        // Retrieve current user (for permissions)
        $user = Auth::user();

        $templates = [
            "menu" => '
              <ul class="sidebar-menu" data-widget="tree">
                %s
              </ul>
        ',

            "menu_row" => '
          <li class="%s">
            %s
          </li>
        ', // class, link . submenu

            "menu_caret" => '
            <span class="pull-right-container">
              <i class="fa fa-angle-left pull-right"></i>
            </span>',

            "menu_subrow" => '
          <ul class="treeview-menu">
            %s
          </ul>
        ',

            "menu_link" => '
          <a href="%s"><i class="%s text-red"></i><span>%s</span>%s</a>
        ' // url, icon, title
        ];

        $traverse = function ($rows) use (&$traverse, $templates, $user) {
            $menuString = "";
            $hasActive = false;
            foreach ($rows as $menu) {
                if (!empty($menu->permission) and !$user->hasPermission($menu->permission)) {
                    continue;
                }

                $hasActive = false;
                $submenu = "";
                $authorized = true;

                if ($menu->children->count() > 0) {
                    list($submenuString, $hasActive) = $traverse($menu->children);
                    $submenu = "";
                    if (!empty($submenuString)) {
                        $submenu = sprintf($templates['menu_subrow'], $submenuString);
                    } else {
                        $authorized = false;
                    }
                }

                $menu_caret = (!empty($submenu) ? $templates['menu_caret'] : '');
                $link = sprintf($templates['menu_link'],
                    (!empty($menu->route) ? url($menu->route) : '#'),
                    (!empty($menu->icon) ? $menu->icon : 'fa fa-circle-o'),
                    //trans('back-project::base.dashboard')
                    \Lang::has('back-project::menu.' . $menu->title) ? __('back-project::menu.' . $menu->title) : $menu->title,
                    $menu_caret
                );
                $class = (!empty($submenu) ? 'treeview' : '');
                $current_url = \Route::current()->uri();

                if ($authorized) {
                    $menuString .= sprintf($templates['menu_row'], $class, $link . $submenu);
                }
            }

            return [
                $menuString,
                $hasActive
            ];
        };

        list($menu, $hasActive) = $traverse($menus);
        return sprintf($templates['menu'], $menu);
    }
10441
public function render(array $options = [])
    {
        $output = '';

        if ($this->count()) {
            foreach ($this->storage as $key => $value) {
                $output = trim($output);
                switch ($key) {
                    case 'style':
                        if (count($value) == 0) {
                            continue;
                        }

                        $output .= 'style="';
                        foreach ($value as $styleKey => $styleValue) {
                            $output .= $styleKey . ':' . $styleValue . ';';
                        }
                        $output .= '"';

                        break;
                    case 'class':
                        if (count($value) == 0) {
                            continue;
                        }
                        $output .= ' ' . $key . '="' . implode(' ', $value) . '"';
                        break;
                    case 'js':
                        $output .= ' ' . $key . '="' . $value . '"';
                        break;
                    default:
                        if (is_array($value)) {
                            if (count($value) == 0) {
                                continue;
                            }
                            $value = implode(', ', $value);
                        }

                        if (is_bool($value)) {
                            $value = $value === true ? 'true' : 'false';
                        }

                        if (in_array($key, [
                            'controls',
                            'disabled',
                            'readonly',
                            'autocomplete',
                            'checked',
                            'loop',
                            'autoplay',
                            'muted',
                        ])) {
                            $output .= ' ' . $key;
                        } else {
                            $output .= ' ' . $key . '="' . $value . '"';
                        }
                        break;
                }
            }
        }

        return $output;
    }
844843
public function render(array $options = array())
    {
        $url = $this->service->generateEmbedUrl($this);
        $options = array_replace(array(
            'width' => 560,
            'height' => 315,
            'frameborder' => 0,
            'allowfullscreen' => ''
        ), $options);

        $html = <<<HTML
<iframe src="$url" width="{$options['width']}" height="{$options['height']}" frameborder="{$options['frameborder']}" {$options['allowfullscreen']}></iframe>
HTML;
        return $html;
    }
363374
protected function createNavbarContainerClass(array $options)
    {
        // Create navbar container class
        $containerClass = 'navbar';
        if ($options['inverse']) {
            $containerClass .= ' navbar-inverse';
        }
        if ($options['fixed']) {
            $containerClass .= ' navbar-fixed-';
            switch ($options['fixed']) {
                case 'top':
                case 'bottom':
                    $containerClass .= $options['fixed'];
                    break;
                default:
                    throw new Exception\InvalidArgumentException(
                        'Only top and bottom are acceptable navbarFixed options'
                    );
            }
        }
        return $containerClass;
    }
122939
public function render($options = array())
    {
        $options = array_merge($this->defaultOptions, $options);
        return $this->view->make('shareable::twitter', array('options' => $options));
    }
92531
public function renderContainer($name, $page = null, array $options = [])
    {
        $cms = $this->cmsManagerSelector->retrieve();
        $site = $this->siteSelector->retrieve();
        $targetPage = false;

        try {
            if (null === $page) {
                $targetPage = $cms->getCurrentPage();
            } elseif (!$page instanceof PageInterface && \is_string($page)) {
                $targetPage = $cms->getInternalRoute($site, $page);
            } elseif ($page instanceof PageInterface) {
                $targetPage = $page;
            }
        } catch (PageNotFoundException $e) {
            // the snapshot does not exist
            $targetPage = false;
        }

        if (!$targetPage) {
            return '';
        }

        $container = $cms->findContainer($name, $targetPage);

        if (!$container) {
            return '';
        }

        return $this->renderBlock($container, $options);
    }
72989
protected function _inputContainerTemplate($options)
    {
        $inputContainerTemplate = $options['options']['type'] . 'Container' . $options['errorSuffix'];
        if (!$this->templater()->get($inputContainerTemplate)) {
            $inputContainerTemplate = 'inputContainer' . $options['errorSuffix'];
        }

        $_options = new Data($options['options']);
        $before   = $this->_prepareBeforeAfterContainer('before', $_options->get('before'));
        $after    = $this->_prepareBeforeAfterContainer('after', $_options->get('after'));

        return $this->formatTemplate($inputContainerTemplate, [
            'after'         => $after,
            'before'        => $before,
            'error'         => $options['error'],
            'content'       => $options['content'],
            'type'          => $options['options']['type'],
            'required'      => $options['options']['required'] ? ' required' : '',
            'templateVars'  => isset($options['options']['templateVars']) ? $options['options']['templateVars'] : []
        ]);
    }
763550
public static function renderElement($type, $content, $options = [])
    {
        $tag = ArrayHelper::remove($options, 'tag', 'div');

        $class = ArrayHelper::remove($options, 'class');
        Html::addCssClass($options, 'ui ' . $class . ' ' . $type);

        return Html::tag($tag, $content, $options);
    }
347363
protected function _inputContainerTemplate($options)
    {
        $inputContainerTemplate = $options['options']['type'] . 'Container' . $options['errorSuffix'];
        if (!$this->templater()->get($inputContainerTemplate)) {
            $inputContainerTemplate = 'inputContainer' . $options['errorSuffix'];
        }

        return $this->templater()->format($inputContainerTemplate, [
            'content' => $options['content'],
            'error' => $options['error'],
            'required' => $options['options']['required'] ? ' required' : '',
            'type' => $options['options']['type'],
            'templateVars' => isset($options['options']['templateVars']) ? $options['options']['templateVars'] : [],
            'help' => $options['options']['help'],
        ]);
    }
531469
protected function renderNavbarRightMenu(array $options)
    {
        // Get container to use
        $container = $options['rightMenu'];
        $this->parseContainer($container);
        if (null === $container) {
            $container = new Navigation;
        }

        // Set option
        $options['ulClass'] .= ' navbar-right';

        return $this->renderNavbarMenu($container, $options);
    }