HosipLan

Untitled

Dec 28th, 2011
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // presenter  render
  2.  
  3. $this->template->data = $data;
  4.  
  5. // presenter form
  6.  
  7. protected function createComponentTableForm()
  8. {
  9.     $form = new UI\Form();
  10.     $form->addDynamic('rows', function ($container) {
  11.         $container->addCheckbox('select');
  12.     });
  13.     $form->addSubmit('delete', 'Smazat');
  14.     return $form;
  15. }
  16.  
  17. // sablona
  18.  
  19. {form tableForm}
  20.  
  21. <tr n:foreach="$data as $id => $row">
  22.     <td>{control rows-$id-select}</td>
  23.     <td n:foreach="$row as $key => $value">{$value}</td>
  24. </tr>
  25.  
  26. {control delete}
  27.  
  28. {/form}
  29.  
  30. // zpracovani
  31.  
  32. public function Submitted($form)
  33. {
  34.     $ids = array_keys(array_filter(function ($row) {
  35.         return $row['select'];
  36.     }, (array)$form->rows->values));
  37. }
Advertisement
Add Comment
Please, Sign In to add comment