Ejemplo n.º 1
0
 public function init(array $params = array())
 {
     // Create top parent container
     $this->workspace = new Container($this);
     // Create main UI menu
     $menu = new Menu($this, $this->workspace);
     $menu->set('class', 'main-menu');
     // Create home item
     $homeItem = new MenuItem($menu);
     $homeItem->set('title', 'Home')->set('class', 'btn-home')->set('content', '<a href="/"><i class="sprite sprite-header_home" href="/"></i></a>');
     // Create site item
     $siteItem = new MenuItem($menu);
     $siteItem->set('title', t('Перейти на веб-сайт', true))->set('class', 'btn-site')->set('content', '<a href="/"><i class="sprite sprite-header_site" href="/"></i></a>');
     // Fire event that ui menu left container has been created
     Event::fire('cms_ui.mainmenu_leftcreated', array(&$menu, &$this));
     // Create exit item
     $exitItem = new MenuItem($menu);
     $exitItem->set('title', t('Выйти', true))->set('class', 'btn-icon-right btn-logout')->set('content', '<a href="signin/logout"><i class="sprite sprite-header_logout" href="/"></i></a>');
     // Create settings item
     $settingsItem = new MenuItem($menu);
     $settingsItem->set('title', t('Выйти', true))->set('class', 'btn-icon-right btn-settings')->set('content', '<a href="settings"><i class="sprite sprite-header_settings" href="/"></i></a>');
     // Create i18n menu
     $i18nMenu = new Menu($this, $menu);
     $i18nMenu->set('title', t('Выберите язык', true))->set('class', 'i18n-list');
     // Iterate all supported locales
     foreach (\samson\core\SamsonLocale::get() as $locale) {
         $localeItem = new MenuItem($i18nMenu);
         $url = $locale == DEFAULT_LOCALE ? '' : '/' . $locale;
         $localeItem->set('class', 'i18n_item-' . $locale . ' ' . ($locale == \samson\core\SamsonLocale::current() ? 'i18n-active' : ''))->set('content', '<a href="' . $url . '">' . $locale . '</a>');
     }
     // Fire event that ui menu container has been created
     Event::fire('cms_ui.mainmenu_created', array(&$menu, &$this));
     // Create main UI menu
     $subMenu = new Menu($this, $menu);
     $subMenu->set('class', 'sub-menu');
     // Fire event that ui sub-menu container has been created
     Event::fire('cms_ui.submenu_created', array(&$subMenu, &$this));
     // Create main-content panel
     $mainPanel = new Container($this, $this->workspace);
     $mainPanel->set('class', 'mainPanel ' . (sizeof($subMenu->children()) ? 'with-sub-menu' : ''));
     /*// Create form with tabs
             $form = new Form($this, $mainPanel);
     
             // Create form tab view
             $tabs = new TabView($form);
     
             // Add tab
             $tab = new Tab($tabs);
             $tab->header->set('content', '<span>Описание</span>');
     
             // Create localized tabs
             foreach (\samson\core\SamsonLocale::get() as $locale) {
                 (new Tab($tab))->header->set('content', '<span>'.$locale.'</span>');
             }*/
     // Fire event that ui workspace container has been created
     Event::fire('cms_ui.workspace_created', array(&$this->workspace, &$this));
     return parent::init($params);
 }
Ejemplo n.º 2
0
 /**
  * @param Container $parent Pointer to parent container
  */
 public function __construct(Container &$parent)
 {
     parent::__construct($parent->renderer, $parent);
     // Create header containers
     $this->header = new Container($parent->renderer, $this);
     $this->header->set('view', 'tab/header');
     $this->header->set('identifier', $this->identifier);
     // Create body containers
     $this->body = new Container($parent->renderer, $this);
     $this->body->set('view', 'tab/body');
     $this->body->set('identifier', $this->identifier);
     /**
      * Add nested tab to current tab.
      * This overloaded add method also connects current tab header & body
      * with added tab header & body which gives generic recursion and separate
      * rendering of inner tab headers and body inside current tab header and body
      * and so on.
      */
     if (is_a($parent, 'samsonos\\cms\\ui\\Tab')) {
         // Add nested tab header container to current header
         $parent->header->add($this->header);
         // Add nested tab body container to current body
         $parent->body->add($this->body);
     }
     // Fire event that tab has been created
     Event::fire('cms_ui.tab_created', array(&$this));
 }
Ejemplo n.º 3
0
 /**
  * @param Container $parent Add parent container
  * @param IViewable $renderer Object for rendering container
  */
 public function __construct(IViewable &$renderer, Container &$parent = null)
 {
     // Define renderer
     $this->renderer =& $renderer;
     // Save pointer to parent form
     $this->parent =& $parent;
     // Generate unique identifier
     $this->identifier = uniqid();
     // Generate generic title
     $this->title = get_class($this) . $this->identifier;
     // If parent container is specified - add this container to it
     if (isset($parent)) {
         $parent->add($this);
     }
     // Fire event that ui container has been created
     Event::fire('cms_ui.container_created', array(&$this));
 }
Ejemplo n.º 4
0
 /**
  * @param Form $form Pointer to parent form container
  * @param TabView $tab Pointer to parent tab container
  * @param \samson\core\IViewable $renderer Renderer object
  */
 public function __construct(Form &$form)
 {
     // Fire event that tab has been created
     Event::fire('cms_ui.tabview_created', array(&$this));
     parent::__construct($form->renderer, $form);
 }
Ejemplo n.º 5
0
 /**
  * @param \samson\core\IViewable $renderer Renderer object
  * @param Container $parent Pointer to parent form container
  */
 public function __construct(IViewable &$renderer, Container &$parent = null)
 {
     // Fire event that form has been created
     Event::fire('cms_ui.form_created', array(&$this));
     parent::__construct($renderer, $parent);
 }