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

  • AdminDecorator
  • AdminIndexController
  • BlockController
  • BlockDecorator
  • ConfigBlock
  • ConfigController
  • ConfigOperation
  • Core
  • DeleteBlock
  • DeleteController
  • Document
  • DocumentDecorator
  • EditBlock
  • EditController
  • FormBlock
  • Hooks
  • InterlockBlock
  • Kses
  • ManageBlock
  • Module
  • Modules
  • StatsDecorator

Constants

  • OPERATION_SAVE_MODE
  • OPERATION_SAVE_MODE_CONTINUE
  • OPERATION_SAVE_MODE_DISPLAY
  • OPERATION_SAVE_MODE_LIST
  • OPERATION_SAVE_MODE_NEW

Functions

  • slugize
  • start
  • strip_stopwords
  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;
 13 
 14 use ICanBoogie\Debug;
 15 use ICanBoogie\Operation;
 16 use ICanBoogie\Route;
 17 
 18 use Brickrouge\A;
 19 use Brickrouge\Alert;
 20 use Brickrouge\DropdownMenu;
 21 
 22 class AdminDecorator
 23 {
 24     protected $component;
 25 
 26     public function __construct($component)
 27     {
 28         $this->component = $component;
 29     }
 30 
 31     protected $changed_site = false;
 32 
 33     public function __toString()
 34     {
 35         try
 36         {
 37             return $this->render();
 38         }
 39         catch (\Exception $e)
 40         {
 41             return Debug::format_alert($e);
 42         }
 43     }
 44 
 45     public function render()
 46     {
 47         global $core;
 48 
 49         $this->add_assets($core->document);
 50 
 51         #
 52 
 53         if ($core->session->last_site_id)
 54         {
 55             if ($core->session->last_site_id != $core->site_id)
 56             {
 57                 $core->session->last_site_id = $core->site_id;
 58 
 59                 if (!$core->request['ssc'])
 60                 {
 61                     $this->changed_site = true;
 62                 }
 63             }
 64         }
 65         else
 66         {
 67             $core->session->last_site_id = $core->site_id;
 68         }
 69 
 70         if ($this->changed_site)
 71         {
 72             \ICanBoogie\log_info("Vous avez changé de site.");
 73         }
 74 
 75         #
 76 
 77         $component = (string) $this->component;
 78         $actionbar = new \Icybee\Element\Actionbar;
 79         $shortcuts = $this->render_shortcuts();
 80         $navigation = $this->render_navigation();
 81 
 82         $alert = $this->render_alerts();
 83 
 84         return <<<EOT
 85 <div id="body-wrapper">
 86     $shortcuts
 87     $navigation
 88     $actionbar
 89 
 90     <div id="contents">
 91         <div class="alert-wrapper">$alert</div>
 92         $component
 93     </div>
 94 </div>
 95 EOT;
 96     }
 97 
 98     protected function add_assets(\Brickrouge\Document $document)
 99     {
100         $document->css->add(\Brickrouge\ASSETS . 'brickrouge.css', -250);
101         $document->css->add(\Icybee\ASSETS . 'icybee.css', -240);
102         $document->css->add(\Icybee\ASSETS . 'admin.css', -200);
103         $document->css->add(\Icybee\ASSETS . 'admin-more.css', -200);
104 
105         $document->js->add(\Icybee\ASSETS . 'mootools.js', -200);
106         $document->js->add(\ICanBoogie\ASSETS . 'icanboogie.js', -190);
107         $document->js->add(\Brickrouge\ASSETS . 'brickrouge.js', -190);
108         $document->js->add(\Icybee\ASSETS . 'admin.js', -180);
109     }
110 
111     protected function render_navigation()
112     {
113         global $core;
114 
115         $user = $core->user;
116 
117         if ($user->is_guest || $user instanceof \Icybee\Modules\Members\Member)
118         {
119             $this->title = 'Icybee';
120 
121             return;
122         }
123 
124         return new \Icybee\Element\Navigation(array('id' => 'navigation'));
125     }
126 
127     protected function render_shortcuts()
128     {
129         global $core;
130 
131         $user = $core->user;
132         $site = $core->site;
133 
134         if ($user->is_guest)
135         {
136             $this->page_title = 'Icybee';
137 
138             $html = '<a href="' . $site->url . '" class="home">' . \ICanBoogie\escape($site->title) . '</a> <i class="icon-home icon-white"></i>';
139         }
140         else
141         {
142             $html = new \Icybee\Element\SiteMenu(array('class' => 'pull-left'))
143             . new \Icybee\Element\UserMenu(array('class' => 'pull-right'));
144         }
145 
146         return '<div id="quick">' . $html . '</div>';
147     }
148 
149     protected function render_alerts()
150     {
151         global $core;
152 
153         $html = '';
154         $types = array('success', 'info', 'error');
155 
156         if (Debug::$mode == Debug::MODE_DEV || $core->user->is_admin)
157         {
158             $types[] = 'debug';
159         }
160 
161         foreach ($types as $type)
162         {
163             $html .= new Alert(Debug::fetch_messages($type), array(Alert::CONTEXT => $type));
164         }
165 
166         return $html;
167     }
168 }
Autodoc API documentation generated by ApiGen 2.8.0