/lib/vendor/symfony/lib/plugins/sfPropelPlugin/data/generator/sfPropelAdmin/default/template/templates/_edit_form.php

https://github.com/proyectoalba/alba · PHP · 86 lines · 73 code · 10 blank · 3 comment · 17 complexity · 7076dd193706f99303dcb91494645764 MD5 · raw file

  1. [?php echo form_tag('<?php echo $this->getModuleName() ?>/save', array(
  2. 'id' => 'sf_admin_edit_form',
  3. 'name' => 'sf_admin_edit_form',
  4. 'multipart' => true,
  5. <?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
  6. <?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
  7. <?php if (false !== strpos($this->getParameterValue('edit.fields.'.$column->getName().'.type'), 'admin_double_list')): ?>
  8. 'onsubmit' => 'double_list_submit(); return true;'
  9. <?php break 2; ?>
  10. <?php endif; ?>
  11. <?php endforeach; ?>
  12. <?php endforeach; ?>
  13. )) ?]
  14. <?php foreach ($this->getPrimaryKey() as $pk): ?>
  15. [?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?]
  16. <?php endforeach; ?>
  17. <?php $first = true ?>
  18. <?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
  19. <?php
  20. if ($category[0] == '-')
  21. {
  22. $category_name = substr($category, 1);
  23. $collapse = true;
  24. if ($first)
  25. {
  26. $first = false;
  27. echo "[?php use_javascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype') ?]\n";
  28. echo "[?php use_javascript(sfConfig::get('sf_admin_web_dir').'/js/collapse') ?]\n";
  29. }
  30. }
  31. else
  32. {
  33. $category_name = $category;
  34. $collapse = false;
  35. }
  36. ?>
  37. <fieldset id="sf_fieldset_<?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($category_name)) ?>" class="<?php if ($collapse): ?> collapse<?php endif; ?>">
  38. <?php if ($category != 'NONE'): ?><h2>[?php echo __('<?php echo $category_name ?>') ?]</h2>
  39. <?php endif; ?>
  40. <?php $hides = $this->getParameterValue('edit.hide', array()) ?>
  41. <?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
  42. <?php if (in_array($column->getName(), $hides)) continue ?>
  43. <?php if ($column->isPrimaryKey()) continue ?>
  44. <?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
  45. <?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
  46. [?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
  47. <?php endif; ?>
  48. <div class="form-row">
  49. [?php echo label_for('<?php echo $this->getParameterValue("edit.fields.".$column->getName().".label_for", $this->getSingularName()."[".$column->getName()."]") ?>', __($labels['<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}']), '<?php if ($column->isNotNull()): ?>class="required" <?php endif; ?>') ?]
  50. <div class="content[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]">
  51. [?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?]
  52. [?php echo form_error('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}', array('class' => 'form-error-msg')) ?]
  53. [?php endif; ?]
  54. [?php $value = <?php echo $this->getColumnEditTag($column); ?>; echo $value ? $value : '&nbsp;' ?]
  55. <?php echo $this->getHelp($column, 'edit') ?>
  56. </div>
  57. </div>
  58. <?php if ($credentials): ?>
  59. [?php endif; ?]
  60. <?php endif; ?>
  61. <?php endforeach; ?>
  62. </fieldset>
  63. <?php endforeach; ?>
  64. [?php include_partial('edit_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
  65. </form>
  66. <ul class="sf_admin_actions">
  67. <?php
  68. /*
  69. * WARNING: delete is a form, it must be outside the main form
  70. */
  71. $editActions = $this->getParameterValue('edit.actions');
  72. ?>
  73. <?php if (null === $editActions || (null !== $editActions && array_key_exists('_delete', $editActions))): ?>
  74. <?php echo $this->addCredentialCondition($this->getButtonToAction('_delete', $editActions['_delete'], true), $editActions['_delete']) ?>
  75. <?php endif; ?>
  76. </ul>