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
This commit is contained in:
phpnut 2005-10-24 01:56:20 +00:00
parent ee07b4efa9
commit 68b194965e
14 changed files with 469 additions and 1180 deletions

View file

@ -1,8 +1,9 @@
body
{
margin: 0;
font:small "Trebuchet MS",Verdana,Arial,Sans-serif;
background: #F2F5F5 url('../img/cake.bg.body.gif') top center repeat-y;
margin: 4px 30px;
font: 13px "Trebuchet MS",Verdana,Arial,Sans-serif;
background-color: #51230B;
line-height: 18px;
}
h1
@ -54,8 +55,8 @@ ul
}
ul li
{
list-style-image: url(../img/cake.redbox.gif);
padding-bottom: 8px;
list-style-image: url("../img/cake.redbox.gif");
margin-bottom: 8px;
}
p
@ -66,61 +67,88 @@ p
margin-bottom: 6px;
}
#main
#container
{
width: 752px;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
padding-bottom: 20px;
background-color: #EFF1F1;
border-top: 4px solid #fff;
/*border-bottom: 1px solid #D2D7D8;*/
/*border-top: 1px solid #C9CFD1;
border-bottom: 1px solid #C9CFD1;
border-left: 1px solid #C9CFD1;
border-right: 1px solid #C9CFD1;*/
margin-bottom: 20px;
border: 5px solid #fff;
background-color: #EBEDEE;
}
#header
{
padding: 0px;
height: 112px;
background: #fff url(../img/cake.bg.header.gif) repeat-x;
background: #fff url("../img/cake.bg.header.gif") repeat-x;
border-bottom: 1px solid #D2D7D8;
vertical-align: bottom;
white-space: normal;
}
#headerLogo
{
float: left;
border: 0;
}
#headerLogo img
{
border: 0;
}
#headerNav
{
float: left;
float: right;
margin-top: 56px;
margin-left: 10px;
margin-right: 30px;
margin-bottom: 12px;
font-size: 15px;
font-weight: bold;
color: #71300F;
}
#headerNav a {
padding: 4px 10px;
font-weight: bold;
}
#headerSubNav
{
float: left;
margin-top: 12px;
margin-left: 10px;
#headerNav a:hover {
padding: 4px 10px;
background-color: #D2D7D8;
}
#headerNav .active {
padding: 4px 10px;
background-color: #D2D7D8;
}
#pageNav {
margin-top: 20px;
margin-right: 30px;
text-align: right;
font-size: 15px;
font-weight: bold;
color: #71300F;
}
#headerSubNav a {
#pageNav a {
padding: 4px 10px;
font-weight: bold;
border-top: 1px solid #EBEDEE;
border-left: 1px solid #EBEDEE;
border-right: 1px solid #EBEDEE;
}
#pageNav a:hover {
padding: 4px 10px;
background-color: #fff;
border-top: 1px solid #D2D7D8;
border-left: 1px solid #D2D7D8;
border-right: 1px solid #D2D7D8;
}
#pageNav .active {
padding: 4px 10px;
background-color: #fff;
border-top: 1px solid #D2D7D8;
border-left: 1px solid #D2D7D8;
border-right: 1px solid #D2D7D8;
}
#content
{
margin: 20px 20px;
padding: 0px 28px 40px 22px;
clear: both;
margin: 2px 20px 20px 20px;
padding: 6px 28px 40px 22px;
background-color: #fff;
border-top: 1px solid #D2D7D8;
border-left: 1px solid #D2D7D8;
@ -143,24 +171,16 @@ a:hover
#footer
{
padding-bottom: 40px;
}
.active {
background-color: #D2D7D8;
padding: 10px;
}
/***Please Leave Powered by Cake****/
#pb-cake {
width: 752px;
margin-top: 0px;
margin-left: auto;
margin-right: auto;
padding-right: 6px;
padding-bottom: 0px;
text-align: right;
}
#pb-cake a{
padding: 0;
/***Please Leave Powered by Cake****/
#pb-cake {
margin-bottom: 20px;
padding-right: 6px;
text-align: center;
}
#pb-cake a {
padding: 0;
border: 0;
}

View file

@ -1,39 +1,4 @@
/* CSS Document */
* {
margin: 0;
padding: 0;
}
body {
color: #333;
font: 76% Verdana, Arial, Helvetica, sans-serif;
}
h1 {
color: #69c;
font-size:2.1em;
}
h2 {
color: #383;
clear: both;
display:block;
font-size:1.7em;
float:left;
margin-top:5px;
}
h3 {
color: #553;
font-size:1.4em;
}
h4 {
color: #338;
font-size:1.15em;
}
a {
text-decoration:underline;
white-space:nowrap;
}
a:hover {
background-color:#eee;
}
code, pre {
color:#44a;
font-family:monospace;
@ -56,44 +21,42 @@ ul {
}
li {
margin-left:2em;
list-style:none;
list-style-image: none;
}
#container {
color: #333;
margin: 2em auto;
width:80%;
}
.notice {
background: #ffd;
background: #71300F;
border: solid 2px #eeb;
display: block;
font-family: Verdana;
padding: 1em;
}
.tip {
background: #efe;
border: solid 2px #cdc;
background: #71300F;
border: solid 2px #333;
padding: 1em;
}
.error {
background: #fee;
border: solid 2px #dcc;
color: #DBA941
background: #f4f4f4;
border: solid 2px #333;
padding: 1em;
}
ul.actions {
float:left;
list-style: none;
text-align:right;
margin:2em 0;
}
ul.actions li {
border: 1px solid #333;
float:left;
margin-left:1em;
width:10em;
list-style: none;
}
ul.actions li a, ul.actions li input {
background-color:#3297FC;
border:1px solid #3297FC;
background-color:#71300F;
border:1px solid #71300F;
clear: both;
color: #fff;
display:block;
@ -105,12 +68,12 @@ td.listactions {
width:17em;
}
td.listactions a {
float: left;
text-align:center;
font-weight: bold;
color: #fff;
background-color:#3297FC;
background-color:#71300F;
display:block;
float:left;
text-decoration: none;
margin-bottom:3px;
margin-right: 3px;
@ -119,10 +82,10 @@ td.listactions a {
}
table {
background-color: #fff;
border: 1px solid #686E74;
border: 1px solid #333;
clear:both;
margin: 1em 0 2em 0;
width: 100%;
white-space: normal;
}
th {
background-color: #ccc;
@ -131,20 +94,18 @@ th {
border-bottom: 1px solid #666;
text-align: left;
padding:3px;
white-space:nowrap;
}
table tr td {
border-right: 1px solid #ccc;
padding:2px 0;
padding:2px 4px;
vertical-align:top;
}
table tr.altRow td {
background: #EBF4FD;
background: #f4f4f4;
}
div.related {
clear:both;
display:block;
float:left;
}
dl {
line-height:2em;

Binary file not shown.

After

Width:  |  Height:  |  Size: 294 B

View file

@ -33,58 +33,58 @@
; Tag template for a link.
link = "<a href="%s"%s>%s</a>"
link = "<a href="%s" %s>%s</a>"
; Tag template for a mailto: link.
mailto = "<a href="mailto:%s"%s>%s</a>"
mailto = "<a href="mailto:%s" %s>%s</a>"
; Tag template for opening form tag.
form = "<form %s>"
; Tag template for an input type='text' tag.
input = "<input name="data[%s][%s]"%s/>"
input = "<input name="data[%s][%s]" %s/>"
; Tag template for an input type='textarea' tag
textarea = "<textarea name="data[%s][%s]"%s>%s</textarea>"
textarea = "<textarea name="data[%s][%s]" %s>%s</textarea>"
; Tag template for an input type='hidden' tag.
hidden = "<input type="hidden" name="data[%s][%s]"%s/>"
hidden = "<input type="hidden" name="data[%s][%s]" %s/>"
; Tag template for a textarea tag.
textarea = "<textarea name="data[%s][%s]"%s>%s</textarea>"
textarea = "<textarea name="data[%s][%s]" %s>%s</textarea>"
; Tag template for a input type='checkbox ' tag.
checkbox = "<input type="checkbox" name="data[%s][%s]" id="tag_%s" %s/>"
; Tag template for a input type='radio' tag.
radio = "<input type="radio" name="data[%s][%s]" id="tag_%s"%s/>"
radio = "<input type="radio" name="data[%s][%s]" id="tag_%s" %s/>"
; Tag template for a select opening tag.
selectstart = "<select name="data[%s][%s]"%s>"
selectstart = "<select name="data[%s][%s]" %s>"
; Tag template for a select opening tag.
selectmultiplestart = "<select name="data[%s][%s][]"%s>"
selectmultiplestart = "<select name="data[%s][%s][]" %s>"
; Tag template for an empty select option tag.
selectempty = "<option value=""%s></option>"
selectempty = "<option value="" %s></option>"
; Tag template for a select option tag.
selectoption = "<option value="%s"%s>%s</option>"
selectoption = "<option value="%s" %s>%s</option>"
; Tag template for a closing select tag.
selectend = "</select>"
; Tag template for a password tag.
password = "<input type="password" name="data[%s][%s]"%s/>"
password = "<input type="password" name="data[%s][%s]" %s/>"
; Tag template for a file input tag.
file = "<input type="file" name="%s"%s/>"
file = "<input type="file" name="%s" %s/>"
; Tag template for a submit button tag.
submit = "<input type="submit"%s/>"
submit = "<input type="submit" %s/>"
; Tag template for an image tag.
image =" <img src="%s"%s/>"
image =" <img src="%s" %s/>"
; Tag template for a table header tag.
tableheader = "<th%s>%s</th>"

View file

@ -125,7 +125,7 @@ class Controller extends Object
* @var array Array of model objects.
* @access public
*/
var $models = array();
var $modelNames = array();
/**
@ -189,27 +189,18 @@ class Controller extends Object
*/
function __construct ()
{
// parent::__construct();
$r = null;
if (!preg_match('/(.*)Controller/i', get_class($this), $r))
{
die("Controller::__construct() : Can't get or parse my own class name, exiting.");
}
$classVars = get_class_vars(get_class($this));
if(in_array('casedClass', array_keys($classVars)) && !empty($this->casedClass))
{
$this->name = $this->casedClass;
$this->viewPath = Inflector::underscore($this->casedClass);
}
else
if($this->name === null)
{
$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];
$this->viewPath = Inflector::underscore($r[1]);
}
parent::__construct();
$this->viewPath = Inflector::underscore($this->name);
parent::__construct();
}
/**
@ -261,7 +252,8 @@ class Controller extends Object
if (class_exists($modelClass) && ($this->uses === false))
{
$this->models[$modelKey] = new $modelClass($id);
$this->{$modelClass} =& new $modelClass($id);
$this->modelNames[] = $modelClass;
}
elseif ($this->uses)
{
@ -279,7 +271,8 @@ class Controller extends Object
if (class_exists($modelClass))
{
$this->models[$modelKey] = new $modelClass($id);
$this->{$modelClass} =& new $modelClass($id);
$this->modelNames[] = $modelClass;
}
else
{
@ -370,14 +363,14 @@ class Controller extends Object
{
$view =& new View($this);
if(!empty($this->models))
if(!empty($this->modelNames))
{
foreach ($this->models as $key)
foreach ($this->modelNames as $model)
{
$key = Inflector::underscore(get_class($key));
if(!empty($this->models[$key]->validationErrors))
$key = Inflector::underscore($model);
if(!empty($this->{$model}->validationErrors))
{
$view->validationErrors[$key] =& $this->models[$key]->validationErrors;
$view->validationErrors[$key] =& $this->{$model}->validationErrors;
}
}
}
@ -593,13 +586,14 @@ class Controller extends Object
$fieldNames = array();
// figure out what model and table we are working with
$model = Inflector::underscore(Inflector::singularize($this->name));
$table = $this->models[$model]->table;
$model = Inflector::singularize($this->name);
$modelKey = Inflector::underscore($model);
$table = $this->{$model}->table;
// get all of the column names.
$classRegistry =& ClassRegistry::getInstance();
$objRegistryModel = $classRegistry->getObject($model);
$objRegistryModel = $classRegistry->getObject($modelKey);
foreach ($objRegistryModel->_tableInfo as $tables)
@ -613,8 +607,8 @@ class Controller extends Object
$fieldNames[ $tabl['name'] ]['prompt'] = Inflector::humanize($niceName);
// this is a foreign key, also set up the other controller
$fieldNames[ $tabl['name'] ]['table'] = Inflector::pluralize($niceName);
$fieldNames[ $tabl['name'] ]['model'] = $this->models[$model]->tableToModel[$fieldNames[ $tabl['name'] ]['table']];
$fieldNames[ $tabl['name'] ]['controller'] = Inflector::pluralize($this->models[$model]->tableToModel[Inflector::pluralize($niceName)]);
$fieldNames[ $tabl['name'] ]['model'] = $this->{$model}->tableToModel[$fieldNames[ $tabl['name'] ]['table']];
$fieldNames[ $tabl['name'] ]['controller'] = Inflector::pluralize($this->{$model}->tableToModel[Inflector::pluralize($niceName)]);
$fieldNames[ $tabl['name'] ]['foreignKey'] = true;
}
else if( 'created' != $tabl['name'] && 'updated' != $tabl['name'] )
@ -632,7 +626,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'] = $model.'/'.$tabl['name'];
$fieldNames[ $tabl['name']]['tagName'] = $modelKey.'/'.$tabl['name'];
// Now, find out if this is a required field.
//$validationFields = $classRegistry->getObject($table)->validate;
@ -759,7 +753,7 @@ class Controller extends Object
}
}
}
$fieldNames[ $tabl['name']]['selected'] = $data[$model][$tabl['name']];
$fieldNames[ $tabl['name']]['selected'] = $data[$modelKey][$tabl['name']];
}
}
else

View file

@ -50,223 +50,248 @@ uses(DS.'model'.DS.'model', 'inflector', 'object');
*/
class Scaffold extends Object {
/**
* Name of controller class
*
* @var string
*/
var $clazz = null;
/**
* Enter description here...
*
* @var string
*/
var $actionView = null;
/**
* Enter description here...
*
* @var string
*/
var $actionView = null;
/**
* Enter description here...
*
* @var unknown_type
*/
var $modelKey = null;
/**
* Enter description here...
*
* @var unknown_type
*/
var $modelKey = null;
/**
* Enter description here...
*
* @var Object
*/
var $controllerClass = null;
/**
* Enter description here...
*
* @var Object
*/
var $controllerClass = null;
/**
* Name of scaffolded Model
*
* @var string
*/
var $modelName = null;
/**
* Name of scaffolded Model
*
* @var string
*/
var $modelName = null;
/**
* Title HTML element for current scaffolded view
*
* @var string
*/
var $scaffoldTitle = null;
/**
* Title HTML element for current scaffolded view
*
* @var string
*/
var $scaffoldTitle = null;
/**
* Base URL
*
* @var string
*/
var $base = false;
/**
* Base URL
*
* @var string
*/
var $base = false;
/**
* Construct and set up given controller with given parameters.
*
* @param string $controller_class Name of controller
* @param array $params
*/
function __construct(&$controller, $params)
{
$this->controllerClass =& $controller;
$this->clazz = $controller->name;
/**
* Construct and set up given controller with given parameters.
*
* @param string $controller_class Name of controller
* @param array $params
*/
function __construct(&$controller, $params)
{
$this->controllerClass =& $controller;
$this->actionView = $controller->action;
$this->modelKey = Inflector::underscore(Inflector::singularize($this->clazz));
$this->modelKey = Inflector::singularize($controller->name);
$this->scaffoldTitle = Inflector::humanize($this->modelKey);
$this->controllerClass->layout = 'scaffold';
$this->controllerClass->pageTitle = $this->scaffoldTitle;
$this->_renderScaffold($params);
}
function _renderScaffold($params)
{
$this->_scaffoldView($params);
}
/**
* Renders the List view as the default action (index).
*
* @param array $params
* @return boolean Success
*/
function _scaffoldIndex($params)
{
$this->controllerClass->pageTitle = Inflector::humanize(Inflector::pluralize($this->modelKey));
return $this->_scaffoldList($params);
}
/**
* Renders a Show view of scaffolded Model.
*
* @param array $params
*/
function _scaffoldShow($params)
{
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->modelKey]->read();
$this->controllerClass->set('data', $this->controllerClass->params['data'] );
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames( $this->controllerClass->params['data'], false ) );
$this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
}
/**
* Renders List view of scaffolded Model.
*
* @param array $params
*/
function _scaffoldList($params)
{
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
$this->controllerClass->set('data', $this->controllerClass->models[$this->modelKey]->findAll());
$this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
}
/**
* Creates a new scaffold.
*
* @param array $params
*/
function _scaffoldNew($params)
{
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
$this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
/**
* Renders an Edit view for scaffolded Model.
*
* @param array $params
*/
function _scaffoldEdit($params)
{
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->modelKey]->read();
// generate the field names.
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames($this->controllerClass->params['data']) );
$this->controllerClass->set('data', $this->controllerClass->params['data']);
$this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'edit.thtml');
}
/**
* Renders a "create new" view for scaffolded Model.
*
* @param array $params
*/
function _scaffoldCreate($params)
{
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
$this->_cleanUpFields();
if ($this->controllerClass->models[$this->modelKey]->save($this->controllerClass->params['data']))
{
$this->controllerClass->flash('Your '.$this->modelKey.' has been saved.', '/'.Inflector::underscore($this->controllerClass->viewPath) );
}
else
{
$this->controllerClass->set('data', $this->controllerClass->params['data']);
$this->controllerClass->validateErrors($this->controllerClass->models[$this->modelKey]);
$this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
}
/**
* Renders an update view for scaffolded Model.
*
* @param array $params
*/
function _scaffoldUpdate($params=array())
{
// clean up the date fields
$this->_cleanUpFields();
$this->controllerClass->models[$this->modelKey]->set($this->controllerClass->params['data']);
if ( $this->controllerClass->models[$this->modelKey]->save())
{
$this->controllerClass->flash('The '.Inflector::humanize($this->modelKey).' has been updated.','/'.Inflector::underscore($this->controllerClass->viewPath));
}
else
{
$this->controllerClass->flash('There was an error updating the '.Inflector::humanize($this->modelKey),'/'.Inflector::underscore($this->controllerClass->viewPath));
}
}
/**
* Performs a delete on given scaffolded Model.
*
* @param array $params
*/
function _scaffoldDestroy($params=array())
{
$id = $params['pass'][0];
// figure out what model and table we are working with
if ($this->controllerClass->models[$this->modelKey]->del($id))
{
$this->controllerClass->flash('The '.Inflector::humanize($this->modelKey).' with id: '.$id.' has been deleted.', '/'.Inflector::underscore($this->controllerClass->viewPath));
}
else
{
$this->controllerClass->flash('There was an error deleting the '.Inflector::humanize($this->modelKey).' with the id '.$id, '/'.Inflector::underscore($this->controllerClass->viewPath));
}
}
/**
* When methods are now present in a controller
* scaffoldView is used to call default Scaffold methods if:
* <code>
* var $scaffold;
* </code>
* is placed in the controller's class definition.
*
* @param string $url
* @param string $controller_class
* @param array $params
* @since Cake v 0.10.0.172
*/
* Enter description here...
*
* @param unknown_type $params
* @access private
*/
function _renderScaffold($params)
{
$this->_scaffoldView($params);
}
/**
* Renders the List view as the default action (index).
*
* @param array $params
* @return Scaffold::_scaffoldList();
* @access private
*/
function _scaffoldIndex($params)
{
$this->controllerClass->pageTitle = Inflector::humanize(Inflector::pluralize($this->modelKey));
return $this->_scaffoldList($params);
}
/**
* Renders a Show view of scaffolded Model.
*
* @param array $params
* @return A rendered view of a row from Models database table
* @access private
*/
function _scaffoldShow($params)
{
$this->controllerClass->params['data'] = $this->controllerClass->{$this->modelKey}->read();
$this->controllerClass->set('data', $this->controllerClass->params['data'] );
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames( $this->controllerClass->params['data'], false ) );
return $this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
}
/**
* Renders List view of scaffolded Model.
*
* @param array $params
* @return A rendered view listing rows from Models database table
* @access private
*/
function _scaffoldList($params)
{
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
$this->controllerClass->set('data', $this->controllerClass->{$this->modelKey}->findAll());
return $this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
}
/**
* Creates a new scaffold.
*
* @param array $params
* @return A rendered view with a form to create a new row in the Models database table
* @access private
*/
function _scaffoldNew($params)
{
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
return $this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
/**
* Renders an Edit view for scaffolded Model.
*
* @param array $params
* @return A rendered view with a form to edit a record in the Models database table
* @access private
*/
function _scaffoldEdit($params)
{
$this->controllerClass->params['data'] = $this->controllerClass->{$this->modelKey}->read();
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames($this->controllerClass->params['data']) );
$this->controllerClass->set('data', $this->controllerClass->params['data']);
return $this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'edit.thtml');
}
/**
* Renders a "create new" view for scaffolded Model.
*
* @param array $params
* @return success on save new form if data is empty or if data does not validate
* @access private
*/
function _scaffoldCreate($params)
{
if(empty($this->controllerClass->params['data']))
{
return $this->_scaffoldNew($params);
}
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
$this->_cleanUpFields();
if ($this->controllerClass->{$this->modelKey}->save($this->controllerClass->params['data']))
{
return $this->controllerClass->flash('Your '.Inflector::humanize($this->modelKey).' has been saved.', '/'.
Inflector::underscore($this->controllerClass->viewPath) );
}
else
{
$this->controllerClass->set('data', $this->controllerClass->params['data']);
$this->controllerClass->validateErrors($this->controllerClass->{$this->modelKey});
return $this->controllerClass->render($this->actionView, '', LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
}
/**
* Renders an update view for scaffolded Model.
*
* @param array $params
* @return success on save new form if data is empty or error if update fails
* @access private
*/
function _scaffoldUpdate($params=array())
{
if(empty($this->controllerClass->params['data']))
{
return $this->_scaffoldNew($params);
}
$this->_cleanUpFields();
$this->controllerClass->{$this->modelKey}->set($this->controllerClass->params['data']);
if ( $this->controllerClass->{$this->modelKey}->save())
{
return $this->controllerClass->flash('The '.Inflector::humanize($this->modelKey).' has been updated.','/'.
Inflector::underscore($this->controllerClass->viewPath));
}
else
{
return $this->controllerClass->flash('There was an error updating the '.Inflector::humanize($this->modelKey),'/'.
Inflector::underscore($this->controllerClass->viewPath));
}
}
/**
* Performs a delete on given scaffolded Model.
*
* @param array $params
* @return success on delete error if delete fails
* @access private
*/
function _scaffoldDestroy($params=array())
{
$id = $params['pass'][0];
if ($this->controllerClass->{$this->modelKey}->del($id))
{
return $this->controllerClass->flash('The '.Inflector::humanize($this->modelKey).' with id: '.
$id.' has been deleted.', '/'.Inflector::underscore($this->controllerClass->viewPath));
}
else
{
return $this->controllerClass->flash('There was an error deleting the '.Inflector::humanize($this->modelKey).' with the id '.
$id, '/'.Inflector::underscore($this->controllerClass->viewPath));
}
}
/**
* When methods are now present in a controller
* scaffoldView is used to call default Scaffold methods if:
* <code>
* var $scaffold;
* </code>
* is placed in the controller's class definition.
*
* @param string $url
* @param string $controller_class
* @param array $params
* @since Cake v 0.10.0.172
* @access private
*/
function _scaffoldView ($params)
{
if(!in_array('form', $this->controllerClass->helpers))
{
$this->controllerClass->helpers[] = 'form';
}
if(!in_array('form', $this->controllerClass->helpers))
{
$this->controllerClass->helpers[] = 'form';
}
$isDataBaseSet = DboFactory::getInstance($this->controllerClass->useDbConfig);
if(!empty($isDataBaseSet))
@ -329,61 +354,57 @@ class Scaffold extends Object {
}
}
/**
* Cleans up the date fields of current Model.
*
*
*/
function _cleanUpFields()
{
// clean up the date fields
$objModel = $this->controllerClass->models[$this->modelKey];
foreach( $objModel->_tableInfo as $table )
{
foreach ($table as $field)
{
if( 'date' == $field['type'] && isset($this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] ) )
{
$newDate = mktime( 0,0,0,
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_month'],
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_day'],
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = $newDate;
}
else if( 'datetime' == $field['type'] && isset($this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] ) )
{
$hour = $this->controllerClass->params['data'][$this->modelKey][$field['name'].'_hour'];
if( $hour != 12 && 'pm' == $this->controllerClass->params['data'][$this->modelKey][$field['name'].'_meridian'] )
{
$hour = $hour + 12;
}
$newDate = mktime( $hour,
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_min'],
0,
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_month'],
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_day'],
$this->controllerClass->params['data'][$this->modelKey][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = $newDate;
}
else if( 'tinyint(1)' == $field['type'] )
{
if( isset( $this->controllerClass->params['data'][$this->modelKey][$field['name']]) &&
"on" == $this->controllerClass->params['data'][$this->modelKey][$field['name']] )
{
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = true;
}
else
{
$this->controllerClass->params['data'][$this->modelKey][$field['name']] = false;
}
}
}
}
}
/**
* Cleans up the date fields of current Model.
*
* @access private
*/
function _cleanUpFields()
{
$modelKey = Inflector::underscore($this->modelKey);
foreach( $this->controllerClass->{$this->modelKey}->_tableInfo as $table )
{
foreach ($table as $field)
{
if('date' == $field['type'] && isset($this->controllerClass->params['data'][$modelKey][$field['name'].'_year']))
{
$newDate = mktime( 0,0,0,
$this->controllerClass->params['data'][$modelKey][$field['name'].'_month'],
$this->controllerClass->params['data'][$modelKey][$field['name'].'_day'],
$this->controllerClass->params['data'][$modelKey][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$modelKey][$field['name']] = $newDate;
}
else if( 'datetime' == $field['type'] && isset($this->controllerClass->params['data'][$modelKey][$field['name'].'_year'] ) )
{
$hour = $this->controllerClass->params['data'][$modelKey][$field['name'].'_hour'];
if( $hour != 12 && 'pm' == $this->controllerClass->params['data'][$modelKey][$field['name'].'_meridian'] )
{
$hour = $hour + 12;
}
$newDate = mktime( $hour,
$this->controllerClass->params['data'][$modelKey][$field['name'].'_min'],0,
$this->controllerClass->params['data'][$modelKey][$field['name'].'_month'],
$this->controllerClass->params['data'][$modelKey][$field['name'].'_day'],
$this->controllerClass->params['data'][$modelKey][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$modelKey][$field['name']] = $newDate;
}
else if( 'tinyint(1)' == $field['type'] )
{
if( isset( $this->controllerClass->params['data'][$modelKey][$field['name']]) &&
"on" == $this->controllerClass->params['data'][$modelKey][$field['name']] )
{
$this->controllerClass->params['data'][$modelKey][$field['name']] = true;
}
else
{
$this->controllerClass->params['data'][$modelKey][$field['name']] = false;
}
}
}
}
}
}
?>

View file

@ -1,46 +0,0 @@
<?php
/* SVN FILE: $Id$ */
/**
* Base controller class.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2005, CakePHP Authors/Developers
*
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
* Larry E. Masters aka PhpNut <nut@phpnut.com>
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @author CakePHP Authors/Developers
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.cake.libs.controller.templates.scaffolds
* @since CakePHP v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title><?php echo $title_for_layout; ?></title>
<?php echo $html->charsetTag('UTF-8'); ?>
<?php echo $html->cssTag('cake.scaffold'); ?>
<?php echo $html->cssTag('cake.forms'); ?>
</head>
<body>
<div id="container">
<h1><?php echo $title_for_layout; ?></h1>
<?php echo $content_for_layout; ?>
</div>
</body>
</html>

View file

@ -1,566 +0,0 @@
<?php
/* SVN FILE: $Id$ */
/**
* Creates ready-to-use file skeletons for applications.
*
* Creates controller, model, view files, and the required directories on demand.
* Used by /scripts/bake.php.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2005, CakePHP Authors/Developers
*
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
* Larry E. Masters aka PhpNut <nut@phpnut.com>
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @author CakePHP Authors/Developers
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.cake.libs.generator
* @since CakePHP v 0.2.9
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Require needed libraries.
*/
uses('object', 'inflector');
/**
* Creates ready-to-use file skeletons for applications.
*
* Bake class creates files in configured application directories. This is a
* base class for /scripts/add.php.
*
* @package cake
* @subpackage cake.cake.libs.generator
* @since CakePHP v 0.2.9
*/
class Bake extends Object {
/**
* Standard input stream (php://stdin).
*
* @var resource
* @access private
*/
var $stdin = null;
/**
* Standard output stream (php://stdout).
*
* @var resource
* @access private
*/
var $stdout = null;
/**
* Standard error stream (php://stderr).
*
* @var resource
* @access private
*/
var $stderr = null;
/**
* Counts actions taken.
*
* @var integer
* @access private
*/
var $actions = null;
/**
* Decides whether to overwrite existing files without asking.
*
* @var boolean
* @access private
*/
var $dontAsk = false;
/**
* Returns code template for PHP file generator.
*
* @param string $type
* @return string
* @access private
*/
function template ($type)
{
switch ($type)
{
case 'view': return "%s";
case 'model': return "<?php\n\nclass %s extends AppModel {\n}\n\n?>";
case 'action': return "\n\tfunction %s () {\n\t}\n";
case 'ctrl': return "<?php\n\nclass %s extends %s {\n%s\n}\n\n?>";
case 'helper': return "<?php\n\nclass %s extends AppController {\n}\n\n?>";
case 'test': return '<?php
class %sTest extends TestCase {
var $abc;
// called before the tests
function setUp()
{
$this->abc = new %s ();
}
// called after the tests
function tearDown()
{
unset($this->abc);
}
/*
function testFoo ()
{
$result = $this->abc->Foo();
$expected = \'\';
$this->assertEquals($result, $expected);
}
*/
}
?>';
default:
return false;
}
}
/**
* Baker's constructor method. Initialises bakery, and starts production.
*
* @param string $type
* @param array $names
* @access public
* @uses Bake::stdin Opens stream for reading.
* @uses Bake::stdout Opens stream for writing.
* @uses Bake::stderr Opens stream for writing.
* @uses Bake::newModel() Depending on the case, can create a new model.
* @uses Bake::newView() Depending on the case, can create a new view.
* @uses Bake::newController() Depending on the case, can create a new controller.
*/
function __construct ($type, $names)
{
$this->stdin = fopen('php://stdin', 'r');
$this->stdout = fopen('php://stdout', 'w');
$this->stderr = fopen('php://stderr', 'w');
// Output directory name
fwrite($this->stderr, "\n".substr(ROOT,0,strlen(ROOT)-1).":\n".str_repeat('-',strlen(ROOT)+1)."\n");
switch ($type)
{
case 'model':
case 'models':
foreach ($names as $model_name)
$this->newModel($model_name);
break;
case 'controller':
case 'ctrl':
$controller = array_shift($names);
$add_actions = array();
foreach ($names as $action)
{
$add_actions[] = $action;
$this->newView($controller, $action);
}
$this->newController($controller, $add_actions);
break;
case 'view':
case 'views':
$r = null;
foreach ($names as $model_name)
{
if (preg_match('/^([a-z0-9_]+(?:\/[a-z0-9_]+)*)\/([a-z0-9_]+)$/i', $model_name, $r))
{
$this->newView($r[1], $r[2]);
}
}
break;
}
if (!$this->actions)
fwrite($this->stderr, "Nothing to do, quitting.\n");
}
/**
* Creates new view in VIEWS/$controller/ directory.
*
* @param string $controller
* @param string $name
* @access private
* @uses Inflector::underscore() Underscores directory's name.
* @uses Bake::createDir() Creates new directory in views dir, named after the controller.
* @uses VIEWS
* @uses Bake::createFile() Creates view file.
* @uses Bake::template() Collects view template.
* @uses Bake::actions Adds one action for each run.
*/
function newView ($controller, $name)
{
// $controller = Inflector::pluralize($controller);
$dir = Inflector::underscore($controller);
$path = $dir.DS.strtolower($name).".thtml";
$this->createDir(VIEWS.$dir);
$fn = VIEWS.$path;
$this->createFile($fn, sprintf($this->template('view'), "<p>Edit <b>app".DS."views".DS."{$path}</b> to change this message.</p>"));
$this->actions++;
}
/**
* Creates new controller with defined actions, controller's test and helper
* with helper's test.
*
* @param string $name
* @param array $actions
* @access private
* @uses Inflector::pluralize()
* @uses Bake::makeController()
* @uses Bake::makeControllerTest()
* @uses Bake::makeHelper()
* @uses Bake::makeHelperTest()
* @uses Bake::actions Adds one action for each run.
*/
function newController ($name, $actions=array())
{
// $name = Inflector::pluralize($name);
$this->makeController($name, $actions);
$this->makeControllerTest($name);
$this->makeHelper($name);
$this->makeHelperTest($name);
$this->actions++;
}
/**
* Creates new controller file with defined actions.
*
* @param string $name
* @param array $actions
* @return boolean
* @access private
* @uses Bake::makeControllerName() CamelCase for controller's name.
* @uses Bake::makeHelperName() CamelCase for helper's name.
* @uses Bake::template() Controller's template.
* @uses Bake::getActions() Actions' templates to be included in the controller.
* @uses Bake::createFile() Creates controller's file.
* @uses Bake::makeControllerFn() Underscored name for controller's filename.
*/
function makeController ($name, $actions)
{
$ctrl = $this->makeControllerName($name);
$helper = $this->makeHelperName($name);
$body = sprintf($this->template('ctrl'), $ctrl, $helper, join('', $this->getActions($actions)));
return $this->createFile($this->makeControllerFn($name), $body);
}
/**
* Returns controller's name in CamelCase.
*
* @param string $name
* @return string
* @access private
* @uses Inflector::camelize CamelCase for controller name.
*/
function makeControllerName ($name)
{
return Inflector::camelize($name).'Controller';
}
/**
* Returns a name for controller's file, underscored.
*
* @param string $name
* @return string
* @access private
* @uses Inflector::underscore() Underscore for controller's file name.
*/
function makeControllerFn ($name)
{
return CONTROLLERS.Inflector::underscore($name).'_controller.php';
}
/**
* Creates new test for a controller.
*
* @param string $name
* @return boolean
* @access private
* @uses CONTROLLER_TESTS
* @uses Inflector::underscore()
* @uses Bake::getTestBody()
* @uses Bake::makeControllerName()
* @uses Bake::createFile()
*/
function makeControllerTest ($name)
{
$fn = CONTROLLER_TESTS.Inflector::underscore($name).'_controller_test.php';
$body = $this->getTestBody($this->makeControllerName($name));
return $this->createFile($fn, $body);
}
/**
* Creates new helper.
*
* @param string $name
* @return boolean
* @access private
* @uses Bake::template()
* @uses Bake::makeHelperName()
* @uses Bake::createFile()
* @uses Bake::makeHelperFn()
*/
function makeHelper ($name)
{
$body = sprintf($this->template('helper'), $this->makeHelperName($name));
return $this->createFile($this->makeHelperFn($name), $body);
}
/**
* Returns CamelCase name for a helper.
*
* @param string $name
* @return string
* @access private
* @uses Inflector::camelize()
*/
function makeHelperName ($name)
{
return Inflector::camelize($name).'Helper';
}
/**
* Underscores file name for a helper.
*
* @param string $name
* @return string
* @access private
* @uses HELPERS
* @uses Inflector::underscore()
*/
function makeHelperFn ($name)
{
return HELPERS.Inflector::underscore($name).'_helper.php';
}
/**
* Creates new test for a helper.
*
* @param string $name
* @return boolean
* @access private
* @uses HELPER_TESTS
* @uses Inflector::underscore()
* @uses Bake::getTestBody()
* @uses Bake::makeHelperName()
* @uses Bake::createFile()
*/
function makeHelperTest ($name)
{
$fn = HELPER_TESTS.Inflector::underscore($name).'_helper_test.php';
$body = $this->getTestBody($this->makeHelperName($name));
return $this->createFile($fn, $body);
}
/**
* Returns an array of actions' templates.
*
* @param array $as
* @return array
* @access private
* @uses Bake::template()
*/
function getActions ($as)
{
$out = array();
foreach ($as as $a)
$out[] = sprintf($this->template('action'), $a);
return $out;
}
/**
* Returns a test template for given class.
*
* @param string $class
* @return string
* @access private
* @uses Bake::template()
*/
function getTestBody ($class)
{
return sprintf($this->template('test'), $class, $class);
}
/**
* Creates new model.
*
* @param string $name
* @access private
* @uses Bake::createFile()
* @uses Bake::getModelFn()
* @uses Bake::template()
* @uses Bake::getModelName()
* @uses Bake::makeModelTest()
* @uses Bake::actions
*/
function newModel ($name)
{
$this->createFile($this->getModelFn($name), sprintf($this->template('model'), $this->getModelName($name)));
$this->makeModelTest ($name);
$this->actions++;
}
/**
* Returns an underscored filename for a model.
*
* @param string $name
* @return string
* @access private
* @uses MODELS
* @uses Inflector::underscore()
*/
function getModelFn ($name)
{
return MODELS.Inflector::underscore($name).'.php';
}
/**
* Creates a test for given model.
*
* @param string $name
* @return boolean
* @access private
* @uses MODEL_TESTS
* @uses Inflector::underscore()
* @uses Bake::getTestBody()
* @uses Bake::getModelName()
* @uses Bake::createFile()
*/
function makeModelTest ($name)
{
$fn = MODEL_TESTS.Inflector::underscore($name).'_test.php';
$body = $this->getTestBody($this->getModelName($name));
return $this->createFile($fn, $body);
}
/**
* Returns CamelCased name of a model.
*
* @param string $name
* @return string
* @access private
* @uses Inflector::camelize()
*/
function getModelName ($name)
{
return Inflector::camelize($name);
}
/**
* Creates a file with given path and contents.
*
* @param string $path
* @param string $contents
* @return boolean
* @access private
* @uses Bake::dontAsk
* @uses Bake::stdin
* @uses Bake::stdout
* @uses Bake::stderr
*/
function createFile ($path, $contents)
{
$shortPath = str_replace(ROOT,null,$path);
if (is_file($path) && !$this->dontAsk)
{
fwrite($this->stdout, "File {$shortPath} exists, overwrite? (yNaq) ");
$key = trim(fgets($this->stdin));
if ($key=='q')
{
fwrite($this->stdout, "Quitting.\n");
exit;
}
elseif ($key=='a')
{
$this->dont_ask = true;
}
elseif ($key=='y')
{
}
else
{
fwrite($this->stdout, "Skip {$shortPath}\n");
return false;
}
}
if ($f = fopen($path, 'w'))
{
fwrite($f, $contents);
fclose($f);
fwrite($this->stdout, "Wrote {$shortPath}\n");
// debug ("Wrote {$path}");
return true;
}
else
{
fwrite($this->stderr, "Error! Couldn't open {$shortPath} for writing.\n");
// debug ("Error! Couldn't open {$path} for writing.");
return false;
}
}
/**
* Creates a directory with given path.
*
* @param string $path
* @return boolean
* @access private
* @uses Bake::stdin
* @uses Bake::stdout
*/
function createDir ($path)
{
if (is_dir($path))
return true;
$shortPath = str_replace(ROOT, null, $path);
if (mkdir($path))
{
fwrite($this->stdout, "Created {$shortPath}\n");
// debug ("Created {$path}");
return true;
}
else
{
fwrite($this->stderr, "Error! Couldn't create dir {$shortPath}\n");
// debug ("Error! Couldn't create dir {$path}");
return false;
}
}
}
?>

View file

@ -190,7 +190,11 @@ class Model extends Object
*/
function __construct ($id=false, $table=null, $db=null)
{
$this->name = get_class($this);
if($this->name === null)
{
$this->name = get_class($this);
}
$this->currentModel = Inflector::underscore($this->name);
if($db != null)
@ -208,7 +212,7 @@ class Model extends Object
}
$classRegistry =& ClassRegistry::getInstance();
$classRegistry->addObject($this->name, $this);
$classRegistry->addObject($this->currentModel, $this);
if ($id)
{

View file

@ -79,7 +79,7 @@ class Helper extends Object
*/
function Helper()
{
$this->tags = $this->readConfigFile(CONFIGS.'tags.ini.php');
$this->tags = $this->readConfigFile(CAKE.'config'.DS.'tags.ini.php');
}
/**

View file

@ -1,57 +0,0 @@
<?php
/* SVN FILE: $Id$ */
/**
* Access Control List.
*
* To-be-implemented.
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2005, CakePHP Authors/Developers
*
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
* Larry E. Masters aka PhpNut <nut@phpnut.com>
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @author CakePHP Authors/Developers
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.cake.libs.view.helpers
* @since CakePHP v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
/**
* Access Control List helper library.
*
* To-be-implemented.
*
* @package cake
* @subpackage cake.cake.libs.view.helpers
* @since CakePHP v 0.10.0.1076
*
*/
class AclHelper
{
/**
* Helper for Access Control List functionality.
*
* @return AclHelper
*/
function AclHelper()
{
}
}
?>

View file

@ -1,97 +1,75 @@
<?php
/* SVN FILE: $Id$ */
/**
*
*
*
*
* PHP versions 4 and 5
*
* CakePHP : Rapid Development Framework <http://www.cakephp.org/>
* Copyright (c) 2005, CakePHP Authors/Developers
*
* Author(s): Michal Tatarynowicz aka Pies <tatarynowicz@gmail.com>
* Larry E. Masters aka PhpNut <nut@phpnut.com>
* Kamil Dzielinski aka Brego <brego.dk@gmail.com>
*
* Licensed under The MIT License
* Redistributions of files must retain the above copyright notice.
*
* @filesource
* @author CakePHP Authors/Developers
* @copyright Copyright (c) 2005, CakePHP Authors/Developers
* @link https://trac.cakephp.org/wiki/Authors Authors/Developers
* @package cake
* @subpackage cake.cake.libs.view.templates.layouts
* @since CakePHP v 0.10.0.1076
* @version $Revision$
* @modifiedby $LastChangedBy$
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
?>
<? //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>
<title>CakePHP :: A Rapid Development Framework :: <?php echo $title_for_layout?></title>
<link REL="SHORTCUT ICON" HREF="img/favicon.ico" type="image/x-icon">
<?php echo $html->charsetTag('UTF-8')?>
<?php echo $html->cssTag('cake.default')?>
<title>CakePHP : A Rapid Development Framework :: <?php echo $title_for_layout?></title>
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<?php echo $html->charset('UTF-8')?>
<?php echo $html->css('cake.default')?>
<?php echo $html->css('cake.scaffold')?>
<?php echo $html->css('cake.form')?>
</head>
<body>
<div id="main">
<div id="container">
<div id="header">
<div id="headerLogo"><?php echo $html->image('cake.logo.png',array('alt'=>"CakePHP :: A Rapid Development Framework")); ?></div>
<div id="headerLogo">
<a href="http://cakephp.org">
<?php echo $html->image('cake.logo.png', array('alt'=>"CakePHP : Rapid Development Framework")); ?>
</a>
</div>
<div id="headerNav">
<?
$css_class = ($title_for_layout == 'Home') ? 'active' : '';
echo $html->link('Home', 'http://cakephp.org',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Documentation') ? 'active' : '';
echo $html->link('Documentation', 'http://cakephp.org/pages/documentation',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Downloads') ? 'active' : '';
echo $html->link('Downloads', 'http://cakephp.org/downloads/',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Support') ? 'active' : '';
echo $html->link('Support', 'http://cakephp.org/pages/support/',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Development') ? 'active' : '';
echo $html->link('Development', 'https://trac.cakephp.org',array('class'=>$css_class));
?>
</div>
<div id="headerSubNav">
<?
<?php
$css_class = ($title_for_layout == 'Blog') ? 'active' : '';
echo $html->link('Blog', '/',array('class'=>$css_class));
echo $html->link('CakeBlog', '/',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Wiki Community') ? 'active' : '';
echo $html->link('Wiki Community', 'http://wiki.cakephp.org',array('class'=>$css_class));
echo $html->link('CakeWiki', 'http://wiki.cakephp.org',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Plugins') ? 'active' : '';
echo $html->link('Apps & Plugins', 'http://cakeforge.org',array('class'=>$css_class));
echo $html->link('CakeForge', 'http://cakeforge.org',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Cakebin') ? 'active' : '';
echo $html->link('Cakebin', 'http://cakephp.org/pastes/',array('class'=>$css_class));
echo $html->link('CakeTrac', 'https://trac.cakephp.org',array('class'=>$css_class));
$css_class = ($title_for_layout == 'Pastes') ? 'active' : '';
echo $html->link('CakeBin', 'http://cakephp.org/pastes/',array('class'=>$css_class));
?>
</div>
</div>
<div id="pageNav">
<?php
$css_class = ($title_for_layout == 'Home') ? 'active' : '';
echo $html->link('Home', 'http://cakephp.org/',array('class'=>$css_class));
echo '&nbsp;';
$css_class = ($title_for_layout == 'Documentation') ? 'active' : '';
echo $html->link('Documentation', 'http://cakephp.org/pages/documentation',array('class'=>$css_class));
echo '&nbsp;';
$css_class = ($title_for_layout == 'Downloads') ? 'active' : '';
echo $html->link('Downloads', 'http://cakephp.org/downloads/',array('class'=>$css_class));
echo '&nbsp;';
$css_class = ($title_for_layout == 'Support') ? 'active' : '';
echo $html->link('Support', 'http://cakephp.org/pages/support/',array('class'=>$css_class));
?>
</div>
<div id="content">
<?php echo $content_for_layout?>
</div>
</div>
<div id="footer" align="center">
&copy; 2005 CakePHP ::
<a href="https://trac.cakephp.org/wiki/Authors">CakePHP Developers and Authors</a>
<p>CakePHP v 0.10.0.1076_dev</p>
</div>
<!---PLEASE LEAVE THE POWERED BY CAKE LOGO------->
<div id="pb-cake">
<a href="http://www.cakephp.org/" target="_new" class="simple">
<?php echo $html->image('pbcake.gif',array('width'=>"120",'height'=>"28",'alt'=>"CakePHP :: A Rapid Development Framework", 'border'=>"0"))?>
<div id="pb-cake">
&copy; 2005 CakePHP ::
<a href="https://trac.cakephp.org/wiki/Authors">CakePHP Developers and Authors</a>
<p>CakePHP version 0.10.0.1076_dev</p>
<a href="http://www.cakephp.org/" target="_new" class="simple">
<?php echo $html->image('cake.power.png', array('alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"))?>
</a>
<a href="http://www.cakephp.org/" target="_new" class="simple">
<?php echo $html->image('pbcake.gif', array('width'=>"120",'height'=>"28",'alt'=>"CakePHP : Rapid Development Framework", 'border'=>"0"))?>
</a>
</div>
<div id="footer">
<a href='http://www.silktide.com/index.php?node=18448&url=http%3A%2F%2Fwww.cakephp.org'>
<img src='http://sitescore.silktide.com/index.php?siteScoreUrl=http%3A%2F%2Fwww.cakephp.org' alt='Silktide SiteScore for this website' border='0'>
</a>
</div>
</div>
<!---PLEASE USE ONE OF THE POWERED BY CAKE LOGOS------->
</body>
</html>

View file

@ -169,13 +169,6 @@ class View extends Object
*/
var $hasRendered = null;
/**
* True when the Model objects are all loaded.
*
* @var boolean
*/
var $modelsLoaded = false;
/**
* Enter description here...
*
@ -200,7 +193,7 @@ class View extends Object
$this->helpers =& $this->controller->helpers;
$this->here =& $this->controller->here;
$this->layout =& $this->controller->layout;
$this->models =& $this->controller->models;
$this->modelNames =& $this->controller->modelNames;
$this->name =& $this->controller->name;
$this->pageTitle =& $this->controller->pageTitle;
$this->parent =& $this->controller->parent;
@ -236,16 +229,7 @@ class View extends Object
*/
function render($action=null, $layout=null, $file=null)
{
if ($this->modelsLoaded!==true)
{
foreach ($this->models as $modelName => $model)
{
$this->$modelName = $model;
}
}
// What is reason for these being the same?
if (isset($this->hasRendered) && $this->hasRendered)
if (isset($this->hasRendered) && $this->hasRendered)
{
return true;
}
@ -515,10 +499,6 @@ class View extends Object
{
$layoutFileName = LIBS.'view'.DS.'templates'.DS."layouts".DS."{$this->layout}.thtml";
}
else if(file_exists(LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS."{$this->layout}.thtml"))
{
$layoutFileName = LIBS.'controller'.DS.'templates'.DS.'scaffolds'.DS."{$this->layout}.thtml";
}
return $layoutFileName;
}