Changeset 10048
- Timestamp:
- 07/01/08 21:07:16 (5 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/_list_td_actions.php (modified) (1 diff)
- plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/lib/sfAdvancedAdminGenerator.class.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php
r10032 r10048 71 71 $this->pager->init(); 72 72 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> 73 $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate();73 $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 74 74 $this-><?php echo $this->getSingularName() ?>->set<?php echo sfInflector::camelize($fc) ?>($this->foreign_class); 75 75 <?php endif ?> … … 89 89 <?php if (null === $this->getParameterValue('create')): ?> 90 90 return $this->forward('<?php echo $this->getModuleName() ?>', 'edit'); 91 <?php else: ?> 91 <?php else: ?> 92 92 $this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>(); 93 93 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> … … 461 461 <?php if (!$multisort) :?> 462 462 $this->getUser()->getAttributeHolder()->removeNamespace('sf_admin/<?php echo $this->getSingularName() ?>/sort'); 463 <?php endif; ?> 463 <?php endif; ?> 464 464 465 465 $this->getUser()->setAttribute($sort, $type, 'sf_admin/<?php echo $this->getSingularName() ?>/sort'); … … 634 634 return <?php var_export($this->getParameterValue('maps'))?>; 635 635 } 636 637 <?php if ($object_actions = $this->getParameterValue('list.object_actions')): ?> 638 <?php foreach ($object_actions as $key => $value): ?> 639 <?php if (substr($key, 0, 10) == '_has_many_'): ?> 640 public function executeList<?php echo sfInflector::camelize($has_many = substr($key, 10, -1)) ?>s() 641 { 642 $this->getUser()->setAttribute('<?php echo sfInflector::underscore($this->getClassName()) ?>', $this->get<?php echo $this->getClassName() ?>OrCreate()); 643 $this->forward('<?php echo strtolower($has_many) ?>', 'index'); 644 } 645 646 <?php endif ?> 647 <?php endforeach ?> 648 <?php endif ?> 636 649 } plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_list_td_actions.php
r9939 r10048 4 4 <?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?> 5 5 <?php if (isset($params['condition'])): ?> 6 <?php if (substr($actionName, 0, 10) == '_has_many_'): ?> 7 [?php if ($<?php echo $this->getSingularName() ?>-><?php echo sfInflector::camelize($params['condition']) ?>()): ?] 8 <?php echo $this->addCredentialCondition($this->getHasManyLinkTo(sfInflector::camelize(substr($actionName, 10)), $params, true), $params) ?> 9 [?php endif ?] 10 <?php else: ?> 6 11 [?php if ($<?php echo $this->getSingularName() ?>-><?php echo sfInflector::camelize($params['condition']) ?>()): ?] 7 12 <?php echo $this->addCredentialCondition($this->getLinkToAction($actionName, $params, true), $params) ?> 8 13 [?php endif ?] 14 <?php endif ?> 15 <?php else: ?> 16 <?php if (substr($actionName, 0, 10) == '_has_many_'): ?> 17 <?php echo $this->addCredentialCondition($this->getHasManyLinkTo(sfInflector::camelize(substr($actionName, 10)), $params, true), $params) ?> 9 18 <?php else: ?> 10 19 <?php echo $this->addCredentialCondition($this->getLinkToAction($actionName, $params, true), $params) ?> 20 <?php endif ?> 11 21 <?php endif ?> 12 22 <?php endforeach; ?> plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/lib/sfAdvancedAdminGenerator.class.php
r10032 r10048 1 1 <?php 2 2 3 /*4 * This file is part of the symfony package.5 * (c) 2004-2006 Fabien Potencier <fabien.potencier@symfony-project.com>6 *7 * For the full copyright and license information, please view the LICENSE8 * file that was distributed with this source code.9 */10 11 3 /** 12 * PropelAdmin generator.4 * sfAdvancedAdmin generator. 13 5 * 14 6 * This class generates an admin module with propel. … … 16 8 * @package symfony 17 9 * @subpackage generator 18 * @author Fabien Potencier <fabien.potencier@symfony-project.com>19 * @version SVN : $Id: sfPropelAdminGenerator.class.php 3302 2007-01-18 13:42:46Z fabien $10 * @author Patricio Mac Adden <pmacadden@desarrollo.cespi.unlp.edu.ar> 11 * @version SVN 20 12 */ 21 13 … … 119 111 if ($actionName === '_show') { 120 112 return preg_replace('/\/show_icon.png/', '/filter.png', $ret); 121 } 122 else { 113 } else { 123 114 return $ret; 124 115 } 116 } 117 118 public function getHasManyLinkTo($actionName, $params, $pk_link = false) 119 { 120 if (!isset($params['action'])) 121 $params['action'] = 'list'.sfInflector::camelize($actionName); 122 /* 123 if (!isset($params['icon'])) 124 $params['icon'] = sfConfig::get('sf_web_dir').'/sfAdvancedAdminGeneratorPlugin/images/has_many_icon.png'; 125 */ 126 $html = $this->getLinkToAction(sfInflector::camelize($actionName), $params, $pk_link); 127 return preg_replace('/\/default_icon.png/', '/list.png', $html); 125 128 } 126 129