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-16 21:34:46 +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-10-24 07:51:09 +00:00
|
|
|
<h1>List <?php echo Inflector::humanize($this->name)?></h1>
|
2005-10-09 01:56:21 +00:00
|
|
|
|
2005-07-21 04:02:32 +00:00
|
|
|
<?php
|
2005-10-24 07:51:09 +00:00
|
|
|
$model = Inflector::singularize($this->name);
|
[1198]
Author: phpnut
Date: 7:29:04 PM, Monday, October 24, 2005
Message:
More work on changes to use CamelCase throughout the system.
[1197]
Author: phpnut
Date: 2:57:08 PM, Monday, October 24, 2005
Message:
Removing unneeded calls to Inflector class
[1196]
Author: phpnut
Date: 2:39:30 PM, Monday, October 24, 2005
Message:
adding fix for Ticket #61
[1195]
Author: phpnut
Date: 11:19:43 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #47
[1194]
Author: phpnut
Date: 10:10:41 AM, Monday, October 24, 2005
Message:
Adding fix for Ticket #49
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1199 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-25 00:33:08 +00:00
|
|
|
$modelKey = $model;
|
2005-08-21 06:49:02 +00:00
|
|
|
$humanName = Inflector::humanize($this->name);
|
|
|
|
$humanSingularName = Inflector::singularize( $humanName );
|
2005-12-27 03:33:44 +00:00
|
|
|
// var_dump( $data );
|
2005-07-21 04:02:32 +00:00
|
|
|
?>
|
2005-08-21 06:49:02 +00:00
|
|
|
<table class="inav" cellspacing="0">
|
|
|
|
<tr>
|
2006-01-16 21:34:46 +00:00
|
|
|
<?php foreach ( $fieldNames as $fieldName ) { ?>
|
2005-08-21 06:49:02 +00:00
|
|
|
<th><?php echo $fieldName['prompt'];?></th>
|
|
|
|
<?php } ?>
|
|
|
|
<th>Actions</th>
|
|
|
|
</tr>
|
2006-01-16 21:34:46 +00:00
|
|
|
<?php
|
2005-08-21 06:49:02 +00:00
|
|
|
$iRowIndex = 0;
|
2006-01-16 21:34:46 +00:00
|
|
|
|
|
|
|
if( is_array( $data ) )
|
2005-08-21 06:49:02 +00:00
|
|
|
{
|
2006-01-16 21:34:46 +00:00
|
|
|
foreach ( $data as $row ) {
|
2005-08-21 06:49:02 +00:00
|
|
|
if( $iRowIndex++ % 2 == 0 )
|
|
|
|
{
|
|
|
|
echo "<tr>";
|
|
|
|
} else {
|
|
|
|
echo "<tr class='altRow'>";
|
|
|
|
}
|
|
|
|
foreach( $fieldNames as $field=>$value ) { ?>
|
|
|
|
<td>
|
|
|
|
<?php
|
2006-01-16 21:34:46 +00:00
|
|
|
if( isset($value['foreignKey']) )
|
2005-08-25 16:40:50 +00:00
|
|
|
{
|
2005-08-21 06:49:02 +00:00
|
|
|
// this is a foreign key, figure out what the display field should be for this model.
|
[1258]
Author: phpnut
Date: 8:13:45 PM, Friday, October 28, 2005
Message:
adding version text file
[1257]
Author: phpnut
Date: 8:03:24 PM, Friday, October 28, 2005
Message:
small typo in last commit
[1256]
Author: phpnut
Date: 7:16:50 PM, Friday, October 28, 2005
Message:
Added fix for a self join of 1 to 1 associations.
This is automatic and adds Child_ to the joined class for hasOne or belongsTo.
Scaffold is updated to work with this change.
You will have to consider the Child_ prefix when working with self joins.
[1253]
Author: phpnut
Date: 4:07:55 PM, Friday, October 28, 2005
Message:
Fixed problem with session cookies being set for each path in the URL.
Added char to switch in Controller::generateFieldNames()
[1252]
Author: phpnut
Date: 1:59:49 PM, Friday, October 28, 2005
Message:
Updated routes.php.default with change to route case.
Removed debug code I had added to Model::findAll
[1251]
Author: phpnut
Date: 1:51:00 PM, Friday, October 28, 2005
Message:
Added a fix for class already defined error.
Updated core.php docblock with level 3 setting for DEBUG.
Change instances of AppController to Controller for loading error messages.
Updated 404 errors to use default layout
[1250]
Author: phpnut
Date: 1:34:08 PM, Friday, October 28, 2005
Message:
renaming error or error404
[1249]
Author: phpnut
Date: 1:32:51 PM, Friday, October 28, 2005
Message:
moving error.thtml to errors directory
git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1259 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-29 01:21:47 +00:00
|
|
|
$otherModelKey = Inflector::underscore($value['modelKey']);
|
2006-01-12 02:10:47 +00:00
|
|
|
$otherControllerName = $value['controller'];
|
2006-01-20 18:43:05 +00:00
|
|
|
$otherModelObject =& ClassRegistry::getObject( $otherModelKey );
|
[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'],$this->controller->{$model}->alias);
|
2006-01-16 21:34:46 +00:00
|
|
|
if( is_object($otherModelObject) )
|
2005-08-21 06:49:02 +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
|
|
|
$displayText = $row[$alias][ $otherModelObject->getDisplayField() ];
|
2005-08-21 06:49:02 +00:00
|
|
|
} else{
|
[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 = $row[$alias][$field];
|
2006-01-16 21:34:46 +00:00
|
|
|
}
|
2006-01-12 02:10:47 +00:00
|
|
|
echo $html->link( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
|
2006-01-16 21:34:46 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
} else {
|
2006-01-16 21:34:46 +00:00
|
|
|
echo $row[$modelKey][$field];
|
2005-08-21 06:49:02 +00:00
|
|
|
} ?>
|
|
|
|
</td>
|
|
|
|
<?php } // end for each $fieldNames as $field=>value ?>
|
2006-01-12 02:10:47 +00:00
|
|
|
<td class="listactions"><?php echo $html->link('View',"/".$this->viewPath."/show/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
|
|
|
<?php echo $html->link('Edit',"/".$this->viewPath."/edit/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
|
|
|
<?php echo $html->link('Delete',"/".$this->viewPath."/destroy/{$row[$modelKey][$this->controller->{$model}->primaryKey]}/")?>
|
2005-08-21 06:49:02 +00:00
|
|
|
</td>
|
2006-01-16 21:34:46 +00:00
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
</tr>
|
|
|
|
<?php } // end for each data as row
|
|
|
|
} // end if( $data )?>
|
2006-01-16 21:34:46 +00:00
|
|
|
|
|
|
|
|
2005-08-21 06:49:02 +00:00
|
|
|
</table>
|
|
|
|
<ul class="actions">
|
2006-01-12 02:10:47 +00:00
|
|
|
<li><?php echo $html->link('New '.$humanSingularName, '/'.$this->viewPath.'/add'); ?></li>
|
2005-08-21 06:49:02 +00:00
|
|
|
</ul>
|
2005-07-21 04:02:32 +00:00
|
|
|
|
|
|
|
|