a grand renaming so that the most significant portion of the name comes first
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
<?php
|
||||
/**
|
||||
* Bake Template for Controller action generation.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.console.libs.template.objects
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
|
||||
function <?php echo $admin ?>index() {
|
||||
$this-><?php echo $currentModelName ?>->recursive = 0;
|
||||
$this->set('<?php echo $pluralName ?>', $this->paginate());
|
||||
}
|
||||
|
||||
function <?php echo $admin ?>view($id = null) {
|
||||
if (!$id) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName) ?>', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
$this->set('<?php echo $singularName; ?>', $this-><?php echo $currentModelName; ?>->read(null, $id));
|
||||
}
|
||||
|
||||
<?php $compact = array(); ?>
|
||||
function <?php echo $admin ?>add() {
|
||||
if (!empty($this->data)) {
|
||||
$this-><?php echo $currentModelName; ?>->create();
|
||||
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('<?php echo ucfirst(strtolower($currentModelName)); ?> saved.', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
} else {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
|
||||
<?php endif; ?>
|
||||
}
|
||||
}
|
||||
<?php
|
||||
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
|
||||
foreach ($modelObj->{$assoc} as $associationName => $relation):
|
||||
if (!empty($associationName)):
|
||||
$otherModelName = $this->_modelName($associationName);
|
||||
$otherPluralName = $this->_pluralName($associationName);
|
||||
echo "\t\t\${$otherPluralName} = \$this->{$currentModelName}->{$otherModelName}->find('list');\n";
|
||||
$compact[] = "'{$otherPluralName}'";
|
||||
endif;
|
||||
endforeach;
|
||||
endforeach;
|
||||
if (!empty($compact)):
|
||||
echo "\t\t\$this->set(compact(".join(', ', $compact)."));\n";
|
||||
endif;
|
||||
?>
|
||||
}
|
||||
|
||||
<?php $compact = array(); ?>
|
||||
function <?php echo $admin; ?>edit($id = null) {
|
||||
if (!$id && empty($this->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('Invalid <?php echo strtolower($singularHumanName); ?>', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(sprintf(__('Invalid <?php echo strtolower($singularHumanName); ?>', true)), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
if (!empty($this->data)) {
|
||||
if ($this-><?php echo $currentModelName; ?>->save($this->data)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> has been saved', true));
|
||||
$this->redirect(array('action' => 'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('The <?php echo strtolower($singularHumanName); ?> has been saved.', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
} else {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('The <?php echo strtolower($singularHumanName); ?> could not be saved. Please, try again.', true));
|
||||
<?php endif; ?>
|
||||
}
|
||||
}
|
||||
if (empty($this->data)) {
|
||||
$this->data = $this-><?php echo $currentModelName; ?>->read(null, $id);
|
||||
}
|
||||
<?php
|
||||
foreach (array('belongsTo', 'hasAndBelongsToMany') as $assoc):
|
||||
foreach ($modelObj->{$assoc} as $associationName => $relation):
|
||||
if (!empty($associationName)):
|
||||
$otherModelName = $this->_modelName($associationName);
|
||||
$otherPluralName = $this->_pluralName($associationName);
|
||||
echo "\t\t\${$otherPluralName} = \$this->{$currentModelName}->{$otherModelName}->find('list');\n";
|
||||
$compact[] = "'{$otherPluralName}'";
|
||||
endif;
|
||||
endforeach;
|
||||
endforeach;
|
||||
if (!empty($compact)):
|
||||
echo "\t\t\$this->set(compact(".join(', ', $compact)."));\n";
|
||||
endif;
|
||||
?>
|
||||
}
|
||||
|
||||
function <?php echo $admin; ?>delete($id = null) {
|
||||
if (!$id) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('Invalid id for <?php echo strtolower($singularHumanName); ?>', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(sprintf(__('Invalid <?php echo strtolower($singularHumanName); ?>', true)), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
if ($this-><?php echo $currentModelName; ?>->delete($id)) {
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
<?php else: ?>
|
||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> deleted', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
}
|
||||
<?php if ($wannaUseSession): ?>
|
||||
$this->Session->setFlash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true));
|
||||
<?php else: ?>
|
||||
$this->flash(__('<?php echo ucfirst(strtolower($singularHumanName)); ?> was not deleted', true), array('action' => 'index'));
|
||||
<?php endif; ?>
|
||||
$this->redirect(array('action' => 'index'));
|
||||
}
|
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
/**
|
||||
* Controller bake template file
|
||||
*
|
||||
* Allows templating of Controllers generated from bake.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
echo "<?php\n";
|
||||
?>
|
||||
class <?php echo $controllerName; ?>Controller extends <?php echo $plugin; ?>AppController {
|
||||
|
||||
var $name = '<?php echo $controllerName; ?>';
|
||||
<?php if ($isScaffold): ?>
|
||||
var $scaffold;
|
||||
<?php else: ?>
|
||||
<?php
|
||||
if (count($helpers)):
|
||||
echo "\tvar \$helpers = array(";
|
||||
for ($i = 0, $len = count($helpers); $i < $len; $i++):
|
||||
if ($i != $len - 1):
|
||||
echo "'" . Inflector::camelize($helpers[$i]) . "', ";
|
||||
else:
|
||||
echo "'" . Inflector::camelize($helpers[$i]) . "'";
|
||||
endif;
|
||||
endfor;
|
||||
echo ");\n";
|
||||
endif;
|
||||
|
||||
if (count($components)):
|
||||
echo "\tvar \$components = array(";
|
||||
for ($i = 0, $len = count($components); $i < $len; $i++):
|
||||
if ($i != $len - 1):
|
||||
echo "'" . Inflector::camelize($components[$i]) . "', ";
|
||||
else:
|
||||
echo "'" . Inflector::camelize($components[$i]) . "'";
|
||||
endif;
|
||||
endfor;
|
||||
echo ");\n";
|
||||
endif;
|
||||
|
||||
echo $actions;
|
||||
|
||||
endif; ?>
|
||||
|
||||
}
|
||||
<?php echo "?>"; ?>
|
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Fixture Template file
|
||||
*
|
||||
* Fixture Template used when baking fixtures with bake
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<?php echo '<?php' . "\n"; ?>
|
||||
/* <?php echo $model; ?> Fixture generated on: <?php echo date('Y-m-d H:m:s') . " : ". time(); ?> */
|
||||
class <?php echo $model; ?>Fixture extends CakeTestFixture {
|
||||
var $name = '<?php echo $model; ?>';
|
||||
<?php if ($table): ?>
|
||||
var $table = '<?php echo $table; ?>';
|
||||
<?php endif; ?>
|
||||
<?php if ($import): ?>
|
||||
var $import = <?php echo $import; ?>;
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ($schema): ?>
|
||||
var $fields = <?php echo $schema; ?>;
|
||||
<?php endif;?>
|
||||
|
||||
<?php if ($records): ?>
|
||||
var $records = <?php echo $records; ?>;
|
||||
<?php endif;?>
|
||||
}
|
||||
<?php echo '?>'; ?>
|
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
/**
|
||||
* Model template file.
|
||||
*
|
||||
* Used by bake to create new Model files.
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.console.libs.templates.objects
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
|
||||
echo "<?php\n"; ?>
|
||||
class <?php echo $name ?> extends <?php echo $plugin; ?>AppModel {
|
||||
var $name = '<?php echo $name; ?>';
|
||||
<?php if ($useDbConfig != 'default'): ?>
|
||||
var $useDbConfig = '<?php echo $useDbConfig; ?>';
|
||||
<?php endif;?>
|
||||
<?php if ($useTable && $useTable !== Inflector::tableize($name)):
|
||||
$table = "'$useTable'";
|
||||
echo "\tvar \$useTable = $table;\n";
|
||||
endif;
|
||||
if ($primaryKey !== 'id'): ?>
|
||||
var $primaryKey = '<?php echo $primaryKey; ?>';
|
||||
<?php endif;
|
||||
if ($displayField): ?>
|
||||
var $displayField = '<?php echo $displayField; ?>';
|
||||
<?php endif;
|
||||
|
||||
if (!empty($validate)):
|
||||
echo "\tvar \$validate = array(\n";
|
||||
foreach ($validate as $field => $validations):
|
||||
echo "\t\t'$field' => array(\n";
|
||||
foreach ($validations as $key => $validator):
|
||||
echo "\t\t\t'$key' => array(\n";
|
||||
echo "\t\t\t\t'rule' => array('$validator'),\n";
|
||||
echo "\t\t\t\t//'message' => 'Your custom message here',\n";
|
||||
echo "\t\t\t\t//'allowEmpty' => false,\n";
|
||||
echo "\t\t\t\t//'required' => false,\n";
|
||||
echo "\t\t\t\t//'last' => false, // Stop validation after this rule\n";
|
||||
echo "\t\t\t\t//'on' => 'create', // Limit validation to 'create' or 'update' operations\n";
|
||||
echo "\t\t\t),\n";
|
||||
endforeach;
|
||||
echo "\t\t),\n";
|
||||
endforeach;
|
||||
echo "\t);\n";
|
||||
endif;
|
||||
|
||||
foreach ($associations as $assoc):
|
||||
if (!empty($assoc)):
|
||||
?>
|
||||
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||
<?php
|
||||
break;
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
foreach (array('hasOne', 'belongsTo') as $assocType):
|
||||
if (!empty($associations[$assocType])):
|
||||
$typeCount = count($associations[$assocType]);
|
||||
echo "\n\tvar \$$assocType = array(";
|
||||
foreach ($associations[$assocType] as $i => $relation):
|
||||
$out = "\n\t\t'{$relation['alias']}' => array(\n";
|
||||
$out .= "\t\t\t'className' => '{$relation['className']}',\n";
|
||||
$out .= "\t\t\t'foreignKey' => '{$relation['foreignKey']}',\n";
|
||||
$out .= "\t\t\t'conditions' => '',\n";
|
||||
$out .= "\t\t\t'fields' => '',\n";
|
||||
$out .= "\t\t\t'order' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $typeCount) {
|
||||
$out .= ",";
|
||||
}
|
||||
echo $out;
|
||||
endforeach;
|
||||
echo "\n\t);\n";
|
||||
endif;
|
||||
endforeach;
|
||||
|
||||
if (!empty($associations['hasMany'])):
|
||||
$belongsToCount = count($associations['hasMany']);
|
||||
echo "\n\tvar \$hasMany = array(";
|
||||
foreach ($associations['hasMany'] as $i => $relation):
|
||||
$out = "\n\t\t'{$relation['alias']}' => array(\n";
|
||||
$out .= "\t\t\t'className' => '{$relation['className']}',\n";
|
||||
$out .= "\t\t\t'foreignKey' => '{$relation['foreignKey']}',\n";
|
||||
$out .= "\t\t\t'dependent' => false,\n";
|
||||
$out .= "\t\t\t'conditions' => '',\n";
|
||||
$out .= "\t\t\t'fields' => '',\n";
|
||||
$out .= "\t\t\t'order' => '',\n";
|
||||
$out .= "\t\t\t'limit' => '',\n";
|
||||
$out .= "\t\t\t'offset' => '',\n";
|
||||
$out .= "\t\t\t'exclusive' => '',\n";
|
||||
$out .= "\t\t\t'finderQuery' => '',\n";
|
||||
$out .= "\t\t\t'counterQuery' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $belongsToCount) {
|
||||
$out .= ",";
|
||||
}
|
||||
echo $out;
|
||||
endforeach;
|
||||
echo "\n\t);\n\n";
|
||||
endif;
|
||||
|
||||
if (!empty($associations['hasAndBelongsToMany'])):
|
||||
$habtmCount = count($associations['hasAndBelongsToMany']);
|
||||
echo "\n\tvar \$hasAndBelongsToMany = array(";
|
||||
foreach ($associations['hasAndBelongsToMany'] as $i => $relation):
|
||||
$out = "\n\t\t'{$relation['alias']}' => array(\n";
|
||||
$out .= "\t\t\t'className' => '{$relation['className']}',\n";
|
||||
$out .= "\t\t\t'joinTable' => '{$relation['joinTable']}',\n";
|
||||
$out .= "\t\t\t'foreignKey' => '{$relation['foreignKey']}',\n";
|
||||
$out .= "\t\t\t'associationForeignKey' => '{$relation['associationForeignKey']}',\n";
|
||||
$out .= "\t\t\t'unique' => true,\n";
|
||||
$out .= "\t\t\t'conditions' => '',\n";
|
||||
$out .= "\t\t\t'fields' => '',\n";
|
||||
$out .= "\t\t\t'order' => '',\n";
|
||||
$out .= "\t\t\t'limit' => '',\n";
|
||||
$out .= "\t\t\t'offset' => '',\n";
|
||||
$out .= "\t\t\t'finderQuery' => '',\n";
|
||||
$out .= "\t\t\t'deleteQuery' => '',\n";
|
||||
$out .= "\t\t\t'insertQuery' => ''\n";
|
||||
$out .= "\t\t)";
|
||||
if ($i + 1 < $habtmCount) {
|
||||
$out .= ",";
|
||||
}
|
||||
echo $out;
|
||||
endforeach;
|
||||
echo "\n\t);\n\n";
|
||||
endif;
|
||||
?>
|
||||
}
|
||||
<?php echo '?>'; ?>
|
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Test Case bake template
|
||||
*
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.console.libs.templates.objects
|
||||
* @since CakePHP(tm) v 1.3
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
echo "<?php\n";
|
||||
echo "/* ". $className ." Test cases generated on: " . date('Y-m-d H:m:s') . " : ". time() . "*/\n";
|
||||
?>
|
||||
App::import('<?php echo $type; ?>', '<?php echo $plugin . $className;?>');
|
||||
|
||||
<?php if ($mock and strtolower($type) == 'controller'): ?>
|
||||
class Test<?php echo $fullClassName; ?> extends <?php echo $fullClassName; ?> {
|
||||
var $autoRender = false;
|
||||
|
||||
function redirect($url, $status = null, $exit = true) {
|
||||
$this->redirectUrl = $url;
|
||||
}
|
||||
}
|
||||
|
||||
<?php endif; ?>
|
||||
class <?php echo $fullClassName; ?>TestCase extends CakeTestCase {
|
||||
<?php if (!empty($fixtures)): ?>
|
||||
var $fixtures = array('<?php echo join("', '", $fixtures); ?>');
|
||||
|
||||
<?php endif; ?>
|
||||
function startTest() {
|
||||
$this-><?php echo $className . ' =& ' . $construction; ?>
|
||||
}
|
||||
|
||||
function endTest() {
|
||||
unset($this-><?php echo $className;?>);
|
||||
ClassRegistry::flush();
|
||||
}
|
||||
|
||||
<?php foreach ($methods as $method): ?>
|
||||
function test<?php echo Inflector::classify($method); ?>() {
|
||||
|
||||
}
|
||||
|
||||
<?php endforeach;?>
|
||||
}
|
||||
<?php echo '?>'; ?>
|
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.console.libs.templates.views
|
||||
* @since CakePHP(tm) v 1.2.0.5234
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<div class="<?php echo $pluralVar;?> form">
|
||||
<?php echo "<?php echo \$this->Form->create('{$modelClass}');?>\n";?>
|
||||
<fieldset>
|
||||
<legend><?php printf("<?php __('%s %s'); ?>", Inflector::humanize($action), $singularHumanName); ?></legend>
|
||||
<?php
|
||||
echo "\t<?php\n";
|
||||
foreach ($fields as $field) {
|
||||
if (strpos($action, 'add') !== false && $field == $primaryKey) {
|
||||
continue;
|
||||
} elseif (!in_array($field, array('created', 'modified', 'updated'))) {
|
||||
echo "\t\techo \$this->Form->input('{$field}');\n";
|
||||
}
|
||||
}
|
||||
if (!empty($associations['hasAndBelongsToMany'])) {
|
||||
foreach ($associations['hasAndBelongsToMany'] as $assocName => $assocData) {
|
||||
echo "\t\techo \$this->Form->input('{$assocName}');\n";
|
||||
}
|
||||
}
|
||||
echo "\t?>\n";
|
||||
?>
|
||||
</fieldset>
|
||||
<?php
|
||||
echo "<?php echo \$this->Form->end(__('Submit', true));?>\n";
|
||||
?>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<h3><?php echo "<?php __('Actions'); ?>"; ?></h3>
|
||||
<ul>
|
||||
|
||||
<?php if (strpos($action, 'add') === false): ?>
|
||||
<li><?php echo "<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \$this->Form->value('{$modelClass}.{$primaryKey}')), null, sprintf(__('Are you sure you want to delete # %s?', true), \$this->Form->value('{$modelClass}.{$primaryKey}'))); ?>";?></li>
|
||||
<?php endif;?>
|
||||
<li><?php echo "<?php echo \$this->Html->link(__('List " . $pluralHumanName . "', true), array('action' => 'index'));?>";?></li>
|
||||
<?php
|
||||
$done = array();
|
||||
foreach ($associations as $type => $data) {
|
||||
foreach ($data as $alias => $details) {
|
||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
$done[] = $details['controller'];
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
$output = "<h2>Sweet, \"" . Inflector::humanize($app) . "\" got Baked by CakePHP!</h2>\n";
|
||||
$output .="
|
||||
<?php
|
||||
if (Configure::read() > 0):
|
||||
Debugger::checkSecurityKeys();
|
||||
endif;
|
||||
?>
|
||||
<p>
|
||||
<?php
|
||||
if (is_writable(TMP)):
|
||||
echo '<span class=\"notice success\">';
|
||||
__('Your tmp directory is writable.');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class=\"notice\">';
|
||||
__('Your tmp directory is NOT writable.');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
\$settings = Cache::settings();
|
||||
if (!empty(\$settings)):
|
||||
echo '<span class=\"notice success\">';
|
||||
printf(__('The %s is being used for caching. To change the config edit APP/config/core.php ', true), '<em>'. \$settings['engine'] . 'Engine</em>');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class=\"notice\">';
|
||||
__('Your cache is NOT working. Please check the settings in APP/config/core.php');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<p>
|
||||
<?php
|
||||
\$filePresent = null;
|
||||
if (file_exists(CONFIGS . 'database.php')):
|
||||
echo '<span class=\"notice success\">';
|
||||
__('Your database configuration file is present.');
|
||||
\$filePresent = true;
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class=\"notice\">';
|
||||
__('Your database configuration file is NOT present.');
|
||||
echo '<br/>';
|
||||
__('Rename config/database.php.default to config/database.php');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
if (!empty(\$filePresent)):
|
||||
if (!class_exists('ConnectionManager')) {
|
||||
require LIBS . 'model' . DS . 'connection_manager.php';
|
||||
}
|
||||
\$db = ConnectionManager::getInstance();
|
||||
\$connected = \$db->getDataSource('default');
|
||||
?>
|
||||
<p>
|
||||
<?php
|
||||
if (\$connected->isConnected()):
|
||||
echo '<span class=\"notice success\">';
|
||||
__('Cake is able to connect to the database.');
|
||||
echo '</span>';
|
||||
else:
|
||||
echo '<span class=\"notice\">';
|
||||
__('Cake is NOT able to connect to the database.');
|
||||
echo '</span>';
|
||||
endif;
|
||||
?>
|
||||
</p>\n";
|
||||
$output .= "<?php endif;?>\n";
|
||||
$output .= "<h3><?php __('Editing this Page') ?></h3>\n";
|
||||
$output .= "<p>\n";
|
||||
$output .= "<?php\n";
|
||||
$output .= "\tprintf(__('To change the content of this page, edit: %s\n";
|
||||
$output .= "\t\tTo change its layout, edit: %s\n";
|
||||
$output .= "\t\tYou can also add some CSS styles for your pages at: %s', true),\n";
|
||||
$output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
|
||||
$output .= "?>\n";
|
||||
$output .= "</p>\n";
|
||||
?>
|
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.console.libs.templates.views
|
||||
* @since CakePHP(tm) v 1.2.0.5234
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<div class="<?php echo $pluralVar;?> index">
|
||||
<h2><?php echo "<?php __('{$pluralHumanName}');?>";?></h2>
|
||||
<table cellpadding="0" cellspacing="0">
|
||||
<tr>
|
||||
<?php foreach ($fields as $field):?>
|
||||
<th><?php echo "<?php echo \$this->Paginator->sort('{$field}');?>";?></th>
|
||||
<?php endforeach;?>
|
||||
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
|
||||
</tr>
|
||||
<?php
|
||||
echo "<?php
|
||||
\$i = 0;
|
||||
foreach (\${$pluralVar} as \${$singularVar}):
|
||||
\$class = null;
|
||||
if (\$i++ % 2 == 0) {
|
||||
\$class = ' class=\"altrow\"';
|
||||
}
|
||||
?>\n";
|
||||
echo "\t<tr<?php echo \$class;?>>\n";
|
||||
foreach ($fields as $field) {
|
||||
$isKey = false;
|
||||
if (!empty($associations['belongsTo'])) {
|
||||
foreach ($associations['belongsTo'] as $alias => $details) {
|
||||
if ($field === $details['foreignKey']) {
|
||||
$isKey = true;
|
||||
echo "\t\t<td>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t</td>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($isKey !== true) {
|
||||
echo "\t\t<td><?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?> </td>\n";
|
||||
}
|
||||
}
|
||||
|
||||
echo "\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('View', true), array('action' => 'view', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?>\n";
|
||||
echo "\t\t</td>\n";
|
||||
echo "\t</tr>\n";
|
||||
|
||||
echo "<?php endforeach; ?>\n";
|
||||
?>
|
||||
</table>
|
||||
<p>
|
||||
<?php echo "<?php
|
||||
echo \$this->Paginator->counter(array(
|
||||
'format' => __('Page %page% of %pages%, showing %current% records out of %count% total, starting on record %start%, ending on %end%', true)
|
||||
));
|
||||
?>";?>
|
||||
</p>
|
||||
|
||||
<div class="paging">
|
||||
<?php echo "\t<?php echo \$this->Paginator->prev('<< ' . __('previous', true), array(), null, array('class'=>'disabled'));?>\n";?>
|
||||
| <?php echo "\t<?php echo \$this->Paginator->numbers();?>\n"?> |
|
||||
<?php echo "\t<?php echo \$this->Paginator->next(__('next', true) . ' >>', array(), null, array('class' => 'disabled'));?>\n";?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<h3><?php echo "<?php __('Actions'); ?>"; ?></h3>
|
||||
<ul>
|
||||
<li><?php echo "<?php echo \$this->Html->link(__('New " . $singularHumanName . "', true), array('action' => 'add')); ?>";?></li>
|
||||
<?php
|
||||
$done = array();
|
||||
foreach ($associations as $type => $data) {
|
||||
foreach ($data as $alias => $details) {
|
||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
$done[] = $details['controller'];
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
@@ -0,0 +1,146 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
|
||||
* Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
*
|
||||
* Licensed under The MIT License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @copyright Copyright 2005-2010, Cake Software Foundation, Inc. (http://cakefoundation.org)
|
||||
* @link http://cakephp.org CakePHP(tm) Project
|
||||
* @package cake
|
||||
* @subpackage cake.cake.console.libs.templates.views
|
||||
* @since CakePHP(tm) v 1.2.0.5234
|
||||
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
||||
*/
|
||||
?>
|
||||
<div class="<?php echo $pluralVar;?> view">
|
||||
<h2><?php echo "<?php __('{$singularHumanName}');?>";?></h2>
|
||||
<dl><?php echo "<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
|
||||
<?php
|
||||
foreach ($fields as $field) {
|
||||
$isKey = false;
|
||||
if (!empty($associations['belongsTo'])) {
|
||||
foreach ($associations['belongsTo'] as $alias => $details) {
|
||||
if ($field === $details['foreignKey']) {
|
||||
$isKey = true;
|
||||
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize(Inflector::underscore($alias)) . "'); ?></dt>\n";
|
||||
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \$this->Html->link(\${$singularVar}['{$alias}']['{$details['displayField']}'], array('controller' => '{$details['controller']}', 'action' => 'view', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?>\n\t\t\t \n\t\t</dd>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($isKey !== true) {
|
||||
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "'); ?></dt>\n";
|
||||
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t\t\t<?php echo \${$singularVar}['{$modelClass}']['{$field}']; ?>\n\t\t\t \n\t\t</dd>\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
</dl>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<h3><?php echo "<?php __('Actions'); ?>"; ?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('Edit " . $singularHumanName ."', true), array('action' => 'edit', \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('Delete " . $singularHumanName . "', true), array('action' => 'delete', \${$singularVar}['{$modelClass}']['{$primaryKey}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$singularVar}['{$modelClass}']['{$primaryKey}'])); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('List " . $pluralHumanName . "', true), array('action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('New " . $singularHumanName . "', true), array('action' => 'add')); ?> </li>\n";
|
||||
|
||||
$done = array();
|
||||
foreach ($associations as $type => $data) {
|
||||
foreach ($data as $alias => $details) {
|
||||
if ($details['controller'] != $this->name && !in_array($details['controller'], $done)) {
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('List " . Inflector::humanize($details['controller']) . "', true), array('controller' => '{$details['controller']}', 'action' => 'index')); ?> </li>\n";
|
||||
echo "\t\t<li><?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add')); ?> </li>\n";
|
||||
$done[] = $details['controller'];
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
if (!empty($associations['hasOne'])) :
|
||||
foreach ($associations['hasOne'] as $alias => $details): ?>
|
||||
<div class="related">
|
||||
<h3><?php echo "<?php __('Related " . Inflector::humanize($details['controller']) . "');?>";?></h3>
|
||||
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
|
||||
<dl><?php echo "\t<?php \$i = 0; \$class = ' class=\"altrow\"';?>\n";?>
|
||||
<?php
|
||||
foreach ($details['fields'] as $field) {
|
||||
echo "\t\t<dt<?php if (\$i % 2 == 0) echo \$class;?>><?php __('" . Inflector::humanize($field) . "');?></dt>\n";
|
||||
echo "\t\t<dd<?php if (\$i++ % 2 == 0) echo \$class;?>>\n\t<?php echo \${$singularVar}['{$alias}']['{$field}'];?>\n </dd>\n";
|
||||
}
|
||||
?>
|
||||
</dl>
|
||||
<?php echo "<?php endif; ?>\n";?>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo "<?php echo \$this->Html->link(__('Edit " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$singularVar}['{$alias}']['{$details['primaryKey']}'])); ?></li>\n";?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
endforeach;
|
||||
endif;
|
||||
if (empty($associations['hasMany'])) {
|
||||
$associations['hasMany'] = array();
|
||||
}
|
||||
if (empty($associations['hasAndBelongsToMany'])) {
|
||||
$associations['hasAndBelongsToMany'] = array();
|
||||
}
|
||||
$relations = array_merge($associations['hasMany'], $associations['hasAndBelongsToMany']);
|
||||
$i = 0;
|
||||
foreach ($relations as $alias => $details):
|
||||
$otherSingularVar = Inflector::variable($alias);
|
||||
$otherPluralHumanName = Inflector::humanize($details['controller']);
|
||||
?>
|
||||
<div class="related">
|
||||
<h3><?php echo "<?php __('Related " . $otherPluralHumanName . "');?>";?></h3>
|
||||
<?php echo "<?php if (!empty(\${$singularVar}['{$alias}'])):?>\n";?>
|
||||
<table cellpadding = "0" cellspacing = "0">
|
||||
<tr>
|
||||
<?php
|
||||
foreach ($details['fields'] as $field) {
|
||||
echo "\t\t<th><?php __('" . Inflector::humanize($field) . "'); ?></th>\n";
|
||||
}
|
||||
?>
|
||||
<th class="actions"><?php echo "<?php __('Actions');?>";?></th>
|
||||
</tr>
|
||||
<?php
|
||||
echo "\t<?php
|
||||
\$i = 0;
|
||||
foreach (\${$singularVar}['{$alias}'] as \${$otherSingularVar}):
|
||||
\$class = null;
|
||||
if (\$i++ % 2 == 0) {
|
||||
\$class = ' class=\"altrow\"';
|
||||
}
|
||||
?>\n";
|
||||
echo "\t\t<tr<?php echo \$class;?>>\n";
|
||||
|
||||
foreach ($details['fields'] as $field) {
|
||||
echo "\t\t\t<td><?php echo \${$otherSingularVar}['{$field}'];?></td>\n";
|
||||
}
|
||||
|
||||
echo "\t\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t\t<?php echo \$this->Html->link(__('View', true), array('controller' => '{$details['controller']}', 'action' => 'view', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$this->Html->link(__('Edit', true), array('controller' => '{$details['controller']}', 'action' => 'edit', \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t\t<?php echo \$this->Html->link(__('Delete', true), array('controller' => '{$details['controller']}', 'action' => 'delete', \${$otherSingularVar}['{$details['primaryKey']}']), null, sprintf(__('Are you sure you want to delete # %s?', true), \${$otherSingularVar}['{$details['primaryKey']}'])); ?>\n";
|
||||
echo "\t\t\t</td>\n";
|
||||
echo "\t\t</tr>\n";
|
||||
|
||||
echo "\t<?php endforeach; ?>\n";
|
||||
?>
|
||||
</table>
|
||||
<?php echo "<?php endif; ?>\n\n";?>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo "<?php echo \$this->Html->link(__('New " . Inflector::humanize(Inflector::underscore($alias)) . "', true), array('controller' => '{$details['controller']}', 'action' => 'add'));?>";?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<?php endforeach;?>
|
Reference in New Issue
Block a user