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

  • ChangeOperation
  • Collection
  • FeedEditor
  • FeedEditorElement
  • ImageEditor
  • ImageEditorElement
  • Module
  • MultiEditorElement
  • NodeEditor
  • NodeEditorElement
  • PatronEditor
  • PatronEditorElement
  • PHPEditor
  • PHPEditorElement
  • RawEditor
  • RawEditorElement
  • RTEEditor
  • RTEEditorElement
  • SelectorElement
  • TabbableEditor
  • TabbableEditorElement
  • TabbableEditorRenderer
  • TabbableNewPaneOperation
  • TextEditor
  • TextEditorElement
  • TextmarkEditor
  • TextmarkEditorElement
  • WidgetsEditor
  • WidgetsEditorElement

Interfaces

  • Editor
  • EditorElement

Exceptions

  • EditorAlreadyInstantiated
  • EditorNotDefined
  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\Modules\Editor;
 13 
 14 use ICanBoogie\Module;
 15 
 16 use Brickrouge\Element;
 17 use Brickrouge\Text;
 18 
 19 /**
 20  * "Feed" editor.
 21  */
 22 class FeedEditorElement extends Element implements EditorElement
 23 {
 24     private $elements = array();
 25 
 26     public function __construct(array $attributes=array())
 27     {
 28         global $core;
 29 
 30         $constructors = array();
 31         $modules = $core->modules;
 32 
 33         foreach ($modules->descriptors as $module_id => $descriptor)
 34         {
 35             if ($module_id == 'contents' || !$modules->is_extending($module_id, 'contents'))
 36             {
 37                 continue;
 38             }
 39 
 40             $constructors[$module_id] = $descriptor[Module::T_TITLE];
 41         }
 42 
 43         uasort($constructors, 'ICanBoogie\unaccent_compare_ci');
 44 
 45         parent::__construct
 46         (
 47             'div', $attributes + array
 48             (
 49                 self::CHILDREN => array
 50                 (
 51                     $this->elements['constructor'] = new Element
 52                     (
 53                         'select', array
 54                         (
 55                             Element::LABEL => 'Module',
 56                             Element::LABEL_POSITION => 'above',
 57                             Element::REQUIRED => true,
 58                             Element::OPTIONS => array(null => '<sélectionner un module>') + $constructors
 59                         )
 60                     ),
 61 
 62                     $this->elements['limit'] = new Text
 63                     (
 64                         array
 65                         (
 66                             Element::LABEL => "Nombre d'entrées dans le flux",
 67                             Element::LABEL_POSITION => 'above',
 68                             Element::REQUIRED => true,
 69                             Element::DEFAULT_VALUE => 10,
 70 
 71                             'size' => 4
 72                         )
 73                     ),
 74 
 75                     $this->elements['settings'] = new Element
 76                     (
 77                         Element::TYPE_CHECKBOX_GROUP, array
 78                         (
 79                             Element::LABEL => 'Options',
 80                             Element::LABEL_POSITION => 'above',
 81                             Element::OPTIONS => array
 82                             (
 83                                 'is_with_author' => "Mentionner l'auteur",
 84                                 'is_with_category' => "Mentionner les catégories",
 85                                 'is_with_attached' => "Ajouter les pièces jointes"
 86                             ),
 87 
 88                             'class' => 'list'
 89                         )
 90                     )
 91                 ),
 92 
 93                 'class' => 'editor feed combo'
 94             )
 95         );
 96     }
 97 
 98     public function offsetSet($offset, $value)
 99     {
100         if ($offset == 'name')
101         {
102             foreach ($this->elements as $identifier => $element)
103             {
104                 $element['name'] = $value . '[' . $identifier . ']';
105             }
106         }
107 
108         parent::offsetSet($offset, $value);
109     }
110 
111     public function render_inner_html()
112     {
113         $value = $this['value'];
114 
115         if ($value)
116         {
117             if (is_string($value))
118             {
119                 $value = json_decode($value, true);
120             }
121 
122             foreach ($value as $identifier => $v)
123             {
124                 $this->elements[$identifier]['value'] = $v;
125             }
126         }
127 
128         return parent::render_inner_html();
129     }
130 }
Autodoc API documentation generated by ApiGen 2.8.0