Changeset 10077
- Timestamp:
- 07/02/08 20:14:26 (2 months ago)
- Files:
-
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php (modified) (6 diffs)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_actions.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_form.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_show_actions.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/listSuccess.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/lib/sfAdvancedAdminGenerator.class.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php
r10048 r10077 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);16 <?php if ($bt = $this->getParameterValue('belongs_to.class', '')): ?> 17 $this->belongs_to = $this->getUser()->getAttribute('<?php echo sfInflector::underscore($bt) ?>'); 18 $this->forward404Unless($this->belongs_to); 19 19 <?php endif ?> 20 20 $this->maps = $this->getMaps(); … … 70 70 <?php endif ?> 71 71 $this->pager->init(); 72 <?php if ($ fc = $this->getParameterValue('foreign_class', '')): ?>72 <?php if ($bt = $this->getParameterValue('belongs_to.class', '')): ?> 73 73 $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 74 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($ fc) ?>($this->foreign_class);74 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($bt) ?>($this->belongs_to); 75 75 <?php endif ?> 76 76 } … … 91 91 <?php else: ?> 92 92 $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 93 <?php if ($ fc = $this->getParameterValue('foreign_class', '')): ?>94 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($ fc) ?>($this->foreign_class);93 <?php if ($bt = $this->getParameterValue('belongs_to.class', '')): ?> 94 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($bt) ?>($this->belongs_to); 95 95 <?php endif ?> 96 96 … … 115 115 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 116 116 <?php if (null === $this->getParameterValue('create')): ?> 117 <?php if ($ fc = $this->getParameterValue('foreign_class', '')): ?>118 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($ fc) ?>($this->foreign_class);117 <?php if ($bt = $this->getParameterValue('belongs_to.class', '')): ?> 118 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($bt) ?>($this->belongs_to); 119 119 <?php endif ?> 120 120 <?php endif ?> … … 551 551 <?php endforeach; ?> 552 552 <?php endif; ?> 553 <?php if ($ fc = $this->getParameterValue('foreign_class', '')): ?>554 $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper(sfInflector::underscore($ fc)) ?>_ID, $this->foreign_class->getId());553 <?php if ($bt = $this->getParameterValue('belongs_to.class', '')): ?> 554 $c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper(sfInflector::underscore($bt)) ?>_ID, $this->belongs_to->getId()); 555 555 <?php endif ?> 556 556 } … … 635 635 } 636 636 637 <?php if ($object_actions = $this->getParameterValue('list.object_actions')): ?> 638 <?php foreach ($object_actions as $key => $value): ?> 637 <?php if ($bt = $this->getParameterValue('belongs_to.class')): ?> 638 public function executeBack() 639 { 640 <?php $module = $this->getParameterValue('belongs_to.module')?$this->getParameterValue('belongs_to.module'):$this->getBelongsToClassName(); ?> 641 <?php $action = $this->getParameterValue('belongs_to.action')?$this->getParameterValue('belongs_to.action'):'index' ?> 642 $this->getRequest()->setParameter('id', $this->belongs_to->getId()); 643 $this->forward('<?php echo $module ?>', '<?php echo $action ?>'); 644 } 645 <?php endif ?> 646 647 <?php $object_actions = $this->getParameterValue('list.object_actions') ?> 648 <?php $edit_actions = $this->getParameterValue('edit.actions') ?> 649 <?php $show_actions = $this->getParameterValue('show.actions') ?> 650 <?php if ($object_actions || $edit_actions || $show_actions): ?> 651 <?php $arr = array() ?> 652 <?php if (is_array($object_actions)): ?> 653 <?php $arr = array_merge($arr, $object_actions) ?> 654 <?php endif ?> 655 <?php if (is_array($edit_actions)): ?> 656 <?php $arr = array_merge($arr, $edit_actions) ?> 657 <?php endif ?> 658 <?php if (is_array($show_actions)): ?> 659 <?php $arr = array_merge($arr, $show_actions) ?> 660 <?php endif ?> 661 <?php foreach ($arr as $key => $value): ?> 639 662 <?php if (substr($key, 0, 10) == '_has_many_'): ?> 640 663 public function executeList<?php echo sfInflector::camelize($has_many = substr($key, 10, -1)) ?>s() plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_create_form.php
r10026 r10077 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->getPhpName() != $this->getParameterValue(' foreign_class').'Id'): ?>47 <?php if ($column->getPhpName() != $this->getParameterValue('belongs_to.class').'Id'): ?> 48 48 <?php if (in_array($column->getName(), $hides)) continue ?> 49 49 <?php if ($column->isPrimaryKey()) continue ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_actions.php
r9935 r10077 3 3 <?php if (null !== $editActions): ?> 4 4 <?php foreach ((array) $editActions as $actionName => $params): ?> 5 <?php if ($actionName == '_delete') continue ?> 6 <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?> 5 <?php if (substr($actionName, 0, 10) == '_has_many_'): ?> 6 <?php if ($actionName == '_delete') continue ?> 7 <?php echo $this->addCredentialCondition($this->getButtonToAction(sfInflector::camelize(substr($actionName, 10)), $params, true), $params) ?> 8 <?php else: ?> 9 <?php if ($actionName == '_delete') continue ?> 10 <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?> 11 <?php endif ?> 7 12 <?php endforeach; ?> 8 13 <?php else: ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_form.php
r10026 r10077 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->getPhpName() != $this->getParameterValue(' foreign_class').'Id'): ?>47 <?php if ($column->getPhpName() != $this->getParameterValue('belongs_to.class').'Id'): ?> 48 48 <?php if (in_array($column->getName(), $hides)) continue ?> 49 49 <?php if ($column->isPrimaryKey()) continue ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php
r9935 r10077 1 1 <ul class="sf_admin_actions"> 2 <?php if ($this->getParameterValue('belongs_to.class')): ?> 3 <?php echo $this->getButtonToAction('back', array('action' => 'back'), false) ?> 4 <?php endif ?> 2 5 <?php $listActions = $this->getParameterValue('list.actions') ?> 3 6 <?php if (null !== $listActions): ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_show_actions.php
r9935 r10077 3 3 <?php if (null !== $createActions): ?> 4 4 <?php foreach ((array) $createActions as $actionName => $params): ?> 5 <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?> 5 <?php if (substr($actionName, 0, 10) == '_has_many_'): ?> 6 <?php echo $this->addCredentialCondition($this->getButtonToAction(sfInflector::camelize(substr($actionName, 10)), $params, true), $params) ?> 7 <?php else: ?> 8 <?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?> 9 <?php endif ?> 6 10 <?php endforeach; ?> 7 11 <?php else: ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/listSuccess.php
r10032 r10077 5 5 <div id="sf_admin_container"> 6 6 7 <h1><?php echo $this->getI18NString('list.title', (($value = $this->get ForeignClassName())?$value.'\'s ':'').$this->getModuleName().' list') ?></h1>7 <h1><?php echo $this->getI18NString('list.title', (($value = $this->getBelongsToClassName())?$value.'\'s ':'').$this->getModuleName().' list') ?></h1> 8 8 9 9 <div id="sf_admin_header"> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/lib/sfAdvancedAdminGenerator.class.php
r10048 r10077 128 128 } 129 129 130 public function get ForeignClassName()130 public function getBelongsToClassName() 131 131 { 132 return strtolower($this->getParameterValue(' foreign_class'));132 return strtolower($this->getParameterValue('belongs_to.class')); 133 133 } 134 134 }