2005-10-09 01:56:21 +00:00
|
|
|
<?php
|
|
|
|
/* SVN FILE: $Id$ */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Base controller class.
|
|
|
|
*
|
|
|
|
* PHP versions 4 and 5
|
|
|
|
*
|
|
|
|
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
|
2006-01-20 07:46:14 +00:00
|
|
|
* Copyright (c) 2006, Cake Software Foundation, Inc.
|
2005-12-23 21:57:26 +00:00
|
|
|
* 1785 E. Sahara Avenue, Suite 490-204
|
|
|
|
* Las Vegas, Nevada 89104
|
2006-01-06 04:46:42 +00:00
|
|
|
*
|
2005-12-23 21:57:26 +00:00
|
|
|
* Licensed under The MIT License
|
|
|
|
* Redistributions of files must retain the above copyright notice.
|
2005-10-09 01:56:21 +00:00
|
|
|
*
|
|
|
|
* @filesource
|
2006-01-20 07:46:14 +00:00
|
|
|
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
|
2005-12-23 21:57:26 +00:00
|
|
|
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
|
2005-10-09 01:56:21 +00:00
|
|
|
* @package cake
|
|
|
|
* @subpackage cake.cake.libs.controller.templates.scaffolds
|
|
|
|
* @since CakePHP v 0.10.0.1076
|
|
|
|
* @version $Revision$
|
|
|
|
* @modifiedby $LastChangedBy$
|
|
|
|
* @lastmodified $Date$
|
|
|
|
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
|
2005-07-21 04:02:32 +00:00
|
|
|
<?php
|
2005-08-21 06:49:02 +00:00
|
|
|
$modelName = Inflector::singularize($this->name);
|
2005-09-17 02:22:07 +00:00
|
|
|
$modelKey = Inflector::underscore($modelName);
|
2006-01-20 18:43:05 +00:00
|
|
|
$objModel =& ClassRegistry::getObject($modelKey);
|
2005-07-21 04:02:32 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
?>
|
2005-10-24 07:51:09 +00:00
|
|
|
<h1>Show <?php echo Inflector::humanize($modelName)?></h1>
|
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
<dl>
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
<?php foreach($fieldNames as $field => $value)
|
2005-08-28 16:33:50 +00:00
|
|
|
{
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
echo "<dt>".$value['prompt']."</dt>";
|
|
|
|
if(isset($value['foreignKey']))
|
2005-08-28 16:33:50 +00:00
|
|
|
{
|
[1335]
Author: phpnut
Date: 2:11:57 PM, Saturday, November 05, 2005
Message:
Fixing Controller::generateFieldNames() to work with changes to Model
[1334]
Author: phpnut
Date: 1:18:02 PM, Saturday, November 05, 2005
Message:
More work on changes made in the model to allow association names to be used as an alias.
These changes are being made to update scaffold to work with changes in [1330].
Added var $alias that holds an array with the key value pair of the table name and the association name.
[1330]
Author: phpnut
Date: 10:25:16 PM, Friday, November 04, 2005
Message:
Adding fix for Ticket #127. The query returns properly now but, this breaks scaffold which I will be fixing soon.
Also the save methods for the model have not been tested but I am sure these need to be corrected also.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1336 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-05 20:35:43 +00:00
|
|
|
$alias = array_search($value['table'],$objModel->alias);
|
2006-01-20 18:43:05 +00:00
|
|
|
$otherModelObject =& ClassRegistry::getObject(Inflector::underscore($objModel->tableToModel[$value['table']]));
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
$displayField = $otherModelObject->getDisplayField();
|
[1335]
Author: phpnut
Date: 2:11:57 PM, Saturday, November 05, 2005
Message:
Fixing Controller::generateFieldNames() to work with changes to Model
[1334]
Author: phpnut
Date: 1:18:02 PM, Saturday, November 05, 2005
Message:
More work on changes made in the model to allow association names to be used as an alias.
These changes are being made to update scaffold to work with changes in [1330].
Added var $alias that holds an array with the key value pair of the table name and the association name.
[1330]
Author: phpnut
Date: 10:25:16 PM, Friday, November 04, 2005
Message:
Adding fix for Ticket #127. The query returns properly now but, this breaks scaffold which I will be fixing soon.
Also the save methods for the model have not been tested but I am sure these need to be corrected also.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1336 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-05 20:35:43 +00:00
|
|
|
$displayText = $data[$alias][$displayField];
|
2005-12-23 21:57:26 +00:00
|
|
|
|
2006-01-22 05:12:28 +00:00
|
|
|
if(!empty($data[$objModel->tableToModel[$objModel->table]][$field]) && (isset($displayText)))
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
{
|
2006-01-12 02:10:47 +00:00
|
|
|
echo "<dd>".$html->link($displayText, '/'.Inflector::underscore($value['controller']).'/show/'
|
2006-01-12 03:56:59 +00:00
|
|
|
.$data[$objModel->tableToModel[$objModel->table]][$field] )."</dd>";
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<dd> </dd>";
|
|
|
|
}
|
2005-08-28 16:33:50 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
// this is just a plain old field.
|
2006-01-12 03:56:59 +00:00
|
|
|
if( !empty($data[$objModel->tableToModel[$objModel->table]][$field]))
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
{
|
2006-01-12 03:56:59 +00:00
|
|
|
echo "<dd>".$data[$objModel->tableToModel[$objModel->table]][$field]."</dd>";
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<dd> </dd>";
|
|
|
|
}
|
2005-08-28 16:33:50 +00:00
|
|
|
}
|
2005-12-23 21:57:26 +00:00
|
|
|
}
|
2005-08-21 06:49:02 +00:00
|
|
|
?>
|
|
|
|
|
|
|
|
</dl>
|
|
|
|
<ul class='actions'>
|
2005-07-21 04:02:32 +00:00
|
|
|
<?php
|
2006-01-12 03:56:59 +00:00
|
|
|
echo "<li>".$html->link('Edit '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/edit/'.$data[$objModel->tableToModel[$objModel->table]][$this->controller->{$modelName}->primaryKey])."</li>";
|
|
|
|
echo "<li>".$html->link('Delete '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/destroy/'.$data[$objModel->tableToModel[$objModel->table]][$this->controller->{$modelName}->primaryKey])."</li>";
|
2006-01-12 02:10:47 +00:00
|
|
|
echo "<li>".$html->link('List '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/index')."</li>";
|
|
|
|
echo "<li>".$html->link('New '.Inflector::humanize($objModel->name), '/'.$this->viewPath.'/add')."</li>";
|
|
|
|
|
|
|
|
foreach( $fieldNames as $field => $value )
|
|
|
|
{
|
|
|
|
if( isset( $value['foreignKey'] ) )
|
|
|
|
{
|
|
|
|
echo "<li>".$html->link( "List ".Inflector::humanize($value['controller']), "/".Inflector::underscore($value['controller'])."/index/")."</li>";
|
|
|
|
}
|
|
|
|
}
|
2005-08-21 06:49:02 +00:00
|
|
|
?>
|
|
|
|
</ul>
|
2005-07-21 04:02:32 +00:00
|
|
|
|
2005-08-21 20:01:32 +00:00
|
|
|
<!--hasOne relationships -->
|
2005-07-21 04:02:32 +00:00
|
|
|
<?php
|
2006-01-12 02:10:47 +00:00
|
|
|
foreach ($objModel->hasOne as $association => $relation)
|
2005-08-21 20:01:32 +00:00
|
|
|
{
|
2006-01-16 21:34:46 +00:00
|
|
|
$model = $relation['className'];
|
|
|
|
$otherModelName = $objModel->tableToModel[$objModel->{$model}->table];
|
|
|
|
$controller = Inflector::pluralize($model);
|
|
|
|
$new = true;
|
|
|
|
echo "<div class='related'><H2>Related ".Inflector::humanize($association)."</H2>";
|
|
|
|
echo "<dl>";
|
|
|
|
if( isset($data[$association]) && is_array($data[$association]) )
|
|
|
|
{
|
|
|
|
foreach( $data[$association] as $field => $value )
|
|
|
|
{
|
|
|
|
if( isset($value) )
|
|
|
|
{
|
|
|
|
echo "<dt>".Inflector::humanize($field)."</dt>";
|
|
|
|
if( !empty($value) )
|
|
|
|
{
|
|
|
|
echo "<dd>".$value."</dd>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<dd> </dd>";
|
|
|
|
}
|
|
|
|
$new = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo "</dl>";
|
|
|
|
if($new == null)
|
|
|
|
{
|
|
|
|
echo "<ul class='actions'><li>".$html->link('Edit '.Inflector::humanize($association),"/".Inflector::underscore($controller)."/edit/{$data[$association][$objModel->{$model}->primaryKey]}")."</li></ul></div>";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
echo "<ul class='actions'><li>".$html->link('New '.Inflector::humanize($association),"/".Inflector::underscore($controller)."/add/{$data[$association][$objModel->{$model}->primaryKey]}")."</li></ul></div>";
|
|
|
|
}
|
|
|
|
}
|
2005-08-21 20:01:32 +00:00
|
|
|
}
|
|
|
|
?>
|
|
|
|
|
|
|
|
<!-- HAS MANY AND HASANDBELONGSTOMANY -->
|
|
|
|
<?php
|
|
|
|
|
2006-01-12 02:10:47 +00:00
|
|
|
$relations = array_merge($objModel->hasMany, $objModel->hasAndBelongsToMany);
|
|
|
|
foreach($relations as $association => $relation)
|
2005-08-21 20:01:32 +00:00
|
|
|
{
|
2006-01-12 02:10:47 +00:00
|
|
|
$model = $relation['className'];
|
2005-08-21 20:01:32 +00:00
|
|
|
$count = 0;
|
[1159]
Author: phpnut
Date: 1:39:26 PM, Saturday, October 22, 2005
Message:
Just about done with refactoring the model class.
This should be tested to make sure all changes are working as expected.
[1158]
Author: phpnut
Date: 5:34:41 AM, Saturday, October 22, 2005
Message:
More work on associations.
Adding fields setting, order by and conditions to hasMany and hasAndBelongsToMany
[1157]
Author: phpnut
Date: 3:39:13 AM, Saturday, October 22, 2005
Message:
More cleanup in Model class.
[1156]
Author: phpnut
Date: 2:43:38 AM, Saturday, October 22, 2005
Message:
Removing duplicate code the the associations.
Added Model::_associationSwitch(); to move all association settings to one location and remove duplicate code.
[1155]
Author: phpnut
Date: 1:52:47 AM, Saturday, October 22, 2005
Message:
More cleaning up of the model class
[1154]
Author: phpnut
Date: 1:40:34 AM, Saturday, October 22, 2005
Message:
Cleaning up code layout
[1153]
Author: phpnut
Date: 1:32:05 AM, Saturday, October 22, 2005
Message:
removing temp variables and extra calls to Inflector::underscore();
[1152]
Author: phpnut
Date: 1:22:58 AM, Saturday, October 22, 2005
Message:
More work on associations.
Removing code that is no longer needed.
[1151]
Author: phpnut
Date: 12:02:43 AM, Saturday, October 22, 2005
Message:
more work on associations
[1150]
Author: phpnut
Date: 6:25:45 PM, Friday, October 21, 2005
Message:
more refactoring of associations
[1149]
Author: phpnut
Date: 6:04:18 PM, Friday, October 21, 2005
Message:
refactoring model and adding more association code
[1145]
Author: phpnut
Date: 2:43:05 PM, Thursday, October 20, 2005
Message:
more refactoring on associations
[1143]
Author: phpnut
Date: 1:44:42 PM, Thursday, October 20, 2005
Message:
Refactoring associations code.
Starting work allowing full use of associations array settings
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1160 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-22 19:31:38 +00:00
|
|
|
$otherModelName = Inflector::singularize($model);
|
|
|
|
$controller = Inflector::pluralize($model);
|
2005-07-21 04:02:32 +00:00
|
|
|
|
[1335]
Author: phpnut
Date: 2:11:57 PM, Saturday, November 05, 2005
Message:
Fixing Controller::generateFieldNames() to work with changes to Model
[1334]
Author: phpnut
Date: 1:18:02 PM, Saturday, November 05, 2005
Message:
More work on changes made in the model to allow association names to be used as an alias.
These changes are being made to update scaffold to work with changes in [1330].
Added var $alias that holds an array with the key value pair of the table name and the association name.
[1330]
Author: phpnut
Date: 10:25:16 PM, Friday, November 04, 2005
Message:
Adding fix for Ticket #127. The query returns properly now but, this breaks scaffold which I will be fixing soon.
Also the save methods for the model have not been tested but I am sure these need to be corrected also.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1336 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-05 20:35:43 +00:00
|
|
|
echo "<div class='related'><H2>Related ".Inflector::humanize(Inflector::pluralize($association))."</H2>";
|
2005-12-23 21:57:26 +00:00
|
|
|
if( isset($data[$association]) && is_array($data[$association]) )
|
2005-08-21 06:49:02 +00:00
|
|
|
{
|
|
|
|
?>
|
2005-12-23 21:57:26 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
<table class="inav" cellspacing="0">
|
2005-12-23 21:57:26 +00:00
|
|
|
<tr>
|
2005-08-21 06:49:02 +00:00
|
|
|
<?php // Loop through and create the header row.
|
|
|
|
// find a row that matches this title.
|
|
|
|
$bFound = false;
|
[1335]
Author: phpnut
Date: 2:11:57 PM, Saturday, November 05, 2005
Message:
Fixing Controller::generateFieldNames() to work with changes to Model
[1334]
Author: phpnut
Date: 1:18:02 PM, Saturday, November 05, 2005
Message:
More work on changes made in the model to allow association names to be used as an alias.
These changes are being made to update scaffold to work with changes in [1330].
Added var $alias that holds an array with the key value pair of the table name and the association name.
[1330]
Author: phpnut
Date: 10:25:16 PM, Friday, November 04, 2005
Message:
Adding fix for Ticket #127. The query returns properly now but, this breaks scaffold which I will be fixing soon.
Also the save methods for the model have not been tested but I am sure these need to be corrected also.
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1336 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-11-05 20:35:43 +00:00
|
|
|
foreach( $data[$association][0] as $column=>$value ) {
|
2005-08-21 06:49:02 +00:00
|
|
|
echo "<th>".Inflector::humanize($column)."</th>";
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
// now find all matching rows
|
2005-12-23 21:57:26 +00:00
|
|
|
foreach( $data[$association] as $row )
|
2005-08-21 06:49:02 +00:00
|
|
|
{
|
|
|
|
echo "<tr>";
|
2005-12-23 21:57:26 +00:00
|
|
|
foreach( $row as $column=>$value )
|
2005-08-21 06:49:02 +00:00
|
|
|
{
|
|
|
|
echo "<td>".$value."</td>";
|
|
|
|
}
|
|
|
|
?>
|
2006-01-16 21:34:46 +00:00
|
|
|
<?php if (isset($this->controller->{$modelName}->{$association}))
|
|
|
|
{?>
|
2006-01-12 02:10:47 +00:00
|
|
|
<td class="listactions"><?php echo $html->link('View',"/".Inflector::underscore($controller)."/show/{$row[$this->controller->{$modelName}->{$association}->primaryKey]}/")?>
|
|
|
|
<?php echo $html->link('Edit',"/".Inflector::underscore($controller)."/edit/{$row[$this->controller->{$modelName}->{$association}->primaryKey]}/")?>
|
|
|
|
<?php echo $html->link('Delete',"/".Inflector::underscore($controller)."/destroy/{$row[$this->controller->{$modelName}->{$association}->primaryKey]}/")?>
|
2005-08-21 06:49:02 +00:00
|
|
|
</td>
|
2006-01-16 21:34:46 +00:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{?>
|
|
|
|
<td class="listactions"><?php echo $html->link('View',"/".Inflector::underscore($controller)."/show/{$row[$this->controller->{$modelName}->primaryKey]}/")?>
|
|
|
|
<?php echo $html->link('Edit',"/".Inflector::underscore($controller)."/edit/{$row[$this->controller->{$modelName}->primaryKey]}/")?>
|
|
|
|
<?php echo $html->link('Delete',"/".Inflector::underscore($controller)."/destroy/{$row[$this->controller->{$modelName}->primaryKey]}/")?>
|
|
|
|
</td>
|
|
|
|
<?php
|
|
|
|
}?>
|
2005-08-21 06:49:02 +00:00
|
|
|
<?php
|
|
|
|
echo "</tr>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
2005-12-23 21:57:26 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
</table>
|
|
|
|
<ul class="actions">
|
2005-07-21 04:02:32 +00:00
|
|
|
<?php
|
2005-08-21 06:49:02 +00:00
|
|
|
// add a link to create a new relation.
|
2005-07-21 04:02:32 +00:00
|
|
|
|
2006-01-12 02:10:47 +00:00
|
|
|
echo "<li>".$html->link('New '.Inflector::humanize($association),"/".Inflector::underscore($controller)."/add/")."</li>";
|
2005-07-21 04:02:32 +00:00
|
|
|
?>
|
2005-08-21 20:01:32 +00:00
|
|
|
</ul></div>
|
|
|
|
|
|
|
|
<?php } // end loop through relations
|
2005-09-17 02:22:07 +00:00
|
|
|
?>
|