cakephp2-php8/cake/libs/view/templates/scaffolds/show.thtml

202 lines
7.5 KiB
Text
Raw Normal View History

Merging from sandboxes [1079] Merged [1005] committed by nate but not added to core prior to release. Merged [1078] prior to modifying all developers sandboxes. [1081] adding view and template directories [1082] adding base files for view generator [1083] correcting all package and sub package tags for in doc blocks. Making sure every file in the core has doc block in them [1084] renaming working copy of latest release [1093] Added fix for associations using underscores if var $useTable is set in the associated models. This closes ticket #11. [1094] Fix for Ticket #24. The problem was tracked to a variable in View::_render(); $loadedHelpers was being assigned a reference when it when it should not have been. [1096] Initial work on controller components needs testing. Also added a work around for the basics.php uses(). Using the define DS where the files from the original version are now located in deeper libs directories. [1097] committing a few typos in the code I added [1098] reformatting code in component.php [1104] changed the test route and corrected a regex in inflector. [1111] removing the contructor from dispatcher, it is not needed [1112] Changes made for errors when a file is not present in webroot. Fixed the regex used in Router::parse(). Change the error layout template. [1113] Changes to Folder class to allow setting the permissions mode when constructing. This class needs to be refactored and move everything that is in the contructor out. The constructor should set the vars for use in other Folder::"methods"(). Will work on this at a later time. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1114 3807eeeb-6ff5-0310-8944-8be069107fe0
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/>
* Copyright (c) 2006, Cake Software Foundation, Inc.
* 1785 E. Sahara Avenue, Suite 490-204
* Las Vegas, Nevada 89104
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
Merging from sandboxes [1079] Merged [1005] committed by nate but not added to core prior to release. Merged [1078] prior to modifying all developers sandboxes. [1081] adding view and template directories [1082] adding base files for view generator [1083] correcting all package and sub package tags for in doc blocks. Making sure every file in the core has doc block in them [1084] renaming working copy of latest release [1093] Added fix for associations using underscores if var $useTable is set in the associated models. This closes ticket #11. [1094] Fix for Ticket #24. The problem was tracked to a variable in View::_render(); $loadedHelpers was being assigned a reference when it when it should not have been. [1096] Initial work on controller components needs testing. Also added a work around for the basics.php uses(). Using the define DS where the files from the original version are now located in deeper libs directories. [1097] committing a few typos in the code I added [1098] reformatting code in component.php [1104] changed the test route and corrected a regex in inflector. [1111] removing the contructor from dispatcher, it is not needed [1112] Changes made for errors when a file is not present in webroot. Fixed the regex used in Router::parse(). Change the error layout template. [1113] Changes to Folder class to allow setting the permissions mode when constructing. This class needs to be refactored and move everything that is in the contructor out. The constructor should set the vars for use in other Folder::"methods"(). Will work on this at a later time. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1114 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-09 01:56:21 +00:00
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
Merging from sandboxes [1079] Merged [1005] committed by nate but not added to core prior to release. Merged [1078] prior to modifying all developers sandboxes. [1081] adding view and template directories [1082] adding base files for view generator [1083] correcting all package and sub package tags for in doc blocks. Making sure every file in the core has doc block in them [1084] renaming working copy of latest release [1093] Added fix for associations using underscores if var $useTable is set in the associated models. This closes ticket #11. [1094] Fix for Ticket #24. The problem was tracked to a variable in View::_render(); $loadedHelpers was being assigned a reference when it when it should not have been. [1096] Initial work on controller components needs testing. Also added a work around for the basics.php uses(). Using the define DS where the files from the original version are now located in deeper libs directories. [1097] committing a few typos in the code I added [1098] reformatting code in component.php [1104] changed the test route and corrected a regex in inflector. [1111] removing the contructor from dispatcher, it is not needed [1112] Changes made for errors when a file is not present in webroot. Fixed the regex used in Router::parse(). Change the error layout template. [1113] Changes to Folder class to allow setting the permissions mode when constructing. This class needs to be refactored and move everything that is in the contructor out. The constructor should set the vars for use in other Folder::"methods"(). Will work on this at a later time. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1114 3807eeeb-6ff5-0310-8944-8be069107fe0
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
*/
?>
<?php
$modelName = Inflector::singularize($this->name);
$modelKey = Inflector::underscore($modelName);
$objModel =& ClassRegistry::getObject($modelKey);
?>
<h1>Show <?php echo Inflector::humanize($modelName)?></h1>
<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)
{
[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']))
{
$alias = array_search($value['table'],$objModel->alias);
$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();
$displayText = $data[$alias][$displayField];
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
{
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-01-12 02:10:47 +00:00
echo "<dd>".$html->link($displayText, '/'.Inflector::underscore($value['controller']).'/show/'
.$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>&nbsp;</dd>";
}
}
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.
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
{
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>&nbsp;</dd>";
}
}
}
?>
</dl>
<ul class='actions'>
<?php
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>";
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
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>";
}
}
?>
</ul>
<!--hasOne relationships -->
<?php
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-01-12 02:10:47 +00:00
foreach ($objModel->hasOne as $association => $relation)
{
$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>&nbsp;</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>";
}
}
}
?>
<!-- HAS MANY AND HASANDBELONGSTOMANY -->
<?php
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-01-12 02:10:47 +00:00
$relations = array_merge($objModel->hasMany, $objModel->hasAndBelongsToMany);
foreach($relations as $association => $relation)
{
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-01-12 02:10:47 +00:00
$model = $relation['className'];
$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);
echo "<div class='related'><H2>Related ".Inflector::humanize(Inflector::pluralize($association))."</H2>";
if( isset($data[$association]) && is_array($data[$association]) )
{
?>
<table class="inav" cellspacing="0">
<tr>
<?php // Loop through and create the header row.
// find a row that matches this title.
$bFound = false;
foreach( $data[$association][0] as $column=>$value ) {
echo "<th>".Inflector::humanize($column)."</th>";
}
?>
<th>Actions</th>
</tr>
<?php
// now find all matching rows
foreach( $data[$association] as $row )
{
echo "<tr>";
foreach( $row as $column=>$value )
{
echo "<td>".$value."</td>";
}
?>
<?php if (isset($this->controller->{$modelName}->{$association}))
{?>
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
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]}/")?>
</td>
<?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
}?>
<?php
echo "</tr>";
}
}
?>
</table>
<ul class="actions">
<?php
// add a link to create a new relation.
Merging changes to trunk: Revision: [1761] Removing old db_acl.sql Revision: [1759] Removed unneeded calls to uses(). Changed basics.php listClasses() no longer using folder class. Starting corrections in DboPostgres class. Adding missing DboPostgres::query(). Added missing doc blocks to AjaxHelper. Fixed undefined keys in FormHelper::generateFields() Reformatted FormHelper::generateFields() adding open and close brackets where needed Revision: [1758] Fixed typo Revision: [1757] Fixed errors found when using PHP 4. Fixed a scaffold error Revision: [1756] Merging changes to model_php4.php Revision: [1755] Fixed scaffolding for the changes made to the model. Fixed Model::isForeignKey(), replaced array_key_exists with in_array, other function was failing Revision: [1754] Committing changes from bundt model to beta. DataSources will not be in the beta release Revision: [1751] Cleaning up a little more in the code. Removing loading of log.php unless it is really needed. Refactored dispatcher to speed up the stripslashes code if it is called Revision: [1748] removing all references to error_messages and deleting the file Revision: [1747] updated more error messages Revision: [1746] removing all error message defines Revision: [1745] added _() method from 1.0 to basics.php only used to return string right now Revision: [1744] Adding fix for ticket #220 Revision: [1743] More work on ErrorHandler class Revision: [1742] Renaming error view for missing database connection Revision: [1741] More work on ErrorHandler class Revision: [1740] More work on error class Revision: [1739] Replacing all $_SERVER variable check with env() in basics.php Revision: [1738] Adding env() to basic Revision: [1737] Updated session to use env() Revision: [1736] Removing ternary operators from Dispatcher Revision: [1735] Per nates request I am rolling back ACL to [1373] Revision: [1734] Removed the IP in the session class this was not very reliable. Added a time setting that generates current time adding the Security::inactiveMins() to the session Removed code that was added to basics.php to replace gethostbyaddr(). Added CAKE_SESSION_STRING define to core.php which is used in the by the Session class to generate a hashed key. Revision: [1733] Moving errors messages to ErrorHandler class. Updating errors view for use with new class. Updating Scaffold to use new class. Updated Dispatcher to use new class. Removing methods from Object class Revision: [1732] Adding ErrorHandler class Revision: [1731] Adding fix for Ticket #223 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1762 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-01-12 02:10:47 +00:00
echo "<li>".$html->link('New '.Inflector::humanize($association),"/".Inflector::underscore($controller)."/add/")."</li>";
?>
</ul></div>
<?php } // end loop through relations
?>