mirror of
https://github.com/atlanticbiomedical/portal-legacy.git
synced 2025-07-02 01:47:28 -04:00
initial commit
This commit is contained in:
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ##MODULE_NAME## actions.
|
||||
*
|
||||
* @package ##PROJECT_NAME##
|
||||
* @subpackage ##MODULE_NAME##
|
||||
* @author ##AUTHOR_NAME##
|
||||
* @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
|
||||
*/
|
||||
class ##MODULE_NAME##Actions extends auto##MODULE_NAME##Actions
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
generator:
|
||||
class: sfPropelAdminGenerator
|
||||
param:
|
||||
model_class: ##MODEL_CLASS##
|
||||
theme: ##THEME##
|
435
data/symfony/generator/sfPropelAdmin/default/template/actions/actions.class.php
Executable file
435
data/symfony/generator/sfPropelAdmin/default/template/actions/actions.class.php
Executable file
@ -0,0 +1,435 @@
|
||||
[?php
|
||||
|
||||
/**
|
||||
* <?php echo $this->getGeneratedModuleName() ?> actions.
|
||||
*
|
||||
* @package ##PROJECT_NAME##
|
||||
* @subpackage <?php echo $this->getGeneratedModuleName() ?>
|
||||
|
||||
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
||||
* @version SVN: $Id: actions.class.php 3501 2007-02-18 10:28:17Z fabien $
|
||||
*/
|
||||
class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions
|
||||
{
|
||||
public function executeIndex()
|
||||
{
|
||||
return $this->forward('<?php echo $this->getModuleName() ?>', 'list');
|
||||
}
|
||||
|
||||
public function executeList()
|
||||
{
|
||||
$this->processSort();
|
||||
|
||||
$this->processFilters();
|
||||
|
||||
<?php if ($this->getParameterValue('list.filters')): ?>
|
||||
$this->filters = $this->getUser()->getAttributeHolder()->getAll('sf_admin/<?php echo $this->getSingularName() ?>/filters');
|
||||
<?php endif ?>
|
||||
|
||||
// pager
|
||||
$this->pager = new sfPropelPager('<?php echo $this->getClassName() ?>', <?php echo $this->getParameterValue('list.max_per_page', 20) ?>);
|
||||
$c = new Criteria();
|
||||
$this->addSortCriteria($c);
|
||||
$this->addFiltersCriteria($c);
|
||||
$this->pager->setCriteria($c);
|
||||
$this->pager->setPage($this->getRequestParameter('page', 1));
|
||||
<?php if ($this->getParameterValue('list.peer_method')): ?>
|
||||
$this->pager->setPeerMethod('<?php echo $this->getParameterValue('list.peer_method') ?>');
|
||||
<?php endif ?>
|
||||
<?php if ($this->getParameterValue('list.peer_count_method')): ?>
|
||||
$this->pager->setPeerCountMethod('<?php echo $this->getParameterValue('list.peer_count_method') ?>');
|
||||
<?php endif ?>
|
||||
$this->pager->init();
|
||||
}
|
||||
|
||||
public function executeCreate()
|
||||
{
|
||||
return $this->forward('<?php echo $this->getModuleName() ?>', 'edit');
|
||||
}
|
||||
|
||||
public function executeSave()
|
||||
{
|
||||
return $this->forward('<?php echo $this->getModuleName() ?>', 'edit');
|
||||
}
|
||||
|
||||
public function executeEdit()
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate();
|
||||
|
||||
if ($this->getRequest()->getMethod() == sfRequest::POST)
|
||||
{
|
||||
$this->update<?php echo $this->getClassName() ?>FromRequest();
|
||||
|
||||
$this->save<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>);
|
||||
|
||||
$this->setFlash('notice', 'Your modifications have been saved');
|
||||
|
||||
if ($this->getRequestParameter('save_and_add'))
|
||||
{
|
||||
return $this->redirect('<?php echo $this->getModuleName() ?>/create');
|
||||
}
|
||||
else if ($this->getRequestParameter('save_and_list'))
|
||||
{
|
||||
return $this->redirect('<?php echo $this->getModuleName() ?>/list');
|
||||
}
|
||||
else
|
||||
{
|
||||
return $this->redirect('<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams('this->') ?>);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->labels = $this->getLabels();
|
||||
}
|
||||
}
|
||||
|
||||
public function executeDelete()
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(40) ?>);
|
||||
$this->forward404Unless($this-><?php echo $this->getSingularName() ?>);
|
||||
|
||||
try
|
||||
{
|
||||
$this->delete<?php echo $this->getClassName() ?>($this-><?php echo $this->getSingularName() ?>);
|
||||
}
|
||||
catch (PropelException $e)
|
||||
{
|
||||
$this->getRequest()->setError('delete', 'Could not delete the selected <?php echo sfInflector::humanize($this->getSingularName()) ?>. Make sure it does not have any associated items.');
|
||||
return $this->forward('<?php echo $this->getModuleName() ?>', 'list');
|
||||
}
|
||||
|
||||
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
|
||||
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
|
||||
<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?>
|
||||
<?php if ($input_type == 'admin_input_file_tag'): ?>
|
||||
<?php $upload_dir = $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.upload_dir')) ?>
|
||||
$currentFile = sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$this-><?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>();
|
||||
if (is_file($currentFile))
|
||||
{
|
||||
unlink($currentFile);
|
||||
}
|
||||
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
return $this->redirect('<?php echo $this->getModuleName() ?>/list');
|
||||
}
|
||||
|
||||
public function handleErrorEdit()
|
||||
{
|
||||
$this->preExecute();
|
||||
$this-><?php echo $this->getSingularName() ?> = $this->get<?php echo $this->getClassName() ?>OrCreate();
|
||||
$this->update<?php echo $this->getClassName() ?>FromRequest();
|
||||
|
||||
$this->labels = $this->getLabels();
|
||||
|
||||
return sfView::SUCCESS;
|
||||
}
|
||||
|
||||
protected function save<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>)
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?>->save();
|
||||
|
||||
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
|
||||
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?>
|
||||
<?php $name = $column->getName() ?>
|
||||
<?php if ($column->isPrimaryKey()) continue ?>
|
||||
<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
|
||||
<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?>
|
||||
<?php
|
||||
|
||||
$user_params = $this->getParameterValue('edit.fields.'.$column->getName().'.params');
|
||||
$user_params = is_array($user_params) ? $user_params : sfToolkit::stringToArray($user_params);
|
||||
$through_class = isset($user_params['through_class']) ? $user_params['through_class'] : '';
|
||||
|
||||
?>
|
||||
<?php if ($through_class): ?>
|
||||
<?php
|
||||
|
||||
$class = $this->getClassName();
|
||||
$related_class = sfPropelManyToMany::getRelatedClass($class, $through_class);
|
||||
$related_table = constant($related_class.'Peer::TABLE_NAME');
|
||||
$middle_table = constant($through_class.'Peer::TABLE_NAME');
|
||||
$this_table = constant($class.'Peer::TABLE_NAME');
|
||||
|
||||
$related_column = sfPropelManyToMany::getRelatedColumn($class, $through_class);
|
||||
$column = sfPropelManyToMany::getColumn($class, $through_class);
|
||||
|
||||
?>
|
||||
<?php if ($input_type == 'admin_double_list' || $input_type == 'admin_check_list' || $input_type == 'admin_select_list'): ?>
|
||||
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
|
||||
if ($this->getUser()->hasCredential(<?php echo $credentials ?>))
|
||||
{
|
||||
<?php endif; ?>
|
||||
// Update many-to-many for "<?php echo $name ?>"
|
||||
$c = new Criteria();
|
||||
$c->add(<?php echo $through_class ?>Peer::<?php echo strtoupper($column->getColumnName()) ?>, $<?php echo $this->getSingularName() ?>->getPrimaryKey());
|
||||
<?php echo $through_class ?>Peer::doDelete($c);
|
||||
|
||||
$ids = $this->getRequestParameter('associated_<?php echo $name ?>');
|
||||
if (is_array($ids))
|
||||
{
|
||||
foreach ($ids as $id)
|
||||
{
|
||||
$<?php echo ucfirst($through_class) ?> = new <?php echo $through_class ?>();
|
||||
$<?php echo ucfirst($through_class) ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>->getPrimaryKey());
|
||||
$<?php echo ucfirst($through_class) ?>->set<?php echo $related_column->getPhpName() ?>($id);
|
||||
$<?php echo ucfirst($through_class) ?>->save();
|
||||
}
|
||||
}
|
||||
|
||||
<?php if ($credentials): ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
}
|
||||
|
||||
protected function delete<?php echo $this->getClassName() ?>($<?php echo $this->getSingularName() ?>)
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?>->delete();
|
||||
}
|
||||
|
||||
protected function update<?php echo $this->getClassName() ?>FromRequest()
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?> = $this->getRequestParameter('<?php echo $this->getSingularName() ?>');
|
||||
|
||||
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
|
||||
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): $type = $column->getCreoleType(); ?>
|
||||
<?php $name = $column->getName() ?>
|
||||
<?php if ($column->isPrimaryKey()) continue ?>
|
||||
<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
|
||||
<?php $input_type = $this->getParameterValue('edit.fields.'.$column->getName().'.type') ?>
|
||||
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
|
||||
if ($this->getUser()->hasCredential(<?php echo $credentials ?>))
|
||||
{
|
||||
<?php endif; ?>
|
||||
<?php if ($input_type == 'admin_input_file_tag'): ?>
|
||||
<?php $upload_dir = $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.upload_dir')) ?>
|
||||
$currentFile = sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$this-><?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>();
|
||||
if (!$this->getRequest()->hasErrors() && isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>_remove']))
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>('');
|
||||
if (is_file($currentFile))
|
||||
{
|
||||
unlink($currentFile);
|
||||
}
|
||||
}
|
||||
|
||||
if (!$this->getRequest()->hasErrors() && $this->getRequest()->getFileSize('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]'))
|
||||
{
|
||||
<?php elseif ($type != CreoleTypes::BOOLEAN): ?>
|
||||
if (isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']))
|
||||
{
|
||||
<?php endif; ?>
|
||||
<?php if ($input_type == 'admin_input_file_tag'): ?>
|
||||
<?php if ($this->getParameterValue('edit.fields.'.$column->getName().'.filename')): ?>
|
||||
$fileName = "<?php echo str_replace('"', '\\"', $this->replaceConstants($this->getParameterValue('edit.fields.'.$column->getName().'.filename'))) ?>";
|
||||
<?php else: ?>
|
||||
$fileName = md5($this->getRequest()->getFileName('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]').time().rand(0, 99999));
|
||||
<?php endif ?>
|
||||
$ext = $this->getRequest()->getFileExtension('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]');
|
||||
if (is_file($currentFile))
|
||||
{
|
||||
unlink($currentFile);
|
||||
}
|
||||
$this->getRequest()->moveFile('<?php echo $this->getSingularName() ?>[<?php echo $name ?>]', sfConfig::get('sf_upload_dir')."/<?php echo $upload_dir ?>/".$fileName.$ext);
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($fileName.$ext);
|
||||
<?php elseif ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
|
||||
if ($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'])
|
||||
{
|
||||
try
|
||||
{
|
||||
$dateFormat = new sfDateFormat($this->getUser()->getCulture());
|
||||
<?php $inputPattern = $type == CreoleTypes::DATE ? 'd' : 'g'; ?>
|
||||
<?php $outputPattern = $type == CreoleTypes::DATE ? 'i' : 'I'; ?>
|
||||
if (!is_array($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']))
|
||||
{
|
||||
$value = $dateFormat->format($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'], '<?php echo $outputPattern ?>', $dateFormat->getInputPattern('<?php echo $inputPattern ?>'));
|
||||
}
|
||||
else
|
||||
{
|
||||
$value_array = $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'];
|
||||
$value = $value_array['year'].'-'.$value_array['month'].'-'.$value_array['day'].(isset($value_array['hour']) ? ' '.$value_array['hour'].':'.$value_array['minute'].(isset($value_array['second']) ? ':'.$value_array['second'] : '') : '');
|
||||
}
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($value);
|
||||
}
|
||||
catch (sfException $e)
|
||||
{
|
||||
// not a date
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(null);
|
||||
}
|
||||
<?php elseif ($type == CreoleTypes::BOOLEAN): ?>
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>(isset($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']) ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : 0);
|
||||
<?php elseif ($column->isForeignKey()): ?>
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] ? $<?php echo $this->getSingularName() ?>['<?php echo $name ?>'] : null);
|
||||
<?php else: ?>
|
||||
$this-><?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($<?php echo $this->getSingularName() ?>['<?php echo $name ?>']);
|
||||
<?php endif; ?>
|
||||
<?php if ($type != CreoleTypes::BOOLEAN): ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
<?php if ($credentials): ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
}
|
||||
|
||||
protected function get<?php echo $this->getClassName() ?>OrCreate(<?php echo $this->getMethodParamsForGetOrCreate() ?>)
|
||||
{
|
||||
if (<?php echo $this->getTestPksForGetOrCreate() ?>)
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();
|
||||
}
|
||||
else
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForGetOrCreate() ?>);
|
||||
|
||||
$this->forward404Unless($<?php echo $this->getSingularName() ?>);
|
||||
}
|
||||
|
||||
return $<?php echo $this->getSingularName() ?>;
|
||||
}
|
||||
|
||||
protected function processFilters()
|
||||
{
|
||||
<?php if ($this->getParameterValue('list.filters')): ?>
|
||||
if ($this->getRequest()->hasParameter('filter'))
|
||||
{
|
||||
$filters = $this->getRequestParameter('filters');
|
||||
<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?>
|
||||
<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
|
||||
if (isset($filters['<?php echo $column->getName() ?>']['from']) && $filters['<?php echo $column->getName() ?>']['from'] !== '')
|
||||
{
|
||||
$filters['<?php echo $column->getName() ?>']['from'] = sfI18N::getTimestampForCulture($filters['<?php echo $column->getName() ?>']['from'], $this->getUser()->getCulture());
|
||||
}
|
||||
if (isset($filters['<?php echo $column->getName() ?>']['to']) && $filters['<?php echo $column->getName() ?>']['to'] !== '')
|
||||
{
|
||||
$filters['<?php echo $column->getName() ?>']['to'] = sfI18N::getTimestampForCulture($filters['<?php echo $column->getName() ?>']['to'], $this->getUser()->getCulture());
|
||||
}
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
$this->getUser()->getAttributeHolder()->removeNamespace('sf_admin/<?php echo $this->getSingularName() ?>/filters');
|
||||
$this->getUser()->getAttributeHolder()->add($filters, 'sf_admin/<?php echo $this->getSingularName() ?>/filters');
|
||||
}
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
protected function processSort()
|
||||
{
|
||||
if ($this->getRequestParameter('sort'))
|
||||
{
|
||||
$this->getUser()->setAttribute('sort', $this->getRequestParameter('sort'), 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
|
||||
$this->getUser()->setAttribute('type', $this->getRequestParameter('type', 'asc'), 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
|
||||
}
|
||||
|
||||
if (!$this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort'))
|
||||
{
|
||||
<?php if ($sort = $this->getParameterValue('list.sort')): ?>
|
||||
<?php if (is_array($sort)): ?>
|
||||
$this->getUser()->setAttribute('sort', '<?php echo $sort[0] ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
|
||||
$this->getUser()->setAttribute('type', '<?php echo $sort[1] ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
|
||||
<?php else: ?>
|
||||
$this->getUser()->setAttribute('sort', '<?php echo $sort ?>', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
|
||||
$this->getUser()->setAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort');
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
}
|
||||
}
|
||||
|
||||
protected function addFiltersCriteria($c)
|
||||
{
|
||||
<?php if ($this->getParameterValue('list.filters')): ?>
|
||||
<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?>
|
||||
<?php if (($column->isPartial() || $column->isComponent()) && $this->getParameterValue('list.fields.'.$column->getName().'.filter_criteria_disabled')) continue ?>
|
||||
if (isset($this->filters['<?php echo $column->getName() ?>_is_empty']))
|
||||
{
|
||||
$criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, '');
|
||||
$criterion->addOr($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, null, Criteria::ISNULL));
|
||||
$c->add($criterion);
|
||||
}
|
||||
<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
|
||||
else if (isset($this->filters['<?php echo $column->getName() ?>']))
|
||||
{
|
||||
if (isset($this->filters['<?php echo $column->getName() ?>']['from']) && $this->filters['<?php echo $column->getName() ?>']['from'] !== '')
|
||||
{
|
||||
<?php if ($type == CreoleTypes::DATE): ?>
|
||||
$criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['from']), Criteria::GREATER_EQUAL);
|
||||
<?php else: ?>
|
||||
$criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['from'], Criteria::GREATER_EQUAL);
|
||||
<?php endif; ?>
|
||||
}
|
||||
if (isset($this->filters['<?php echo $column->getName() ?>']['to']) && $this->filters['<?php echo $column->getName() ?>']['to'] !== '')
|
||||
{
|
||||
if (isset($criterion))
|
||||
{
|
||||
<?php if ($type == CreoleTypes::DATE): ?>
|
||||
$criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL));
|
||||
<?php else: ?>
|
||||
$criterion->addAnd($c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL));
|
||||
<?php endif; ?>
|
||||
}
|
||||
else
|
||||
{
|
||||
<?php if ($type == CreoleTypes::DATE): ?>
|
||||
$criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, date('Y-m-d', $this->filters['<?php echo $column->getName() ?>']['to']), Criteria::LESS_EQUAL);
|
||||
<?php else: ?>
|
||||
$criterion = $c->getNewCriterion(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']['to'], Criteria::LESS_EQUAL);
|
||||
<?php endif; ?>
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($criterion))
|
||||
{
|
||||
$c->add($criterion);
|
||||
}
|
||||
}
|
||||
<?php else: ?>
|
||||
else if (isset($this->filters['<?php echo $column->getName() ?>']) && $this->filters['<?php echo $column->getName() ?>'] !== '')
|
||||
{
|
||||
<?php if ($type == CreoleTypes::CHAR || $type == CreoleTypes::VARCHAR || $type == CreoleTypes::LONGVARCHAR): ?>
|
||||
$c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, strtr($this->filters['<?php echo $column->getName() ?>'], '*', '%'), Criteria::LIKE);
|
||||
<?php else: ?>
|
||||
$c->add(<?php echo $this->getPeerClassName() ?>::<?php echo strtoupper($column->getName()) ?>, $this->filters['<?php echo $column->getName() ?>']);
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
}
|
||||
|
||||
protected function addSortCriteria($c)
|
||||
{
|
||||
if ($sort_column = $this->getUser()->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort'))
|
||||
{
|
||||
$sort_column = <?php echo $this->getClassName() ?>Peer::translateFieldName($sort_column, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_COLNAME);
|
||||
if ($this->getUser()->getAttribute('type', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc')
|
||||
{
|
||||
$c->addAscendingOrderByColumn($sort_column);
|
||||
}
|
||||
else
|
||||
{
|
||||
$c->addDescendingOrderByColumn($sort_column);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function getLabels()
|
||||
{
|
||||
return array(
|
||||
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
|
||||
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
|
||||
'<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}' => '<?php $label_name = str_replace("'", "\\'", $this->getParameterValue('edit.fields.'.$column->getName().'.name')); echo $label_name ?><?php if ($label_name): ?>:<?php endif ?>',
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
<ul class="sf_admin_actions">
|
||||
<?php $editActions = $this->getParameterValue('edit.actions') ?>
|
||||
<?php if (null !== $editActions): ?>
|
||||
<?php foreach ((array) $editActions as $actionName => $params): ?>
|
||||
<?php if ($actionName == '_delete') continue ?>
|
||||
<?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, true), $params) ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $this->getButtonToAction('_list', array(), true) ?>
|
||||
<?php echo $this->getButtonToAction('_save', array(), true) ?>
|
||||
<?php echo $this->getButtonToAction('_save_and_add', array(), true) ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
@ -0,0 +1,86 @@
|
||||
[?php echo form_tag('<?php echo $this->getModuleName() ?>/save', array(
|
||||
'id' => 'sf_admin_edit_form',
|
||||
'name' => 'sf_admin_edit_form',
|
||||
'multipart' => true,
|
||||
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
|
||||
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
|
||||
<?php if (false !== strpos($this->getParameterValue('edit.fields.'.$column->getName().'.type'), 'admin_double_list')): ?>
|
||||
'onsubmit' => 'double_list_submit(); return true;'
|
||||
<?php break 2; ?>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
<?php endforeach; ?>
|
||||
)) ?]
|
||||
|
||||
<?php foreach ($this->getPrimaryKey() as $pk): ?>
|
||||
[?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?]
|
||||
<?php endforeach; ?>
|
||||
|
||||
<?php $first = true ?>
|
||||
<?php foreach ($this->getColumnCategories('edit.display') as $category): ?>
|
||||
<?php
|
||||
if ($category[0] == '-')
|
||||
{
|
||||
$category_name = substr($category, 1);
|
||||
$collapse = true;
|
||||
|
||||
if ($first)
|
||||
{
|
||||
$first = false;
|
||||
echo "[?php use_javascript(sfConfig::get('sf_prototype_web_dir').'/js/prototype') ?]\n";
|
||||
echo "[?php use_javascript(sfConfig::get('sf_admin_web_dir').'/js/collapse') ?]\n";
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$category_name = $category;
|
||||
$collapse = false;
|
||||
}
|
||||
?>
|
||||
<fieldset id="sf_fieldset_<?php echo preg_replace('/[^a-z0-9_]/', '_', strtolower($category_name)) ?>" class="<?php if ($collapse): ?> collapse<?php endif; ?>">
|
||||
<?php if ($category != 'NONE'): ?><h2>[?php echo __('<?php echo $category_name ?>') ?]</h2>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $hides = $this->getParameterValue('edit.hide', array()) ?>
|
||||
<?php foreach ($this->getColumns('edit.display', $category) as $name => $column): ?>
|
||||
<?php if (in_array($column->getName(), $hides)) continue ?>
|
||||
<?php if ($column->isPrimaryKey()) continue ?>
|
||||
<?php $credentials = $this->getParameterValue('edit.fields.'.$column->getName().'.credentials') ?>
|
||||
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
|
||||
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
|
||||
<?php endif; ?>
|
||||
<div class="form-row">
|
||||
[?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; ?>') ?]
|
||||
<div class="content[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?] form-error[?php endif; ?]">
|
||||
[?php if ($sf_request->hasError('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}')): ?]
|
||||
[?php echo form_error('<?php echo $this->getSingularName() ?>{<?php echo $column->getName() ?>}', array('class' => 'form-error-msg')) ?]
|
||||
[?php endif; ?]
|
||||
|
||||
[?php $value = <?php echo $this->getColumnEditTag($column); ?>; echo $value ? $value : ' ' ?]
|
||||
<?php echo $this->getHelp($column, 'edit') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($credentials): ?>
|
||||
[?php endif; ?]
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</fieldset>
|
||||
<?php endforeach; ?>
|
||||
|
||||
[?php include_partial('edit_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
|
||||
|
||||
</form>
|
||||
|
||||
<ul class="sf_admin_actions">
|
||||
<?php
|
||||
/*
|
||||
* WARNING: delete is a form, it must be outside the main form
|
||||
*/
|
||||
$editActions = $this->getParameterValue('edit.actions');
|
||||
?>
|
||||
<?php if (null === $editActions || (null !== $editActions && array_key_exists('_delete', $editActions))): ?>
|
||||
<?php echo $this->addCredentialCondition($this->getButtonToAction('_delete', $editActions['_delete'], true), $editActions['_delete']) ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
@ -0,0 +1,15 @@
|
||||
[?php if ($sf_request->hasErrors()): ?]
|
||||
<div class="form-errors">
|
||||
<h2>[?php echo __('There are some errors that prevent the form to validate') ?]</h2>
|
||||
<dl>
|
||||
[?php foreach ($sf_request->getErrorNames() as $name): ?]
|
||||
<dt>[?php echo __($labels[$name]) ?]</dt>
|
||||
<dd>[?php echo $sf_request->getError($name) ?]</dd>
|
||||
[?php endforeach; ?]
|
||||
</dl>
|
||||
</div>
|
||||
[?php elseif ($sf_flash->has('notice')): ?]
|
||||
<div class="save-ok">
|
||||
<h2>[?php echo __($sf_flash->get('notice')) ?]</h2>
|
||||
</div>
|
||||
[?php endif; ?]
|
37
data/symfony/generator/sfPropelAdmin/default/template/templates/_filters.php
Executable file
37
data/symfony/generator/sfPropelAdmin/default/template/templates/_filters.php
Executable file
@ -0,0 +1,37 @@
|
||||
[?php use_helper('Object') ?]
|
||||
|
||||
<?php if ($this->getParameterValue('list.filters')): ?>
|
||||
<div class="sf_admin_filters">
|
||||
[?php echo form_tag('<?php echo $this->getModuleName() ?>/list', array('method' => 'get')) ?]
|
||||
|
||||
<fieldset>
|
||||
<h2>[?php echo __('filters') ?]</h2>
|
||||
<?php foreach ($this->getColumns('list.filters') as $column): $type = $column->getCreoleType() ?>
|
||||
<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?>
|
||||
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
|
||||
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
|
||||
<?php endif; ?>
|
||||
<div class="form-row">
|
||||
<label for="<?php echo $column->getName() ?>">[?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>:') ?]</label>
|
||||
<div class="content">
|
||||
[?php echo <?php echo $this->getColumnFilterTag($column) ?> ?]
|
||||
<?php if ($this->getParameterValue('list.fields.'.$column->getName().'.filter_is_empty')): ?>
|
||||
<div>[?php echo checkbox_tag('filters[<?php echo $column->getName() ?>_is_empty]', 1, isset($filters['<?php echo $column->getName() ?>_is_empty']) ? $filters['<?php echo $column->getName() ?>_is_empty'] : null) ?] <label for="filters[<?php echo $column->getName() ?>_is_empty]">[?php echo __('is empty') ?]</label></div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($credentials): ?>
|
||||
[?php endif; ?]
|
||||
<?php endif; ?>
|
||||
|
||||
<?php endforeach; ?>
|
||||
</fieldset>
|
||||
|
||||
<ul class="sf_admin_actions">
|
||||
<li>[?php echo button_to(__('reset'), '<?php echo $this->getModuleName() ?>/list?filter=filter', 'class=sf_admin_action_reset_filter') ?]</li>
|
||||
<li>[?php echo submit_tag(__('filter'), 'name=filter class=sf_admin_action_filter') ?]</li>
|
||||
</ul>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
<?php endif; ?>
|
36
data/symfony/generator/sfPropelAdmin/default/template/templates/_list.php
Executable file
36
data/symfony/generator/sfPropelAdmin/default/template/templates/_list.php
Executable file
@ -0,0 +1,36 @@
|
||||
<table cellspacing="0" class="sf_admin_list">
|
||||
<thead>
|
||||
<tr>
|
||||
[?php include_partial('list_th_<?php echo $this->getParameterValue('list.layout', 'tabular') ?>') ?]
|
||||
<?php if ($this->getParameterValue('list.object_actions')): ?>
|
||||
<th id="sf_admin_list_th_sf_actions">[?php echo __('Actions') ?]</th>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[?php $i = 1; foreach ($pager->getResults() as $<?php echo $this->getSingularName() ?>): $odd = fmod(++$i, 2) ?]
|
||||
<tr class="sf_admin_row_[?php echo $odd ?]">
|
||||
[?php include_partial('list_td_<?php echo $this->getParameterValue('list.layout', 'tabular') ?>', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
|
||||
[?php include_partial('list_td_actions', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
|
||||
</tr>
|
||||
[?php endforeach; ?]
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr><th colspan="<?php echo $this->getParameterValue('list.object_actions') ? count($this->getColumns('list.display')) + 1 : count($this->getColumns('list.display')) ?>">
|
||||
<div class="float-right">
|
||||
[?php if ($pager->haveToPaginate()): ?]
|
||||
[?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/first.png', array('align' => 'absmiddle', 'alt' => __('First'), 'title' => __('First'))), '<?php echo $this->getModuleName() ?>/list?page=1') ?]
|
||||
[?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/previous.png', array('align' => 'absmiddle', 'alt' => __('Previous'), 'title' => __('Previous'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getPreviousPage()) ?]
|
||||
|
||||
[?php foreach ($pager->getLinks() as $page): ?]
|
||||
[?php echo link_to_unless($page == $pager->getPage(), $page, '<?php echo $this->getModuleName() ?>/list?page='.$page) ?]
|
||||
[?php endforeach; ?]
|
||||
|
||||
[?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/next.png', array('align' => 'absmiddle', 'alt' => __('Next'), 'title' => __('Next'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getNextPage()) ?]
|
||||
[?php echo link_to(image_tag(sfConfig::get('sf_admin_web_dir').'/images/last.png', array('align' => 'absmiddle', 'alt' => __('Last'), 'title' => __('Last'))), '<?php echo $this->getModuleName() ?>/list?page='.$pager->getLastPage()) ?]
|
||||
[?php endif; ?]
|
||||
</div>
|
||||
[?php echo format_number_choice('[0] no result|[1] 1 result|(1,+Inf] %1% results', array('%1%' => $pager->getNbResults()), $pager->getNbResults()) ?]
|
||||
</th></tr>
|
||||
</tfoot>
|
||||
</table>
|
@ -0,0 +1,10 @@
|
||||
<ul class="sf_admin_actions">
|
||||
<?php $listActions = $this->getParameterValue('list.actions') ?>
|
||||
<?php if (null !== $listActions): ?>
|
||||
<?php foreach ((array) $listActions as $actionName => $params): ?>
|
||||
<?php echo $this->addCredentialCondition($this->getButtonToAction($actionName, $params, false), $params) ?>
|
||||
<?php endforeach; ?>
|
||||
<?php else: ?>
|
||||
<?php echo $this->getButtonToAction('_create', array(), false) ?>
|
||||
<?php endif; ?>
|
||||
</ul>
|
@ -0,0 +1,8 @@
|
||||
[?php if ($sf_request->getError('delete')): ?]
|
||||
<div class="form-errors">
|
||||
<h2>Could not delete the selected <?php echo sfInflector::humanize($this->getSingularName()) ?></h2>
|
||||
<ul>
|
||||
<li>[?php echo $sf_request->getError('delete') ?]</li>
|
||||
</ul>
|
||||
</div>
|
||||
[?php endif; ?]
|
@ -0,0 +1,9 @@
|
||||
<?php if ($this->getParameterValue('list.object_actions')): ?>
|
||||
<td>
|
||||
<ul class="sf_admin_td_actions">
|
||||
<?php foreach ($this->getParameterValue('list.object_actions') as $actionName => $params): ?>
|
||||
<?php echo $this->addCredentialCondition($this->getLinkToAction($actionName, $params, true), $params) ?>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</td>
|
||||
<?php endif; ?>
|
@ -0,0 +1,16 @@
|
||||
<td colspan="<?php echo count($this->getColumns('list.display')) ?>">
|
||||
<?php if ($this->getParameterValue('list.params')): ?>
|
||||
<?php echo $this->getI18NString('list.params') ?>
|
||||
<?php else: ?>
|
||||
<?php $hides = $this->getParameterValue('list.hide', array()) ?>
|
||||
<?php foreach ($this->getColumns('list.display') as $column): ?>
|
||||
<?php if (in_array($column->getName(), $hides)) continue ?>
|
||||
<?php if ($column->isLink()): ?>
|
||||
[?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]
|
||||
<?php else: ?>
|
||||
[?php echo <?php echo $this->getColumnListTag($column) ?> ?]
|
||||
<?php endif; ?>
|
||||
-
|
||||
<?php endforeach; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
@ -0,0 +1,16 @@
|
||||
<?php $hs = $this->getParameterValue('list.hide', array()) ?>
|
||||
<?php foreach ($this->getColumns('list.display') as $column): ?>
|
||||
<?php if (in_array($column->getName(), $hs)) continue ?>
|
||||
<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?>
|
||||
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
|
||||
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
|
||||
<?php endif; ?>
|
||||
<?php if ($column->isLink()): ?>
|
||||
<td>[?php echo link_to(<?php echo $this->getColumnListTag($column) ?> ? <?php echo $this->getColumnListTag($column) ?> : __('-'), '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]</td>
|
||||
<?php else: ?>
|
||||
<td>[?php echo <?php echo $this->getColumnListTag($column) ?> ?]</td>
|
||||
<?php endif; ?>
|
||||
<?php if ($credentials): ?>
|
||||
[?php endif; ?]
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
@ -0,0 +1 @@
|
||||
[?php include_partial('list_th_tabular') ?]
|
@ -0,0 +1,24 @@
|
||||
<?php $hides = $this->getParameterValue('list.hide', array()) ?>
|
||||
<?php foreach ($this->getColumns('list.display') as $column): ?>
|
||||
<?php if (in_array($column->getName(), $hides)) continue ?>
|
||||
<?php $credentials = $this->getParameterValue('list.fields.'.$column->getName().'.credentials') ?>
|
||||
<?php if ($credentials): $credentials = str_replace("\n", ' ', var_export($credentials, true)) ?>
|
||||
[?php if ($sf_user->hasCredential(<?php echo $credentials ?>)): ?]
|
||||
<?php endif; ?>
|
||||
<th id="sf_admin_list_th_<?php echo $column->getName() ?>">
|
||||
<?php if ($column->isReal()): ?>
|
||||
[?php if ($sf_user->getAttribute('sort', null, 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == '<?php echo $column->getName() ?>'): ?]
|
||||
[?php echo link_to(__('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>'), '<?php echo $this->getModuleName() ?>/list?sort=<?php echo $column->getName() ?>&type='.($sf_user->getAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort') == 'asc' ? 'desc' : 'asc')) ?]
|
||||
([?php echo __($sf_user->getAttribute('type', 'asc', 'sf_admin/<?php echo $this->getSingularName() ?>/sort')) ?])
|
||||
[?php else: ?]
|
||||
[?php echo link_to(__('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>'), '<?php echo $this->getModuleName() ?>/list?sort=<?php echo $column->getName() ?>&type=asc') ?]
|
||||
[?php endif; ?]
|
||||
<?php else: ?>
|
||||
[?php echo __('<?php echo str_replace("'", "\\'", $this->getParameterValue('list.fields.'.$column->getName().'.name')) ?>') ?]
|
||||
<?php endif; ?>
|
||||
<?php echo $this->getHelpAsIcon($column, 'list') ?>
|
||||
</th>
|
||||
<?php if ($credentials): ?>
|
||||
[?php endif; ?]
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
@ -0,0 +1,22 @@
|
||||
[?php use_helper('Object', 'Validation', 'ObjectAdmin', 'I18N', 'Date') ?]
|
||||
|
||||
[?php use_stylesheet('<?php echo $this->getParameterValue('css', sfConfig::get('sf_admin_web_dir').'/css/main') ?>') ?]
|
||||
|
||||
<div id="sf_admin_container">
|
||||
|
||||
<h1><?php echo $this->getI18NString('edit.title', 'edit '.$this->getModuleName()) ?></h1>
|
||||
|
||||
<div id="sf_admin_header">
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/edit_header', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
|
||||
</div>
|
||||
|
||||
<div id="sf_admin_content">
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/edit_messages', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'labels' => $labels)) ?]
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/edit_form', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>, 'labels' => $labels)) ?]
|
||||
</div>
|
||||
|
||||
<div id="sf_admin_footer">
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/edit_footer', array('<?php echo $this->getSingularName() ?>' => $<?php echo $this->getSingularName() ?>)) ?]
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,33 @@
|
||||
[?php use_helper('I18N', 'Date') ?]
|
||||
|
||||
[?php use_stylesheet('<?php echo $this->getParameterValue('css', sfConfig::get('sf_admin_web_dir').'/css/main') ?>') ?]
|
||||
|
||||
<div id="sf_admin_container">
|
||||
|
||||
<h1><?php echo $this->getI18NString('list.title', $this->getModuleName().' list') ?></h1>
|
||||
|
||||
<div id="sf_admin_header">
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/list_header', array('pager' => $pager)) ?]
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/list_messages', array('pager' => $pager)) ?]
|
||||
</div>
|
||||
|
||||
<div id="sf_admin_bar">
|
||||
<?php if ($this->getParameterValue('list.filters')): ?>
|
||||
[?php include_partial('filters', array('filters' => $filters)) ?]
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div id="sf_admin_content">
|
||||
[?php if (!$pager->getNbResults()): ?]
|
||||
[?php echo __('no result') ?]
|
||||
[?php else: ?]
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/list', array('pager' => $pager)) ?]
|
||||
[?php endif; ?]
|
||||
[?php include_partial('list_actions') ?]
|
||||
</div>
|
||||
|
||||
<div id="sf_admin_footer">
|
||||
[?php include_partial('<?php echo $this->getModuleName() ?>/list_footer', array('pager' => $pager)) ?]
|
||||
</div>
|
||||
|
||||
</div>
|
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ##MODULE_NAME## actions.
|
||||
*
|
||||
* @package ##PROJECT_NAME##
|
||||
* @subpackage ##MODULE_NAME##
|
||||
* @author ##AUTHOR_NAME##
|
||||
* @version SVN: $Id: actions.class.php 2288 2006-10-02 15:22:13Z fabien $
|
||||
*/
|
||||
class ##MODULE_NAME##Actions extends auto##MODULE_NAME##Actions
|
||||
{
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
generator:
|
||||
class: sfPropelCrudGenerator
|
||||
param:
|
||||
model_class: ##MODEL_CLASS##
|
||||
theme: default
|
0
data/symfony/generator/sfPropelCrud/default/skeleton/lib/.sf
Executable file
0
data/symfony/generator/sfPropelCrud/default/skeleton/lib/.sf
Executable file
0
data/symfony/generator/sfPropelCrud/default/skeleton/templates/.sf
Executable file
0
data/symfony/generator/sfPropelCrud/default/skeleton/templates/.sf
Executable file
0
data/symfony/generator/sfPropelCrud/default/skeleton/validate/.sf
Executable file
0
data/symfony/generator/sfPropelCrud/default/skeleton/validate/.sf
Executable file
@ -0,0 +1,89 @@
|
||||
[?php
|
||||
|
||||
/**
|
||||
* <?php echo $this->getGeneratedModuleName() ?> actions.
|
||||
*
|
||||
* @package ##PROJECT_NAME##
|
||||
* @subpackage <?php echo $this->getGeneratedModuleName() ?>
|
||||
|
||||
* @author ##AUTHOR_NAME##
|
||||
* @version SVN: $Id: actions.class.php 3335 2007-01-23 16:19:56Z fabien $
|
||||
*/
|
||||
class <?php echo $this->getGeneratedModuleName() ?>Actions extends sfActions
|
||||
{
|
||||
public function executeIndex()
|
||||
{
|
||||
return $this->forward('<?php echo $this->getModuleName() ?>', 'list');
|
||||
}
|
||||
|
||||
public function executeList()
|
||||
{
|
||||
$this-><?php echo $this->getPluralName() ?> = <?php echo $this->getClassName() ?>Peer::doSelect(new Criteria());
|
||||
}
|
||||
|
||||
public function executeShow()
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>);
|
||||
$this->forward404Unless($this-><?php echo $this->getSingularName() ?>);
|
||||
}
|
||||
|
||||
public function executeCreate()
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();
|
||||
|
||||
$this->setTemplate('edit');
|
||||
}
|
||||
|
||||
public function executeEdit()
|
||||
{
|
||||
$this-><?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(49) ?>);
|
||||
$this->forward404Unless($this-><?php echo $this->getSingularName() ?>);
|
||||
}
|
||||
|
||||
public function executeUpdate()
|
||||
{
|
||||
if (<?php echo $this->getTestPksForGetOrCreate(false) ?>)
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?> = new <?php echo $this->getClassName() ?>();
|
||||
}
|
||||
else
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(45) ?>);
|
||||
$this->forward404Unless($<?php echo $this->getSingularName() ?>);
|
||||
}
|
||||
|
||||
<?php foreach ($this->getTableMap()->getColumns() as $name => $column): $type = $column->getCreoleType(); ?>
|
||||
<?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?>
|
||||
<?php $name = sfInflector::underscore($column->getPhpName()) ?>
|
||||
<?php if ($type == CreoleTypes::DATE || $type == CreoleTypes::TIMESTAMP): ?>
|
||||
if ($this->getRequestParameter('<?php echo $name ?>'))
|
||||
{
|
||||
list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('<?php echo $name ?>'), $this->getUser()->getCulture());
|
||||
$<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>("$y-$m-$d");
|
||||
}
|
||||
<?php elseif ($type == CreoleTypes::BOOLEAN): ?>
|
||||
$<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>', 0));
|
||||
<?php elseif ($column->isForeignKey()): ?>
|
||||
$<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>') ? $this->getRequestParameter('<?php echo $name ?>') : null);
|
||||
<?php else: ?>
|
||||
$<?php echo $this->getSingularName() ?>->set<?php echo $column->getPhpName() ?>($this->getRequestParameter('<?php echo $name ?>'));
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
$<?php echo $this->getSingularName() ?>->save();
|
||||
|
||||
return $this->redirect('<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>);
|
||||
<?php //' ?>
|
||||
}
|
||||
|
||||
public function executeDelete()
|
||||
{
|
||||
$<?php echo $this->getSingularName() ?> = <?php echo $this->getClassName() ?>Peer::retrieveByPk(<?php echo $this->getRetrieveByPkParamsForAction(43) ?>);
|
||||
|
||||
$this->forward404Unless($<?php echo $this->getSingularName() ?>);
|
||||
|
||||
$<?php echo $this->getSingularName() ?>->delete();
|
||||
|
||||
return $this->redirect('<?php echo $this->getModuleName() ?>/list');
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
[?php use_helper('Object') ?]
|
||||
|
||||
[?php echo form_tag('<?php echo $this->getModuleName() ?>/update') ?]
|
||||
|
||||
<?php foreach ($this->getPrimaryKey() as $pk): ?>
|
||||
[?php echo object_input_hidden_tag($<?php echo $this->getSingularName() ?>, 'get<?php echo $pk->getPhpName() ?>') ?]
|
||||
<?php endforeach; ?>
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<?php foreach ($this->getTableMap()->getColumns() as $name => $column): ?>
|
||||
<?php if ($column->isPrimaryKey()) continue ?>
|
||||
<?php if ($name == 'CREATED_AT' || $name == 'UPDATED_AT') continue ?>
|
||||
<tr>
|
||||
<th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?><?php if ($column->isNotNull()): ?>*<?php endif; ?>:</th>
|
||||
<td>[?php echo <?php echo $this->getCrudColumnEditTag($column) ?> ?]</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
[?php echo submit_tag('save') ?]
|
||||
[?php if (<?php echo $this->getPrimaryKeyIsSet() ?>): ?]
|
||||
[?php echo link_to('delete', '<?php echo $this->getModuleName() ?>/delete?<?php echo $this->getPrimaryKeyUrlParams() ?>, 'post=true&confirm=Are you sure?') ?]
|
||||
[?php echo link_to('cancel', '<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]
|
||||
[?php else: ?]
|
||||
[?php echo link_to('cancel', '<?php echo $this->getModuleName() ?>/list') ?]
|
||||
[?php endif; ?]
|
||||
</form>
|
@ -0,0 +1,26 @@
|
||||
<h1><?php echo $this->getModuleName() ?></h1>
|
||||
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<?php foreach ($this->getTableMap()->getColumns() as $column): ?>
|
||||
<th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?></th>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
[?php foreach ($<?php echo $this->getPluralName() ?> as $<?php echo $this->getSingularName() ?>): ?]
|
||||
<tr>
|
||||
<?php foreach ($this->getTableMap()->getColumns() as $column): ?>
|
||||
<?php if ($column->isPrimaryKey()): ?>
|
||||
<td>[?php echo link_to($<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>(), '<?php echo $this->getModuleName() ?>/show?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]</td>
|
||||
<?php else: ?>
|
||||
<td>[?php echo $<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>() ?]</td>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tr>
|
||||
[?php endforeach; ?]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
[?php echo link_to ('create', '<?php echo $this->getModuleName() ?>/create') ?]
|
@ -0,0 +1,13 @@
|
||||
<table>
|
||||
<tbody>
|
||||
<?php foreach ($this->getTableMap()->getColumns() as $column): ?>
|
||||
<tr>
|
||||
<th><?php echo sfInflector::humanize(sfInflector::underscore($column->getPhpName())) ?>: </th>
|
||||
<td>[?= $<?php echo $this->getSingularName() ?>->get<?php echo $column->getPhpName() ?>() ?]</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
[?php echo link_to('edit', '<?php echo $this->getModuleName() ?>/edit?<?php echo $this->getPrimaryKeyUrlParams() ?>) ?]
|
||||
[?php echo link_to('list', '<?php echo $this->getModuleName() ?>/list') ?]
|
Reference in New Issue
Block a user