cakephp2-php8/cake/libs/controller/controller.php

815 lines
25 KiB
PHP
Raw Normal View History

<?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.
*
* @filesource
* @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
* @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
* @package cake
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
* @subpackage cake.cake.libs.controller
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Include files
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
uses(DS.'controller'.DS.'component', DS.'view'.DS.'view');
/**
* Controller
*
* Application controller (controllers are where you put all the actual code)
* Provides basic functionality, such as rendering views (aka displaying templates).
* Automatically selects model name from on singularized object class name
* and creates the model object if proper class exists.
*
* @package cake
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
* @subpackage cake.cake.libs.controller
* @since CakePHP v 0.2.9
*
*/
class Controller extends Object
{
/**
* Name of the controller.
*
* @var unknown_type
* @access public
*/
var $name = null;
/**
* Stores the current URL (for links etc.)
*
* @var string Current URL
*/
var $here = null;
/**
* Action to be performed.
*
* @var string
* @access public
*/
var $action = null;
/**
* An array of names of models the particular controller wants to use.
*
* @var mixed A single name as a string or a list of names as an array.
* @access protected
*/
var $uses = false;
/**
* An array of names of built-in helpers to include.
*
* @var mixed A single name as a string or a list of names as an array.
* @access protected
*/
var $helpers = array('Html');
/**
* Enter description here...
*
* @var unknown_type
*/
var $viewPath;
/**
* Variables for the view
*
* @var array
* @access private
*/
var $_viewVars = array();
/**
* Web page title
*
* @var boolean
* @access private
*/
var $pageTitle = false;
/**
* An array of model objects.
*
* @var array Array of model objects.
* @access public
*/
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
var $modelNames = array();
/**
* Enter description here...
*
* @var unknown_type
* @access public
*/
var $base = null;
/**
* Layout file to use (see /app/views/layouts/default.thtml)
*
* @var string
* @access public
*/
var $layout = 'default';
/**
* Automatically render the view (the dispatcher checks for this variable before running render())
*
* @var boolean
* @access public
*/
var $autoRender = true;
/**
* Enter description here...
*
* @var boolean
* @access public
*/
var $autoLayout = true;
/**
* Enter description here...
*
* @var string
* @access public
*/
var $beforeFilter = null;
/**
* Enter description here...
*
* @var unknown_type
*/
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
var $components = array();
/**
* Enter description here...
*
* @var unknown_type
*/
var $view = 'View';
/**
* Enter description here...
*
* @var unknown_type
*/
var $_viewClass = null;
/**
* The output of the requested action. Contains either a variable
* returned from the action, or the data of the rendered view;
*
* @var unknown_type
*/
var $output = null;
/**
* Enter description here...
*
* @var unknown_type
*/
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
var $plugin = null;
/**
* Constructor.
*
*/
function __construct ()
{
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
if($this->name === null)
{
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
$r = null;
if (!preg_match('/(.*)Controller/i', get_class($this), $r))
{
die("Controller::__construct() : Can't get or parse my own class name, exiting.");
}
$this->name = $r[1];
}
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
$this->viewPath = Inflector::underscore($this->name);
$this->modelClass = Inflector::singularize($this->name);
$this->modelKey = Inflector::underscore($this->modelClass);
if(!defined('AUTO_SESSION') || AUTO_SESSION == true)
{
array_push($this->components, 'Session');
}
parent::__construct();
}
/**
* Enter description here...
*
*/
function constructClasses()
{
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
if (!empty($this->components))
{
$component =& new Component($this);
}
if(empty($this->params['pass']))
{
$id = false;
}
else
{
$id = $this->params['pass'];
}
if (class_exists($this->modelClass) && ($this->uses === false))
{
$this->{$this->modelClass} =& new $this->modelClass($id);
$this->modelNames[] = $this->modelClass;
}
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
elseif($this->uses === false)
{
return $this->cakeError('missingModel',array(array('className' => $this->modelClass,
'webroot' => '')));
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
}
if ($this->uses)
{
$uses = is_array($this->uses)? $this->uses: array($this->uses);
foreach ($uses as $modelClass)
{
$modelKey = Inflector::underscore($modelClass);
if (class_exists($modelClass))
{
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
$this->{$modelClass} =& new $modelClass($id);
$this->modelNames[] = $modelClass;
}
else
{
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
return $this->cakeError('missingModel',array(array('className' => $modelClass,
'webroot' => '')));
}
}
}
}
/**
* Redirects to given $url, after turning off $this->autoRender.
*
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
* @param string $url
* @param integer $status
*/
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
function redirect ($url, $status = null)
{
$this->autoRender = false;
$pos = strpos($url, '://');
if ($pos === false)
{
if(strpos($url, '/') !== 0)
{
$url = '/'.$url;
}
$url = $this->base . $url;
}
if (function_exists('session_write_close'))
{
session_write_close();
}
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
if ($status != null)
{
$codes = array (
100 => "HTTP/1.1 100 Continue",
101 => "HTTP/1.1 101 Switching Protocols",
200 => "HTTP/1.1 200 OK",
201 => "HTTP/1.1 201 Created",
202 => "HTTP/1.1 202 Accepted",
203 => "HTTP/1.1 203 Non-Authoritative Information",
204 => "HTTP/1.1 204 No Content",
205 => "HTTP/1.1 205 Reset Content",
206 => "HTTP/1.1 206 Partial Content",
300 => "HTTP/1.1 300 Multiple Choices",
301 => "HTTP/1.1 301 Moved Permanently",
302 => "HTTP/1.1 302 Found",
303 => "HTTP/1.1 303 See Other",
304 => "HTTP/1.1 304 Not Modified",
305 => "HTTP/1.1 305 Use Proxy",
307 => "HTTP/1.1 307 Temporary Redirect",
400 => "HTTP/1.1 400 Bad Request",
401 => "HTTP/1.1 401 Unauthorized",
402 => "HTTP/1.1 402 Payment Required",
403 => "HTTP/1.1 403 Forbidden",
404 => "HTTP/1.1 404 Not Found",
405 => "HTTP/1.1 405 Method Not Allowed",
406 => "HTTP/1.1 406 Not Acceptable",
407 => "HTTP/1.1 407 Proxy Authentication Required",
408 => "HTTP/1.1 408 Request Time-out",
409 => "HTTP/1.1 409 Conflict",
410 => "HTTP/1.1 410 Gone",
411 => "HTTP/1.1 411 Length Required",
412 => "HTTP/1.1 412 Precondition Failed",
413 => "HTTP/1.1 413 Request Entity Too Large",
414 => "HTTP/1.1 414 Request-URI Too Large",
415 => "HTTP/1.1 415 Unsupported Media Type",
416 => "HTTP/1.1 416 Requested range not satisfiable",
417 => "HTTP/1.1 417 Expectation Failed",
500 => "HTTP/1.1 500 Internal Server Error",
501 => "HTTP/1.1 501 Not Implemented",
502 => "HTTP/1.1 502 Bad Gateway",
503 => "HTTP/1.1 503 Service Unavailable",
504 => "HTTP/1.1 504 Gateway Time-out"
);
if (isset($codes[$status]))
{
header($codes[$status]);
}
}
header ('Location: '.$url);
}
/**
* Saves a variable to use inside a template.
*
* @param mixed $one A string or an array of data.
* @param string $two Value in case $one is a string (which then works as the key), otherwise unused.
* @return unknown
*/
function set($one, $two=null)
{
return $this->_setArray(is_array($one)? $one: array($one=>$two));
}
/**
* Enter description here...
*
* @param unknown_type $action
*/
function setAction ($action)
{
$this->action = $action;
$args = func_get_args();
call_user_func_array(array(&$this, $action), $args);
}
/**
* Returns number of errors in a submitted FORM.
*
* @return int Number of errors
*/
function validate ()
{
$args = func_get_args();
$errors = call_user_func_array(array(&$this, 'validateErrors'), $args);
if ($errors === false)
{
return 0;
}
return count($errors);
}
/**
* Validates a FORM according to the rules set up in the Model.
*
* @return int Number of errors
*/
function validateErrors ()
{
$objects = func_get_args();
if (!count($objects))
{
return false;
}
$errors = array();
foreach ($objects as $object)
{
$errors = array_merge($errors, $object->invalidFields($object->data));
}
return $this->validationErrors = (count($errors)? $errors: false);
}
/**
* Gets an instance of the view object & prepares it for rendering the output, then
* asks the view to actualy do the job.
*
* @param unknown_type $action
* @param unknown_type $layout
* @param unknown_type $file
* @return unknown
*/
function render($action=null, $layout=null, $file=null)
{
$viewClass = $this->view;
if($this->view != 'View' && !class_exists($viewClass))
{
$viewClass = $this->view.'View';
loadView($this->view);
}
if($this->view != 'View')
{
$viewClass = $this->view.'View';
}
Merging fixes and enhancements into trunk Revision: [2009] Adding fixes for session errors posted in the google group. Changed the header for PHP version in the model classes. Change uses() back to require_once Revision: [2008] Adding reference back to the PHP 4 model Revision: [2007] Merging changes from model_php5 Revision: [2006] Fixing recursive associations, adding whitelist to Model::save Revision: [2005] Added fix for error in CakeSession class. Updated home.thtml Revision: [2004] Rearranged some of the defines moving the most often changed ones to the top of the script Revision: [2003] Moved SQL files distributed with the core to app/config/sql/ Removed app/config/routes.php.default Fixed class_exists check in TextHelper Revision: [2002] adding sql directory Revision: [2001] Fixed error when cake distribution is installed inside of the DOCUMENT ROOT Revision: [2000] Adding checks for classes that are already loaded so the require() calls will not error Revision: [1999] Replacing all require_once() with require() Revision: [1998] Moved creation of the Dispatcher object to app/webroot/index.php Revision: [1997] Adding session sql file Revision: [1996] Revision: [1995] Fixing session db queries Revision: [1994] Change the require_once in bootstrap to require. Merged changes John made to the CakeSession database methods Revision: [1993] Removing some constants that are not needed Revision: [1992] Adding fix for Ticket #400 Revision: [1991] Fixing Ticket #348 Revision: [1990] Fixing Tickets #397 and #399 Revision: [1989] Fixed callbacks in JavaScript events and Ajax, fixed Controller::beforeRender so you can set view variables, and fixed Ticket #394 Revision: [1988] Renamed the $dir param to $direction. Added default value to the DboSource::order() $direction param. Revision: [1987] Adding changes back to the sessions class I reverted in [1984] git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2010 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-17 10:12:15 +00:00
$this->beforeRender();
$this->_viewClass =& new $viewClass($this);
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
if(!empty($this->modelNames))
{
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
foreach ($this->modelNames as $model)
{
[1178] Author: phpnut Date: 8:52:12 PM, Sunday, October 23, 2005 Message: adding cakephp power image [1177] Author: phpnut Date: 8:48:32 PM, Sunday, October 23, 2005 Message: Updated scaffold to use new layout template. [1176] Author: phpnut Date: 7:09:27 PM, Sunday, October 23, 2005 Message: renaming cake/conf to cake/config [1175] Author: phpnut Date: 7:06:04 PM, Sunday, October 23, 2005 Message: moving tags.ini.php to cake/conf/tags.ini.php [1174] Author: phpnut Date: 6:52:19 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1173] Author: phpnut Date: 6:46:07 PM, Sunday, October 23, 2005 Message: updating css/cake.deafult.css and default layout [1172] Author: phpnut Date: 6:42:48 PM, Sunday, October 23, 2005 Message: updating css/cake.scaffold.css [1171] Author: phpnut Date: 6:41:00 PM, Sunday, October 23, 2005 Message: Adding spaces to tags.ini file [1170] Author: phpnut Date: 6:37:17 PM, Sunday, October 23, 2005 Message: Removing code that is no longer used [1169] Author: phpnut Date: 6:34:24 PM, Sunday, October 23, 2005 Message: removing files that are no longer used [1168] Author: phpnut Date: 6:19:46 PM, Sunday, October 23, 2005 Message: Cleaning up Scaffold class. [1167] Author: phpnut Date: 5:26:27 PM, Sunday, October 23, 2005 Message: Changes are added to remove the $this->models array that would hold the instance of the models. Now they are available as $this->ModelName; This should be CamelCased. Added check in the Scaffold to return forms when accessing the actions update, create without a form being submitted. [1166] Author: phpnut Date: 3:53:08 PM, Sunday, October 23, 2005 Message: Making change to allow setting the name of a class camel cased to fix issues with PHP 4. In both the model and the controllers: Model: var $name = 'ModelName'; Controller: var $name = 'ControllerName'; ControllerName not ControllerNameController. [1165] Author: phpnut Date: 1:45:17 PM, Sunday, October 23, 2005 Message: Fix added for problems with key name that was added to the class registry when underscored git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1179 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-10-24 01:56:20 +00:00
if(!empty($this->{$model}->validationErrors))
{
$this->_viewClass->validationErrors[$model] =& $this->{$model}->validationErrors;
}
}
}
$this->autoRender = false;
return $this->_viewClass->render($action, $layout, $file);
}
/**
* Gets the referring URL of this request
*
* @param string $default Default URL to use if HTTP_REFERER cannot be read from headers
* @param boolean $local If true, restrict referring URLs to local server
* @access public
*/
function referer($default = null, $local = false)
{
$ref = env('HTTP_REFERER');
$base = FULL_BASE_URL . $this->webroot;
Merging fixes and enhancements into trunk Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-16 09:29:28 +00:00
if ($ref != null && (defined(FULL_BASE_URL) || FULL_BASE_URL))
{
Merging fixes and enhancements into trunk Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-16 09:29:28 +00:00
if (strpos($ref, $base) === 0)
{
return substr($ref, strlen($base) - 1);
}
elseif (!$local)
{
return $ref;
}
}
if ($default != null)
{
return $default;
}
else
{
return '/';
}
}
/**
* Sets data for this view. Will set title if the key "title" is in given $data array.
*
* @param array $data Array of
* @access private
*/
function _setArray($data)
{
foreach ($data as $name => $value)
{
if ($name == 'title')
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
{
$this->_setTitle($value);
}
else
Merging fixes and enhancements into trunk Revision: [1891] Added patch from Ticket #278 Revision: [1890] Adding patch from Ticket #227 Revision: [1889] Adding fix from Changeset [1631]. This fixes Ticket #319 Revision: [1888] Added fix for Ticket #315 Revision: [1887] Adding patch from Ticket #312 Revision: [1886] Adding fix that was committed in [1304] back. Closing Ticket #77 again Revision: [1885] Fix added for Ticket #306 Added patch from Ticket #318 Added patch from Ticket #322 Revision: [1884] Adding fix to Ticket #332 Revision: [1883] Adding patch from Ticket #330 Revision: [1882] Adding fix for Ticket #170 back to HtmlHelper::selectTag(). Was lost in a previous merge Revision: [1881] Adding fix for Ticket #336 Revision: [1880] Adding fix from Ticket #307 Revision: [1879] Plugins will use their own helpers and components if present Revision: [1878] Basic implementation of plugins within app/plugins working. Revision: [1877] Starting plugin code for multiple apps within one app. Revision: [1876] Added Ticket #345. Revision: [1875] Added check to AcoAction class that would not attempt to load AppModel Class if it is already defined in memory Added fixes for Ticket #317, Ticket #333, Ticket #343, Ticket #337 Revision: [1874] Adding fix for Ticket #340 Revision: [1873] Added themeWeb var to helpers that will be used if a theme class overrides the view class Revision: [1872] Adding $format to timeAgo and relativeTime, for gwoo Revision: [1871] Docstrings changes. One char at a time we map out Cake. Revision: [1870] Docstrings for Session, and corrections to tabbing on datasource. Revision: [1869] Docstrings for the core database classes. Revision: [1868] Adding patch for Ticket #131 Revision: [1867] Allowing ajax link titles to not be escaped Revision: [1866] Changed error class so calls to ErrorHandler::error() in production setting will work. git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1892 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-01 13:26:23 +00:00
{
$this->_viewVars[$name] = $value;
}
}
}
/**
* Set the title element of the page.
*
* @param string $pageTitle Text for the title
* @access private
*/
function _setTitle($pageTitle)
{
$this->pageTitle = $pageTitle;
}
/**
* Shows a message to the user $time seconds, then redirects to $url
* Uses flash.thtml as a layout for the messages
*
* @param string $message Message to display to the user
* @param string $url Relative URL to redirect to after the time expires
* @param int $time Time to show the message
*/
function flash($message, $url, $pause = 1)
{
$this->autoRender = false;
$this->autoLayout = false;
$this->set('url', $this->base.$url);
$this->set('message', $message);
$this->set('pause', $pause);
$this->set('page_title', $message);
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
if(file_exists(VIEWS.'layouts'.DS.'flash.thtml'))
{
$flash = VIEWS.'layouts'.DS.'flash.thtml';
}
elseif($flash = fileExistsInPath(LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml'))
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
{
}
$this->render(null, false, $flash);
}
/**
* Shows a message to the user $time seconds, then redirects to $url
* Uses flash.thtml as a layout for the messages
*
* @param string $message Message to display to the user
* @param string $url URL to redirect to after the time expires
* @param int $time Time to show the message
*
* @param unknown_type $message
* @param unknown_type $url
* @param unknown_type $time
*/
function flashOut($message, $url, $time=1)
{
$this->autoRender = false;
$this->autoLayout = false;
$this->set('url', $url);
$this->set('message', $message);
$this->set('time', $time);
$this->render(null, false, VIEWS.'layouts'.DS.'flash.thtml');
}
/**
* This function creates a $fieldNames array for the view to use.
* @todo Map more database field types to html form fields.
* @todo View the database field types from all the supported databases.
*
*/
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
function generateFieldNames( $data = null, $doCreateOptions = true )
{
$fieldNames = array();
$model = $this->modelClass;
$modelKey = $this->modelKey;
$table = $this->{$model}->table;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
$association = array_search($table,$this->{$model}->alias);
$objRegistryModel =& ClassRegistry::getObject($modelKey);
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
foreach ($objRegistryModel->_tableInfo as $tables)
{
foreach ($tables as $tabl)
{
$alias = null;
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
if ($objRegistryModel->isForeignKey($tabl['name']))
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
{
$niceName = substr( $tabl['name'], 0, strpos( $tabl['name'], "_id" ) );
$fkNames = $this->{$model}->keyToTable[$tabl['name']];
$fieldNames[ $tabl['name'] ]['prompt'] = Inflector::humanize($fkNames[1]);
$fieldNames[ $tabl['name'] ]['table'] = $fkNames[0];
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
$association = array_search($fieldNames[ $tabl['name'] ]['table'],$this->{$model}->alias);
$fieldNames[ $tabl['name'] ]['prompt'] = Inflector::humanize($alias.$niceName);
$fieldNames[ $tabl['name'] ]['model'] = $fkNames[1];
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
$fieldNames[ $tabl['name'] ]['modelKey'] = $this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']];
Merging fixes and enhancements into trunk Revision: [1985] Changed DboSource?::order() to allow passing an array in the order param Revision: [1984] Reverting changes from [1983] Revision: [1983] Merging change from [1966] and [1967] Revision: [1982] Adding fix for DboSource::order(). This allows setting the order in the find methods. Revision: [1981] cleaned up code Revision: [1980] Corrected the array keys in the regex I added Revision: [1979] Added check to DboMysql::value() that does not add quotes around a numerical value. Refactored DboSource::conditions() adding better regex. Revision: [1978] Added check for LIKE in a condition array this fixes the = being added. Revision: [1977] Added fix for Ticket #392 Revision: [1976] Adding changes suggested in Ticket #381. These have not been fully tested. Revision: [1975] Added fix for Ticket #391 Revision: [1974] Added patch from Ticket #390 Revision: [1973] Adding patch from Ticket #386 Revision: [1972] Added patch from Ticket #385. Changed wording of a comment. Revision: [1971] Added patch from Ticket #383 Revision: [1970] Adding fix for Ticket #395 Revision: [1969] Adding more detailed comment to path defines Revision: [1968] Making a few more changes to the path settings Revision: [1965] fixing path issue with loading PagesController Revision: [1964] Added model method for getting column types by field Revision: [1963] Corrected paths to the tmp directory. Making a few more changes to the defines in index.php Revision: [1962] Moving tmp directory to app Revision: [1961] Starting separation of core from the application. Revision: [1960] Adding vendors directory to app directory Revision: [1959] Finished support for recursive associations. Still needs some testing... Revision: [1958] Adding fix for Ticket #387, and automagic id's for form inputs Revision: [1957] Revision: [1956] Adding fix for error reported in Google Group: http://groups.google.com/group/cake-php/browse_thread/thread/395593a3cea34174 Revision: [1955] Adding fix for Controller::referer() git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1986 3807eeeb-6ff5-0310-8944-8be069107fe0
2006-02-16 09:29:28 +00:00
$fieldNames[ $tabl['name'] ]['controller'] = Inflector::pluralize($this->{$model}->tableToModel[$fkNames[0]]);
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
$fieldNames[ $tabl['name'] ]['foreignKey'] = true;
}
else if( 'created' != $tabl['name'] && 'updated' != $tabl['name'] )
{
$fieldNames[$tabl['name']]['prompt'] = Inflector::humanize($tabl['name']);
}
else if( 'created' == $tabl['name'] )
{
$fieldNames[$tabl['name']]['prompt'] = 'Created';
}
else if( 'updated' == $tabl['name'] )
{
$fieldNames[$tabl['name']]['prompt'] = 'Modified';
}
$fieldNames[ $tabl['name']]['tagName'] = $model.'/'.$tabl['name'];
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
$validationFields = $objRegistryModel->validate;
if( isset( $validationFields[ $tabl['name'] ] ) )
{
if( VALID_NOT_EMPTY == $validationFields[ $tabl['name'] ] )
{
$fieldNames[$tabl['name']]['required'] = true;
$fieldNames[$tabl['name']]['errorMsg'] = "Required Field";
}
}
$lParenPos = strpos( $tabl['type'], '(');
$rParenPos = strpos( $tabl['type'], ')');
if( false != $lParenPos )
{
$type = substr($tabl['type'], 0, $lParenPos );
$fieldLength = substr( $tabl['type'], $lParenPos+1, $rParenPos - $lParenPos -1 );
}
else
{
$type = $tabl['type'];
}
switch( $type )
{
case "text":
case "mediumtext":
$fieldNames[ $tabl['name']]['type'] = 'area';
break;
case "varchar":
[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
case "char":
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
if (isset($fieldNames[ $tabl['name']]['foreignKey']))
{
$fieldNames[ $tabl['name']]['type'] = 'select';
$fieldNames[ $tabl['name']]['options'] = array();
$otherModel =& ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey']));
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
if (is_object($otherModel))
{
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
if ($doCreateOptions)
{
$otherDisplayField = $otherModel->getDisplayField();
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 ($otherModel->findAll() as $pass)
{
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 ($pass as $key => $value)
{
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
if($alias.$key == $this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']] && isset( $value['id'] ) && isset( $value[$otherDisplayField]))
{
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
$fieldNames[ $tabl['name']]['options'][$value['id']] = $value[$otherDisplayField];
}
}
}
}
$fieldNames[ $tabl['name']]['selected'] = $data[$association][$tabl['name']];
}
}
else
{
$fieldNames[ $tabl['name']]['type'] = 'input';
}
break;
case "tinyint":
if( $fieldLength > 1 )
{
$fieldNames[ $tabl['name']]['type'] = 'input';
}
else
{
$fieldNames[ $tabl['name']]['type'] = 'checkbox';
}
break;
case "int":
case "smallint":
case "mediumint":
case "bigint":
case "decimal":
case "float":
case "double":
$charCount = strlen($this->$model->primaryKey);
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
if(0 == strncmp($tabl['name'], $this->$model->primaryKey, $charCount))
{
$fieldNames[ $tabl['name']]['type'] = 'hidden';
}
else if( isset( $fieldNames[ $tabl['name']]['foreignKey'] ) )
{
$fieldNames[ $tabl['name']]['type'] = 'select';
$fieldNames[ $tabl['name']]['options'] = array();
$otherModel =& ClassRegistry::getObject(Inflector::underscore($fieldNames[$tabl['name']]['modelKey']));
if( is_object($otherModel) )
{
if( $doCreateOptions )
{
$otherDisplayField = $otherModel->getDisplayField();
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($otherModel->findAll() as $pass)
{
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($pass as $key => $value)
{
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
if( $alias.$key == $this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']] && isset($value[$otherModel->primaryKey]) && isset($value[$otherDisplayField]))
{
$fieldNames[ $tabl['name']]['options'][$value[$otherModel->primaryKey]] = $value[$otherDisplayField];
}
}
}
}
$fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']];
}
}
else
{
$fieldNames[ $tabl['name']]['type'] = 'input';
}
break;
case "enum":
$fieldNames[ $tabl['name']]['type'] = 'select';
$fieldNames[ $tabl['name']]['options'] = array();
$enumValues = split(',', $fieldLength );
foreach ($enumValues as $enum )
{
$enum = trim( $enum, "'" );
$fieldNames[$tabl['name']]['options'][$enum] = $enum;
}
$fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']];
break;
case "date":
case "datetime":
if(0 != strncmp( "created", $tabl['name'], 6 ) && 0 != strncmp("modified",$tabl['name'], 8))
{
$fieldNames[ $tabl['name']]['type'] = $type;
}
if(isset($data[$model][$tabl['name']]))
{
$fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']];
}
else
{
$fieldNames[ $tabl['name']]['selected'] = null;
}
break;
default:
break;
}
}
foreach($objRegistryModel->hasAndBelongsToMany as $relation => $relData)
{
$modelName = $relData['className'];
$manyAssociation = $relation;
$modelKeyM = Inflector::underscore($modelName);
$modelObject =& new $modelName();
if($doCreateOptions)
{
$otherDisplayField = $modelObject->getDisplayField();
$fieldNames[$modelKeyM]['model'] = $modelName;
$fieldNames[$modelKeyM]['prompt'] = "Related ".Inflector::humanize(Inflector::pluralize($modelName));
$fieldNames[$modelKeyM]['type'] = "selectMultiple";
$fieldNames[$modelKeyM]['tagName'] = $manyAssociation.'/'.$manyAssociation;
foreach($modelObject->findAll() as $pass)
{
foreach($pass as $key=>$value)
{
if($key == $modelName && isset($value[$modelObject->primaryKey]) && isset( $value[$otherDisplayField]))
{
$fieldNames[$modelKeyM]['options'][$value[$modelObject->primaryKey]] = $value[$otherDisplayField];
}
}
}
if( isset( $data[$manyAssociation] ) )
{
foreach( $data[$manyAssociation] as $key => $row )
{
$fieldNames[$modelKeyM]['selected'][$row[$modelObject->primaryKey]] = $row[$modelObject->primaryKey];
}
}
}
}
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
}
return $fieldNames;
Merging: Revision: [1638] removing php short tags Revision: [1637] Remove renderElememnts loading of helpers also, forgot it in the last commit Revision: [1636] Refactoring after profiling code. Session was creating a new instance of Dispatcher removed the need for it. Added a check to the Component class to pass the base to the SessionComponent class, will refactor that at a later time. Changed View class so it would not load helpers when rending a layout, no need for that. A great performance boost after the change. Change the loadModels method call in app/webroot/index.php. Will only attempt the loadModels call if the AppModel class is not in memory, and the Database class is in memory. Removed all unnecessary calls to basics uses(). Again another big performance increase. Added fix to the Html::guiListTree() after discussing the output that is expected. A ticket was closed on this already. Revision: [1635] Removing calls to basic uses() Revision: [1634] Removing calls to basics uses() that are not needed. Revision: [1633] Removing calls to basics uses() that are not needed. Moved Object class further up in the loading order Revision: [1632] adding fix for Ticket #132 Revision: [1631] Added fix from Ticket #122 Revision: [1630] Scaffold views can now be placed in a view directory. These will override the core. Example (Must have the scaffold dot name): app/views/posts/scaffold.list.thtml app/views/posts/scaffold.new.thtml app/views/posts/scaffold.edit.thtml app/views/posts/scaffold.show.thtml Revision: [1629] Think I fixed the issue with scaffold showing proper dates prior to January 1 1970 00:00:00. Revision: [1628] Added a few more change to allow saving dates prior to January 1 1970 00:00:00. Still a few issues with this, but will get them figured out soon. Changed scaffold to use only one form view. Revision: [1627] Added fix for Ticket #189 Revision: [1626] Added fix for Ticket #120. Revision: [1625] left justified doc blocks Revision: [1624] remove files from uses() that are loaded by default in app/webroot/index.php no reason to attempt to load them again in the classes Revision: [1623] adding check to the loadModels and loadController that will only attempt to load files if the classes are not already in memory Revision: [1622] Adding fix to time helper that was lost in a previous merge Removing all tabs from code Revision: [1621] Addtional model validation fixes Revision: [1620] fixed parse error Revision: [1619] Fixing ticket #102 Revision: [1618] correcting mime types and keywords Revision: [1617] correcting mime types and keywords Revision: [1616] fixed link in footer Revision: [1615] Fixing ticket #207 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1639 3807eeeb-6ff5-0310-8944-8be069107fe0
2005-12-27 03:33:44 +00:00
}
/**
* Called before the controller action. Overridden in subclasses.
*
*/
function beforeFilter ()
{
}
/**
* Called after the controller action is run, but before the view is rendered. Overridden in subclasses.
*
*/
function beforeRender ()
{
}
/**
* Called after the controller action is run and rendered. Overridden in subclasses.
*
*/
function afterFilter ()
{
}
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
}
?>