mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
[1198]
Author: phpnut Date: 7:29:04 PM, Monday, October 24, 2005 Message: More work on changes to use CamelCase throughout the system. [1197] Author: phpnut Date: 2:57:08 PM, Monday, October 24, 2005 Message: Removing unneeded calls to Inflector class [1196] Author: phpnut Date: 2:39:30 PM, Monday, October 24, 2005 Message: adding fix for Ticket #61 [1195] Author: phpnut Date: 11:19:43 AM, Monday, October 24, 2005 Message: Adding fix for Ticket #47 [1194] Author: phpnut Date: 10:10:41 AM, Monday, October 24, 2005 Message: Adding fix for Ticket #49 git-svn-id: https://svn.cakephp.org/repo/trunk/cake@1199 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
e2815b4a5c
commit
c5e4f8cd79
10 changed files with 29 additions and 23 deletions
|
@ -111,7 +111,7 @@ else
|
|||
|
||||
header("Date: ".date("D, j M Y G:i:s ", $templateModified).'GMT');
|
||||
header("Content-Type: text/css");
|
||||
header("Expires: ".date("D, j M Y G:i:s T", time()+DAY));
|
||||
header("Expires: ".gmdate("D, j M Y H:i:s", time()+DAY)." GMT");
|
||||
header("Cache-Control: cache"); // HTTP/1.1
|
||||
header("Pragma: cache"); // HTTP/1.0
|
||||
print $output;
|
||||
|
|
|
@ -618,7 +618,7 @@ class Controller extends Object
|
|||
|
||||
// Now, set up some other attributes that will be useful for auto generating a form.
|
||||
//tagName is in the format table/field "post/title"
|
||||
$fieldNames[ $tabl['name']]['tagName'] = $modelKey.'/'.$tabl['name'];
|
||||
$fieldNames[ $tabl['name']]['tagName'] = $model.'/'.$tabl['name'];
|
||||
|
||||
// Now, find out if this is a required field.
|
||||
//$validationFields = $classRegistry->getObject($table)->validate;
|
||||
|
@ -651,6 +651,7 @@ class Controller extends Object
|
|||
{
|
||||
|
||||
case "text":
|
||||
case "mediumtext":
|
||||
{
|
||||
$fieldNames[ $tabl['name']]['type'] = 'area';
|
||||
//$fieldNames[ $tabl['name']]['size'] = $fieldLength;
|
||||
|
@ -666,7 +667,9 @@ class Controller extends Object
|
|||
|
||||
// get the list of options from the other model.
|
||||
$registry = ClassRegistry::getInstance();
|
||||
$otherModel = $registry->getObject($fieldNames[$tabl['name']]['model']);
|
||||
$otherModel = $registry->getObject(Inflector::underscore($fieldNames[$tabl['name']]['model']));
|
||||
|
||||
|
||||
if( is_object($otherModel) )
|
||||
{
|
||||
if( $doCreateOptions )
|
||||
|
@ -746,7 +749,7 @@ class Controller extends Object
|
|||
}
|
||||
}
|
||||
}
|
||||
$fieldNames[ $tabl['name']]['selected'] = $data[$modelKey][$tabl['name']];
|
||||
$fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']];
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -768,7 +771,7 @@ class Controller extends Object
|
|||
$enum = trim( $enum, "'" );
|
||||
$fieldNames[$tabl['name']]['options'][$enum] = $enum;
|
||||
}
|
||||
$fieldNames[ $tabl['name']]['selected'] = $data[$table][$tabl['name']];
|
||||
$fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']];
|
||||
|
||||
}
|
||||
break;
|
||||
|
@ -807,15 +810,15 @@ class Controller extends Object
|
|||
{
|
||||
foreach( $pass as $key=>$value )
|
||||
{
|
||||
if( $key == $modelKey && isset( $value['id'] ) && isset( $value[$otherDisplayField] ) )
|
||||
if( $key == $modelName && isset( $value['id'] ) && isset( $value[$otherDisplayField] ) )
|
||||
{
|
||||
$fieldNames[$modelKey]['options'][$value['id']] = $value[$otherDisplayField];
|
||||
}
|
||||
}
|
||||
}
|
||||
if( isset( $data[$modelKey] ) )
|
||||
if( isset( $data[$model] ) )
|
||||
{
|
||||
foreach( $data[$modelKey] as $row )
|
||||
foreach( $data[$model] as $row )
|
||||
{
|
||||
$fieldNames[$modelKey]['selected'][$row['id']] = $row['id'];
|
||||
}
|
||||
|
@ -823,6 +826,7 @@ class Controller extends Object
|
|||
}
|
||||
} // end loop through manytomany relations.
|
||||
}
|
||||
|
||||
return $fieldNames;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,12 +30,12 @@
|
|||
*/
|
||||
|
||||
$modelName = Inflector::singularize($this->name);
|
||||
$modelKey = Inflector::underscore($modelName);
|
||||
$modelKey = $modelName;
|
||||
?>
|
||||
<h1>Edit <?php echo Inflector::humanize($modelName);?></h1>
|
||||
|
||||
<?php
|
||||
echo $html->formTag('/'.Inflector::underscore($this->name).'/update');
|
||||
echo $html->formTag('/'. $this->name .'/update');
|
||||
|
||||
|
||||
echo $form->generateFields( $fieldNames );
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<?php
|
||||
$model = Inflector::singularize($this->name);
|
||||
$modelKey = Inflector::underscore(Inflector::singularize($this->name));
|
||||
$modelKey = $model;
|
||||
$humanName = Inflector::humanize($this->name);
|
||||
$humanSingularName = Inflector::singularize( $humanName );
|
||||
// var_dump( $data );
|
||||
|
@ -70,9 +70,9 @@
|
|||
$otherModelObject = $registry->getObject( $otherModelKey );
|
||||
if( is_object($otherModelObject) )
|
||||
{
|
||||
$displayText = $row[$otherModelKey][ $otherModelObject->getDisplayField() ];
|
||||
$displayText = $row[$value['model']][ $otherModelObject->getDisplayField() ];
|
||||
} else{
|
||||
$displayText = $row[$otherModelKey][$field];
|
||||
$displayText = $row[$value['model']][$field];
|
||||
}
|
||||
echo $html->linkTo( $displayText, "/".Inflector::underscore($otherControllerName)."/show/".$row[$modelKey][$field] );
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
<h1>New <?php echo Inflector::humanize($this->name)?></h1>
|
||||
|
||||
<?php
|
||||
echo $html->formTag('/'.Inflector::underscore($this->name).'/create');
|
||||
echo $html->formTag('/'. $this->name .'/create');
|
||||
|
||||
echo $form->generateFields( $fieldNames );
|
||||
|
||||
|
|
|
@ -514,7 +514,7 @@ class Model extends Object
|
|||
$this->{$className}->{$this->currentModel.'_insertsql'} = null;
|
||||
break;
|
||||
}
|
||||
$this->tableToModel[$this->{$className}->table] = strtolower($className);
|
||||
$this->tableToModel[$this->{$className}->table] = $className;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -561,7 +561,7 @@ class Model extends Object
|
|||
else
|
||||
{
|
||||
$this->table = $tableName;
|
||||
$this->tableToModel[$this->table] = Inflector::underscore($this->name);
|
||||
$this->tableToModel[$this->table] = $this->name;
|
||||
$this->loadInfo();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ define('VALID_NUMBER', '/^[0-9]+$/');
|
|||
/**
|
||||
* A valid email address.
|
||||
*/
|
||||
define('VALID_EMAIL', '/^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.[a-z]{2,3})$/i');
|
||||
define('VALID_EMAIL', '/^([a-z0-9][a-z0-9_\-\.\+]*)@([a-z0-9][a-z0-9\.\-]{0,63}\.([a-z][a-z]|com|org|net|biz|info|name|net|pro|aero|coop|museum))$/i');
|
||||
|
||||
/**
|
||||
* A valid year (1000-2999).
|
||||
|
|
|
@ -160,10 +160,12 @@ class HtmlHelper extends Helper
|
|||
}
|
||||
elseif ($url{0} == '/')
|
||||
{
|
||||
$url = Inflector::underscore($url);
|
||||
$output = $this->base . $url;
|
||||
}
|
||||
else
|
||||
{
|
||||
$url = Inflector::underscore($url);
|
||||
$output = $this->base.'/'.strtolower($this->params['controller']).'/'.$url;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
<? //echo $this->webroot?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
|
|
|
@ -271,13 +271,14 @@ class View extends Object
|
|||
// check for controller-level view handler
|
||||
foreach(array($this->name, 'errors') as $viewDir)
|
||||
{
|
||||
if(file_exists(VIEWS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml'))
|
||||
$errorAction =Inflector::underscore($errorAction);
|
||||
if(file_exists(VIEWS.$viewDir.DS.$errorAction.'.thtml'))
|
||||
{
|
||||
$missingViewFileName = VIEWS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml';
|
||||
$missingViewFileName = VIEWS.$viewDir.DS.$errorAction.'.thtml';
|
||||
}
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml'))
|
||||
elseif(file_exists(LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml'))
|
||||
{
|
||||
$missingViewFileName = LIBS.'view'.DS.'templates'.DS.$viewDir.DS.Inflector::underscore($errorAction).'.thtml';
|
||||
$missingViewFileName = LIBS.'view'.DS.'templates'.DS.$viewDir.DS.$errorAction.'.thtml';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue