Changeset 9937
- Timestamp:
- 06/27/08 17:23:22 (3 months ago)
- Files:
-
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php (modified) (4 diffs)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php (modified) (2 diffs)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_form.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php
r9935 r9937 14 14 public function preExecute() 15 15 { 16 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> 17 $this->foreign_class = $this->getUser()->getAttribute('<?php echo sfInflector::underscore($fc) ?>'); 18 $this->forward404Unless($this->foreign_class); 19 <?php endif ?> 16 20 $this->maps = $this->getMaps(); 17 21 } … … 83 87 <?php else: ?> 84 88 $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 89 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> 90 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($fc) ?>($this->foreign_class); 91 <?php endif ?> 85 92 86 93 if ($this->getRequest()->getMethod() == sfRequest::POST) … … 103 110 { 104 111 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 112 <?php if (null === $this->getParameterValue('create')): ?> 113 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> 114 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($fc) ?>($this->foreign_class); 115 <?php endif ?> 116 <?php endif ?> 105 117 106 118 if ($this->getRequest()->getMethod() == sfRequest::POST) … … 535 547 <?php endforeach; ?> 536 548 <?php endif; ?> 549 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> 550 $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper(sfInflector::underscore($fc)) ?>_ID, $this->foreign_class->getId()); 551 <?php endif ?> 537 552 } 538 553 plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php
r9935 r9937 45 45 <?php $hides = $this->getParameterValue('create.hide', array()) ?> 46 46 <?php foreach ($this->getColumns('create.display', $category) as $name => $column): ?> 47 <?php if (!$column->isForeignKey() && $column->getPhpName() != $this->getParameterValue('foreign_class').'Id'): ?> 47 48 <?php if (in_array($column->getName(), $hides)) continue ?> 48 49 <?php if ($column->isPrimaryKey()) continue ?> … … 65 66 [?php endif; ?] 66 67 <?php endif; ?> 68 <?php endif ?> 67 69 68 70 <?php endforeach; ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_form.php
r9935 r9937 45 45 <?php $hides = $this->getParameterValue('edit.hide', array()) ?> 46 46 <?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?> 47 <?php if (!$column->isForeignKey() && $column->getPhpName() != $this->getParameterValue('foreign_class').'Id'): ?> 47 48 <?php if (in_array($column->getName(), $hides)) continue ?> 48 49 <?php if ($column->isPrimaryKey()) continue ?> … … 65 66 [?php endif; ?] 66 67 <?php endif; ?> 68 <?php endif ?> 67 69 68 70 <?php endforeach; ?>