mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Merge branch 'master' into 2.3
This commit is contained in:
commit
35d67bf4a8
6 changed files with 102 additions and 25 deletions
|
@ -380,7 +380,9 @@ class Shell extends Object {
|
|||
if (!empty($this->params['quiet'])) {
|
||||
$this->_useLogger(false);
|
||||
}
|
||||
|
||||
if (!empty($this->params['plugin'])) {
|
||||
CakePlugin::load($this->params['plugin']);
|
||||
}
|
||||
$this->command = $command;
|
||||
if (!empty($this->params['help'])) {
|
||||
return $this->_displayHelp($command);
|
||||
|
|
|
@ -433,8 +433,14 @@ class Scaffold {
|
|||
$associations[$type][$assocKey]['foreignKey'] =
|
||||
$assocData['foreignKey'];
|
||||
|
||||
list($plugin, $model) = pluginSplit($assocData['className']);
|
||||
if ($plugin) {
|
||||
$plugin = Inflector::underscore($plugin);
|
||||
}
|
||||
$associations[$type][$assocKey]['plugin'] = $plugin;
|
||||
|
||||
$associations[$type][$assocKey]['controller'] =
|
||||
Inflector::pluralize(Inflector::underscore($assocData['className']));
|
||||
Inflector::pluralize(Inflector::underscore($model));
|
||||
|
||||
if ($type == 'hasAndBelongsToMany') {
|
||||
$associations[$type][$assocKey]['with'] = $assocData['with'];
|
||||
|
|
|
@ -217,6 +217,7 @@ class ScaffoldTest extends CakeTestCase {
|
|||
$this->assertEquals('scaffoldMock', $result['singularVar']);
|
||||
$this->assertEquals('scaffoldMock', $result['pluralVar']);
|
||||
$this->assertEquals(array('id', 'user_id', 'title', 'body', 'published', 'created', 'updated'), $result['scaffoldFields']);
|
||||
$this->assertArrayHasKey('plugin', $result['associations']['belongsTo']['User']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,8 +40,14 @@
|
|||
foreach ($associations as $_type => $_data) {
|
||||
foreach ($_data as $_alias => $_details) {
|
||||
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(
|
||||
__d('cake', 'List %s', Inflector::humanize($_details['controller'])),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index')
|
||||
) . "</li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(
|
||||
__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
|
||||
) . "</li>\n";
|
||||
$done[] = $_details['controller'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,29 +26,28 @@
|
|||
<th><?php echo __d('cake', 'Actions'); ?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach (${$pluralVar} as ${$singularVar}):
|
||||
echo "<tr>";
|
||||
echo '<tr>';
|
||||
foreach ($scaffoldFields as $_field) {
|
||||
$isKey = false;
|
||||
if (!empty($associations['belongsTo'])) {
|
||||
foreach ($associations['belongsTo'] as $_alias => $_details) {
|
||||
if ($_field === $_details['foreignKey']) {
|
||||
$isKey = true;
|
||||
echo "<td>" . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "</td>";
|
||||
echo '<td>' . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . '</td>';
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($isKey !== true) {
|
||||
echo "<td>" . h(${$singularVar}[$modelClass][$_field]) . "</td>";
|
||||
echo '<td>' . h(${$singularVar}[$modelClass][$_field]) . '</td>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '<td class="actions">';
|
||||
echo $this->Html->link(__d('cake', 'View'), array('action' => 'view', ${$singularVar}[$modelClass][$primaryKey]));
|
||||
echo $this->Html->link(__d('cake', 'Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
|
||||
echo $this->Form->postLink(
|
||||
echo ' ' . $this->Html->link(__d('cake', 'Edit'), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
|
||||
echo ' ' . $this->Form->postLink(
|
||||
__d('cake', 'Delete'),
|
||||
array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]),
|
||||
null,
|
||||
|
@ -83,8 +82,19 @@ endforeach;
|
|||
foreach ($associations as $_type => $_data) {
|
||||
foreach ($_data as $_alias => $_details) {
|
||||
if ($_details['controller'] != $this->name && !in_array($_details['controller'], $done)) {
|
||||
echo "<li>" . $this->Html->link(__d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>";
|
||||
echo "<li>" . $this->Html->link(__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>";
|
||||
echo '<li>';
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'List %s', Inflector::humanize($_details['controller'])),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index')
|
||||
);
|
||||
echo '</li>';
|
||||
|
||||
echo '<li>';
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
|
||||
);
|
||||
echo '</li>';
|
||||
$done[] = $_details['controller'];
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,12 @@ foreach ($scaffoldFields as $_field) {
|
|||
if ($_field === $_details['foreignKey']) {
|
||||
$isKey = true;
|
||||
echo "\t\t<dt>" . Inflector::humanize($_alias) . "</dt>\n";
|
||||
echo "\t\t<dd>\n\t\t\t" . $this->Html->link(${$singularVar}[$_alias][$_details['displayField']], array('controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])) . "\n\t\t </dd>\n";
|
||||
echo "\t\t<dd>\n\t\t\t";
|
||||
echo $this->Html->link(
|
||||
${$singularVar}[$_alias][$_details['displayField']],
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'view', ${$singularVar}[$_alias][$_details['primaryKey']])
|
||||
);
|
||||
echo "\n\t\t </dd>\n";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -45,17 +50,38 @@ foreach ($scaffoldFields as $_field) {
|
|||
<h3><?php echo __d('cake', 'Actions'); ?></h3>
|
||||
<ul>
|
||||
<?php
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey])) . " </li>\n";
|
||||
echo "\t\t<li>" . $this->Form->postLink(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?') . " </li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index')) . " </li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add')) . " </li>\n";
|
||||
echo "\t\t<li>";
|
||||
echo $this->Html->link(__d('cake', 'Edit %s', $singularHumanName), array('action' => 'edit', ${$singularVar}[$modelClass][$primaryKey]));
|
||||
echo " </li>\n";
|
||||
|
||||
echo "\t\t<li>";
|
||||
echo $this->Form->postLink(__d('cake', 'Delete %s', $singularHumanName), array('action' => 'delete', ${$singularVar}[$modelClass][$primaryKey]), null, __d('cake', 'Are you sure you want to delete').' #' . ${$singularVar}[$modelClass][$primaryKey] . '?');
|
||||
echo " </li>\n";
|
||||
|
||||
echo "\t\t<li>";
|
||||
echo $this->Html->link(__d('cake', 'List %s', $pluralHumanName), array('action' => 'index'));
|
||||
echo " </li>\n";
|
||||
|
||||
echo "\t\t<li>";
|
||||
echo $this->Html->link(__d('cake', 'New %s', $singularHumanName), array('action' => 'add'));
|
||||
echo " </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>" . $this->Html->link(__d('cake', 'List %s', Inflector::humanize($_details['controller'])), array('controller' => $_details['controller'], 'action' => 'index')) . "</li>\n";
|
||||
echo "\t\t<li>" . $this->Html->link(__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')) . "</li>\n";
|
||||
echo "\t\t<li>";
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'List %s', Inflector::humanize($_details['controller'])),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'index')
|
||||
);
|
||||
echo "</li>\n";
|
||||
echo "\t\t<li>";
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'New %s', Inflector::humanize(Inflector::underscore($_alias))),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
|
||||
);
|
||||
echo "</li>\n";
|
||||
$done[] = $_details['controller'];
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +108,13 @@ foreach ($associations['hasOne'] as $_alias => $_details): ?>
|
|||
<?php endif; ?>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo $this->Html->link(__d('cake', 'Edit %s', Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'edit', ${$singularVar}[$_alias][$_details['primaryKey']]))."</li>\n"; ?>
|
||||
<li><?php
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'Edit %s', Inflector::humanize(Inflector::underscore($_alias))),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'edit', ${$singularVar}[$_alias][$_details['primaryKey']])
|
||||
);
|
||||
echo "</li>\n";
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -128,9 +160,26 @@ $otherSingularVar = Inflector::variable($_alias);
|
|||
}
|
||||
|
||||
echo "\t\t\t<td class=\"actions\">\n";
|
||||
echo "\t\t\t\t" . $this->Html->link(__d('cake', 'View'), array('controller' => $_details['controller'], 'action' => 'view', ${$otherSingularVar}[$_details['primaryKey']])). "\n";
|
||||
echo "\t\t\t\t" . $this->Html->link(__d('cake', 'Edit'), array('controller' => $_details['controller'], 'action' => 'edit', ${$otherSingularVar}[$_details['primaryKey']])). "\n";
|
||||
echo "\t\t\t\t" . $this->Form->postLink(__d('cake', 'Delete'), array('controller' => $_details['controller'], 'action' => 'delete', ${$otherSingularVar}[$_details['primaryKey']]), null, __d('cake', 'Are you sure you want to delete', true).' #' . ${$otherSingularVar}[$_details['primaryKey']] . '?'). "\n";
|
||||
echo "\t\t\t\t";
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'View'),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'view', ${$otherSingularVar}[$_details['primaryKey']])
|
||||
);
|
||||
echo "\n";
|
||||
echo "\t\t\t\t";
|
||||
echo $this->Html->link(
|
||||
__d('cake', 'Edit'),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'edit', ${$otherSingularVar}[$_details['primaryKey']])
|
||||
);
|
||||
echo "\n";
|
||||
echo "\t\t\t\t";
|
||||
echo $this->Form->postLink(
|
||||
__d('cake', 'Delete'),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'delete', ${$otherSingularVar}[$_details['primaryKey']]),
|
||||
null,
|
||||
__d('cake', 'Are you sure you want to delete', true) .' #' . ${$otherSingularVar}[$_details['primaryKey']] . '?'
|
||||
);
|
||||
echo "\n";
|
||||
echo "\t\t\t</td>\n";
|
||||
echo "\t\t</tr>\n";
|
||||
endforeach;
|
||||
|
@ -139,7 +188,10 @@ $otherSingularVar = Inflector::variable($_alias);
|
|||
<?php endif; ?>
|
||||
<div class="actions">
|
||||
<ul>
|
||||
<li><?php echo $this->Html->link(__d('cake', "New %s", Inflector::humanize(Inflector::underscore($_alias))), array('controller' => $_details['controller'], 'action' => 'add')); ?> </li>
|
||||
<li><?php echo $this->Html->link(
|
||||
__d('cake', "New %s", Inflector::humanize(Inflector::underscore($_alias))),
|
||||
array('plugin' => $_details['plugin'], 'controller' => $_details['controller'], 'action' => 'add')
|
||||
); ?> </li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue