mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-31 00:48:25 +00:00
[1188]
Author: phpnut Date: 2:44:40 AM, Monday, October 24, 2005 Message: Should complete work on new look for scaffold [1187] Author: phpnut Date: 1:59:09 AM, Monday, October 24, 2005 Message: More work on scaffold to get all changes done in the last few days correctly displaying. Fix for Ticket #89 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1189 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
dd6024b1c4
commit
2acd3acbf6
13 changed files with 190 additions and 180 deletions
|
@ -34,8 +34,9 @@
|
|||
/**
|
||||
* Enter description here...
|
||||
*/
|
||||
require(ROOT.'config'.DS.'paths.php');
|
||||
require(LIBS.'basics.php');
|
||||
require_once(CONFIGS.'paths.php');
|
||||
require_once(CAKE.'basics.php');
|
||||
require_once(LIBS.'folder.php');
|
||||
require(LIBS.'file.php');
|
||||
require(LIBS.'legacy.php');
|
||||
|
||||
|
|
|
@ -77,47 +77,44 @@ p
|
|||
#header
|
||||
{
|
||||
padding: 0px;
|
||||
height: 112px;
|
||||
height: 114px;
|
||||
background: #fff url("../img/cake.bg.header.gif") repeat-x;
|
||||
border-bottom: 1px solid #D2D7D8;
|
||||
vertical-align: bottom;
|
||||
white-space: normal;
|
||||
margin-bottom: 30px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#headerLogo
|
||||
#header img
|
||||
{
|
||||
float: left;
|
||||
vertical-align: middle;
|
||||
border: 0;
|
||||
}
|
||||
#headerLogo img
|
||||
{
|
||||
border: 0;
|
||||
}
|
||||
#headerNav
|
||||
.headerNav
|
||||
{
|
||||
float: right;
|
||||
margin-top: 56px;
|
||||
margin-right: 30px;
|
||||
margin-bottom: 12px;
|
||||
font-size: 15px;
|
||||
margin-top: 3px;
|
||||
padding-right: 30px;
|
||||
font-size: 13px;
|
||||
font-weight: bold;
|
||||
color: #71300F;
|
||||
}
|
||||
|
||||
#headerNav a {
|
||||
.headerNav a {
|
||||
padding: 4px 10px;
|
||||
}
|
||||
#headerNav a:hover {
|
||||
.headerNav a:hover {
|
||||
padding: 4px 10px;
|
||||
background-color: #D2D7D8;
|
||||
background-color: #fff;
|
||||
}
|
||||
#headerNav .active {
|
||||
.headerNav .active {
|
||||
padding: 4px 10px;
|
||||
background-color: #D2D7D8;
|
||||
background-color: #fff;
|
||||
}
|
||||
#pageNav {
|
||||
margin-top: 20px;
|
||||
clear: both;
|
||||
margin-top: 0px;
|
||||
margin-right: 30px;
|
||||
margin-left: 30px;
|
||||
text-align: right;
|
||||
font-size: 15px;
|
||||
font-weight: bold;
|
||||
|
@ -148,7 +145,7 @@ p
|
|||
{
|
||||
clear: both;
|
||||
margin: 2px 20px 20px 20px;
|
||||
padding: 6px 28px 40px 22px;
|
||||
padding: 20px 28px 40px 22px;
|
||||
background-color: #fff;
|
||||
border-top: 1px solid #D2D7D8;
|
||||
border-left: 1px solid #D2D7D8;
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
/* form.css */
|
||||
|
||||
form {
|
||||
font-size: 100%;
|
||||
min-width: 560px;
|
||||
max-width: 620px;
|
||||
width: 590px;
|
||||
margin: 0 4px;
|
||||
font-size: 120%;
|
||||
border-width: 0px 0px 0px 0px;
|
||||
border-style: solid;
|
||||
border-color: #71300F;
|
||||
}
|
||||
|
||||
form fieldset {
|
||||
|
@ -23,7 +24,7 @@ form fieldset legend {
|
|||
}
|
||||
|
||||
label {
|
||||
font-size: 100%;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
label u {
|
||||
|
@ -44,7 +45,6 @@ textarea {
|
|||
form div {
|
||||
clear: left;
|
||||
display: block;
|
||||
width: 354px;
|
||||
height: expression('1%');
|
||||
margin: 5px 0px 0px 0px;
|
||||
padding: 1px 3px;
|
||||
|
@ -85,12 +85,11 @@ form fieldset div.notes p.last {
|
|||
|
||||
form div fieldset {
|
||||
clear: none;
|
||||
border-width: 1px;
|
||||
border-width: 0px 1px 0px 1px;
|
||||
border-style: solid;
|
||||
border-color: #666;
|
||||
margin: 0px 0px 0px 142px;
|
||||
padding: 0px 5px 5px 5px;
|
||||
width: 197px;
|
||||
}
|
||||
|
||||
form div fieldset legend {
|
||||
|
@ -105,7 +104,9 @@ form div.required fieldset legend {
|
|||
form div label {
|
||||
display: block;
|
||||
float: left;
|
||||
width: 130px;
|
||||
width: 200px;
|
||||
background-color: #f4f4f4;
|
||||
font-size: 16px;
|
||||
padding: 3px 5px;
|
||||
margin: 0px 0px 5px 0px;
|
||||
text-align: right;
|
||||
|
@ -122,7 +123,6 @@ form div.required label, label.required {
|
|||
form div label.labelCheckbox, form div label.labelRadio {
|
||||
float: none;
|
||||
display: block;
|
||||
width: 200px;
|
||||
height: expression('1%');
|
||||
margin: 0px 0px 5px 142px;
|
||||
text-align: left;
|
||||
|
@ -130,43 +130,14 @@ form div label.labelCheckbox, form div label.labelRadio {
|
|||
|
||||
form div fieldset label.labelCheckbox, form div fieldset label.labelRadio {
|
||||
margin: 0px 0px 5px 0px;
|
||||
width: 170px;
|
||||
}
|
||||
|
||||
p.error {
|
||||
background-color: #f00;
|
||||
background-image: url(/images/icon_error.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: 3px 3px;
|
||||
color: #ffffff;
|
||||
padding: 3px 3px 5px 27px;
|
||||
border: 1px solid #000;
|
||||
margin: auto 100px;
|
||||
}
|
||||
|
||||
form div.error {
|
||||
background-color: #ffffe1;
|
||||
background-image: url(/images/required_bg.gif);
|
||||
background-repeat: no-repeat;
|
||||
background-position: top left;
|
||||
color: #666;
|
||||
border: 1px solid #f00;
|
||||
}
|
||||
|
||||
form div.error p.error {
|
||||
background-image: url(/images/icon_error.gif);
|
||||
background-position: top left;
|
||||
background-color: transparent;
|
||||
border-style: none;
|
||||
font-size: 88%;
|
||||
font-weight: bold;
|
||||
margin: 0px 0px 0px 118px;
|
||||
width: 200px;
|
||||
color: #f00;
|
||||
color: #71300F;
|
||||
background-color: #DBA941;
|
||||
}
|
||||
|
||||
form div input, form div select, form div textarea {
|
||||
width: 200px;
|
||||
background-color: #f4f4f4;
|
||||
padding: 1px 3px;
|
||||
margin: 0px 0px 0px 0px;
|
||||
}
|
||||
|
@ -189,38 +160,34 @@ form div input.inputCheckbox, form div input.inputRadio, input.inputCheckbox, in
|
|||
}
|
||||
|
||||
form div.submit {
|
||||
width: 214px;
|
||||
padding: 0px 0px 0px 140px;
|
||||
clear:both;
|
||||
display:block;
|
||||
}
|
||||
|
||||
div.submit input {
|
||||
text-align:center;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background-color:#3297FC;
|
||||
display:block;
|
||||
float:left;
|
||||
text-decoration: none;
|
||||
border: 1px;
|
||||
width: 215px;
|
||||
padding:6px;
|
||||
margin: 5px;
|
||||
|
||||
}
|
||||
form div.submit div {
|
||||
display: inline;
|
||||
float: left;
|
||||
text-align: left;
|
||||
padding: 2px 12px;
|
||||
color: #71300F;
|
||||
background-color:#ccc;
|
||||
text-decoration: none;
|
||||
border: 1px solid #666;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align:center;
|
||||
text-decoration: none;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
form div input.inputSubmit, form div input.inputButton, input.inputSubmit, input.inputButton {
|
||||
background-color: #cccccc;
|
||||
color: #000000;
|
||||
div.submit input:hover {
|
||||
padding: 2px 12px;
|
||||
color: #fff;
|
||||
background-color:#71300F;
|
||||
text-decoration: none;
|
||||
border: 1px solid #666;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align:center;
|
||||
text-decoration: none;
|
||||
width: auto;
|
||||
padding: 0px 6px;
|
||||
}
|
||||
|
||||
form div.submit div input.inputSubmit, form div.submit div input.inputButton {
|
||||
|
|
|
@ -1,4 +1,18 @@
|
|||
/* CSS Document */
|
||||
h1
|
||||
{
|
||||
padding: 2px 6px;
|
||||
color: #fff;
|
||||
background-color: #71300F;
|
||||
font-size: 30px;
|
||||
}
|
||||
h2
|
||||
{
|
||||
padding: 1px 6px;
|
||||
color: #fff;
|
||||
background-color: #71300F;
|
||||
font-size: 24px;
|
||||
}
|
||||
code, pre {
|
||||
color:#44a;
|
||||
font-family:monospace;
|
||||
|
@ -26,65 +40,79 @@ li {
|
|||
}
|
||||
|
||||
.notice {
|
||||
background: #71300F;
|
||||
border: solid 2px #eeb;
|
||||
display: block;
|
||||
color: #71300F;
|
||||
background-color: #DBA941;
|
||||
font-family: Verdana;
|
||||
padding: 1em;
|
||||
}
|
||||
.tip {
|
||||
background: #71300F;
|
||||
border: solid 2px #333;
|
||||
padding: 1em;
|
||||
}
|
||||
.error {
|
||||
color: #DBA941
|
||||
background: #f4f4f4;
|
||||
border: solid 2px #333;
|
||||
color: #71300F;
|
||||
background-color: #DBA941;
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
ul.actions {
|
||||
list-style: none;
|
||||
text-align:right;
|
||||
text-align:left;
|
||||
margin:2em 0;
|
||||
padding: 0 0em;
|
||||
}
|
||||
ul.actions li {
|
||||
border: 1px solid #333;
|
||||
margin-left:1em;
|
||||
width:10em;
|
||||
list-style: none;
|
||||
display: inline;
|
||||
}
|
||||
ul.actions li a, ul.actions li input {
|
||||
background-color:#71300F;
|
||||
border:1px solid #71300F;
|
||||
clear: both;
|
||||
color: #fff;
|
||||
display:block;
|
||||
padding: 2px 12px;
|
||||
color: #71300F;
|
||||
background-color:#ccc;
|
||||
text-decoration: none;
|
||||
border: 1px solid #666;
|
||||
line-height: 24px;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align:center;
|
||||
text-decoration: none;
|
||||
}
|
||||
ul.actions li a:hover {
|
||||
color: #71300F;
|
||||
background-color:#fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
td.listactions {
|
||||
width:17em;
|
||||
width: 14em;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
}
|
||||
td.listactions a {
|
||||
float: left;
|
||||
|
||||
padding: 0px 8px;
|
||||
text-align:center;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #71300F;
|
||||
background-color:#ccc;
|
||||
text-decoration: none;
|
||||
border: 1px solid #666;
|
||||
|
||||
}
|
||||
td.listactions a:hover {
|
||||
padding: 0px 8px;
|
||||
text-align:center;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
background-color:#71300F;
|
||||
display:block;
|
||||
text-decoration: none;
|
||||
margin-bottom:3px;
|
||||
margin-right: 3px;
|
||||
border: 1px;
|
||||
width:5em;
|
||||
border: 1px solid #666;
|
||||
white-space: nowrap;
|
||||
}
|
||||
table {
|
||||
width: 100%;
|
||||
background-color: #fff;
|
||||
border: 1px solid #333;
|
||||
clear:both;
|
||||
margin: 1em 0 2em 0;
|
||||
margin: 0em 0 2em 0;
|
||||
white-space: normal;
|
||||
}
|
||||
th {
|
||||
|
@ -92,13 +120,15 @@ th {
|
|||
border-top: 1px solid #fff;
|
||||
border-right: 1px solid #666;
|
||||
border-bottom: 1px solid #666;
|
||||
text-align: left;
|
||||
text-align: center;
|
||||
padding:3px;
|
||||
}
|
||||
table tr td {
|
||||
border-right: 1px solid #ccc;
|
||||
padding:2px 4px;
|
||||
padding:4px 4px;
|
||||
font-size: 12px;
|
||||
vertical-align:top;
|
||||
text-align: center;
|
||||
}
|
||||
table tr.altRow td {
|
||||
background: #f4f4f4;
|
||||
|
|
|
@ -109,8 +109,8 @@ require_once LIBS.'inflector.php';
|
|||
|
||||
if (strpos($url, 'ccss/') === 0)
|
||||
{
|
||||
include ROOT.'public'.DS.'css.php';
|
||||
die;
|
||||
include WWW_ROOT.DS.'css.php';
|
||||
die();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -399,23 +399,23 @@ function params($p)
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
function setUri() {
|
||||
if (isset($_SERVER['REQUEST_URI']))
|
||||
function setUri()
|
||||
{
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (isset($_SERVER['argv']))
|
||||
if (isset($_SERVER['REQUEST_URI']))
|
||||
{
|
||||
$uri = $_SERVER['PHP_SELF'] .'/'. $_SERVER['argv'][0];
|
||||
$uri = $_SERVER['REQUEST_URI'];
|
||||
}
|
||||
else
|
||||
{
|
||||
$uri = $_SERVER['PHP_SELF'] .'/'. $_SERVER['QUERY_STRING'];
|
||||
if (isset($_SERVER['argv']))
|
||||
{
|
||||
$uri = $_SERVER['PHP_SELF'] .'/'. $_SERVER['argv'][0];
|
||||
}
|
||||
else
|
||||
{
|
||||
$uri = $_SERVER['PHP_SELF'] .'/'. $_SERVER['QUERY_STRING'];
|
||||
}
|
||||
}
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
return $uri;
|
||||
}
|
||||
?>
|
|
@ -649,6 +649,7 @@ class Controller extends Object
|
|||
}
|
||||
switch( $type )
|
||||
{
|
||||
|
||||
case "text":
|
||||
{
|
||||
$fieldNames[ $tabl['name']]['type'] = 'area';
|
||||
|
@ -664,9 +665,8 @@ class Controller extends Object
|
|||
$fieldNames[ $tabl['name']]['options'] = array();
|
||||
|
||||
// get the list of options from the other model.
|
||||
$registry =& ClassRegistry::getInstance();
|
||||
$otherModel =& $registry->getObject($fieldNames[ $tabl['name']]['model']);
|
||||
|
||||
$registry = ClassRegistry::getInstance();
|
||||
$otherModel = $registry->getObject($fieldNames[$tabl['name']]['model']);
|
||||
if( is_object($otherModel) )
|
||||
{
|
||||
if( $doCreateOptions )
|
||||
|
@ -726,8 +726,9 @@ class Controller extends Object
|
|||
$fieldNames[ $tabl['name']]['options'] = array();
|
||||
|
||||
// get the list of options from the other model.
|
||||
$registry =& ClassRegistry::getInstance();
|
||||
$otherModel =& $registry->getObject($fieldNames[ $tabl['name']]['model']);
|
||||
$registry = ClassRegistry::getInstance();
|
||||
|
||||
$otherModel = $registry->getObject($fieldNames[$tabl['name']]['model']);
|
||||
|
||||
if( is_object($otherModel) )
|
||||
{
|
||||
|
@ -789,34 +790,34 @@ class Controller extends Object
|
|||
// loop through the many to many relations to make a list box.
|
||||
foreach( $objRegistryModel->_manyToMany as $relation )
|
||||
{
|
||||
list($tableName) = $relation;
|
||||
list($modelName) = $relation;
|
||||
|
||||
$otherModelName = Inflector::underscore($tableName);
|
||||
$otherModel = new $otherModelName();
|
||||
$modelKey = Inflector::underscore($modelName);
|
||||
$modelObject = new $modelName();
|
||||
|
||||
if( $doCreateOptions )
|
||||
{
|
||||
$otherDisplayField = $otherModel->getDisplayField();
|
||||
$fieldNames[$tableName]['model'] = $tableName;
|
||||
$fieldNames[$tableName]['prompt'] = "Related ".Inflector::humanize($tableName);
|
||||
$fieldNames[$tableName]['type'] = "selectMultiple";
|
||||
$fieldNames[$tableName]['tagName'] = $otherModelName.'/'.Inflector::underscore($tableName);
|
||||
$otherDisplayField = $modelObject->getDisplayField();
|
||||
$fieldNames[$modelKey]['model'] = $modelName;
|
||||
$fieldNames[$modelKey]['prompt'] = "Related ".Inflector::humanize(Inflector::pluralize($modelName));
|
||||
$fieldNames[$modelKey]['type'] = "selectMultiple";
|
||||
$fieldNames[$modelKey]['tagName'] = $modelKey.'/'.$modelKey;
|
||||
|
||||
foreach( $otherModel->findAll() as $pass )
|
||||
foreach( $modelObject->findAll() as $pass )
|
||||
{
|
||||
foreach( $pass as $key=>$value )
|
||||
{
|
||||
if( $key == $otherModelName && isset( $value['id'] ) && isset( $value[$otherDisplayField] ) )
|
||||
if( $key == $modelKey && isset( $value['id'] ) && isset( $value[$otherDisplayField] ) )
|
||||
{
|
||||
$fieldNames[$tableName]['options'][$value['id']] = $value[$otherDisplayField];
|
||||
$fieldNames[$modelKey]['options'][$value['id']] = $value[$otherDisplayField];
|
||||
}
|
||||
}
|
||||
}
|
||||
if( isset( $data[$tableName] ) )
|
||||
if( isset( $data[$modelKey] ) )
|
||||
{
|
||||
foreach( $data[$tableName] as $row )
|
||||
foreach( $data[$modelKey] as $row )
|
||||
{
|
||||
$fieldNames[$tableName]['selected'][$row['id']] = $row['id'];
|
||||
$fieldNames[$modelKey]['selected'][$row['id']] = $row['id'];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,9 +28,13 @@
|
|||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
?>
|
||||
<?php
|
||||
|
||||
$modelName = Inflector::singularize($this->name);
|
||||
$modelKey = Inflector::underscore($modelName);
|
||||
?>
|
||||
<h1>Edit <?php echo Inflector::humanize($modelName);?></h1>
|
||||
|
||||
<?php
|
||||
echo $html->formTag('/'.Inflector::underscore($this->name).'/update');
|
||||
|
||||
|
||||
|
@ -41,14 +45,13 @@
|
|||
?>
|
||||
<ul class='actions'>
|
||||
<?php
|
||||
$modelName = Inflector::singularize($this->name);
|
||||
$modelKey = Inflector::underscore($modelName);
|
||||
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($modelName), '/'.$this->viewPath.'/destroy/'.$data[$modelKey]['id'])."</li>";
|
||||
|
||||
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($modelName), '/'.$this->viewPath.'/destroy/'.$data[$modelKey]['id'])."</li>";
|
||||
echo "<li>".$html->linkTo('List '.Inflector::humanize($modelName), '/'.$this->viewPath.'/list')."</li>";
|
||||
foreach( $fieldNames as $field => $value ) {
|
||||
if( isset( $value['foreignKey'] ) )
|
||||
{
|
||||
echo "<li>".$html->linkTo( "View ".Inflector::humanize($value['controller']), "/".Inflector::underscore($value['controller'])."/show/".$data[Inflector::singularize($params['controller'])][$field] )."</li>";
|
||||
echo "<li>".$html->linkTo( "View ".Inflector::humanize($value['controller']), "/".Inflector::underscore($value['controller'])."/show/".$data[$modelKey][$field] )."</li>";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
|
@ -29,11 +29,10 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
?>
|
||||
<h1>List <?php echo Inflector::humanize($this->name)?></h1>
|
||||
|
||||
<?php
|
||||
$model = Inflector::pluralize($this->name);
|
||||
//$table = Inflector::underscore(get_class($this->models[strtolower(Inflector::singularize(Inflector::underscore($this->name)))]));
|
||||
|
||||
$model = Inflector::singularize($this->name);
|
||||
$modelKey = Inflector::underscore(Inflector::singularize($this->name));
|
||||
$humanName = Inflector::humanize($this->name);
|
||||
$humanSingularName = Inflector::singularize( $humanName );
|
||||
|
@ -65,16 +64,15 @@
|
|||
{
|
||||
|
||||
// this is a foreign key, figure out what the display field should be for this model.
|
||||
$otherModelName = $value['model'];
|
||||
$otherModelKey = Inflector::underscore($value['model']);
|
||||
$otherControllerName = $value['controller'];
|
||||
|
||||
$registry =& ClassRegistry::getInstance();
|
||||
$otherModelObject =& $registry->getObject( $otherModelName );
|
||||
$registry = ClassRegistry::getInstance();
|
||||
$otherModelObject = $registry->getObject( $otherModelKey );
|
||||
if( is_object($otherModelObject) )
|
||||
{
|
||||
$displayText = $row[$value['model']][ $otherModelObject->getDisplayField() ];
|
||||
$displayText = $row[$otherModelKey][ $otherModelObject->getDisplayField() ];
|
||||
} else{
|
||||
$displayText = $row[$modelKey][$field];
|
||||
$displayText = $row[$otherModelKey][$field];
|
||||
}
|
||||
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
|
||||
|
||||
|
|
|
@ -29,10 +29,19 @@
|
|||
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
||||
*/
|
||||
?>
|
||||
<h1>New <?php echo Inflector::humanize($this->name)?></h1>
|
||||
|
||||
<?php
|
||||
echo $html->formTag('/'.Inflector::underscore($this->name).'/create');
|
||||
|
||||
echo $form->generateFields( $fieldNames );
|
||||
|
||||
echo $form->generateSubmitDiv( 'Add' )
|
||||
|
||||
?>
|
||||
<ul class='actions'>
|
||||
<?php
|
||||
echo "<li>".$html->linkTo('List '.Inflector::humanize($this->name), '/'.$this->viewPath.'/list')."</li>";
|
||||
|
||||
?>
|
||||
</ul>
|
|
@ -30,7 +30,6 @@
|
|||
*/
|
||||
?>
|
||||
|
||||
|
||||
<?php
|
||||
$modelName = Inflector::singularize($this->name);
|
||||
$modelKey = Inflector::underscore($modelName);
|
||||
|
@ -38,6 +37,8 @@
|
|||
$objModel = $registry->getObject($modelName);
|
||||
|
||||
?>
|
||||
<h1>Show <?php echo Inflector::humanize($modelName)?></h1>
|
||||
|
||||
<dl>
|
||||
<?php foreach($fieldNames as $field => $value)
|
||||
{
|
||||
|
@ -78,7 +79,8 @@
|
|||
<?php
|
||||
echo "<li>".$html->linkTo('Edit '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/edit/'.$data[$objModel->tableToModel[$objModel->table]]['id'])."</li>";
|
||||
echo "<li>".$html->linkTo('Delete '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/destroy/'.$data[$objModel->tableToModel[$objModel->table]]['id'])."</li>";
|
||||
|
||||
echo "<li>".$html->linkTo('List '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/list')."</li>";
|
||||
echo "<li>".$html->linkTo('New '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/new')."</li>";
|
||||
foreach( $fieldNames as $field => $value ) {
|
||||
if( isset( $value['foreignKey'] ) )
|
||||
{
|
||||
|
@ -92,10 +94,11 @@
|
|||
<?php
|
||||
foreach ($objModel->_oneToOne as $relation)
|
||||
{
|
||||
list($table, $field, $value) = $relation;
|
||||
$otherModelName = $objModel->tableToModel[$table];
|
||||
|
||||
echo "<div class='related'><H2>Related ".Inflector::humanize($otherModelName)."</H2><br/><br/>";
|
||||
list($model, $value) = $relation;
|
||||
$otherModelName = $objModel->tableToModel[$model];
|
||||
$controller = Inflector::pluralize($model);
|
||||
|
||||
echo "<div class='related'><H2>Related ".Inflector::humanize($otherModelName)."</H2>";
|
||||
echo "<dl>";
|
||||
if( isset($data[$otherModelName]) && is_array($data[$otherModelName]) )
|
||||
{
|
||||
|
@ -112,7 +115,7 @@
|
|||
|
||||
}
|
||||
echo "</dl>";
|
||||
echo "<ul class='actions'><li>".$html->linkTo('Edit '.Inflector::humanize($otherModelName),"/".Inflector::underscore($table)."/edit/{$data[$otherModelName]['id']}")."</li></ul></div>";
|
||||
echo "<ul class='actions'><li>".$html->linkTo('Edit '.Inflector::humanize($otherModelName),"/".Inflector::underscore($controller)."/edit/{$data[$otherModelName]['id']}")."</li></ul></div>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
@ -136,7 +139,7 @@
|
|||
$otherModelName = Inflector::singularize($model);
|
||||
$controller = Inflector::pluralize($model);
|
||||
|
||||
echo "<div class='related'><H2>Related ".Inflector::humanize($objModel->tableToModel[$objModel->{$model}->table])."</H2><br/><br/>";
|
||||
echo "<div class='related'><H2>Related ".Inflector::humanize(Inflector::pluralize($objModel->tableToModel[$objModel->{$model}->table]))."</H2>";
|
||||
if( isset($data[$objModel->tableToModel[$objModel->{$model}->table]]) && is_array($data[$objModel->tableToModel[$objModel->{$model}->table]]) )
|
||||
{
|
||||
?>
|
||||
|
|
|
@ -845,6 +845,7 @@ class Model extends Object
|
|||
{
|
||||
foreach ($y as $name => $value)
|
||||
{
|
||||
$name = Inflector::camelize($name);
|
||||
$joinTable[] = $this->{$name}->{$this->currentModel.'_jointable'};
|
||||
$mainKey = $this->{$name}->{$this->currentModel.'_foreignkey'};
|
||||
$keys[] = $mainKey;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<?php echo $html->charset('UTF-8')?>
|
||||
<?php echo $html->css('cake.default')?>
|
||||
<?php echo $html->css('cake.scaffold')?>
|
||||
<?php echo $html->css('cake.form')?>
|
||||
<?php echo $html->css('cake.forms')?>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container">
|
||||
|
@ -17,21 +17,21 @@
|
|||
<?php echo $html->image('cake.logo.png', array('alt'=>"CakePHP : Rapid Development Framework")); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div id="headerNav">
|
||||
<span class="headerNav">
|
||||
<?php
|
||||
$css_class = ($title_for_layout == 'Blog') ? 'active' : '';
|
||||
echo $html->link('CakeBlog', '/',array('class'=>$css_class));
|
||||
echo $html->link('Blog', 'blog',array('class'=>$css_class));
|
||||
|
||||
echo $html->link('CakeWiki', 'http://wiki.cakephp.org',array('class'=>$css_class));
|
||||
echo $html->link('Wiki', 'http://wiki.cakephp.org',array('class'=>$css_class));
|
||||
|
||||
echo $html->link('CakeForge', 'http://cakeforge.org',array('class'=>$css_class));
|
||||
|
||||
echo $html->link('CakeTrac', 'https://trac.cakephp.org',array('class'=>$css_class));
|
||||
echo $html->link('Trac', 'https://trac.cakephp.org',array('class'=>$css_class));
|
||||
|
||||
$css_class = ($title_for_layout == 'Pastes') ? 'active' : '';
|
||||
echo $html->link('CakeBin', 'http://cakephp.org/pastes/',array('class'=>$css_class));
|
||||
?>
|
||||
</div>
|
||||
</class>
|
||||
</div>
|
||||
<div id="pageNav">
|
||||
<?php
|
||||
|
|
Loading…
Add table
Reference in a new issue