Exemplo n.º 1
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Action::onRender()
  */
 public function onRender()
 {
     $elements = $this->getElements();
     $data = array();
     foreach ($this->formData as $index => $row) {
         $line = array();
         $line['name'] = Form::ID . "[]";
         $line[Form::ID] = $row[Form::ID];
         $line['elements'] = array();
         $line['index'] = $index;
         $line['menu'] = new Menu('actions');
         $line['menu']->addItem(new Menu('main'));
         $elements->rewind();
         while ($elements->valid()) {
             $element = $elements->current();
             //               if ($element->renderControlsForView) {
             $element->onRenderControls($this, $line, $this->formData[$index], $index);
             //               } else {
             //                   $element->onRenderLine($this, $line, $row, $index);
             //               }
             $elements->next();
         }
         $this->form->onCreateItemMenu($line['menu'], $this, $row);
         $data[] = $line;
     }
     $this->set('data', $data);
     return parent::onRender();
 }
Exemplo n.º 2
0
 /**
  * (non-PHPdoc)
  *
  * @see \Simplify\Form\Action::onRender()
  */
 public function onRender()
 {
     $this->set(\Simplify\Form::ID, (array) $this->form->getId());
     $data = array();
     foreach ($this->formData as $index => $row) {
         $line = array();
         $line[\Simplify\Form::ID] = $row[\Simplify\Form::ID];
         $line['name'] = \Simplify\Form::ID . "[]";
         $line['label'] = $row['label'];
         $data[] = $line;
     }
     $this->set('data', $data);
     return parent::onRender();
 }
Exemplo n.º 3
0
 /**
  * (non-PHPdoc)
  * 
  * @see Simplify\Form\Action::onRender()
  */
 public function onRender()
 {
     $elements = $this->getElements();
     $headers = array();
     foreach ($elements as $element) {
         $element->onRenderHeaders($this, $headers);
     }
     $data = array();
     foreach ($this->formData as $index => $row) {
         $line = new \ArrayObject();
         $line[Form::ID] = $row[Form::ID];
         $line['name'] = Form::ID . "[]";
         $line['menu'] = new Menu('actions');
         $line['menu']->addItem(new Menu('main'));
         //$line['state'] = Form::STATE_WARNING;
         $line['elements'] = array();
         $elements->rewind();
         while ($elements->valid()) {
             $element = $elements->current();
             $elements->next();
             $element->onRenderLine($this, $line, $row, $index);
         }
         $this->form->onCreateItemMenu($line['menu'], $this, $row);
         $this->form->dispatch('onRenderListRow', $this, $line, $row);
         $data[] = $line;
     }
     $bulk = array();
     $this->form->onCreateBulkOptions($bulk);
     $this->set('headers', $headers);
     $this->set('data', $data);
     $this->set('pager', $this->pager);
     $this->set('bulk', $bulk);
     return parent::onRender();
 }
Exemplo n.º 4
0
 protected function renderForm()
 {
     $elements = $this->getElements();
     $data = array();
     foreach ($this->formData as $index => $row) {
         $line = array();
         $line['name'] = Form::ID . "[]";
         $line[Form::ID] = $row[Form::ID];
         $line['elements'] = array();
         $line['index'] = $index;
         $elements->rewind();
         while ($elements->valid()) {
             $element = $elements->current();
             $element->onRenderControls($this, $line, $this->formData[$index], $index);
             $elements->next();
         }
         $data[] = $line;
     }
     $this->set('data', $data);
     $this->set('showForm', true);
     $calendarAction = \Simplify::request()->get('calendarAction');
     $this->set('saveUrl', $this->url()->set('calendarAction', $calendarAction)->format('json')->build());
     return parent::onRender();
 }
Exemplo n.º 5
0
 /**
  * (non-PHPdoc)
  *
  * @see Simplify\Form\Action::onRender()
  */
 public function onRender()
 {
     $elements = $this->getElements();
     $headers = array();
     foreach ($elements as $element) {
         $element->onRenderHeaders($this, $headers);
     }
     $caption = $this->getCaptionElement();
     $image = $this->getImageElement();
     /*
      * if (! $caption) {
      * throw new \Exception(__('A galeria necessita de um campo de tipo texto'));
      * }
      */
     if (!$image) {
         throw new \Exception(__('A galeria necessita de um campo de tipo imagem'));
     }
     $data = array();
     foreach ($this->formData as $index => $row) {
         $line = array();
         $line[Form::ID] = $row[Form::ID];
         $line['name'] = Form::ID . "[]";
         $line['menu'] = new Menu('actions');
         $line['menu']->addItem(new Menu('main'));
         $line['caption'] = $caption ? $caption->getDisplayValue($this, $row, $index) : false;
         $imageFile = $image->getValue($row);
         $line['imageUrl'] = $image->getImageUrl($imageFile);
         $line['thumbUrl'] = $image->getThumbUrl($imageFile, 340, 340);
         $line['elements'] = array();
         $elements->rewind();
         while ($elements->valid()) {
             $element = $elements->current();
             $elements->next();
             $element->onRenderLine($this, $line, $row, $index);
         }
         $this->form->onCreateItemMenu($line['menu'], $this, $row);
         $data[] = $line;
     }
     $bulk = array();
     $this->form->onCreateBulkOptions($bulk);
     $this->set('data', $data);
     $this->set('bulk', $bulk);
     return parent::onRender();
 }
Exemplo n.º 6
0
 /**
  * (non-PHPdoc)
  * @see \Simplify\Form\Action::onRender()
  */
 public function onRender()
 {
     $elements = $this->getElements();
     $data = array();
     $line = array();
     $line['name'] = \Simplify\Form::ID . "[]";
     $line[\Simplify\Form::ID] = null;
     $line['elements'] = array();
     while ($elements->valid()) {
         $element = $elements->current();
         $line['index'] = $element->getName();
         //$line['menu'] = new \Simplify\Menu('actions');
         //$line['menu']->addItem(new \Simplify\Menu('main'));
         $element->onRenderControls($this, $line, $this->formData[$element->getName()]['data'], $element->getName());
         $elements->next();
     }
     //$this->form->onCreateItemMenu($line['menu'], $this, null);
     $data[] = $line;
     $this->set('data', $data);
     return parent::onRender();
 }