private function printErrorMessage($params = array(), $message = '') { if (!$message) { $info = JSNRenderHelper::getInfoView($params); $message = JText::sprintf('JSN_RAWMODE_MESSAGE_NOT_SUPPORTED_YET', '"' . JString::strtoupper($info['layout']) . '"', '"' . JString::strtoupper($info['extension']) . '"'); } echo JSNHtmlHelper::openTag('div', array('class' => 'show-message-not-supported-yet')) . $message . JSNHtmlHelper::closeTag('div'); return; }
/** * Only render positions and set data to joomla document. * * @return void */ public function renderEmptyModule() { $document = JFactory::getDocument(); $positions = self::getTemplatePositions(); if ($positions == null) { /** if template not set load positions in index.php file **/ @($positions = $this->_template->loadXMLPositions()); } if (count($positions)) { foreach ($positions as $position) { if ($document->countModules($position->name)) { $buffer = JSNTplTemplateHelper::openTag('div', array('class' => "jsn-element-container_inner")); $buffer .= JSNTplTemplateHelper::openTag('div', array('class' => "jsn-position", 'id' => $position->name . '-jsnposition')); $buffer .= JSNTplTemplateHelper::openTag('p') . $position->name . JSNHtmlHelper::closeTag('p'); $buffer .= JSNTplTemplateHelper::closeTag('div'); $buffer .= JSNTplTemplateHelper::closeTag('div'); $document->setBuffer($buffer, 'modules', $position->name); } } } }
/** * * Render page * * @param (Number) $vms_mode is mode of request */ protected function renderModules($vms_mode = 0) { $domDocument = new DOMDocument(); $domDocument->loadHTML($this->_document); if ($vms_mode) { foreach ($this->_columns as $column) { $contentPosition = $domDocument->getElementById($column); if (is_object($contentPosition)) { $class = $contentPosition->getAttribute('class'); $contentPosition->setAttribute('class', 'jsn-element-container_inner'); $contentPosition->removeAttribute('id'); foreach ($contentPosition->childNodes as $child) { $contentPosition->removeChild($child); } $positionContainer = $domDocument->createElement("div"); $positionContainer->setAttribute('class', 'poweradmin-position'); $positionContainer->setAttribute('id', $column . '-jsnposition'); $positionTitle = $domDocument->createElement("p", $column); $positionContainer->appendChild($positionTitle); $contentPosition->appendChild($positionContainer); } } $this->_document = $domDocument->saveHTML(); } else { $modulesHTML = array(); foreach ($this->_columns as $column) { $contentPosition = $domDocument->getElementById($column); if (is_object($contentPosition)) { $class = $contentPosition->getAttribute('class'); $contentPosition->setAttribute('class', 'jsn-element-container_inner'); $contentPosition->removeAttribute('id'); foreach ($contentPosition->childNodes as $child) { $contentPosition->removeChild($child); } if ((string) $column != '') { $modules = JModuleHelper::getModules($column); } else { $modules = array(); } $HTML = ''; if (count($modules)) { foreach ($modules as $mod) { if ($mod->position != $column) { continue; } $HTML .= JSNHtmlHelper::openTag('div', array('class' => "poweradmin-module-item", 'id' => $mod->id . '-jsnposition-published', 'title' => $mod->title, 'showtitle' => $mod->showtitle)) . JSNHtmlHelper::openTag('div', array('id' => "moduleid-'.{$mod->id}.'-content")) . JModuleHelper::renderModule($mod, array('style' => 'none')) . JSNHtmlHelper::closeTag('div') . JSNHtmlHelper::closeTag('div'); } } $modulesHTML[$column] = $HTML; $positionContainer = $domDocument->createElement("div"); $positionContainer->setAttribute('class', 'poweradmin-position'); $positionContainer->setAttribute('id', $column . '-jsnposition'); $positionContainer->appendChild(new DOMText('HTML' . $column)); $contentPosition->appendChild($positionContainer); } } $this->_document = $domDocument->saveHTML(); foreach ($modulesHTML as $key => $innerHTML) { $this->_document = str_replace('HTML' . $key, $innerHTML, $this->_document); } } }
/** * Return HTML, subitems in menu * * @param: Array items * @param: int $menuid */ protected function renderItems($mItems, $menuid) { $items = ''; if (count($mItems)) { for ($i = 0; $i < count($mItems); $i++) { $publish = $mItems[$i]->published == 1 ? 'Unpublish' : 'Publish'; $class_unpublish = $mItems[$i]->published == 0 ? ' unpublish' : ''; $default = $mItems[$i]->home == 1 ? ' default' : ''; $defaultIndicator = $mItems[$i]->home == 1 ? ' <ins class="menu-default-indicator"></ins>' : ''; $uri = new JURI($mItems[$i]->link); $link = $uri->toString(); if (!JURI::isInternal($link)) { if (JString::strtolower($link) != JString::strtolower($_SERVER['HTTP_HOST'])) { $link = '#'; } } else { if ($mItems[$i]->link == '#') { $link = '#'; } else { $link = JURI::root() . $link; } } if ($link != '#') { if (strpos($link, '?') === false) { $link .= '?Itemid=' . $mItems[$i]->id; } else { $link .= '&Itemid=' . $mItems[$i]->id; } } if ($mItems[$i]->type == 'alias') { jimport('joomla.html.parameter'); $aliasparams = new JRegistry(); $aliasparams->loadString($mItems[$i]->params); $address_itemid = $aliasparams->get('aliasoptions'); if ((int) $address_itemid > 0) { $address_item = $this->getMenuItem($address_itemid); if (is_object($address_item)) { $link = $address_item->link; } else { if (is_array($address_item)) { $link = $address_item['link']; } } if (strpos($link, '?') === false) { $link .= '?aliasoptions=' . $address_itemid . '&Itemid=' . $mItems[$i]->id; } else { $link .= '&aliasoptions=' . $address_itemid . '&Itemid=' . $mItems[$i]->id; } $mItems[$i]->link = $link; } } if ($this->hasChild($mItems[$i]->id)) { $subItems = $this->getItems($mItems[$i]->menutype, $mItems[$i]->id); $items .= JSNHtmlHelper::openTag('li', array('id' => $publish . '-menutypeid' . $menuid . '-' . $mItems[$i]->id, 'class' => 'moveable')) . JSNHtmlHelper::openTag('a', array('onClick' => 'javascript:void(0);', 'class' => $default . $class_unpublish, 'link' => $link, 'title' => $this->getMenuItemType($mItems[$i]->link))) . $mItems[$i]->title . $defaultIndicator . JSNHtmlHelper::closeTag('a'); $items .= JSNHtmlHelper::openTag('ul', array('class' => 'jsn-menu-items', 'style' => 'display:none;', 'id' => 'parentid-' . $mItems[$i]->id)) . $this->renderItems($subItems, $menuid) . JSNHtmlHelper::closeTag('ul'); $items .= JSNHtmlHelper::closeTag('li'); } else { $items .= JSNHtmlHelper::openTag('li', array('id' => $publish . '-menutypeid' . $menuid . '-' . $mItems[$i]->id, 'class' => 'moveable')) . JSNHtmlHelper::openTag('a', array('onClick' => 'javascript:void(0);', 'class' => $default . $class_unpublish, 'link' => $link, 'title' => $this->getMenuItemType($mItems[$i]->link))) . $mItems[$i]->title . $defaultIndicator . JSNHtmlHelper::closeTag('a') . JSNHtmlHelper::closeTag('li'); } } } return $items; }
/** * * Render all modules not assign to default position * * @param Array $modules * @return: HTML */ public function renderModulesNotDefaultPosition($modules) { $position_html = JSNHtmlHelper::openTag('div', array('class' => "jsn-element-container")); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "jsn-element-container_inner jsn-notdefault-element")); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "clearbreak")) . JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::openTag('div', array('class' => 'jsn-poweradmin-position', 'id' => 'notdefault-jsnposition')); $count = count($modules); for ($i = 0; $i < $count; $i++) { $module = $modules[$i]; $checked_out = $module->checked_out ? ' <i class="checked-out icon-lock"></i>' : ''; $module->published = (int) $module->published; $published = $module->published == 0 ? 'unpublished' : 'published'; $class_publish = $module->published == 0 ? ' jsn-module-unpublish' : ''; if ($module->assignment == '' || $module->assignment == 'except') { $class_unassignment = ' jsn-module-unassignment'; } else { $class_unassignment = ''; } $position_html .= JSNHtmlHelper::openTag('div', array('class' => 'jsn-bootstrap poweradmin-module-item ' . $class_unassignment . $class_publish, 'id' => $module->id . '-jsnposition-' . $published, 'title' => $module->moduletype)); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "poweradmin-module-item-drag-handle")) . JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "poweradmin-module-item-inner")); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "poweradmin-module-item-inner-text")); $position_html .= $module->title; $position_html .= JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "clearbreak")) . JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::closeTag('div'); $position_html .= $checked_out; $position_html .= JSNHtmlHelper::openTag('div', array('class' => "clearbreak")) . JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::closeTag('div'); } $position_html .= JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "clearbreak")) . JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::openTag('div', array('class' => "clearbreak")) . JSNHtmlHelper::closeTag('div'); $position_html .= JSNHtmlHelper::closeTag('div'); return $position_html; }
/** * * Only render empty component */ public function renderEmptyComponent() { $component = $this->_document->getBuffer('component'); $component_buffer = JSNHtmlHelper::openTag('div', array('class' => "jsn-component-container", 'id' => "jsnrender-component")) . JSNHtmlHelper::openTag('p') . $this->_document->getTitle() . JSNHtmlHelper::closeTag('p') . JSNHtmlHelper::closeTag('div'); $this->_document->setBuffer($component_buffer, 'component'); }
/** * * Get menutypes */ public function menuTypeDropDownList($canAddMenuType = true) { if (!count($this->_menus)) { $this->_menus = $this->getMenus(); } $HTML = array(); $dropDownList = array(); $titleLists = array(); $dropDownList[] = JSNHtmlHelper::openTag('div', array('id' => 'jsn-menutypes')); $dropDownList[] = JSNHtmlHelper::openTag('div', array('class' => 'jsn-scrollable')); $dropDownList[] = JSNHtmlHelper::openTag('div', array('class' => 'viewport')); $dropDownList[] = JSNHtmlHelper::openTag('div', array('class' => 'overview')); $dropDownList[] = JSNHtmlHelper::openTag('ul', array('class' => 'jsn-menu-dropdown-lists', 'id' => 'jsn-menu-dropdown-list', 'next-id' => $this->getNextMenuTypeId())); for ($i = 0; $i < count($this->_menus); $i++) { $titleLists[$i] = JSNHtmlHelper::openTag('div', array('class' => 'jsn-menutype-title', 'id' => 'jsn-menutype-title-' . $this->_menus[$i]->id, 'menutype' => $this->_menus[$i]->menutype, 'menuid' => $this->_menus[$i]->id, 'menutitle' => $this->_menus[$i]->title)); $titleLists[$i] .= '<div class="btn-group">'; $titleLists[$i] .= JSNHtmlHelper::openTag('btn', array('class' => 'btn menutype-title', 'menutype' => $this->_menus[$i]->menutype, 'menuid' => $this->_menus[$i]->id, 'menutitle' => $this->_menus[$i]->title)); $titleLists[$i] .= $this->_menus[$i]->title; $titleLists[$i] .= JSNHtmlHelper::closeTag('btn'); $titleLists[$i] .= '<button class="btn dropdown-toggle" type="button" data-toggle="dropdown"> <span class="caret"></span> </button>'; $titleLists[$i] .= '</div>'; $titleLists[$i] .= JSNHtmlHelper::closeTag('div'); $dropDownList[] = JSNHtmlHelper::openTag('li', array('id' => 'dropdownmenutype-' . $this->_menus[$i]->id)) . JSNHtmlHelper::openTag('a', array('class' => 'text', 'href' => 'javascript:void(0)')) . $this->_menus[$i]->title . JSNHtmlHelper::closeTag('a') . JSNHtmlHelper::closeTag('li'); } $dropDownList[] = JSNHtmlHelper::closeTag('ul'); $dropDownList[] = JSNHtmlHelper::closeTag('div'); $dropDownList[] = JSNHtmlHelper::closeTag('div'); $dropDownList[] = '<div class="scrollbar"><div class="track"><div class="thumb"><div class="end"></div></div></div></div>'; $dropDownList[] = '<div class="clearfix"></div>'; $dropDownList[] = JSNHtmlHelper::closeTag('div'); if ($canAddMenuType) { $dropDownList[] = JSNHtmlHelper::openTag('div', array('id' => 'add-new-menu')) . JSNHtmlHelper::openTag('a', array('class' => 'text', 'href' => 'javascript:void(0)')) . JText::_('JSN_POWERADMIN_ADD_NEW_MENU', true) . JSNHtmlHelper::closeTag('a') . JSNHtmlHelper::closeTag('div'); } $dropDownList[] = JSNHtmlHelper::closeTag('div'); $titleLists[] = JSNHtmlHelper::openTag('span', array('class' => 'dropdown-arrow')) . JSNHtmlHelper::closeTag('span'); // $dropDownList[] = JSNHtmlHelper::closeTag('ul'); $HTML = JSNHtmlHelper::openTag('div', array('class' => 'jsn-menu-selector jsn-menu-selector-disabled', 'id' => 'jsn-rawmode-menu-selector')); $HTML .= implode(PHP_EOL, $titleLists) . implode(PHP_EOL, $dropDownList); $HTML .= JSNHtmlHelper::closeTag('div'); return $HTML; }
" dir="<?php echo $doc->getDirection(); ?> " > <head> <style type="text/css"> body{ background:#FFF; } </style> <?php /** Add Scripts and StyleSheets to header of page **/ $header = array(); $header[] = JSNHtmlHelper::addCustomStyle(JSN_POWERADMIN_STYLE_URI, 'styles.css'); $header[] = JSNHtmlHelper::addCustomStyle(JSN_POWERADMIN_STYLE_URI, 'visualmode_styles.css'); $header[] = JSNHtmlHelper::addCustomStyle(JURI::root() . 'media/system/css/', 'modal.css'); $header[] = $this->jsnpwrender->getHeader(); echo implode(PHP_EOL, $header); $this->JSNMedia->addMedia(); ?> </head> <?php $body = $this->jsnpwrender->getBody(); ?> <body <?php echo $body->attr; ?> > <div id="jsn-page-container" > <?php echo $body->html;