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\Exception;
 15 use ICanBoogie\Operation;
 16 
 17 use Brickrouge\Button;
 18 use Brickrouge\Element;
 19 use Brickrouge\Form;
 20 
 21 /**
 22  * Base class for configuration blocks.
 23  */
 24 abstract class ConfigBlock extends FormBlock
 25 {
 26     public function render()
 27     {
 28         parent::render();
 29 
 30         $this->element->save();
 31 
 32         return $this;
 33     }
 34 
 35     protected function get_permission()
 36     {
 37         global $core;
 38 
 39         return $core->user->has_permission(Module::PERMISSION_ADMINISTER, $this->module);
 40     }
 41 
 42     protected function access_control()
 43     {
 44         if (!$this->permission)
 45         {
 46             throw new Exception("You don't have permission to access the config block of the %module module", array('module' => $this->module->title));
 47         }
 48     }
 49 
 50     /**
 51      * Add the operation name {@link Module::OPERATION_CONFIG}.
 52      */
 53     protected function lazy_get_attributes()
 54     {
 55         return \ICanBoogie\array_merge_recursive
 56         (
 57             parent::lazy_get_attributes(), array
 58             (
 59                 Form::HIDDENS => array
 60                 (
 61                     Operation::NAME => Module::OPERATION_CONFIG
 62                 )
 63             )
 64         );
 65     }
 66 
 67     protected function alter_actions(array $actions, array $params)
 68     {
 69         return array_merge
 70         (
 71             parent::alter_actions($actions, $params), array
 72             (
 73                 'primary' => new Button('Save', array('class' => 'btn-primary', 'type' => 'submit', 'name' => false))
 74             )
 75         );
 76     }
 77 
 78     protected function alter_values(array $values, array $params)
 79     {
 80         global $core;
 81 
 82         $values = parent::alter_values($values, $params);
 83 
 84         $iterator = new Form(array(Element::CHILDREN => $this->children));
 85 
 86         $registry = $core->registry;
 87         $local = $core->site->metas;
 88 
 89         foreach ($iterator as $child)
 90         {
 91             $name = $child['name'];
 92 
 93             if (!$name)
 94             {
 95                 continue;
 96             }
 97 
 98             $dotted_name = strtr($name, array('[' => '.', ']' => ''));
 99 
100             $value = null;
101 
102             if (strpos($dotted_name, 'local.') === 0)
103             {
104                 $value = $local[substr($dotted_name, 6)];
105             }
106             else if (strpos($dotted_name, 'global.') === 0)
107             {
108                 $value = $registry[substr($dotted_name, 7)];
109             }
110             else
111             {
112                 // COMPAT
113 
114                 $value = $registry[$dotted_name];
115             }
116 
117             if ($value === null)
118             {
119                 continue;
120             }
121 
122             $values[$name] = $value;
123         }
124 
125         return $values;
126     }
127 }
Autodoc API documentation generated by ApiGen 2.8.0