Esempio n. 1
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $elements = $this->getElements($action);
     $pk = $this->getPrimaryKey();
     $line = array();
     $__index = array_merge((array) $index, (array) $this->getName());
     $row = sy_get_param($data, $this->getName(), array());
     $line['id'] = "formData_" . implode('_', $__index);
     $line['name'] = "formData[" . implode('][', $__index) . "][" . \Simplify\Form::ID . "]";
     $line['baseName'] = "formData[" . implode('][', $__index) . "]";
     $line[\Simplify\Form::ID] = sy_get_param($row, \Simplify\Form::ID);
     $line['elements'] = array();
     while ($elements->valid()) {
         $element = $elements->current();
         if ($action->show(Form::ACTION_VIEW)) {
             $element->onRenderLine($action, $line, $row, $__index);
         } else {
             $line['elements'][] = array('label' => $element->getLabel(), 'controls' => $element->onRender($action, $row, $__index)->render());
         }
         $elements->next();
     }
     $this->onRenderRow($line, $row, array($index, $this->getName()));
     $this->set('data', $line);
     return parent::onRender($action, $data, $index);
 }
Esempio n. 2
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Element::onRender()
  */
 public function onRender(\Simplify\Form\Action $action, $data, $index)
 {
     $headers = array();
     $elements = $this->getElements($action);
     while ($elements->valid()) {
         $element = $elements->current();
         $elements->next();
         $element->onRenderHeaders($action, $headers);
     }
     $line = array();
     $line['elements'] = array();
     $elements->rewind();
     while ($elements->valid()) {
         $element = $elements->current();
         $elements->next();
         $element->onRenderControls($action, $line, $data, $index);
     }
     $this->set('headers', $headers);
     $this->set('elements', $line['elements']);
     $names = array_keys($line['elements']);
     $this->set('active', array_shift($names));
     return parent::onRender($action, $data, $index);
 }