Guest User

Untitled

a guest
Apr 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.17 KB | None | 0 0
  1. ## templates/DataGrid.php
  2. <table>
  3. <?php if(count($template['headings']) > 0){ ?>
  4. <tr><?php foreach($template['headings'] as $heading){ ?>
  5. <th><?php echo $heading; ?></th><?php } ?>
  6. </tr>
  7. <?php } foreach($template['rows'] as $rows){ ?>
  8. <tr><?php foreach($rows as $column){ ?>
  9. <td><?php echo $column; ?></td>
  10. </tr>
  11. <?php } ?>
  12. </table>
  13. ## AdminBaseView.class.php
  14. protected function dataGrid($data, $headings = array())
  15. {
  16. $this -> setAttribute("data", $data);
  17. $this -> setAttribute("headings", $headings);
  18.  
  19. $dataGridRendered = ...
  20.  
  21. $this -> setAttribute("datagrid", $dataGridRendered);
  22. }
  23. ## modules/Products/views/ManageSuccessView.class.php
  24. <?php
  25.  
  26. class Products_ManageSuccessView extends AdminBaseView
  27. {
  28.  
  29. public function executeHtml(AgaviRequestDataHolder $rd)
  30. {
  31. parent::setupHtml($rd);
  32. $products = $model -> getAll();
  33. $this -> dataGrid($products);
  34. }
  35.  
  36. }
  37.  
  38. ?>
  39.  
  40. ## modules/Products/templates/ManageSuccess.php
  41. <h2>Products</h2>
  42. ...
  43. <div id="datagrid">
  44. <?php echo $template['datagrid']; ?>
  45. </div>
Add Comment
Please, Sign In to add comment