merging changes from [692] [693] [697] [699] [701] [704] [706] [707]

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@709 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2005-08-25 16:40:50 +00:00
parent cdf8fd5812
commit d5ebd2f4b7
12 changed files with 317 additions and 285 deletions

View file

@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
* Basic Cake functionalities.
* Basic Cake functionality.
*
* Long description for file
* Core functions for including other source files, loading models and so forth.
*
* PHP versions 4 and 5
*
@ -84,8 +84,8 @@ function loadControllers ()
/**
* Loads a controller and its helper libraries.
*
* @param string $name
* @return boolean
* @param string $name Name of controller
* @return boolean Success
*/
function loadController ($name)
{
@ -103,8 +103,8 @@ function loadController ($name)
/**
* Lists PHP files in given directory.
*
* @param string $path
* @return array
* @param string $path Path to scan for files
* @return array List of files in directory
*/
function listClasses($path)
{
@ -114,6 +114,8 @@ function listClasses($path)
/**
* Loads configuration files
*
* @return boolean True on success.
*/
function config ()
{
@ -157,6 +159,12 @@ function uses ()
}
}
/**
* Require given files in the VENDORS directory. Function takes optional number of parameters.
*
* @param string $name Filename without the .php part.
*
*/
function vendor($name)
{
$args = func_get_args();

View file

@ -508,7 +508,7 @@ class Controller extends Object
foreach ($tables as $tabl)
{
// set up the prompt
if( Model::isForeignKey($tabl['name']) )
if( $objRegistryModel->isForeignKey($tabl['name']) )
{
$niceName = substr( $tabl['name'], 0, strpos( $tabl['name'], "_id" ) );
$fieldNames[ $tabl['name'] ]['prompt'] = Inflector::humanize($niceName);
@ -619,6 +619,9 @@ class Controller extends Object
}
break;
case "int":
case "smallint":
case "mediumint":
case "bigint":
case "decimal":
case "float":
case "double":

View file

@ -27,7 +27,8 @@
foreach( $fieldNames as $field=>$value ) { ?>
<td>
<?php
if( Model::isForeignKey( $field ) ) {
if( isset($value['foreignKey']) )
{
// this is a foreign key, figure out what the display field should be for this model.
$otherModelName = $value['model'];

View file

@ -37,9 +37,9 @@
require_once(VENDORS.'adodb/adodb.inc.php');
/**
* Short description for class.
* AdoDB DBO implementation.
*
* Long description for class
* Database abstraction implementation for the AdoDB library.
*
* @package cake
* @subpackage cake.libs.dbo
@ -149,7 +149,7 @@ class DBO_AdoDB extends DBO
* @param string $data String to be prepared for use in an SQL statement
* @return string Quoted and escaped
*
* :TODO: To be implemented.
* @todo To be implemented.
*/
function prepareValue ($data)
{
@ -167,7 +167,7 @@ class DBO_AdoDB extends DBO
}
/**
* Returns number of affected rows in previous database operation. If no previous operation exists, this returns false.
* Returns number of affected rows in previous database operation, or false if no previous operation exists.
*
* @return int Number of affected rows
*/
@ -177,8 +177,7 @@ class DBO_AdoDB extends DBO
}
/**
* Returns number of rows in previous resultset. If no previous resultset exists,
* this returns false.
* Returns number of rows in previous resultset, or false if no previous resultset exists.
*
* @return int Number of rows in resultset
*/
@ -188,20 +187,21 @@ class DBO_AdoDB extends DBO
}
/**
* Returns the ID generated from the previous INSERT operation.
* To-be-implemented. Returns the ID generated from the previous INSERT operation.
*
* @return int
*
* :TODO: To be implemented.
* @todo To be implemented.
*/
function lastInsertId () { die('Please implement DBO::lastInsertId() first.'); }
/**
* Returns a limit statement in the correct format for the particular database.
* Returns a LIMIT statement in the correct format for the particular database.
*
* @param int $limit Limit of results returned
* @param int $offset Offset from which to start results
* @return string SQL limit/offset statement
* @todo Please change output string to whatever select your database accepts. adodb doesn't allow us to get the correct limit string out of it.
*/
function selectLimit ($limit, $offset=null)
{

View file

@ -32,9 +32,9 @@
*/
/**
* Short description for class.
* Abstract DBO class file.
*
* Long description for class
* All implementations override this class.
*
* @package cake
* @subpackage cake.libs.dbo
@ -44,16 +44,15 @@ class DBO_generic extends DBO
{
/**
* Enter description here...
* Abstract method defined in subclasses.
*
* @param unknown_type $config
*/
function connect ($config)
{
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*/
function disconnect ()
@ -61,24 +60,25 @@ class DBO_generic extends DBO
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
* @param unknown_type $sql
*/
function execute ($sql)
{
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*
*/
function fetchRow ()
{
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*
*/
function tablesList ()
@ -86,25 +86,23 @@ class DBO_generic extends DBO
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
* @param unknown_type $table_name
*/
function fields ($table_name)
{
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
* @param unknown_type $data
*/
function prepareValue ($data)
{
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*/
function lastError ()
@ -112,7 +110,7 @@ class DBO_generic extends DBO
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*/
function lastAffected ()
@ -120,7 +118,7 @@ class DBO_generic extends DBO
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*/
function lastNumRows ()
@ -128,7 +126,7 @@ class DBO_generic extends DBO
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
*/
function lastInsertId ()
@ -136,10 +134,8 @@ class DBO_generic extends DBO
}
/**
* Enter description here...
* Abstract method defined in subclasses.
*
* @param unknown_type $limit
* @param unknown_type $offset
*/
function selectLimit ($limit, $offset=null)
{

View file

@ -138,7 +138,7 @@ class DBO_SQLite extends DBO
function fields($table_name)
{
$fields = false;
$cols = sqlite_fetch_column_types($table_name, $this->_conn, SQLITE_ASSOC);
$cols = sqlite_fetch_column_types($table_name, $this->_conn);
foreach ($cols as $column => $type)
{

View file

@ -993,7 +993,7 @@ class HtmlHelper extends Helper
* @param array $optionAttr Array of HTML options for the enclosed OPTION elements
* @return string Formatted SELECT element
*/
function selectTag($fieldName, $option_elements, $selected=null, $select_attr=null, $optionAttr=null, $show_empty=false)
function selectTag($fieldName, $option_elements, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty=true)
{
$this->setFormTag($fieldName);
@ -1012,7 +1012,7 @@ class HtmlHelper extends Helper
$select[] = sprintf($this->tags['selectstart'], $this->model, $this->field, $this->parseHtmlOptions($select_attr));
}
if($show_empty == true)
if($showEmpty == true)
{
$select[] = sprintf($this->tags['selectempty'], $this->parseHtmlOptions($optionAttr));
}

View file

@ -1022,7 +1022,7 @@ class Model extends Object
{
if(!empty($joined))
{
$this->saveMulti($joined, $this->id);
$this->_saveMulti($joined, $this->id);
}
$this->data = false;
return true;
@ -1049,7 +1049,7 @@ class Model extends Object
{
$this->id = $newID;
}
$this->saveMulti($joined, $this->id);
$this->_saveMulti($joined, $this->id);
}
return true;
}
@ -1071,9 +1071,10 @@ class Model extends Object
*
* @param array $joined Data to save.
* @param string $id
* @return boolean success
* @return
* @access private
*/
function saveMulti ($joined, $id)
function _saveMulti ($joined, $id)
{
$sql = array();
@ -1085,27 +1086,27 @@ class Model extends Object
$tableSort[1] = $name;
sort($tableSort);
$joinTable = $tableSort[0] . '_' . $tableSort[1];
$key1 = Inflector::singularize($this->table) . '_id';
$key2 = Inflector::singularize($name) . '_id';
$mainKey = Inflector::singularize($this->table) . '_id';
$key[] = $mainKey;
$key[] = Inflector::singularize($name) . '_id';
$fields = join(',', $key);
foreach ($value as $update)
{
$fields1[] = $key1;
$values1[] = $this->db->prepare($id);
$fields1[] = $key2;
$values1[] = $this->db->prepare($update);
$values[] = $this->db->prepare($id);
$values[] = $this->db->prepare($update);
$values = join(',', $values);
$newValue[] = "({$values})";
unset($values);
$fields1 = join(',', $fields1);
$values1 = join(',', $values1);
$joinedSql[] = "INSERT INTO {$joinTable} ({$fields1}) VALUES ({$values1})";
unset($fields1);
unset($values1);
}
$this->db->query("DELETE FROM {$joinTable} WHERE $key1 = '{$id}'");
}
foreach ($joinedSql as $insert){
$this->db->query($insert);
$this->db->query("DELETE FROM {$joinTable} WHERE $mainKey = '{$id}'");
}
$newValue = join(',', $newValue);
$this->db->query("INSERT INTO {$joinTable} ({$fields}) VALUES {$newValue}");
}
}
@ -1528,12 +1529,24 @@ class Model extends Object
* This function determines whether or not a string is a foreign key
*
* @param string $field Returns true if the input string ends in "_id"
* @return True if the input string ends in "_id", else false.
* @return True if the field is a foreign key listed in the belongsTo array.
*/
function isForeignKey( $field ) {
// search for the string _id reveals that this string appears three characters from the end, then this is a foreign key.
if( substr($field, -3) === '_id' )
function isForeignKey( $field )
{
$foreignKeys = array();
if(!empty($this->_belongsToOther))
{
foreach ($this->_belongsToOther as $rule)
{
list($table, $key, $value) = $rule;
$foreignKeys[$key] = $key;
}
}
if( array_key_exists($field, $foreignKeys) )
{
return true;
}

View file

@ -37,274 +37,281 @@
uses('model', 'template', 'inflector', 'object');
/**
* Short description for class
* Scaffolding is a set of automatic views, forms and controllers for starting web development work faster.
*
* Long description for class
* Scaffold inspects your database tables, and making educated guesses, sets up a
* number of pages for each of your Models. These pages have data forms that work,
* and afford the web developer an early look at the data, and the possibility to over-ride
* scaffolded actions with custom-made ones.
*
* @package cake
* @subpackage cake.libs
* @since Cake v 1.0.0.172
*/
class Scaffold extends Object {
/**
* Enter description here...
* Name of controller class
*
* @var unknown_type
* @var string
*/
var $clazz = null;
/**
* Enter description here...
*
* @var unknown_type
* @var string
*/
var $actionView = null;
/**
* Enter description here...
*
* @var unknown_type
*/
var $model = null;
/**
* Enter description here...
*
* @var unknown_type
* @var Object
*/
var $controllerClass = null;
/**
* Enter description here...
* Name of scaffolded Model
*
* @var unknown_type
* @var string
*/
var $modelName = null;
/**
* Enter description here...
* Title HTML element for current scaffolded view
*
* @var unknown_type
* @var string
*/
var $scaffoldTitle = null;
/**
* Enter description here...
/**
* Base URL
*
* @var unknown_type
* @var string
*/
var $base = false;
/**
* Enter description here...
* Construct and set up given controller with given parameters.
*
* @param unknown_type $controller_class
* @param unknown_type $params
* @param string $controller_class Name of controller
* @param array $params
*/
function __construct($controller_class, $params)
{
$this->clazz = $controller_class;
$this->actionView = $params['action'];
$r = null;
if (!preg_match('/(.*)Controller/i', $this->clazz, $r))
{
die("Scaffold::__construct() : Can't get or parse class name.");
}
$this->model = strtolower(Inflector::singularize($r[1]));
$this->scaffoldTitle = $r[1];
$this->clazz = $controller_class;
$this->actionView = $params['action'];
$r = null;
if (!preg_match('/(.*)Controller/i', $this->clazz, $r))
{
die("Scaffold::__construct() : Can't get or parse class name.");
}
$this->model = strtolower(Inflector::singularize($r[1]));
$this->scaffoldTitle = $r[1];
}
/**
* Enter description here...
* Set up a new class with the given settings.
*
* @param unknown_type $params
* @param array $params
*/
function constructClasses($params)
{
$this->controllerClass = new $this->clazz();
$this->controllerClass->base = $this->base;
$this->controllerClass->params = $params;
$this->controllerClass->contructClasses();
$this->controllerClass->layout = 'scaffold';
$this->controllerClass->pageTitle = $this->scaffoldTitle;
$this->controllerClass = new $this->clazz();
$this->controllerClass->base = $this->base;
$this->controllerClass->params = $params;
$this->controllerClass->contructClasses();
$this->controllerClass->layout = 'scaffold';
$this->controllerClass->pageTitle = $this->scaffoldTitle;
}
/**
* Enter description here...
* Renders the List view as the default action (index).
*
* @param unknown_type $params
* @return unknown
* @param array $params
* @return boolean Success
*/
function scaffoldIndex($params)
{
return $this->scaffoldList($params);
return $this->scaffoldList($params);
}
/**
* Enter description here...
* Renders a Show view of scaffolded Model.
*
* @param unknown_type $params
* @param array $params
*/
function scaffoldShow($params)
{
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->model]->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.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->model]->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.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'show.thtml');
}
/**
* Enter description here...
* Renders List view of scaffolded Model.
*
* @param unknown_type $params
* @param array $params
*/
function scaffoldList($params)
{
$model = $this->model;
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
$model = $this->model;
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames(null,false) );
$this->controllerClass->set('data', $this->controllerClass->models[$model]->findAll());
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'list.thtml');
}
/**
* Enter description here...
* Creates a new scaffold.
*
* @param unknown_type $params
* @param array $params
*/
function scaffoldNew($params)
{
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
/**
* Enter description here...
* Renders an Edit view for scaffolded Model.
*
* @param unknown_type $params
* @param array $params
*/
function scaffoldEdit($params)
{
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->model]->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.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'edit.thtml');
$this->controllerClass->params['data'] = $this->controllerClass->models[$this->model]->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.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'edit.thtml');
}
/**
* Enter description here...
*
* @param unknown_type $params
*/
/**
* 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->model]->save($this->controllerClass->params['data']))
{
$this->controllerClass->flash('Your '.$this->model.' has been saved.', '/'.$this->controllerClass->viewPath );
}
else
{
$this->controllerClass->set('data', $this->controllerClass->params['data']);
$this->controllerClass->validateErrors($this->controllerClass->models[$this->model]);
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
$this->controllerClass->set('fieldNames', $this->controllerClass->generateFieldNames() );
$this->cleanUpFields();
if ($this->controllerClass->models[$this->model]->save($this->controllerClass->params['data']))
{
$this->controllerClass->flash('Your '.$this->model.' has been saved.', '/'.$this->controllerClass->viewPath );
}
else
{
$this->controllerClass->set('data', $this->controllerClass->params['data']);
$this->controllerClass->validateErrors($this->controllerClass->models[$this->model]);
$this->controllerClass->render($this->actionView, '', LIBS.'controllers'.DS.'templates'.DS.'scaffolds'.DS.'new.thtml');
}
}
/**
* Enter description here...
* Renders an update view for scaffolded Model.
*
* @param unknown_type $params
* @param array $params
*/
function scaffoldUpdate($params=array())
{
// clean up the date fields
$this->cleanUpFields();
$this->controllerClass->models[$this->model]->set($this->controllerClass->params['data']);
if ( $this->controllerClass->models[$this->model]->save())
{
$this->controllerClass->flash('The '.$this->model.' has been updated.','/'.$this->controllerClass->name);
}
else
{
$this->controllerClass->flash('There was an error updating the '.$this->model,'/'.$this->controllerClass->name);
}
// clean up the date fields
$this->cleanUpFields();
$this->controllerClass->models[$this->model]->set($this->controllerClass->params['data']);
if ( $this->controllerClass->models[$this->model]->save())
{
$this->controllerClass->flash('The '.$this->model.' has been updated.','/'.$this->controllerClass->name);
}
else
{
$this->controllerClass->flash('There was an error updating the '.$this->model,'/'.$this->controllerClass->name);
}
}
/**
* Enter description here...
* Performs a delete on given scaffolded Model.
*
* @param unknown_type $params
* @param array $params
*/
function scaffoldDestroy($params=array())
{
$id = $params['pass'][0];
// figure out what model and table we are working with
$controllerName = $this->controllerClass->name;
$table = Inflector::singularize($controllerName);
if ($this->controllerClass->models[$table]->del($id))
{
$this->controllerClass->flash('The '.$table.' with id: '.$id.' has been deleted.', '/'.$controllerName);
}
else
{
$this->controllerClass->flash('There was an error deleting the '.$table.' with the id '.$id, '/'.$controllerName);
}
$id = $params['pass'][0];
// figure out what model and table we are working with
$controllerName = $this->controllerClass->name;
$table = Inflector::singularize($controllerName);
if ($this->controllerClass->models[$table]->del($id))
{
$this->controllerClass->flash('The '.$table.' with id: '.$id.' has been deleted.', '/'.$controllerName);
}
else
{
$this->controllerClass->flash('There was an error deleting the '.$table.' with the id '.$id, '/'.$controllerName);
}
}
function cleanUpFields()
/**
* Cleans up the date fields of current Model.
*
*
*/
function cleanUpFields()
{
// clean up the date fields
$objModel = $this->controllerClass->models[$this->model];
foreach( $objModel->_table_info as $table )
{
foreach ($table as $field)
{
if( 'date' == $field['type'] && isset($this->controllerClass->params['data'][$this->model][$field['name'].'_year'] ) )
{
$newDate = mktime( 0,0,0,
$this->controllerClass->params['data'][$this->model][$field['name'].'_month'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_day'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$this->model][$field['name']] = $newDate;
}
else if( 'datetime' == $field['type'] && isset($this->controllerClass->params['data'][$this->model][$field['name'].'_year'] ) )
{
$hour = $this->controllerClass->params['data'][$this->model][$field['name'].'_hour'];
if( $hour != 12 && 'pm' == $this->controllerClass->params['data'][$this->model][$field['name'].'_meridian'] )
{
$hour = $hour + 12;
}
$newDate = mktime( $hour,
$this->controllerClass->params['data'][$this->model][$field['name'].'_min'],
0,
$this->controllerClass->params['data'][$this->model][$field['name'].'_month'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_day'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$this->model][$field['name']] = $newDate;
}
else if( 'tinyint(1)' == $field['type'] )
{
if( isset( $this->controllerClass->params['data'][$this->model][$field['name']]) &&
"on" == $this->controllerClass->params['data'][$this->model][$field['name']] )
{
$this->controllerClass->params['data'][$this->model][$field['name']] = true;
}
else
{
$this->controllerClass->params['data'][$this->model][$field['name']] = false;
}
}
}
}
// clean up the date fields
$objModel = $this->controllerClass->models[$this->model];
foreach( $objModel->_table_info as $table )
{
foreach ($table as $field)
{
if( 'date' == $field['type'] && isset($this->controllerClass->params['data'][$this->model][$field['name'].'_year'] ) )
{
$newDate = mktime( 0,0,0,
$this->controllerClass->params['data'][$this->model][$field['name'].'_month'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_day'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$this->model][$field['name']] = $newDate;
}
else if( 'datetime' == $field['type'] && isset($this->controllerClass->params['data'][$this->model][$field['name'].'_year'] ) )
{
$hour = $this->controllerClass->params['data'][$this->model][$field['name'].'_hour'];
if( $hour != 12 && 'pm' == $this->controllerClass->params['data'][$this->model][$field['name'].'_meridian'] )
{
$hour = $hour + 12;
}
$newDate = mktime( $hour,
$this->controllerClass->params['data'][$this->model][$field['name'].'_min'],
0,
$this->controllerClass->params['data'][$this->model][$field['name'].'_month'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_day'],
$this->controllerClass->params['data'][$this->model][$field['name'].'_year'] );
$newDate = date( 'Y-m-d', $newDate );
$this->controllerClass->params['data'][$this->model][$field['name']] = $newDate;
}
else if( 'tinyint(1)' == $field['type'] )
{
if( isset( $this->controllerClass->params['data'][$this->model][$field['name']]) &&
"on" == $this->controllerClass->params['data'][$this->model][$field['name']] )
{
$this->controllerClass->params['data'][$this->model][$field['name']] = true;
}
else
{
$this->controllerClass->params['data'][$this->model][$field['name']] = false;
}
}
}
}
}
}

View file

@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
* Short description for file.
* Templating for Controller class. Takes care of rendering views.
*
* Long description for file
* Templating system for Cake.
*
* PHP versions 4 and 5
*
@ -49,15 +49,15 @@ class Template extends Object
{
/**
* Enter description here...
* Base URL part
*
* @var unknown_type
* @var string
* @access public
*/
var $base = null;
/**
* Enter description here...
* Layout name
*
* @var string
* @access public
@ -65,7 +65,7 @@ class Template extends Object
var $layout = 'default';
/**
* Enter description here...
* Turns on or off Cake's conventional mode of rendering views. On by default.
*
* @var boolean
* @access public
@ -73,7 +73,7 @@ class Template extends Object
var $autoRender = true;
/**
* Enter description here...
* Turns on or off Cake's conventional mode of finding layout files. On by default.
*
* @var boolean
* @access public
@ -89,7 +89,7 @@ class Template extends Object
var $_viewVars = array();
/**
* Enter description here...
* Title HTML element of current View.
*
* @var boolean
* @access private

View file

@ -2,9 +2,9 @@
/* SVN FILE: $Id$ */
/**
* Short description for file.
* Time library for Cake.
*
* Long description for file
* Methods for handling and formatting date and time information.
*
* PHP versions 4 and 5
*
@ -37,9 +37,9 @@
uses ('object');
/**
* Time related functions, formatting for dates etc.
* Time-related functions, formatting for dates etc.
*
* Long description for class
* The Time class handles and formats date and time information.
*
* @package cake
* @subpackage cake.libs
@ -102,12 +102,12 @@ class Time extends Object
}
/**
* Enter description here...
* Returns SQL for selecting a date range between the datetime pair $begin and $end.
*
* @param unknown_type $begin
* @param unknown_type $end
* @param unknown_type $field_name
* @return unknown
* @param string $begin Start of date range as a Datetime string
* @param string $end End of date range as a Datetime string
* @param string $field_name Name of database date field
* @return string SQL code for selecting the date range
*/
function daysAsSql ($begin, $end, $field_name)
{
@ -118,11 +118,12 @@ class Time extends Object
}
/**
* Enter description here...
* Returns SQL for selecting a date range that includes the whole day of given datetime string.
*
* @param unknown_type $date
* @param unknown_type $field_name
* @return unknown
* @param string $date Datetime string
* @param string $field_name Name of database date field
* @return SQL for selecting the date range of that full day
* @see Time::daysAsSql()
*/
function dayAsSql ($date, $field_name)
{
@ -178,6 +179,7 @@ class Time extends Object
*
* @param datetime $date Datetime string
* @return string Formatted date string
* @todo Is this for RSS 0.9.2 or RSS 2.0?
*/
function toRSS ($date)
{

View file

@ -37,9 +37,9 @@
uses('object');
/**
* Short description for class
* View, the V in the MVC triad.
*
* Long description for class
* Class holding methods for displaying presentation data.
*
* @package cake
* @subpackage cake.libs
@ -50,7 +50,7 @@ class View extends Object
/**
* Name of the controller.
*
* @var unknown_type
* @var string Name of controller
* @access public
*/
var $name = null;
@ -73,7 +73,7 @@ class View extends Object
/**
* Action to be performed.
*
* @var string
* @var string Name of action
* @access public
*/
var $action = null;
@ -95,9 +95,9 @@ class View extends Object
var $helpers = array('html');
/**
* Enter description here...
* Path to View.
*
* @var unknown_type
* @var string Path to View
*/
var $viewPath;
@ -110,7 +110,7 @@ class View extends Object
var $_viewVars = array();
/**
* Enter description here...
* Title HTML element of this View.
*
* @var boolean
* @access private
@ -125,17 +125,16 @@ class View extends Object
*/
var $models = array();
/**
* Enter description here...
* Path parts for creating links in views.
*
* @var unknown_type
* @var string Base URL
* @access public
*/
var $base = null;
/**
* Enter description here...
* Name of layout to use with this View.
*
* @var string
* @access public
@ -143,7 +142,7 @@ class View extends Object
var $layout = 'default';
/**
* Enter description here...
* Turns on or off Cake's conventional mode of rendering views. On by default.
*
* @var boolean
* @access public
@ -151,7 +150,7 @@ class View extends Object
var $autoRender = true;
/**
* Enter description here...
* Turns on or off Cake's conventional mode of finding layout files. On by default.
*
* @var boolean
* @access public
@ -159,27 +158,27 @@ class View extends Object
var $autoLayout = true;
/**
* Enter description here...
* Array of parameter data
*
* @var unknown_type
* @var array Parameter data
*/
var $params;
/**
* Enter description here...
*
* @var unknown_type
* @var boolean
*/
var $hasRendered = null;
/**
* Enter description here...
*
* @var unknown_type
* @var boolean
*/
var $modelsLoaded = false;
/**
* Enter description here...
* Constructor
*
* @return View
*/
@ -203,7 +202,7 @@ class View extends Object
/**
* Render view for given action and layout. If $file is given, that is used
* Renders view for given action and layout. If $file is given, that is used
* for a view filename (e.g. customFunkyView.thtml).
*
* @param string $action Name of action to render for
@ -213,7 +212,6 @@ class View extends Object
function render($action=null, $layout=null, $file=null)
{
if ($this->modelsLoaded!==true)
{
foreach ($this->models as $modelName => $model)
@ -331,8 +329,12 @@ class View extends Object
/**
* Renders a piece of PHP with provided parameters and returns HTML, XML, or any other string.
*
* @param string $name Name of template file
* @param array $params Array of data for rendered view
* This realizes the concept of Elements, (or "partial layouts")
* and the $params array is used to send data to be used in the
* Element.
*
* @param string $name Name of template file in the /app/views/elements/ folder
* @param array $params Array of data to be made available to the for rendered view (i.e. the Element)
* @return string Rendered output
*/
function renderElement($name, $params=array())
@ -349,8 +351,8 @@ class View extends Object
/**
* Renders a layout. Returns output from _render(). Returns false on error.
*
* @param string $content_for_layout Content to render in a view
* @return string Rendered output
* @param string $content_for_layout Content to render in a view, wrapped by the surrounding layout.
* @return string Rendered output, or false on error
*/
function renderLayout($content_for_layout)
{
@ -383,7 +385,7 @@ class View extends Object
}
/**
* Choose the layout to be used when rendering.
* Set layout to be used when rendering.
*
* @param string $layout
*/
@ -397,7 +399,7 @@ class View extends Object
*
* @param int $code Error code (for instance: 404)
* @param string $name Name of the error (for instance: Not Found)
* @param string $message Error message
* @param string $message Error message as a web page
*/
function error ($code, $name, $message)
{
@ -407,7 +409,7 @@ class View extends Object
/**
* Enter description here...
* Renders the Missing Controller web page.
*
*/
function missingController()
@ -417,7 +419,7 @@ class View extends Object
}
/**
* Enter description here...
* Renders the Missing Action web page.
*
*/
function missingAction()
@ -427,7 +429,7 @@ class View extends Object
}
/**
* Enter description here...
* Renders the Missing View web page.
*
*/
function missingView()