function render_html() { if ($this->getAttribute('logoutPageId')) { $output = org_glizy_helpers_Link::makeLink('link', array('pageId' => $this->getAttribute('logoutPageId'), 'title' => $this->getAttribute('label'), 'cssClass' => $this->getAttribute('cssClass'), 'icon' => $this->getAttribute('icon'))); $this->addOutputCode($output); } }
function process() { $this->_content = new org_glizy_components_BreadcrumbsVO(); $this->_content->label = $this->getAttribute('label'); $this->_content->separator = $this->getAttribute('separator'); $this->_content->cssClass = $this->getAttribute('cssClass'); $menuId = $this->getAttribute('menuId'); $siteMap =& $this->_application->getSiteMap(); $currentMenu = is_null($menuId) ? $this->_application->getCurrentMenu() : $siteMap->getNodeById($menuId); if ($this->extraItem) { array_unshift($this->_content->records, '<span class="' . $this->getAttribute('cssCurrent') . '">' . $this->extraItem . '</span>'); } while (true) { if ($currentMenu->type != 'SYSTEM') { $nodeTitle = empty($currentMenu->titleLink) ? $currentMenu->title : $currentMenu->titleLink; $nodeDescription = empty($currentMenu->linkDescription) ? $nodeTitle : $currentMenu->linkDescription; if (count($this->_content->records)) { if (empty($currentMenu->url)) { array_unshift($this->_content->records, org_glizy_helpers_Link::makeLink('link', array('pageId' => $currentMenu->id, 'title' => $nodeDescription, 'label' => $nodeTitle))); } else { array_unshift($this->_content->records, org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $currentMenu->url, $nodeDescription)); } } else { array_unshift($this->_content->records, '<span class="' . $this->getAttribute('cssCurrent') . '">' . $nodeTitle . '</span>'); } } if ($currentMenu->parentId === 0 || !$currentMenu->parentId) { break; } $tempNode =& $currentMenu->parentNode(); $currentMenu =& $tempNode; } }
function render_html() { if ($this->getAttribute('renderHtml')) { $tag = $this->getAttribute('wrapTag'); $label = (!empty($tag) ? '<' . $tag . '>' : '') . $this->getAttribute('title') . (!empty($tag) ? '</' . $tag . '>' : ''); $output = org_glizy_helpers_Link::makeLink('link', array('cssClass' => $this->getAttribute('cssClass'), 'label' => $label, 'pageId' => $this->_content)); $this->addOutputCode($output); } }
function getItem() { $acl = $this->getAttribute('acl'); if (!empty($acl)) { list($service, $action) = explode(',', $acl); if (!$this->_user->acl($service, $action)) { return false; } } $value = strtolower($this->getAttribute('value')); $label = $this->getAttribute('label'); $url = $this->getAttribute('url'); $routeUrl = $this->getAttribute('routeUrl'); $cssClass = $this->getAttribute('cssClass'); if ($routeUrl) { $title = $label; if ($cssClass) { $label = '<i class="' . $cssClass . '"></i>' . $label; } $label = $this->addWrap($label); $url = org_glizy_helpers_Link::makeLink($routeUrl, array('pageId' => $value, 'title' => $title, 'label' => $label), array(), '', false); $condition = $this->getAttribute('selected'); if (!$condition) { $condition = $value; } $condition = explode(',', $condition); if (count($condition) > 1) { $selected = false; for ($i = 0; $i < count($condition); $i++) { if (__Request::get($condition[$i]) == $condition[$i + 1]) { $selected = true; break; } $i++; } } else { $selected = $value == $this->_application->getPageId(); } return array('url' => $url, 'selected' => $selected); } else { if ($url) { return array('url' => org_glizy_helpers_Link::makeSimpleLink($this->addWrap($label), $url, $label, $cssClass), 'selected' => $value == __Request::get('__url__')); } else { if ($value) { $url = org_glizy_helpers_Link::makeLink($value, array('label' => $this->addWrap($label), 'title' => $label, 'cssClass' => $cssClass), array(), '', false); return array('url' => $url, 'selected' => $value == __Request::get('__url__')); } else { return array('url' => '<span class="' . $cssClass . '">' . $label . '</span>', 'selected' => false); } } } }
function render_html() { $output = '<ul id="' . $this->getId() . '"' . (!is_null($this->getAttribute('cssClass')) ? ' class="' . $this->getAttribute('cssClass') . '"' : '') . '>'; foreach ($this->_items as $item) { $output .= '<li'; $output .= $item['selected'] ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssClassCurrent') . '">' : '>'; if (isset($item['url'])) { $output .= $item['url']; } else { if (!empty($item['key'])) { $output .= org_glizy_helpers_Link::makeLink($item['key'], array('title' => $item['value'], 'cssClass' => @$item['cssClass']), array(), '', false); } else { $output .= $item['value']; } } $output .= '</li>'; } $output .= '</ul>'; $this->addOutputCode($output); }
function _makeNavigationMenu(&$node, $endDepth, &$menu, $skip = false) { $skip = !$skip ? $node->depth < $this->_startDepth : $skip; if ($node->type == 'BLOCK') { return true; } if ($node->depth > $endDepth) { return true; } if ($node->isVisible == 0) { return true; } if (is_string($node->isVisible) && preg_match("/\\{php\\:.*\\}/i", $node->isVisible)) { $phpcode = org_glizy_helpers_PhpScript::parse($node->isVisible); if (!eval($phpcode)) { return true; } } if ($node->type == 'SYSTEM' && !$skip) { return true; } if (!$this->_application->canViewPage($node->id)) { return true; } $nodeTitle = empty($node->titleLink) ? $node->title : $node->titleLink; $nodeDescription = empty($node->linkDescription) ? $nodeTitle : $node->linkDescription; $menuNode = array(); if (!$skip) { $menuNode['id'] = $node->id; $menuNode['title'] = $nodeTitle; $menuNode['label'] = $nodeDescription; $menuNode['depth'] = $node->depth; $menuNode['type'] = $node->pageType; $menuNode['cssClass'] = $node->cssClass; $menuNode['haveChild'] = $node->hasChildNodes(); if ($this->_currentMenuId == $node->id && !$this->getAttribute('forceLink')) { $menuNode['node'] = $nodeTitle; } else { $cssClass = $this->getAttribute('selectLink') && $this->_currentMenuId == $node->id ? $this->getAttribute('cssCurrent') : ''; if (empty($node->url)) { $linkParams = array('pageId' => $node->id, 'title' => $nodeDescription, 'label' => $nodeTitle, 'cssClass' => $cssClass, 'icon' => $node->icon); $menuNode['node'] = org_glizy_helpers_Link::makeLink('link', $linkParams); } else { $url = $node->url; if (strpos($url, 'route:') !== false) { $url = substr($url, 6); $url = __Routing::makeUrl($url, __Request::getAllAsArray()); } $menuNode['node'] = org_glizy_helpers_Link::makeSimpleLink($nodeTitle, $url, $nodeDescription, $cssClass); } } if (!$this->getAttribute('selectLink')) { if (!$this->getAttribute('selectParent')) { $menuNode['selected'] = $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : ''; } else { $parentNode =& $this->_currentMenu->parentNodeByDepth($node->depth); if (is_object($parentNode) && $node->depth > 1) { $menuNode['selected'] = $parentNode->id == $node->id || $this->_currentMenuId == $node->id ? ' ' . $this->getAttribute('attributeToSelect') . '="' . $this->getAttribute('cssCurrent') . '"' : ''; } } } } if (count($menuNode)) { $menu[] = $menuNode; } if ($node->hasChildNodes()) { $childNodes =& $node->childNodes(); $tempMenu = array(); for ($i = 0; $i < count($childNodes); $i++) { $newEndDepth = max($this->_endDepth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0), $node->depth + (in_array($node->id, $this->_menuToOpen) ? 1 : 0)); if ($this->getAttribute('showOnlyChilds')) { if (in_array($node->id, $this->_menuToOpen) || $this->_startMenu->depth == $node->depth || $this->_currentMenuId == $node->id || $this->getAttribute('drawAllChilds')) { $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu); } } else { $this->_makeNavigationMenu($childNodes[$i], $newEndDepth, $tempMenu); } } if (count($tempMenu)) { $menuNode['node'] = $tempMenu; $menuNode['selected'] = ''; if ($this->getAttribute('flat') && count($menu)) { $menu = array_merge($menu, $menuNode['node']); } else { $menu[] = $menuNode; } } } if ($skip && count($menu)) { $menu = $menu[0]['node']; } }
public static function makeLinkWithIcon($routeUrl, $iconName, $params, $deleteMsg = NULL) { $icon = '<i class="' . $iconName . '"></i>'; $params['label'] = $icon; if (!is_null($deleteMsg)) { $deleteJs = 'if (!confirm(\'' . addslashes($deleteMsg) . '\')){return false;}'; } return org_glizy_helpers_Link::makeLink($routeUrl, $params, array(), $deleteJs, false); }