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

  • ModelIdColumn
 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\Forms;
13 
14 class ManageBlock extends \Icybee\Modules\Nodes\ManageBlock
15 {
16     public function __construct(Module $module, array $attributes=array())
17     {
18         parent::__construct
19         (
20             $module, $attributes + array
21             (
22                 self::T_COLUMNS_ORDER => array('title', 'is_online', 'modelid', 'uid', 'updated_at')
23             )
24         );
25     }
26 
27     /**
28      * Adds the following columns:
29      *
30      * - `modelid`
31      */
32     protected function get_available_columns()
33     {
34         return array_merge(parent::get_available_columns(), array
35         (
36             'modelid' => __CLASS__ . '\ModelIdColumn'
37         ));
38     }
39 }
40 
41 /*
42  * Columns
43  */
44 
45 namespace Icybee\Modules\Forms\ManageBlock;
46 
47 use Icybee\ManageBlock\Column;
48 use Icybee\ManageBlock\FilterDecorator;
49 use Brickrouge\Alert;
50 
51 /**
52  * Representation of the `modelid` column
53  */
54 class ModelIdColumn extends Column
55 {
56     static protected $modelid_models;
57 
58     public function render_cell($record)
59     {
60         global $core;
61 
62         if (empty(self::$modelid_models))
63         {
64             self::$modelid_models = $core->configs->synthesize('formmodels', 'merge');
65         }
66 
67         $property = $this->id;
68         $modelid = $record->$property;
69         $label = $modelid;
70 
71         if (isset(self::$modelid_models[$modelid]))
72         {
73             $label = $this->t(self::$modelid_models[$modelid]['title']);
74         }
75         else
76         {
77             return new Alert("Undefined model: $modelid", array(Alert::CONTEXT => Alert::CONTEXT_ERROR, Alert::UNDISSMISABLE => true));
78         }
79 
80         return new FilterDecorator($record, $property, $this->is_filtering, $label);
81     }
82 }
Autodoc API documentation generated by ApiGen 2.8.0