Development

Changeset 10077

You must first sign up to be able to contribute.

Changeset 10077

Show
Ignore:
Timestamp:
07/02/08 20:14:26 (2 months ago)
Author:
pmacadden
Message:

--

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/actions/actions.class.php

    r10048 r10077  
    1414  public function preExecute() 
    1515  { 
    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); 
    1919<?php endif ?> 
    2020    $this->maps = $this->getMaps(); 
     
    7070<?php endif ?> 
    7171    $this->pager->init(); 
    72 <?php if ($fc = $this->getParameterValue('foreign_class', '')): ?> 
     72<?php if ($bt = $this->getParameterValue('belongs_to.class', '')): ?> 
    7373    $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); 
    7575<?php endif ?> 
    7676  } 
     
    9191<?php else: ?> 
    9292    $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); 
    9595<?php endif ?> 
    9696 
     
    115115    $this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate(); 
    116116<?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); 
    119119<?php endif ?> 
    120120<?php endif ?> 
     
    551551<?php endforeach; ?> 
    552552<?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()); 
    555555<?php endif ?> 
    556556  } 
     
    635635  } 
    636636 
    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): ?> 
    639662<?php if (substr($key, 0, 10) == '_has_many_'): ?> 
    640663  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  
    4545<?php $hides = $this->getParameterValue('create.hide', array()) ?> 
    4646<?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'): ?> 
    4848<?php if (in_array($column->getName(), $hides)) continue ?> 
    4949<?php if ($column->isPrimaryKey()) continue ?> 
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_actions.php

    r9935 r10077  
    33<?php if (null !== $editActions): ?> 
    44<?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 ?> 
    712<?php endforeach; ?> 
    813<?php else: ?> 
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_edit_form.php

    r10026 r10077  
    4545<?php $hides = $this->getParameterValue('edit.hide', array()) ?> 
    4646<?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'): ?> 
    4848<?php if (in_array($column->getName(), $hides)) continue ?> 
    4949<?php if ($column->isPrimaryKey()) continue ?> 
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_list_actions.php

    r9935 r10077  
    11<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 ?> 
    25<?php $listActions = $this->getParameterValue('list.actions') ?> 
    36<?php if (null !== $listActions): ?> 
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/_show_actions.php

    r9935 r10077  
    33<?php if (null !== $createActions): ?> 
    44<?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 ?> 
    610<?php endforeach; ?> 
    711<?php else: ?> 
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/data/generator/sfAdvancedAdmin/default/template/templates/listSuccess.php

    r10032 r10077  
    55<div id="sf_admin_container"> 
    66 
    7 <h1><?php echo $this->getI18NString('list.title', (($value = $this->getForeignClassName())?$value.'\'s ':'').$this->getModuleName().' list') ?></h1> 
     7<h1><?php echo $this->getI18NString('list.title', (($value = $this->getBelongsToClassName())?$value.'\'s ':'').$this->getModuleName().' list') ?></h1> 
    88 
    99<div id="sf_admin_header"> 
  • plugins/sfAdvancedAdminGeneratorPlugin/branches/pmacadden/lib/sfAdvancedAdminGenerator.class.php

    r10048 r10077  
    128128  } 
    129129 
    130   public function getForeignClassName() 
     130  public function getBelongsToClassName() 
    131131  { 
    132     return strtolower($this->getParameterValue('foreign_class')); 
     132    return strtolower($this->getParameterValue('belongs_to.class')); 
    133133  } 
    134134}