Пример #1
0
 protected function _buildHeaderBranch($parent_id, $level = 0)
 {
     $result = '';
     $OSCOM_CategoryTree = new category_tree();
     if (isset($this->_data[$parent_id])) {
         foreach ($this->_data[$parent_id] as $category_id => $category) {
             $category_link = $category_id;
             if ($level === 0 && isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
                 //we need a opener
             }
             $link_title = $category['name'];
             if (!empty($category['headers_class'])) {
                 $headers_class_extra = $category['headers_class'];
                 $headers_class = 'class=" ' . $category['headers_class'] . ' "';
             } else {
                 $headers_class_extra = null;
                 $headers_class = null;
             }
             if (!empty($category['headers_css_id'])) {
                 $headers_css_id_extra = $category['headers_css_id'];
                 $headers_css_id = 'id="' . $category['headers_css_id'] . '"';
             } else {
                 $headers_css_id_extra = null;
                 $headers_css_id = null;
             }
             if (!empty($category['headers_fa_icon'])) {
                 $headers_fa_icon = '<i class="fa ' . $category['headers_fa_icon'] . '"></i>';
             } else {
                 $headers_fa_icon = null;
             }
             if ($category['type'] == 'div') {
                 $result .= '		<!-- div Startsabc -->';
                 $result .= '			<div ' . $headers_css_id . ' ' . $headers_class . '>';
             }
             if ($category['type'] == 'row') {
                 $result .= '		<!-- row Starts -->';
                 $result .= '			<div ' . $headers_css_id . ' class=" row ' . $headers_class_extra . ' ">';
             }
             if ($category['type'] == 'column') {
                 $result .= '		<!-- column Starts -->';
                 $result .= '			<div ' . $headers_css_id . ' class=" ' . $headers_class_extra . ' ">';
             }
             if ($category['type'] == 'container') {
                 $result .= '		<!-- Container Starts -->';
                 $result .= '			<div ' . $headers_css_id . ' class=" container ' . $headers_class_extra . ' ">';
             }
             if ($category['type'] == 'ul') {
                 $result .= '		<!-- Ul Starts -->';
                 $result .= '			<ul ' . $headers_css_id . ' class=" ' . $headers_class_extra . ' ">';
             }
             if ($category['type'] == 'nav') {
                 $result .= '		<!-- nav Starts -->';
                 $result .= '			<nav ' . $headers_css_id . ' class=" ' . $headers_class_extra . ' " role="navigation">';
             }
             if ($category['type'] == 'logo') {
                 $result .= '					<!-- Logo Starts -->';
                 $result .= '							<div ' . $headers_css_id . ' ' . $headers_class . '>';
                 $result .= '								<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME, '', '', 'class="img-responsive"') . '</a>';
                 $result .= '							</div>';
                 $result .= '					<!-- Logo Ends -->';
             }
             if ($category['type'] == 'link') {
                 $result .= '<li ' . $headers_css_id . ' ' . $headers_class . '><a href="' . tep_href_link($category['headers_url'], '', 'SSL') . '">' . $headers_fa_icon . ' ' . $link_title . '</a></li>';
             }
             if ($category['type'] == 'singlecat') {
                 $result .= '<p class="' . $headers_class . ' ">';
                 $result .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $OSCOM_CategoryTree->getData($category['headers_url'], 'id')) . '">';
                 $result .= $OSCOM_CategoryTree->getData($category['headers_url'], 'categories_name');
                 $result .= '</a>';
                 $result .= '</p>';
             }
             if ($category['type'] == 'text') {
                 $result .= '<p class="' . $headers_class . ' ">' . $link_title . '</p>';
             }
             if ($category['type'] == 'button') {
                 $result .= '<button type="button" ' . $headers_css_id . ' class="btn  ' . $headers_class_extra . ' "><a href="' . $category['headers_url'] . '">' . $link_title . '</a></button>';
             }
             if ($category['type'] == 'cart') {
                 // create the shopping cart
                 global $cart, $currencies;
                 $result .= '<div ' . $headers_css_id . ' class="' . $headers_class_extra . '">';
                 $result .= '    <a href="' . tep_href_link(FILENAME_SHOPPING_CART, '', 'SSL') . '">';
                 $result .= '	 <img src="images/header_cart.png" alt="" class="img-responsive hidden-xs" style="float:left;" height="50" width="44"></a>';
                 $result .= '        <p class="text-left" style="white-space: nowrap;"><strong>Cart Contents (' . $cart->count_contents() . ') items</strong></p>';
                 $result .= '        <p class="text-left" style="white-space: nowrap;">Total: ' . $currencies->format($cart->show_total()) . '</p>';
                 $result .= '</div>';
             }
             //dropdown language
             if ($category['type'] == 'language') {
                 global $lng, $language, $PHP_SELF, $currencies, $HTTP_GET_VARS, $request_type, $currency;
                 $result .= '        <li class="dropdown ' . $headers_class_extra . '">';
                 $result .= '          <a href="#" class="dropdown-toggle" data-toggle="dropdown">';
                 $result .= '						<img id="current_lang" src="' . DIR_WS_LANGUAGES . $language . '/images/icon.gif' . '" width="16" height="11" alt="' . $language . '" /> <span class="hidden-xs">';
                 $result .= sprintf(USER_LOCALIZATION, ucwords($language), $currency);
                 $result .= '</span>';
                 $result .= '<span class="caret"></span></a>';
                 $result .= '<ul class="dropdown-menu" role="menu">';
                 if (substr(basename($PHP_SELF), 0, 8) != 'checkout') {
                     if (count($lng->catalog_languages) > 1) {
                         //echo '<li class="divider"></li>';
                         reset($lng->catalog_languages);
                         while (list($key, $value) = each($lng->catalog_languages)) {
                             $result .= '<li><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'language=' . $key, $request_type) . '">' . tep_image(DIR_WS_LANGUAGES . $value['directory'] . '/images/' . $value['image'], $value['name']) . $value['name'] . '</a></li>';
                         }
                     }
                     // currencies
                     if (isset($currencies) && is_object($currencies) && count($currencies->currencies) > 1) {
                         $result .= '<li class="divider"></li>';
                         reset($currencies->currencies);
                         $currencies_array = array();
                         while (list($key, $value) = each($currencies->currencies)) {
                             $currencies_array[] = array('id' => $key, 'text' => $value['title']);
                             $result .= '<li><a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('language', 'currency')) . 'currency=' . $key, $request_type) . '">' . $value['title'] . '</a></li>';
                         }
                     }
                 }
                 $result .= '          </ul>';
                 $result .= '        </li>';
                 $result .= '				<!-- /LANGUAGE -->';
             }
             //formsearch
             if ($category['type'] == 'formsearch') {
                 global $request_type;
                 $result .= '<div ' . $headers_css_id . ' ' . $headers_class . '>';
                 $result .= tep_draw_form('quick_find', tep_href_link(FILENAME_ADVANCED_SEARCH_RESULT, '', $request_type, false), 'get');
                 $result .= '            <div class="input-group custom-search-form">';
                 $result .= tep_draw_input_field('keywords', '', 'required placeholder="' . TEXT_SEARCH_PLACEHOLDER . '"');
                 $result .= '              <span class="input-group-btn">';
                 $result .= '              <button class="btn btn-default" type="submit">';
                 $result .= '              <i class="fa fa-search"></i>';
                 $result .= '             </button>';
                 $result .= '             </span>';
                 $result .= '             </div><!-- /input-group -->';
                 $result .= tep_draw_hidden_field('search_in_description', '1') . tep_hide_session_id();
                 $result .= '</form>';
                 $result .= '</div>';
             }
             if ($category['type'] == 'formdefault') {
                 $result .= '<form id="search" class="navbar-form  ' . $headers_class . ' " role="search">';
                 $result .= '  <div class="form-group">';
                 $result .= '<input type="text" class="form-control" placeholder="' . $link_title . '">';
                 $result .= '  </div>';
                 $result .= '</form>';
             }
             if ($category['type'] == 'formsubmit') {
                 $result .= '<form class="navbar-form  ' . $headers_class . ' " role="search">';
                 $result .= '  <div class="form-group">';
                 $result .= '<input type="text" class="form-control" placeholder="' . $link_title . '">';
                 $result .= '  </div>';
                 $result .= '  <button type="submit" class="btn btn-default">Submit</button>';
                 $result .= '</form>';
             }
             //For navbar CONTENT only End
             if ($category['type'] == 'navtoggle') {
                 $result .= '<button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".' . $headers_class_extra . '">';
                 $result .= '<span class="sr-only">Toggle Navigation</span>';
                 $result .= '	<i class="fa fa-bars"></i>';
                 $result .= '</button>';
             }
             //We need to check dropdowncat content Start
             if ($category['type'] == 'dropdowncat') {
                 $result .= '<ul ' . $headers_css_id . ' class="nav navbar-nav  ' . $headers_class_extra . ' ">';
                 $result .= '    <li class="dropdown">';
                 $result .= '           <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $OSCOM_CategoryTree->getData($category['headers_url'], 'categories_name') . '<span class="caret"></span></a>';
                 $result .= '        <ul class="dropdown-menu" role="menu">';
                 $result .= $OSCOM_CategoryTree->setRootCategoryID($category['headers_url']);
                 $result .= $OSCOM_CategoryTree->getTree();
                 $result .= '        </ul>';
                 $result .= '    </li>';
                 $result .= '</ul>';
             }
             //We need to check dropdown content Start
             if ($category['type'] == 'dropdown') {
                 $result .= '        <li class="dropdown ' . $headers_class_extra . '">';
                 $result .= '          <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $link_title . '<span class="caret"></span></a>';
                 $result .= '<ul class="dropdown-menu" role="menu">';
             }
             if ($category['type'] == 'nestedlink' && $level > 1) {
                 if ($category['pos'] == 'dropdown-submenu' && $level > 1) {
                     $result .= '<li class=" ' . $headers_class . ' "><a href="#">' . $link_title . '</a><ul class="dropdown-menu">';
                 } else {
                     if ($category['type'] == 'nestedlink' && $level > 1) {
                         $result .= '<li class=" ' . $headers_class . ' "><a href="#">' . $link_title . '</a></li>';
                     }
                 }
             }
             if ($category['type'] == 'nestedtext' && $level > 1) {
                 if ($category['pos'] == 'dropdown-submenu' && $level > 1) {
                     $result .= '<li class=" ' . $headers_class . ' "><a href="#">' . $link_title . '</a><ul class="dropdown-menu">';
                 } else {
                     if ($category['type'] == 'nestedtext' && $level > 1) {
                         $result .= '<li class=" ' . $headers_class . ' "><a href="#">' . $link_title . '</a></li>';
                     }
                 }
             }
             if (isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
                 $result .= $this->_buildHeaderBranch($category_id, $level + 1);
             }
             if ($category['pos'] == 'dropdown-submenu' && $level > 1) {
                 $result .= '</li></ul>';
             }
             //We need to check dropdown content End
             if ($category['type'] == 'dropdown') {
                 $result .= '          </ul>';
                 $result .= '        </li>';
             }
             //We need to close ul's End
             if ($category['type'] == 'ul') {
                 $result .= '			</ul>';
                 $result .= '		<!-- ' . $category['type'] . ' Ends -->';
             }
             //We need to close navbar's End
             if ($category['type'] == 'nav') {
                 $result .= '			</nav>';
                 $result .= '		<!-- ' . $category['type'] . ' Ends -->';
             }
             //we need a closer
             if ($category['type'] == 'div' || $category['type'] == 'container' || $category['type'] == 'row' || $category['type'] == 'column') {
                 $result .= '			</div>';
                 $result .= '		<!-- ' . $category['type'] . ' Ends -->';
             }
             if ($level === 0 && isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
             }
         }
     }
     $result .= '';
     return $result;
 }
Пример #2
0
 protected function _buildHeaderBranch($parent_id, $level = 0)
 {
     $result = '';
     $OSCOM_CategoryTree = new category_tree();
     if (isset($this->_data[$parent_id])) {
         foreach ($this->_data[$parent_id] as $category_id => $category) {
             $category_link = $category_id;
             if ($category['pos'] !== 'null') {
                 $pos = '';
             }
             if ($level === 0 && isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
                 //we need a opener
             }
             $link_title = $category['name'];
             if ($category['type'] == 'header-top') {
                 $result .= '			<div class="header-top">';
                 $result .= '				<div class="container">';
                 $result .= '					<!-- Header Links Starts -->';
                 $result .= '						<div class="col-xs-12 col-sm-8 col-md-12 col-lg-12">';
                 $result .= '							<div class="header-links">';
             }
             if ($category['type'] == 'row') {
                 $result .= '		<!-- row Starts -->';
                 $result .= '			<div class="row">';
             }
             if ($category['type'] == 'column') {
                 $result .= '		<!-- column Starts -->';
                 $result .= '			<div class="' . $link_title . '">';
             }
             if ($category['type'] == 'container') {
                 $result .= '		<!-- Container Starts -->';
                 $result .= '			<div class="container">';
             }
             if ($category['type'] == 'main-header') {
                 $result .= '			<!-- Main Header Starts -->';
                 $result .= '				<div class="main-header">';
                 $result .= '					<div class="row">';
             }
             if ($category['type'] == 'main-menu') {
                 $result .= '			<!-- Main Menu Starts -->';
                 $result .= '				<nav id="main-menu" class="navbar gradient-yellow" role="navigation">';
                 $result .= '				<!-- Nav Header Starts -->';
                 $result .= '					<div class="navbar-header">';
                 $result .= '						<button type="button" class="btn btn-navbar navbar-toggle" data-toggle="collapse" data-target=".navbar-cat-collapse">';
                 $result .= '							<span class="sr-only">Toggle Navigation</span>';
                 $result .= '							<i class="fa fa-bars"></i>';
                 $result .= '						</button>';
                 $result .= '					</div>';
                 $result .= '				<!-- Nav Header Ends -->';
                 $result .= '				<!-- Navbar Cat collapse Starts -->';
                 $result .= '					<div class="collapse navbar-collapse navbar-cat-collapse">';
             }
             if ($category['type'] == 'Logo') {
                 $result .= '					<!-- Logo Starts -->';
                 $result .= '							<div id="logo" class="hidden-xs">';
                 $result .= '								<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME, '', '', 'class="img-responsive"') . '</a>';
                 $result .= '							</div>';
                 $result .= '					<!-- Logo Ends -->';
             }
             /*
                      //For navbar only Start 
             		 if($category['type'] == 'Logo'){
               $result .= '<div class="navbar-header">';
             			
                         $result .= '<a class="navbar-brand" href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'store_logo.png', STORE_NAME, '', '', 'class="img-responsive"') . '</a>';
               $result .= '</div>';
             }		 
             		 if($category['type'] == 'Brand'){
               $result .= '<div class="navbar-header">';
                         $result .= '<a class="navbar-brand" href="#">' . $link_title . '</a>';
               $result .= '</div>';
             }
             		 if($category['type'] == 'Parent'){
               $result .= '';
             }		  
             //For navbar only End
             */
             //For navbar CONTENT only Start
             if ($category['type'] == 'Link') {
                 $result .= '<p class="' . $pos . ' "><a href="' . $category['headers_url'] . '">' . $link_title . '</a></p>';
             }
             if ($category['type'] == 'SingleCat') {
                 $result .= '<p class="' . $pos . ' ">';
                 $result .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $OSCOM_CategoryTree->getData($category['headers_url'], 'id')) . '">';
                 $result .= $OSCOM_CategoryTree->getData($category['headers_url'], 'categories_name');
                 $result .= '</a>';
                 $result .= '</p>';
             }
             if ($category['type'] == 'Text') {
                 $result .= '<p class="' . $pos . ' ">' . $link_title . '</p>';
             }
             if ($category['type'] == 'Button') {
                 $result .= '<button type="button" class="btn btn-info navbar-btn  ' . $pos . ' ">' . $link_title . '</button>';
             }
             if ($category['type'] == 'Cart') {
                 $result .= '<div class="text-right" style="margin: 0px 20px;">';
                 $result .= '    <a href="shopping_cart.php">';
                 $result .= '	 <img src="images/header_cart.png" alt="" class="img-responsive hidden-xs" style="float:left;" height="50" width="44"></a>';
                 $result .= '        <p class="text-left" style="white-space: nowrap;"><strong>Cart Contents</strong></p>';
                 $result .= '        <p class="text-left" style="white-space: nowrap;">0 item(s) totalling $0.00</p>';
                 $result .= '</div>';
             }
             if ($category['type'] == 'FormSearch') {
                 $result .= '<div id="search" class="pull-left">';
                 $result .= '	<div class="row">';
                 $result .= '		<div class="col-lg-12">';
                 $result .= '            <div class="input-group custom-search-form">';
                 $result .= '              <input type="text" class="form-control" placeholder="Search">';
                 $result .= '              <span class="input-group-btn">';
                 $result .= '              <button class="btn btn-default" type="button">';
                 $result .= '              <i class="fa fa-search"></i>';
                 $result .= '             </button>';
                 $result .= '             </span>';
                 $result .= '             </div><!-- /input-group -->';
                 $result .= '        </div>';
                 $result .= '	</div>';
                 $result .= '</div>';
             }
             if ($category['type'] == 'FormDefault') {
                 $result .= '<form id="search" class="navbar-form  ' . $pos . ' " role="search">';
                 $result .= '  <div class="form-group">';
                 $result .= '<input type="text" class="form-control" placeholder="' . $link_title . '">';
                 $result .= '  </div>';
                 $result .= '</form>';
             }
             if ($category['type'] == 'FormSubmit') {
                 $result .= '<form class="navbar-form  ' . $pos . ' " role="search">';
                 $result .= '  <div class="form-group">';
                 $result .= '<input type="text" class="form-control" placeholder="' . $link_title . '">';
                 $result .= '  </div>';
                 $result .= '  <button type="submit" class="btn btn-default">Submit</button>';
                 $result .= '</form>';
             }
             //For navbar CONTENT only End
             //We need to check dropdown content Start
             if ($category['type'] == 'DropdownCat') {
                 $result .= '<ul class="nav navbar-nav  ' . $pos . ' ">';
                 $result .= '        <li class="dropdown">';
                 $result .= '          <a href="#" class="dropdown-toggle" data-toggle="dropdown" data-hover="dropdown">' . $OSCOM_CategoryTree->getData($category['headers_url'], 'categories_name') . '</a>';
                 $result .= '<ul class="dropdown-menu" role="menu">';
                 $result .= $OSCOM_CategoryTree->setRootCategoryID($category['headers_url']);
                 $result .= $OSCOM_CategoryTree->getTree();
                 $result .= '          </ul>';
                 $result .= '        </li>';
                 $result .= '     </ul>';
             }
             //We need to check dropdown content Start
             if ($category['type'] == 'Dropdown') {
                 $result .= '<ul class="nav navbar-nav  ' . $pos . ' ">';
                 $result .= '        <li class="dropdown">';
                 $result .= '          <a href="#" class="dropdown-toggle" data-toggle="dropdown">' . $link_title . '<span class="caret"></span></a>';
                 $result .= '<ul class="dropdown-menu" role="menu">';
             }
             if ($category['type'] == 'nestedlink' && $level > 1) {
                 if ($category['pos'] == 'dropdown-submenu' && $level > 1) {
                     $result .= '<li class=" ' . $pos . ' "><a href="#">' . $link_title . '</a><ul class="dropdown-menu">';
                 } else {
                     if ($category['type'] == 'nestedlink' && $level > 1) {
                         $result .= '<li class=" ' . $pos . ' "><a href="#">' . $link_title . '</a></li>';
                     }
                 }
             }
             if ($category['type'] == 'nestedtext' && $level > 1) {
                 if ($category['pos'] == 'dropdown-submenu' && $level > 1) {
                     $result .= '<li class=" ' . $pos . ' "><a href="#">' . $link_title . '</a><ul class="dropdown-menu">';
                 } else {
                     if ($category['type'] == 'nestedtext' && $level > 1) {
                         $result .= '<li class=" ' . $pos . ' "><a href="#">' . $link_title . '</a></li>';
                     }
                 }
             }
             if (isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
                 $result .= $this->_buildHeaderBranch($category_id, $level + 1);
             }
             if ($category['pos'] == 'dropdown-submenu' && $level > 1) {
                 $result .= '</li></ul>';
             }
             if ($category['type'] == 'Dropdown') {
                 $result .= '          </ul>';
                 $result .= '        </li>';
                 $result .= '     </ul>';
             }
             //We need to check dropdown content End
             if ($category['type'] == 'main-menu') {
                 $result .= '					</div>';
                 $result .= '				<!-- Navbar Cat collapse Ends -->';
                 $result .= '				</nav>';
                 $result .= '			<!-- Main Menu Ends -->';
             }
             if ($category['type'] == 'main-header') {
                 $result .= '				</div>';
                 $result .= '					</div>';
                 $result .= '			<!-- Main Header Ends -->';
             }
             if ($category['type'] == 'Container') {
                 $result .= '			</div>';
                 $result .= '		<!-- Container Ends -->';
             }
             if ($category['type'] == 'Col') {
                 $result .= '			</div>';
                 $result .= '		<!-- Column Ends -->';
             }
             if ($category['type'] == 'Row') {
                 $result .= '			</div>';
                 $result .= '		<!-- Row Ends -->';
             }
             if ($category['type'] == 'header-top') {
                 $result .= '							</div>';
                 $result .= '						</div>';
                 $result .= '						<!-- Header Links Ends -->';
                 $result .= '						</div>';
                 $result .= '					</div>';
             }
             if ($level === 0 && isset($this->_data[$category_id]) && ($this->max_level == '0' || $this->max_level > $level + 1)) {
                 //we need a closer
             }
         }
     }
     $result .= '';
     return $result;
 }