Autodoc
  • Namespace
  • Class
  • Tree

Namespaces

  • BlueTihi
    • Context
  • Brickrouge
    • Element
      • Nodes
    • Renderer
    • Widget
  • ICanBoogie
    • ActiveRecord
    • AutoConfig
    • CLDR
    • Composer
    • Core
    • Event
    • Exception
    • HTTP
      • Dispatcher
      • Request
    • I18n
      • Translator
    • Mailer
    • Modules
      • Taxonomy
        • Support
      • Thumbnailer
        • Versions
    • Object
    • Operation
      • Dispatcher
    • Prototype
    • Routes
    • Routing
      • Dispatcher
    • Session
  • Icybee
    • ActiveRecord
      • Model
    • ConfigOperation
    • Document
    • EditBlock
    • Element
      • ActionbarContextual
      • ActionbarSearch
      • ActionbarToolbar
    • FormBlock
    • Installer
    • ManageBlock
    • Modules
      • Articles
      • Cache
        • Collection
        • ManageBlock
      • Comments
        • ManageBlock
      • Contents
        • ManageBlock
      • Dashboard
      • Editor
        • Collection
      • Files
        • File
        • ManageBlock
      • Forms
        • Form
        • ManageBlock
      • I18n
      • Images
        • ManageBlock
      • Members
      • Modules
        • ManageBlock
      • Nodes
        • ManageBlock
        • Module
      • Pages
        • BreadcrumbElement
        • LanguagesElement
        • ManageBlock
        • NavigationBranchElement
        • NavigationElement
        • Page
        • PageController
      • Registry
      • Search
      • Seo
      • Sites
        • ManageBlock
      • Taxonomy
        • Terms
          • ManageBlock
        • Vocabulary
          • ManageBlock
      • Users
        • ManageBlock
        • NonceLogin
        • Roles
      • Views
        • ActiveRecordProvider
        • Collection
        • View
    • Operation
      • ActiveRecord
      • Constructor
      • Module
      • Widget
    • Rendering
  • None
  • Patron
  • PHP

Classes

  • Actionbar
  • ActionbarContextual
  • ActionbarNav
  • ActionbarNew
  • ActionbarSearch
  • ActionbarTitle
  • ActionbarToolbar
  • AdminMenu
  • Form
  • Group
  • Navigation
  • SiteMenu
  • UserMenu
  1 <?php
  2 
  3 /*
  4  * This file is part of the Icybee package.
  5  *
  6  * (c) Olivier Laviale <olivier.laviale@gmail.com>
  7  *
  8  * For the full copyright and license information, please view the LICENSE
  9  * file that was distributed with this source code.
 10  */
 11 
 12 namespace Icybee\Element;
 13 
 14 use ICanBoogie\Route;
 15 
 16 use Brickrouge\A;
 17 use Brickrouge\DropdownMenu;
 18 use Brickrouge\Element;
 19 
 20 class SiteMenu extends Element
 21 {
 22     public function __construct(array $attributes=array())
 23     {
 24         parent::__construct('div', $attributes);
 25     }
 26 
 27     public function render_inner_html()
 28     {
 29         global $core;
 30 
 31         $user = $core->user;
 32         $site = $core->site;
 33 
 34         $site_title = \ICanBoogie\escape($site->admin_title);
 35 
 36         if (!$site_title)
 37         {
 38             $site_title = \ICanBoogie\escape($site->title) . '<span class="language">:' . $site->language . '</span>';
 39         }
 40 
 41         $options = array();
 42 
 43         try
 44         {
 45             $query = $core->models['sites']->order('admin_title, title');
 46 
 47             $restricted_sites = $user->restricted_sites_ids;
 48 
 49             if ($restricted_sites)
 50             {
 51                 $query->where(array('siteid' => $restricted_sites));
 52             }
 53 
 54             $sites = $query->all;
 55 
 56             if (count($sites) > 1)
 57             {
 58                 $path = $core->request->decontextualized_path;
 59 
 60                 foreach ($sites as $asite)
 61                 {
 62                     $title = $asite->admin_title;
 63 
 64                     if (!$title)
 65                     {
 66                         $title = new Element('span', array(Element::INNER_HTML => $asite->title . '<span class="language">:' . $asite->language . '</span>'));
 67                     }
 68 
 69                     $options[$asite->siteid] = new A($title, $asite->url . $path . '?ssc=1');
 70                 }
 71             }
 72         }
 73         catch (\Exception $e) { /**/ }
 74 
 75         $menu = null;
 76         $menu_toggler = null;
 77 
 78         if ($options)
 79         {
 80             $menu = new DropdownMenu(array
 81             (
 82                 DropdownMenu::OPTIONS => $options,
 83 
 84                 'value' => $site->siteid
 85             ));
 86 
 87             $menu_toggler = <<<EOT
 88 <span class="dropdown-toggle" data-toggle="dropdown"><i class="icon-home icon-white"></i> <span class="caret"></span></span>
 89 EOT;
 90         }
 91         else
 92         {
 93             $menu_toggler = <<<EOT
 94 <i class="icon-home icon-white"></i>
 95 EOT;
 96         }
 97 
 98         return <<<EOT
 99 <div class="btn-group">
100     <a href="$site->url">$site_title</a>
101     $menu_toggler
102     $menu
103 </div>
104 EOT;
105     }
106 }
Autodoc API documentation generated by ApiGen 2.8.0