Merging fixes and enhancements into trunk

Revision: [2025]
A little more work on plugin to set some default routing.

Revision: [2024]
Changed DboSource::field() so the name() is not called for some field variables.

Revision: [2023]
Changes made in [2022] should only check if the $conditions is not empty.

Revision: [2022]
Changed DboSource::conditions() so it will add the "ticks" needed around the Model.field names.
The Model.field name conventions must be used for this to work.

Revision: [2021]
Adding fix for Ticket #405

Revision: [2020]
Added fix for Ticket #403

Revision: [2019]
Added patch from Ticket #404.
Fixing formatting of files.

Revision: [2018]
Fixing formatting of files 

Revision: [2017]
Fixed bad search and replace

Revision: [2016]
Fixing formatting of files 

Revision: [2015]
Replaced all 3 space indents with 4 space indents

Revision: [2014]
Updating variables to use the naming proper conventions

Revision: [2013]
Added patch from Ticket #406

Revision: [2012]
Adding fix for Ticket #407.
Fix variables that where not formatted per the coding conventions

Revision: [2011]
Adding patch from Ticket #401

git-svn-id: https://svn.cakephp.org/repo/trunk/cake@2026 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
phpnut 2006-02-18 23:42:21 +00:00
parent 9a8d5c15fe
commit a75e08976f
74 changed files with 3207 additions and 3045 deletions

View file

@ -6,4 +6,4 @@
// +---------------------------------------------------------------------------------------------------+ //
///////////////////////////////////////////////////////////////////////////////////////////////////////////
0.10.8.2010
0.10.8.2026

View file

@ -60,8 +60,8 @@ define('DEBUG', 1);
define ('LOG_ERROR', 2);
/**
* CakePHP includes 3 types of session saves
* database or file. Set this to your preffered method.
* If you want to use your own save handeler place it in
* database or file. Set this to your preferred method.
* If you want to use your own save handler place it in
* app/config/name.php DO NOT USE file or database as the name.
* and use just the name portion below.
*

View file

@ -1,7 +1,7 @@
# @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
# @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
# @since CakePHP v 0.10.8.1997
# @version $Revision$
-- @copyright Copyright (c) 2006, Cake Software Foundation, Inc.
-- @link http://www.cakefoundation.org/projects/info/cakephp CakePHP Project
-- @since CakePHP v 0.10.8.1997
-- @version $Revision$
CREATE TABLE cake_sessions (
id varchar(255) NOT NULL default '',

View file

@ -289,23 +289,33 @@ function loadPluginController ($plugin, $controller)
}
}
if(empty($controller))
{
if(file_exists(APP.'plugins'.DS.$plugin.DS.'controllers'.DS.$plugin.'_controller.php'))
{
require(APP.'plugins'.DS.$plugin.DS.'controllers'.DS.$plugin.'_controller.php');
return true;
}
}
if(!class_exists($controller.'Controller'))
{
$controller = Inflector::underscore($controller);
$file = APP.'plugins'.DS.$plugin.DS.'controllers'.DS.$controller.'_controller.php';
if(!file_exists($file))
{
return false;
}
else
if(file_exists($file))
{
require($file);
return true;
}
elseif(file_exists(APP.'plugins'.DS.$plugin.DS.'controllers'.DS.$plugin.'_controller.php'))
{
require(APP.'plugins'.DS.$plugin.DS.'controllers'.DS.$plugin.'_controller.php');
return true;
}
else
{
return true;
return false;
}
}
}

View file

@ -125,11 +125,18 @@ class Dispatcher extends Object
else
{
$ctrlClass = $pluginClass;
$oldAction = $params['action'];
$params = $this->_restructureParams($params);
$plugin = Inflector::underscore($ctrlName);
$this->plugin = $plugin.DS;
loadPluginModels($plugin);
$this->base = $this->base.'/'.Inflector::underscore($ctrlName);
if(empty($params['controller']) || !class_exists($pluginClass))
{
$params['controller'] = Inflector::underscore($ctrlName);
$ctrlClass = $ctrlName.'Controller';
$params['action'] = $oldAction;
}
}
}
}

View file

@ -532,13 +532,10 @@ class Controller extends Object
{
$flash = VIEWS.'layouts'.DS.'flash.thtml';
}
else if(file_exists(LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml'))
elseif($flash = fileExistsInPath(LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml'))
{
$flash = LIBS.'view'.DS.'templates'.DS."layouts".DS.'flash.thtml';
}
$this->render(null, false, $flash);
}

View file

@ -412,14 +412,14 @@ class DataSource extends Object
*/
function insertQueryData($query, $data, $association, $assocData, &$model, &$linkModel, $index)
{
$keys = array('{$__cake_id__$}', '{$__cake_foreignKey__$}');
$keys = array('{$__cakeID__$}', '{$__cakeForeignKey__$}');
foreach($keys as $key)
{
if (strpos($query, $key) !== false)
{
switch($key)
{
case '{$__cake_id__$}':
case '{$__cakeID__$}':
$val = null;
if (isset($data[$index][$model->name]))
{

View file

@ -639,7 +639,7 @@ class DboSource extends DataSource
$sql .= ' FROM '.$this->name($linkModel->table).' AS '.$alias;
$conditions = $queryData['conditions'];
$condition = $model->escapeField($assocData['foreignKey']);
$condition .= '={$__cake_foreignKey__$}';
$condition .= '={$__cakeForeignKey__$}';
if (is_array($conditions))
{
$conditions[] = $condition;
@ -702,7 +702,7 @@ class DboSource extends DataSource
$conditions = $assocData['conditions'];
$condition = $linkModel->escapeField($linkModel->primaryKey);
$condition .= '={$__cake_id__$}';
$condition .= '={$__cakeID__$}';
if (is_array($conditions))
{
@ -775,12 +775,12 @@ class DboSource extends DataSource
if (is_array($conditions))
{
$conditions[$alias.'.'.$assocData['foreignKey']] = '{$__cake_id__$}';
$conditions[$alias.'.'.$assocData['foreignKey']] = '{$__cakeID__$}';
}
else
{
$cond = $this->name($alias).'.'.$this->name($assocData['foreignKey']);
$cond .= '={$__cake_id__$}';
$cond .= '={$__cakeID__$}';
if (trim($conditions) != '')
{
@ -805,7 +805,7 @@ class DboSource extends DataSource
$sql = 'SELECT '.join(', ', $this->fields($linkModel, $alias, $assocData['fields']));
$sql .= ' FROM '.$this->name($linkModel->table).' AS '.$this->name($alias);
$sql .= ' JOIN '.$joinTbl.' ON '.$joinTbl;
$sql .= '.'.$this->name($assocData['foreignKey']).'={$__cake_id__$}';
$sql .= '.'.$this->name($assocData['foreignKey']).'={$__cakeID__$}';
$sql .= ' AND '.$joinTbl.'.'.$this->name($assocData['associationForeignKey']);
$sql .= ' = '.$this->name($alias).'.'.$this->name($linkModel->primaryKey);
@ -971,7 +971,13 @@ class DboSource extends DataSource
}
$count = count($fields);
if ($count >= 1 && $fields[0] != '*' && strpos($fields[0], 'COUNT(*)') === false)
if ($count >= 1 && $fields[0] != '*'
&& strpos($fields[0], 'COUNT(') === false
&& strpos($fields[0], 'MAX(') === false
&& strpos($fields[0], 'MIN(') === false
&& strpos($fields[0], 'DISTINCT') === false
&& strpos($fields[0], 'SUM(') === false
&& strpos($fields[0], 'CONCAT(') === false)
{
for ($i = 0; $i < $count; $i++)
{
@ -1010,6 +1016,16 @@ class DboSource extends DataSource
{
$conditions = ' 1 = 1';
}
else
{
preg_match_all('/([a-zA-Z0-9_]{1,})\\.([a-zA-Z0-9_]{1,})/', $conditions, $result, PREG_PATTERN_ORDER);
$pregCount = count($result[0]);
for ($i = 0; $i < $pregCount; $i++)
{
$conditions = preg_replace('/'.$result[0][$i].'/', $this->name($result[0][$i]), $conditions);
}
}
return $rt.$conditions;
}
elseif (is_array($conditions))
@ -1032,7 +1048,7 @@ class DboSource extends DataSource
}
else
{
if (($value != '{$__cake_id__$}') && ($value != '{$__cake_foreignKey__$}'))
if (($value != '{$__cakeID__$}') && ($value != '{$__cakeForeignKey__$}'))
{
$value = $this->value($value);
}

View file

@ -257,7 +257,12 @@ class DboMysql extends DboSource
{
return '*';
}
return '`'. ereg_replace('\.', '`.`', $data) .'`';
$pos = strpos($data, '`');
if ($pos === false)
{
$data = '`'. str_replace('.', '`.`', $data) .'`';
}
return $data;
}
/**

View file

@ -140,8 +140,16 @@ class DboPostgres extends DboSource
*/
function fetchRow ($assoc = false)
{
$assoc = ($assoc === false) ? PGSQL_BOTH : PGSQL_ASSOC;
return pg_fetch_array($this->_result, null, $assoc);
if(is_resource($this->_result))
{
$this->resultSet($this->_result);
$resultRow = $this->fetchResult();
return $resultRow;
}
else
{
return null;
}
}
/**
@ -164,27 +172,66 @@ class DboPostgres extends DboSource
$tables = array();
foreach ($result as $item)
{
$tables[] = $item['name'];
$tables[] = $item[0]['name'];
}
return $tables;
}
}
/**
* Returns an array of the fields in given table name.
* Generates the fields list of an SQL query.
*
* @param string $tableName Name of database table to inspect
* @return array Fields in table. Keys are name and type
* @param Model $model
* @param string $alias Alias tablename
* @param mixed $fields
* @return array
*/
function fields ($tableName)
function fields (&$model, $alias, $fields)
{
$sql = "SELECT c.relname, a.attname, t.typname FROM pg_class c, pg_attribute a, pg_type t WHERE c.relname = '{$tableName}' AND a.attnum > 0 AND a.attrelid = c.oid AND a.atttypid = t.oid";
if (is_array($fields))
{
$fields = $fields;
}
else
{
if ($fields != null)
{
if (strpos($fields, ','))
{
$fields = explode(',', $fields);
}
else
{
$fields = array($fields);
}
$fields = array_map('trim', $fields);
}
else
{
foreach ($model->_tableInfo->value as $field)
{
$fields[]= $field[0]['name'];
}
$fields = false;
foreach ($this->all($sql) as $field) {
$fields[] = array(
'name' => $field['attname'],
'type' => $field['typname']);
}
}
$count = count($fields);
if ($count >= 1 && $fields[0] != '*' && strpos($fields[0], 'COUNT(*)') === false)
{
for ($i = 0; $i < $count; $i++)
{
$dot = strrpos($fields[$i], '.');
if ($dot === false)
{
$fields[$i] = $this->name($alias).'.'.$this->name($fields[$i]) . ' AS ' . $this->name($alias . '__' . $fields[$i]);
}
else
{
$build = explode('.',$fields[$i]);
$fields[$i] = $this->name($build[0]).'.'.$this->name($build[1]) . ' AS ' . $this->name($build[0] . '__' . $build[1]);
}
}
}
return $fields;
@ -206,7 +253,7 @@ class DboPostgres extends DboSource
$fields = false;
$fields = $this->query("SELECT column_name as name, data_type as type FROM information_schema.columns WHERE table_name =".$this->name($model->table));
$fields = $this->query("SELECT column_name as name, data_type as type FROM information_schema.columns WHERE table_name =".$this->value($model->table));
$this->__cacheDescription($model->table, $fields);
return $fields;
@ -220,18 +267,41 @@ class DboPostgres extends DboSource
*/
function name ($data)
{
return "'". $data."'";
if ($data == '*')
{
return '*';
}
return '"'. ereg_replace('\.', '"."', $data) .'"';
}
/**
* Returns a quoted and escaped string of $data for use in an SQL statement.
*
* @param string $data String to be prepared for use in an SQL statement
* @param string $column The column into which this data will be inserted
* @return string Quoted and escaped
* @todo Add logic that formats/escapes data based on column type
*/
function value ($data)
function value ($data, $column = null)
{
return "'".pg_escape_string($data)."'";
$parent = parent::value($data, $column);
if ($parent != null)
{
return $parent;
}
if ($data === null)
{
return 'NULL';
}
if (ini_get('magic_quotes_gpc') == 1)
{
$data = stripslashes($data);
}
$data = pg_escape_string($data);
$return = "'" . $data . "'";
return $return;
}
/**
@ -302,14 +372,72 @@ class DboPostgres extends DboSource
*/
function limit ($limit, $offset = null)
{
$rt = ' LIMIT ' . $limit;
if ($limit)
{
$rt = '';
if (!strpos(low($limit), 'limit') || strpos(low($limit), 'limit') === 0)
{
$rt = ' LIMIT';
}
if ($offset)
{
$rt .= ' OFFSET ' . $offset;
$rt .= ' ' . $offset. ',';
}
$rt .= ' ' . $limit;
return $rt;
}
return null;
}
function resultSet(&$results)
{
$this->results =& $results;
$this->map = array();
$num_fields = pg_num_fields($results);
$index = 0;
$j = 0;
while ($j < $num_fields)
{
$columnName = pg_field_name($results, $j);
if (strpos($columnName, '__'))
{
$parts = explode('__', $columnName);
$this->map[$index++] = array($parts[0], $parts[1]);
}
else
{
$this->map[$index++] = array(0, $columnName);
}
$j++;
}
}
/**
* Fetches the next row from the current result set
*
* @return unknown
*/
function fetchResult()
{
if ($row = pg_fetch_row($this->results))
{
$resultRow = array();
$i =0;
foreach ($row as $index => $field)
{
list($table, $column) = $this->map[$index];
$resultRow[$table][$column] = $row[$index];
$i++;
}
return $resultRow;
}
else
{
return false;
}
}
}
?>

View file

@ -490,19 +490,18 @@ class HtmlHelper extends Helper
* @return mixed Either string or boolean value, depends on AUTO_OUTPUT
* and $return.
*/
function radio($fieldName, $options, $inbetween = null, $htmlAttributes = null,
$return = false)
function radio($fieldName, $options, $inbetween = null, $htmlAttributes = array(), $return = false)
{
$this->setFormTag($fieldName);
$value = isset($htmlAttributes['value'])? $htmlAttributes['value']: $this->tagValue($fieldName);
$out = array();
foreach ($options as $opt_value=>$opt_title)
foreach ($options as $optValue => $optTitle)
{
$options_here = array('value' => $opt_value);
$opt_value==$value? $options_here['checked'] = 'checked': null;
$parsed_options = $this->parseHtmlOptions(array_merge($htmlAttributes, $options_here), null, '', ' ');
$individual_tag_name = "{$this->field}_{$opt_value}";
$out[] = sprintf($this->tags['radio'], $this->model, $this->field, $individual_tag_name, $parsed_options, $opt_title);
$optionsHere = array('value' => $optValue);
$optValue==$value? $optionsHere['checked'] = 'checked': null;
$parsedOptions = $this->parseHtmlOptions(array_merge($htmlAttributes, $optionsHere), null, '', ' ');
$individualTagName = "{$this->field}_{$optValue}";
$out[] = sprintf($this->tags['radio'], $this->model, $this->field, $individualTagName, $parsedOptions, $optTitle);
}
$out = join($inbetween, $out);
@ -514,18 +513,18 @@ class HtmlHelper extends Helper
* Returns a row of formatted and named TABLE headers.
*
* @param array $names Array of tablenames.
* @param array $tr_options HTML options for TR elements.
* @param array $th_options HTML options for TH elements.
* @param array $trOptions HTML options for TR elements.
* @param array $thOptions HTML options for TH elements.
* @return string
*/
function tableHeaders($names, $tr_options=null, $th_options=null)
function tableHeaders($names, $trOptions=null, $thOptions=null)
{
$out = array();
foreach ($names as $arg)
{
$out[] = sprintf($this->tags['tableheader'], $this->parseHtmlOptions($th_options), $arg);
$out[] = sprintf($this->tags['tableheader'], $this->parseHtmlOptions($thOptions), $arg);
}
return sprintf($this->tags['tablerow'], $this->parseHtmlOptions($tr_options), join(' ', $out));
return sprintf($this->tags['tablerow'], $this->parseHtmlOptions($trOptions), join(' ', $out));
}
@ -533,11 +532,11 @@ class HtmlHelper extends Helper
* Returns a formatted string of table rows (TR's with TD's in them).
*
* @param array $data Array of table data
* @param array $odd_tr_options HTML options for odd TR elements
* @param array $even_tr_options HTML options for even TR elements
* @param array $oddTrOptions HTML options for odd TR elements
* @param array $evenTrOptions HTML options for even TR elements
* @return string Formatted HTML
*/
function tableCells($data, $odd_tr_options=null, $even_tr_options=null)
function tableCells($data, $oddTrOptions=null, $evenTrOptions=null)
{
if (empty($data[0]) || !is_array($data[0]))
{
@ -548,14 +547,14 @@ class HtmlHelper extends Helper
foreach ($data as $line)
{
$count++;
$cells_out = array();
$cellsOut = array();
foreach ($line as $cell)
{
$cells_out[] = sprintf($this->tags['tablecell'], null, $cell);
$cellsOut[] = sprintf($this->tags['tablecell'], null, $cell);
}
$options = $this->parseHtmlOptions($count%2? $odd_tr_options: $even_tr_options);
$out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cells_out));
$options = $this->parseHtmlOptions($count%2? $oddTrOptions: $evenTrOptions);
$out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cellsOut));
}
return join("\n", $out);
@ -946,7 +945,7 @@ class HtmlHelper extends Helper
// $this->_parseAttributes($options, $exclude, $insertBefore, $insertAfter);
// }
function parseHtmlOptions($options, $exclude=null, $insert_before=' ', $insert_after=null)
function parseHtmlOptions($options, $exclude=null, $insertBefore=' ', $insertAfter=null)
{
if (!is_array($exclude)) $exclude = array();
@ -961,11 +960,11 @@ class HtmlHelper extends Helper
}
}
$out = join(' ', $out);
return $out? $insert_before.$out.$insert_after: null;
return $out? $insertBefore.$out.$insertAfter: null;
}
else
{
return $options? $insert_before.$options.$insert_after: null;
return $options? $insertBefore.$options.$insertAfter: null;
}
}
@ -1007,29 +1006,29 @@ class HtmlHelper extends Helper
* Returns a SELECT element,
*
* @param string $fieldName Name attribute of the SELECT
* @param array $option_elements Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element
* @param array $optionElements Array of the OPTION elements (as 'value'=>'Text' pairs) to be used in the SELECT element
* @param boolean $show_empty Show/hide the empty select option
* @param array $select_attr Array of HTML options for the opening SELECT element
* @param array $selectAttr Array of HTML options for the opening SELECT element
* @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, $showEmpty=true)
function selectTag($fieldName, $optionElements, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty=true)
{
$this->setFormTag($fieldName);
// do not display the select tag if no option elements are avaible
if (!is_array($option_elements) || count($option_elements) == 0)
if (!is_array($optionElements) || count($optionElements) == 0)
{
return null;
}
if( isset($select_attr) && array_key_exists( "multiple", $select_attr) )
if( isset($selectAttr) && array_key_exists( "multiple", $selectAttr) )
{
$select[] = sprintf($this->tags['selectmultiplestart'], $this->model, $this->field, $this->parseHtmlOptions($select_attr));
$select[] = sprintf($this->tags['selectmultiplestart'], $this->model, $this->field, $this->parseHtmlOptions($selectAttr));
}
else
{
$select[] = sprintf($this->tags['selectstart'], $this->model, $this->field, $this->parseHtmlOptions($select_attr));
$select[] = sprintf($this->tags['selectstart'], $this->model, $this->field, $this->parseHtmlOptions($selectAttr));
}
if($showEmpty == true)
@ -1037,17 +1036,17 @@ class HtmlHelper extends Helper
$select[] = sprintf($this->tags['selectempty'], $this->parseHtmlOptions($optionAttr));
}
foreach ($option_elements as $name=>$title)
foreach ($optionElements as $name => $title)
{
$options_here = $optionAttr;
$optionsHere = $optionAttr;
if (($selected !== null) && ($selected == $name))
{
$options_here['selected'] = 'selected';
$optionsHere['selected'] = 'selected';
} else if ( is_array($selected) && array_key_exists($name, $selected) )
{
$options_here['selected'] = 'selected';
$optionsHere['selected'] = 'selected';
}
$select[] = sprintf($this->tags['selectoption'], $name, $this->parseHtmlOptions($options_here), $title);
$select[] = sprintf($this->tags['selectoption'], $name, $this->parseHtmlOptions($optionsHere), $title);
}
$select[] = sprintf($this->tags['selectend']);
@ -1264,7 +1263,7 @@ class HtmlHelper extends Helper
* @param boolean $show_empty Show/hide the empty select option
* @return string
*/
function dayOptionTag($tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
function dayOptionTag($tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_day");
$dayValue = empty($selected) ? date('d') : $selected;
@ -1277,7 +1276,7 @@ class HtmlHelper extends Helper
'22'=>'22','23'=>'23','24'=>'24',
'25'=>'25','26'=>'26','27'=>'27',
'28'=>'28','29'=>'29','30'=>'30','31'=>'31');
$option = $this->selectTag($tagName.'_day', $days, $dayValue, $select_attr, $optionAttr, $showEmpty);
$option = $this->selectTag($tagName.'_day', $days, $dayValue, $selectAttr, $optionAttr, $showEmpty);
return $option;
}
@ -1293,7 +1292,7 @@ class HtmlHelper extends Helper
* @param boolean $show_empty Show/hide the empty select option
* @return string
*/
function yearOptionTag($tagName, $value=null, $minYear=null, $maxYear=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
function yearOptionTag($tagName, $value=null, $minYear=null, $maxYear=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_year");
@ -1318,7 +1317,7 @@ class HtmlHelper extends Helper
$years[$yearCounter] = $yearCounter;
}
$option = $this->selectTag($tagName.'_year', $years, $yearValue, $select_attr, $optionAttr, $showEmpty);
$option = $this->selectTag($tagName.'_year', $years, $yearValue, $selectAttr, $optionAttr, $showEmpty);
return $option;
}
@ -1332,14 +1331,14 @@ class HtmlHelper extends Helper
* @param boolean $show_empty Show/hide the empty select option
* @return string
*/
function monthOptionTag($tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
function monthOptionTag($tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_month");
$monthValue = empty($selected) ? date('m') : $selected ;
$months=array('01'=>'January','02'=>'February','03'=>'March',
'04'=>'April','05'=>'May','06'=>'June','07'=>'July','08'=>'August',
'09'=>'September','10'=>'October','11'=>'November','12'=>'December');
$option = $this->selectTag($tagName.'_month', $months, $monthValue, $select_attr, $optionAttr, $showEmpty);
$option = $this->selectTag($tagName.'_month', $months, $monthValue, $selectAttr, $optionAttr, $showEmpty);
return $option;
}
@ -1353,7 +1352,7 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string
*/
function hourOptionTag($tagName, $value=null, $format24Hours = false, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true )
function hourOptionTag($tagName, $value=null, $format24Hours = false, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true )
{
$value = isset($value)? $value : $this->tagValue($tagName."_hour");
if ( $format24Hours )
@ -1380,7 +1379,7 @@ class HtmlHelper extends Helper
'10'=>'10','11'=>'11','12'=>'12');
}
$option = $this->selectTag($tagName.'_hour', $hours, $hourValue, $select_attr,
$option = $this->selectTag($tagName.'_hour', $hours, $hourValue, $selectAttr,
$optionAttr);
return $option;
}
@ -1394,7 +1393,7 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string
*/
function minuteOptionTag( $tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
function minuteOptionTag( $tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_min");
$minValue = empty($selected) ? date('i') : $selected ;
@ -1403,7 +1402,7 @@ class HtmlHelper extends Helper
$mins[$minCount] = sprintf('%02d', $minCount);
}
$option = $this->selectTag($tagName.'_min', $mins, $minValue, $select_attr,
$option = $this->selectTag($tagName.'_min', $mins, $minValue, $selectAttr,
$optionAttr);
return $option;
}
@ -1417,13 +1416,13 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string
*/
function meridianOptionTag( $tagName, $value=null, $selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
function meridianOptionTag( $tagName, $value=null, $selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$value = isset($value)? $value : $this->tagValue($tagName."_meridian");
$merValue = empty($selected) ? date('a') : $selected ;
$meridians = array('am'=>'am','pm'=>'pm');
$option = $this->selectTag($tagName.'_meridian', $meridians, $merValue, $select_attr,
$option = $this->selectTag($tagName.'_meridian', $meridians, $merValue, $selectAttr,
$optionAttr);
return $option;
}
@ -1438,7 +1437,7 @@ class HtmlHelper extends Helper
* @param array $optionAttr Attribute array for the option elements.
* @return string The HTML formatted OPTION element
*/
function dateTimeOptionTag( $tagName, $dateFormat = 'DMY', $timeFormat = '12',$selected=null, $select_attr=null, $optionAttr=null, $showEmpty = true)
function dateTimeOptionTag( $tagName, $dateFormat = 'DMY', $timeFormat = '12',$selected=null, $selectAttr=null, $optionAttr=null, $showEmpty = true)
{
$day = null;
$month = null;
@ -1482,13 +1481,13 @@ class HtmlHelper extends Helper
switch ( $dateFormat )
{
case 'DMY' :
$opt = $this->dayOptionTag( $tagName ,null ,$day, $select_attr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $select_attr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag( $tagName, null, null, null, $year, $select_attr, $optionAttr, $showEmpty);
$opt = $this->dayOptionTag( $tagName ,null ,$day, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag( $tagName, null, null, null, $year, $selectAttr, $optionAttr, $showEmpty);
break;
case 'MDY' :
$opt = $this->monthOptionTag($tagName, null, $month, $select_attr, $optionAttr, $showEmpty) .'-'.$this->dayOptionTag( $tagName, null, $day, $select_attr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag($tagName, null, null, null, $year, $optionAttr, $select_attr, $showEmpty);
$opt = $this->monthOptionTag($tagName, null, $month, $selectAttr, $optionAttr, $showEmpty) .'-'.$this->dayOptionTag( $tagName, null, $day, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->yearOptionTag($tagName, null, null, null, $year, $optionAttr, $selectAttr, $showEmpty);
break;
case 'YMD' :
$opt = $this->yearOptionTag($tagName, null, null, null, $year, $select_attr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $select_attr, $optionAttr, $showEmpty) . '-' . $this->dayOptionTag( $tagName, null, $day, $optionAttr, $select_attr, $showEmpty);
$opt = $this->yearOptionTag($tagName, null, null, null, $year, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->monthOptionTag( $tagName, null, $month, $selectAttr, $optionAttr, $showEmpty) . '-' . $this->dayOptionTag( $tagName, null, $day, $optionAttr, $selectAttr, $showEmpty);
break;
case 'NONE':
$opt ='';
@ -1500,10 +1499,10 @@ class HtmlHelper extends Helper
switch ($timeFormat)
{
case '24':
$opt .= $this->hourOptionTag( $tagName, null , true, $hour, $select_attr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $select_attr, $optionAttr, $showEmpty);
$opt .= $this->hourOptionTag( $tagName, null , true, $hour, $selectAttr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $selectAttr, $optionAttr, $showEmpty);
break;
case '12':
$opt .= $this->hourOptionTag( $tagName, null, false, $hour, $select_attr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $select_attr, $optionAttr, $showEmpty) . ' ' . $this->meridianOptionTag($tagName, null, $meridian, $select_attr, $optionAttr, $showEmpty);
$opt .= $this->hourOptionTag( $tagName, null, false, $hour, $selectAttr, $optionAttr, $showEmpty) . ':' . $this->minuteOptionTag( $tagName, null, $min, $selectAttr, $optionAttr, $showEmpty) . ' ' . $this->meridianOptionTag($tagName, null, $meridian, $selectAttr, $optionAttr, $showEmpty);
break;
case 'NONE':
$opt .='';

View file

@ -28,8 +28,8 @@
* @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="pl" xml:lang="pl">
<!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><?php echo $page_title?></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

View file

@ -594,12 +594,12 @@ class View extends Object
* array of data.
*
* @param string $___viewFn Filename of the view
* @param array $___data_for_view Data to include in rendered view
* @param boolean $___play_safe If set to false, the include() of the $__viewFn is done without suppressing output of errors
* @param array $___dataForView Data to include in rendered view
* @param boolean $___playSafe If set to false, the include() of the $__viewFn is done without suppressing output of errors
* @return string Rendered output
* @access private
*/
function _render($___viewFn, $___data_for_view, $___play_safe = true, $loadHelpers = true)
function _render($___viewFn, $___dataForView, $___playSafe = true, $loadHelpers = true)
{
if ($this->helpers != false && $loadHelpers === true)
{
@ -624,7 +624,7 @@ class View extends Object
}
}
extract($___data_for_view, EXTR_SKIP); # load all view variables
extract($___dataForView, EXTR_SKIP); # load all view variables
/**
* Local template variables.
*/
@ -640,7 +640,7 @@ class View extends Object
/**
* Include the template.
*/
$___play_safe? @include($___viewFn): include($___viewFn);
$___playSafe? @include($___viewFn): include($___viewFn);
$out = ob_get_clean();