Render an XHTML item.

@access public
@author Joel Bout, <joel@taotesting.com>
@param  Resource item The item to render.
@return string The rendered item.
@throws taoItems_models_classes_ItemModelException
779073
public function render( core_kernel_classes_Resource $item, $langCode)
    {
    	$itemService = taoItems_models_classes_ItemsService::singleton();
    	$file = $itemService->getItemDirectory($item)->getFile('index.html');
        $xhtml = $file->read();

        // Check if all needed APIs are referenced.
        $xhtml = $this->replaceDeprecatedApis($xhtml); // throws ItemModelException.

        return $xhtml;
    }
1319504
public function editItemClass()
    {
        $this->defaultData();

        $clazz = $this->getClass($this->getRequestParameter('id'));

        if($this->hasRequestParameter('property_mode')){
            $this->setSessionAttribute('property_mode', $this->getRequestParameter('property_mode'));
        }

        $myForm = $this->getClassForm($clazz, $this->getClassService()->getRootClass());

        if ($this->hasWriteAccess($clazz->getUri())) {
            if($myForm->isSubmited()){
                if($myForm->isValid()){
                    if($clazz instanceof core_kernel_classes_Resource){
                        $this->setData("selectNode", tao_helpers_Uri::encode($clazz->getUri()));
                    }
                    $this->setData('message', __('Class schema saved'));
                    $this->setData('reload', false);
                }
            }
        } else {
            $myForm->setActions(array());
        }
        $this->setData('formTitle', __('Manage item class schema'));
        $this->setData('myForm', $myForm->render());
        $this->setView('form.tpl', 'tao');
    }
552453
public function renderItems()
    {
        $items = [];
        $index = 0;
        foreach ($this->items as $key => $item) {
            if (!is_array($item)) {
                $item = ['content' => $item];
            }
            if (!array_key_exists('label', $item)) {
                if (is_int($key)) {
                    throw new InvalidConfigException("The 'label' option is required.");
                } else {
                    $item['label'] = $key;
                }
            }
            $header = ArrayHelper::remove($item, 'label');
            $options = ArrayHelper::getValue($item, 'options', []);
            Html::addCssClass($options, ['panel' => 'card']);
            $items[] = Html::tag('div', $this->renderItem($header, $item, $index++), $options);
        }

        return implode("\n", $items);
    }
212161
public function render(Renderable $item)
    {
        $output = '';
        $nl = '';
        $group = $item->group();

        if ($item instanceof AssetContract) {
            return $this->renderAsset($item, $group);
        }

        foreach ($item as $asset) {
            $output .= $nl.$this->renderAsset($asset, $group);
            $nl = "\n";
        }

        return $output;
    }
295632
protected function renderItem($item, $depth=0)
	{
		//visibility
		if (isset($item['visible']) && $item['visible'] === false) return '';

		//prepare options
		$options = isset($item['options']) ? $item['options'] : [];
		Html::addCssClass($options, 'depth-' . $depth);
		if (isset($item['active']) && $item['active']) Html::addCssClass($options, 'active');
		if (isset($item['items']) && count($item['items']) > 0) Html::addCssClass($options, 'is-parent');

		//prepare returned code
		$ret = Html::beginTag('li', $options);
		$ret .= $this->createEntry($item, $depth);

		//render children recursively
		if (isset($item['items']) && ($this->maxDepth === null || ($this->maxDepth !== null && $depth + 1 <= $this->maxDepth))) {
			$ret .= Html::beginTag('ul');
			foreach ($item['items'] as $subItem) {
				$ret .= $this->renderItem($subItem, $depth + 1);
			}
			$ret .= Html::endTag('ul');
		}

		//finish and return
		$ret .= Html::endTag('li');
		return $ret;
	}
275983
protected function renderSingleElementHTML(PageLayoutView $parentObject, $item)
    {
        $singleElementHTML = '';
        $unset = false;
        if (!isset($parentObject->tt_contentData['nextThree'][$item['uid']])) {
            $unset = true;
            $parentObject->tt_contentData['nextThree'][$item['uid']] = $item['uid'];
        }
        if (!$parentObject->tt_contentConfig['languageMode']) {
            $singleElementHTML .= '<div class="t3-page-ce-dragitem" id="' . StringUtility::getUniqueId() . '">';
        }
        $singleElementHTML .= $parentObject->tt_content_drawHeader(
            $item,
            $parentObject->tt_contentConfig['showInfo'] ? 15 : 5,
            $parentObject->defLangBinding,
            true,
            true
        );
        $singleElementHTML .= (!empty($item['_ORIG_uid']) ? '<div class="ver-element">' : '')
            . '<div class="t3-page-ce-body-inner t3-page-ce-body-inner-' . $item['CType'] . '">'
            . $parentObject->tt_content_drawItem($item)
            . '</div>'
            . (!empty($item['_ORIG_uid']) ? '</div>' : '');
        $singleElementHTML .= $this->tt_content_drawFooter($parentObject, $item);
        if (!$parentObject->tt_contentConfig['languageMode']) {
            $singleElementHTML .= '</div>';
        }
        if ($unset) {
            unset($parentObject->tt_contentData['nextThree'][$item['uid']]);
        }

        return $singleElementHTML;
    }
615502
public function render($item = -1)
	{
		if (!$this->isEnabled()) {
			return;
		}

		return $this->view->make('googlmapper::mapper')
			->withView($this->view)
			->withOptions($this->generateRenderOptions($item))
			->withItems($item > -1 ? [$item => $this->getItem($item)] : $this->getItems())
			->render();
	}
478896
@Override
    public String render(Date date, Locale locale,  Map<String, Object> model) {
        ConcurrentDateFormatAccess dateFormatter = new ConcurrentDateFormatAccess(dateFormat);
        return dateFormatter.convertDateToString(date);
    }
702082
public function renderContent($item)
    {
        $options = ArrayHelper::merge($this->contentOptions, ArrayHelper::getValue($item, 'contentOptions', []));

        $encode = ArrayHelper::getValue($options, 'encode', true);
        $content = $encode ? Html::encode($item['content']) : $item['content'];

        Html::addCssClass($options, 'content');
        if ($item['active']) {
            Html::addCssClass($options, 'active');
        }
        return Html::tag('div', $content, $options);
    }
1273691
protected function renderItem($item)
    {
        $this->validateItems($item);
        $template = ArrayHelper::getValue($item, 'template', $this->linkTemplate);
        $url = Url::to(ArrayHelper::getValue($item, 'url', '#'));
        if (empty($item['top'])) {
            if (empty($item['items'])) {
                $template = str_replace('{icon}', $this->indItem . '{icon}', $template);
            } else {
                $template = '<a href="{url}" class="kv-toggle">{icon}{label}</a>';
                $openOptions = ($item['active']) ? ['class' => 'opened'] : ['class' => 'opened', 'style' => 'display:none'];
                $closeOptions = ($item['active']) ? ['class' => 'closed', 'style' => 'display:none'] : ['class' => 'closed'];
                $indicator = Html::tag('span', $this->indMenuOpen, $openOptions) . Html::tag('span', $this->indMenuClose, $closeOptions);
                $template = str_replace('{icon}', $indicator . '{icon}', $template);
            }
        }
        $icon = empty($item['icon']) ? '' : '<span class="' . $this->iconPrefix . $item['icon'] . '"></span> &nbsp;';
        unset($item['icon'], $item['top']);
        return strtr($template, [
            '{url}' => $url,
            '{label}' => $item['label'],
            '{icon}' => $icon
        ]);
    }
1189745
protected function _renderItem(ItemInterface $item, array $options)
    {
        if (!$item->isDisplayed()) {
            return '';
        }

        $level = $item->getLevel();

        $class = (array)$item->getAttribute('class');

        if ($this->_matcher->isCurrent($item)) {
            $class[] = $options['currentClass'];
        } elseif (isset($options['ancestorClass']) &&
            $this->_matcher->isAncestor($item, $options['matchingDepth'])
        ) {
            $class[] = $options['ancestorClass'];
        }

        if (isset($options['firstClass']) &&
            $item->actsLikeFirst()
        ) {
            $class[] = $options['firstClass'];
        }
        if (isset($options['lastClass']) &&
            $item->actsLikeLast()
        ) {
            $class[] = $options['lastClass'];
        }

        $hasChildren = $item->hasChildren();
        if ($hasChildren &&
            $options['depth'] !== 0
        ) {
            if ($options['branchClass'] !== null &&
                $item->getDisplayChildren()
            ) {
                $class[] = $options['branchClass'];
            }
        } elseif ($options['leafClass'] !== null) {
            $class[] = $options['leafClass'];
        }

        $attributes = $item->getAttributes();
        if (!empty($class)) {
            $attributes['class'] = implode(' ', $class);
        }

        $templater = $this->templater();

        $attributes = $this->_formatAttributes($attributes, $item);

        $templates = (array)$item->getExtra('templates');
        $defaultTemplates = (array)$item->getExtra('defaultTemplates');
        $newTemplates = $templates + $defaultTemplates;
        if ($newTemplates) {
            $templater->push();
            $templater->add($newTemplates);
        }

        $templateVars = (array)$item->getExtra('templateVars');
        $defaultTemplateVars = (array)$item->getExtra('defaultTemplateVars');
        $currentDefaultTemplateVars = (array)$options['defaultTemplateVars'];
        $templateVars =
            $templateVars +
            $defaultTemplateVars +
            $currentDefaultTemplateVars;
        if (empty($templateVars)) {
            $templateVars = null;
        }
        $options['templateVars'] = $templateVars;

        $link = $this->_renderLink($item, $options);

        if ($hasChildren) {
            $nestedClass = (array)$item->getChildrenAttribute('class');
            if ($options['menuLevelClass'] !== null) {
                $nestedClass[] = $options['menuLevelClass'] . $level;
            }
            if ($options['nestedMenuClass'] !== null) {
                $nestedClass[] = $options['nestedMenuClass'];
            }
            $nestedAttributes = $item->getChildrenAttributes();
            $nestedAttributes['class'] = implode(' ', $nestedClass);
            $options['attributes'] = $nestedAttributes;

            $options['childrenTemplates'] = null;
            if ($newTemplates) {
                // item defines new templates that must be ignored by the children
                $options['childrenTemplates'] = $options['defaultTemplates'];
            }
            if ($defaultTemplates) {
                // item defines default templates that must be used by the children
                $options['childrenTemplates'] = $defaultTemplates;
            }

            if ($defaultTemplateVars) {
                // item defines default template vars that must be used by the children
                $options['defaultTemplateVars'] =
                    $defaultTemplateVars +
                    $currentDefaultTemplateVars;
            }

            $nested = $this->_renderNested($item, $options);
        } else {
            $nested = '';
        }

        $rendered = (string)$templater->format('item', [
            'attrs' => $attributes,
            'templateVars' => $templateVars,
            'link' => $link,
            'nest' => $nested
        ]);

        if ($newTemplates) {
            $templater->pop();
        }

        return $rendered;
    }
717165
private function _renderItemSeparated (\stdClass $item) {
		$result = '<script type="text/javascript"';
		if ($item->async) $result .= ' async="async"';
		if ($item->async) $result .= ' defer="defer"';
		if (!$item->external && self::$fileChecking) {
			$fullPath = $this->getAppRoot() . $item->path;
			if (!file_exists($fullPath)) {
				$this->log("File not found in CSS view rendering process ('$fullPath').", 'error');
			}
		}
		$result .= ' src="' . $item->src . '"></script>';
		return $result;
	}
255866
private function renderItems()
    {
        $items = [];
        $icons = $this->icons['items'];
        foreach($icons as $i){
            $labelContent = $i['label'];
            if ($this->encodeLabel) {
                $labelContent = Html::encode($labelContent);
            }
            $label = Html::tag('label',$labelContent)."\n";
            
            $icon = Html::tag('i','',['class'=>$i['icon']])."\n";
            
            $options = ArrayHelper::getValue($i, 'options', []);
            
            if(isset($options['class'])){
                $addClass = 'item '.$options['class'];
                $options = [
                    'class' => $addClass,
                ];
            }else{
                $options['class'] = 'item';
            }
            
            $url = $i['url'];
            $items[] = Html::a($icon.$label,$url,$options)."\n";
        }
        return implode("\n", $items);
    }
376831
protected function renderItems()
    {
        $buttons = [];
        foreach ($this->items as $item) {
            if (is_array($item)) {
                $item['view'] = $this->getView();
                if (!isset($item['tagName'])) {
                    $item['tagName'] = $this->itemTagName;
                }
                if (!isset($item['encodeLabel'])) {
                    $item['encodeLabel'] = $this->encodeLabels;
                }
                if (!isset($item['type'])) {
                    Html::addCssClass($item['options'], 'collection-item');
                } else {
                    Html::addCssClass($item['options'], 'collection-' . $item['type']);
                }
                if (!isset($item['options'])) {
                    $item['options'] = [];
                }

                $items[] = Html::tag($item['tagName'], $item['label'], $item['options']);
            } else {
                $items[] = $item;
            }
        }

        return implode("\n", $items);
    }
1145718
public function item($item, $transformer, $model_name = '')
    {
        $resource = new Item($item, $transformer, $model_name);
        return $this->manager->createData($resource)->toArray();
    }
653832
@Override
    public void renderItem(Listitem item, Document doc) {
        log.trace("item render");
        item.setSelectable(true);
        item.addForward(Events.ON_DOUBLE_CLICK, item.getListbox(), Events.ON_DOUBLE_CLICK);
        addCell(item, "");
        addCell(item, doc.getDateTime());
        addCell(item, doc.getTitle());
        addCell(item, doc.getLocationName());
        addCell(item, doc.getAuthorName());
    }
1060868
protected function render()
    {
        if (!isset($this->items[0])) {
            return '';
        }
        foreach ($this->items as $itemId => $item) {
            $item->setCollapsable(
                self::$id, 
                self::$id . $itemId, 
                in_array($itemId, $this->openedItems));
        }
        $this->setAttribute('id', self::$id);
        $this->addCssClass($this->itemType . '-group');
        return $this
            ->html('<div' . $this->getEltDecorationStr() . '>')
            ->html(implode("\n", $this->items))
            ->html('</div>')
            ->getHtml();
    }