コード例 #1
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Cédric Alfonsi, <*****@*****.**>
  * @param  array options
  * @param  string subgridClass
  * @return mixed
  */
 public function __construct($options = array(), $subgridClass = '')
 {
     parent::__construct($options);
     $this->initSubgridClass($subgridClass);
     //the class exists
     if (!class_exists($this->subgridClass)) {
         throw new Exception('the subgrid class does not exist : ' . $this->subgridClass);
     }
     $this->subGridContainer = new $this->subgridClass(array());
     //the instance is an instance of the good class
     if (is_a($this->subGridContainer, $this->subgridClass) && is_a($this->subGridContainer, 'tao_helpers_grid_GridContainer')) {
         $returnValue = $this->subGridContainer->getGrid()->getColumnsModel();
     } else {
         throw new common_Exception('invalid subgrid class : ' . $this->subgridClass);
     }
 }
コード例 #2
0
ファイル: create.class.php プロジェクト: RuGa/GridClassKey
 /**
  * Used to set values on the resource record sent to the template for derivative classes
  *
  * @return void
  */
 public function prepareResource()
 {
     $settings = $this->resource->getProperties('gridclasskey');
     if (is_array($settings) && !empty($settings)) {
         foreach ($settings as $k => $v) {
             $this->resourceArray['gridclasskey-property-' . $k] = $v;
         }
     } elseif ($this->parent) {
         $parentSettings = $this->parent->getProperties('gridclasskey');
         if (is_array($parentSettings) && isset($parentSettings['child-properties'])) {
             $settings = json_decode($parentSettings['child-properties'], 1);
             $this->resourceArray['properties'] = $settings;
             if (isset($settings['gridclasskey']) && !empty($settings['gridclasskey'])) {
                 foreach ($settings['gridclasskey'] as $k => $v) {
                     $this->resourceArray['gridclasskey-property-' . $k] = $v;
                 }
             }
         }
     }
 }
コード例 #3
0
 public function beforeSave()
 {
     $this->object->set('class_key', 'GridContainer');
     $this->object->set('hide_children_in_tree', true);
     $this->object->set('cacheable', true);
     $this->object->set('isfolder', true);
     $properties = $this->getProperties();
     $settings = $this->object->getProperties('gridclasskey');
     foreach ($properties as $k => $v) {
         if (substr($k, 0, 22) == 'gridclasskey-property-') {
             $key = substr($k, 22);
             if ($v === 'false') {
                 $v = 0;
             } elseif ($v === 'true') {
                 $v = 1;
             }
             if ($key === 'fields') {
                 $v = json_decode($v, TRUE);
             }
             $settings[$key] = $v;
         }
     }
     $this->object->setProperties($settings, 'gridclasskey');
     return parent::beforeSave();
 }