form.ctp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. /**
  3. *
  4. * PHP 5
  5. *
  6. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  7. * Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  8. *
  9. * Licensed under The MIT License
  10. * Redistributions of files must retain the above copyright notice.
  11. *
  12. * @copyright Copyright 2005-2012, Cake Software Foundation, Inc. (http://cakefoundation.org)
  13. * @link http://cakephp.org CakePHP(tm) Project
  14. * @package Cake.View.Scaffolds
  15. * @since CakePHP(tm) v 0.10.0.1076
  16. * @license MIT License (http://www.opensource.org/licenses/mit-license.php)
  17. */
  18. ?>
  19. <div class="<?php echo $pluralVar; ?> form">
  20. <?php
  21. echo $this->Form->create();
  22. echo $this->Form->inputs($scaffoldFields, array('created', 'modified', 'updated'));
  23. echo $this->Form->end(__d('cake', 'Submit'));
  24. ?>
  25. </div>
  26. <div class="actions">
  27. <h3><?php echo __d('cake', 'Actions'); ?></h3>
  28. <ul>
  29. <?php if ($this->request->action != 'add'): ?>
  30. <li><?php echo $this->Form->postLink(
  31. __d('cake', 'Delete'),
  32. array('action' => 'delete', $this->Form->value($modelClass . '.' . $primaryKey)),
  33. null,
  34. __d('cake', 'Are you sure you want to delete # %s?', $this->Form->value($modelClass . '.' . $primaryKey)));
  35. ?></li>
  36. <?php endif; ?>
  37. <li><?php echo $this->Html->link(__d('cake', 'List') . ' ' . $pluralHumanName, array('action' => 'index')); ?></li>
  38. <?php
  39. $done = array();
  40. foreach ($associations as $_type => $_data) {
  41. foreach ($_data as $_alias => $_details) {
  42. if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
  43. echo "\t\t<li>" . $this->Html->link(
  44. __d('cake', 'List %s', Inflector::humanize($_details['controller'])),
  45. array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index')
  46. ) . "</li>\n";
  47. echo "\t\t<li>" . $this->Html->link(
  48. __d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))),
  49. array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
  50. ) . "</li>\n";
  51. $done[] = $_details['controller'];
  52. }
  53. }
  54. }
  55. ?>
  56. </ul>
  57. </div>