From 656c339879a071f2f875831281ed833b876e4361 Mon Sep 17 00:00:00 2001 From: "ctrlaltca@gmail.com" <> Date: Mon, 20 Jun 2011 10:48:45 +0000 Subject: removed useless calls to empty contructor; reverted some additional undocumented changes; upported the "cgi workaround" to trunk/; large (fake) changeset are due to mixed cr/crlf used previously --- framework/Base/TEvent.php | 6 +- framework/Caching/TCache.php | 3 - framework/Collections/TDummyDataSource.php | 3 +- framework/Collections/TList.php | 3 +- framework/Collections/TMap.php | 3 +- framework/Collections/TPagedList.php | 4 +- framework/Collections/TQueue.php | 1 - framework/Collections/TStack.php | 3 +- framework/Data/ActiveRecord/TActiveRecord.php | 3 +- .../Data/ActiveRecord/TActiveRecordGateway.php | 3 +- framework/Data/Common/Oracle/TOracleTableInfo.php | 3 +- framework/Data/Common/TDbCommandBuilder.php | 1017 ++++++++++---------- framework/Data/Common/TDbMetaData.php | 3 +- framework/Data/Common/TDbTableColumn.php | 3 +- framework/Data/Common/TDbTableInfo.php | 21 +- framework/Data/DataGateway/TDataGatewayCommand.php | 4 +- framework/Data/DataGateway/TSqlCriteria.php | 3 +- .../Data/SqlMap/Configuration/TParameterMap.php | 3 +- framework/Data/SqlMap/Configuration/TResultMap.php | 3 +- .../Data/SqlMap/Configuration/TResultProperty.php | 3 +- .../Configuration/TSqlMapXmlConfiguration.php | 2 +- .../Data/SqlMap/Statements/TMappedStatement.php | 3 +- .../Data/SqlMap/Statements/TPreparedStatement.php | 3 +- .../Data/SqlMap/Statements/TSimpleDynamicSql.php | 3 +- framework/Data/SqlMap/TSqlMapGateway.php | 7 +- framework/Data/SqlMap/TSqlMapManager.php | 3 +- framework/Data/TDbCommand.php | 3 +- framework/Data/TDbConnection.php | 7 +- framework/Data/TDbDataReader.php | 3 +- framework/Data/TDbTransaction.php | 3 +- framework/Security/TAuthorizationRule.php | 3 +- framework/Security/TUser.php | 3 +- framework/TApplication.php | 93 +- framework/TComponent.php | 11 +- .../Testing/Data/ActiveRecord/TActiveFinder.php | 1 - .../Testing/Data/ActiveRecord/TActiveRecord.php | 3 +- .../Data/ActiveRecord/TActiveRecordCriteria.php | 1 - .../Testing/Data/Schema/TDbCommandBuilder.php | 1 - framework/Testing/Data/Schema/TDbExpression.php | 1 - framework/Testing/Data/Schema/TDbSchema.php | 1 - framework/Testing/Data/TDbCommand.php | 1 - framework/Testing/Data/TDbConnection.php | 1 - framework/Testing/Data/TDbDataReader.php | 1 - framework/Testing/Data/TDbTransaction.php | 1 - framework/Util/TParameterModule.php | 58 +- framework/Util/TRpcClient.php | 1 - framework/Web/Services/TRpcService.php | 2 - framework/Web/Services/TSoapService.php | 1 - framework/Web/THttpRequest.php | 31 +- framework/Web/THttpResponseAdapter.php | 1 - framework/Web/TUrlMapping.php | 173 ++-- .../Web/UI/ActiveControls/TActiveDataGrid.php | 18 +- .../Web/UI/ActiveControls/TActiveRatingList.php | 2 +- .../Web/UI/ActiveControls/TActiveRepeater.php | 4 +- .../Web/UI/ActiveControls/TActiveTableCell.php | 4 +- .../Web/UI/ActiveControls/TActiveTableRow.php | 4 +- framework/Web/UI/ActiveControls/TAutoComplete.php | 1 - .../Web/UI/ActiveControls/TBaseActiveControl.php | 3 +- .../UI/ActiveControls/TCallbackClientScript.php | 1 - .../UI/ActiveControls/TCallbackEventParameter.php | 5 +- .../UI/ActiveControls/TCallbackResponseAdapter.php | 1 - framework/Web/UI/ActiveControls/TDraggable.php | 1 - framework/Web/UI/ActiveControls/TDropContainer.php | 2 - .../Web/UI/ActiveControls/TTriggeredCallback.php | 5 +- framework/Web/UI/TClientScriptManager.php | 2 - framework/Web/UI/TControl.php | 74 +- framework/Web/UI/TControlAdapter.php | 3 +- framework/Web/UI/THtmlWriter.php | 3 +- framework/Web/UI/TPage.php | 136 +-- framework/Web/UI/TTemplateManager.php | 1 - framework/Web/UI/TThemeManager.php | 1 - framework/Web/UI/WebControls/TBulletedList.php | 3 +- framework/Web/UI/WebControls/TCustomValidator.php | 3 +- framework/Web/UI/WebControls/TDataGrid.php | 9 +- framework/Web/UI/WebControls/TDataList.php | 3 +- .../Web/UI/WebControls/TDataSourceControl.php | 4 +- framework/Web/UI/WebControls/TDataSourceView.php | 4 +- .../Web/UI/WebControls/TDropDownListColumn.php | 3 +- framework/Web/UI/WebControls/THtmlArea.php | 3 +- framework/Web/UI/WebControls/TImageButton.php | 3 +- framework/Web/UI/WebControls/TImageMap.php | 3 +- framework/Web/UI/WebControls/TListItem.php | 4 +- framework/Web/UI/WebControls/TPager.php | 4 +- framework/Web/UI/WebControls/TRepeater.php | 3 +- framework/Web/UI/WebControls/TStyle.php | 4 +- framework/Web/UI/WebControls/TWizard.php | 33 +- framework/Web/UI/WebControls/TXmlTransform.php | 3 +- framework/Xml/TXmlDocument.php | 4 +- 88 files changed, 783 insertions(+), 1102 deletions(-) diff --git a/framework/Base/TEvent.php b/framework/Base/TEvent.php index 5116a5f4..0f64e89d 100644 --- a/framework/Base/TEvent.php +++ b/framework/Base/TEvent.php @@ -1,6 +1,6 @@ - * @version $Id: TEvent.php 978 2009-05-06 03:36:09Z qiang.xue $ + * @version $Id: CComponent.php 978 2009-05-06 03:36:09Z qiang.xue $ * @package system.base * @since 1.0 */ @@ -31,8 +31,6 @@ class TEvent extends TComponent */ public function __construct($sender=null) { - parent::__construct(); - $this->sender=$sender; } } \ No newline at end of file diff --git a/framework/Caching/TCache.php b/framework/Caching/TCache.php index 880161af..02a4ae3b 100644 --- a/framework/Caching/TCache.php +++ b/framework/Caching/TCache.php @@ -347,7 +347,6 @@ class TFileCacheDependency extends TCacheDependency */ public function __construct($fileName) { - parent::__construct(); $this->setFileName($fileName); } @@ -419,7 +418,6 @@ class TDirectoryCacheDependency extends TCacheDependency */ public function __construct($directory) { - parent::__construct(); $this->setDirectory($directory); } @@ -574,7 +572,6 @@ class TGlobalStateCacheDependency extends TCacheDependency */ public function __construct($name) { - parent::__construct(); $this->setStateName($name); } diff --git a/framework/Collections/TDummyDataSource.php b/framework/Collections/TDummyDataSource.php index e1cc3536..491c36c0 100644 --- a/framework/Collections/TDummyDataSource.php +++ b/framework/Collections/TDummyDataSource.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Collections @@ -36,7 +36,6 @@ class TDummyDataSource extends TComponent implements IteratorAggregate, Countabl */ public function __construct($count) { - parent::__construct(); $this->_count=$count; } diff --git a/framework/Collections/TList.php b/framework/Collections/TList.php index af9922d7..e333cbf3 100644 --- a/framework/Collections/TList.php +++ b/framework/Collections/TList.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Collections @@ -62,7 +62,6 @@ class TList extends TComponent implements IteratorAggregate,ArrayAccess,Countabl */ public function __construct($data=null,$readOnly=false) { - parent::__construct(); if($data!==null) $this->copyFrom($data); $this->setReadOnly($readOnly); diff --git a/framework/Collections/TMap.php b/framework/Collections/TMap.php index ce55c3aa..51ed7b1c 100644 --- a/framework/Collections/TMap.php +++ b/framework/Collections/TMap.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Collections @@ -52,7 +52,6 @@ class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable */ public function __construct($data=null,$readOnly=false) { - parent::__construct(); if($data!==null) $this->copyFrom($data); $this->setReadOnly($readOnly); diff --git a/framework/Collections/TPagedList.php b/framework/Collections/TPagedList.php index 7bb58d41..50286aec 100644 --- a/framework/Collections/TPagedList.php +++ b/framework/Collections/TPagedList.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Collections @@ -386,7 +386,6 @@ class TPagedListPageChangedEventParameter extends TEventParameter */ public function __construct($oldPage) { - parent::__construct(); $this->_oldPage=$oldPage; } @@ -430,7 +429,6 @@ class TPagedListFetchDataEventParameter extends TEventParameter */ public function __construct($pageIndex,$offset,$limit) { - parent::__construct(); $this->_pageIndex=$pageIndex; $this->_offset=$offset; $this->_limit=$limit; diff --git a/framework/Collections/TQueue.php b/framework/Collections/TQueue.php index 469be018..bbf8de66 100644 --- a/framework/Collections/TQueue.php +++ b/framework/Collections/TQueue.php @@ -53,7 +53,6 @@ class TQueue extends TComponent implements IteratorAggregate,Countable */ public function __construct($data=null) { - parent::__construct(); if($data!==null) $this->copyFrom($data); } diff --git a/framework/Collections/TStack.php b/framework/Collections/TStack.php index 9fd045e4..42b10674 100644 --- a/framework/Collections/TStack.php +++ b/framework/Collections/TStack.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Collections @@ -52,7 +52,6 @@ class TStack extends TComponent implements IteratorAggregate,Countable */ public function __construct($data=null) { - parent::__construct(); if($data!==null) $this->copyFrom($data); } diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 34de431b..af171bbd 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.ActiveRecord @@ -225,7 +225,6 @@ abstract class TActiveRecord extends TComponent */ public function __construct($data=array(), $connection=null) { - parent::__construct(); if($connection!==null) $this->setDbConnection($connection); $this->setupColumnMapping(); diff --git a/framework/Data/ActiveRecord/TActiveRecordGateway.php b/framework/Data/ActiveRecord/TActiveRecordGateway.php index 534bd253..a61ae0ff 100644 --- a/framework/Data/ActiveRecord/TActiveRecordGateway.php +++ b/framework/Data/ActiveRecord/TActiveRecordGateway.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.ActiveRecord @@ -42,7 +42,6 @@ class TActiveRecordGateway extends TComponent */ public function __construct(TActiveRecordManager $manager) { - parent::__construct(); $this->_manager=$manager; } diff --git a/framework/Data/Common/Oracle/TOracleTableInfo.php b/framework/Data/Common/Oracle/TOracleTableInfo.php index 0a6238e0..c7d373b2 100644 --- a/framework/Data/Common/Oracle/TOracleTableInfo.php +++ b/framework/Data/Common/Oracle/TOracleTableInfo.php @@ -5,7 +5,7 @@ * * @author Marcos Nobre * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.Common @@ -36,7 +36,6 @@ class TOracleTableInfo extends TComponent */ public function __construct($tableInfo=array(),$primary=array(),$foreign=array()) { - parent::__construct(); $this->_info=$tableInfo; $this->_primaryKeys=$primary; $this->_foreignKeys=$foreign; diff --git a/framework/Data/Common/TDbCommandBuilder.php b/framework/Data/Common/TDbCommandBuilder.php index 2e772e73..0dc13e7e 100644 --- a/framework/Data/Common/TDbCommandBuilder.php +++ b/framework/Data/Common/TDbCommandBuilder.php @@ -1,508 +1,509 @@ - - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft - * @license http://www.pradosoft.com/license/ - * @version $Id$ - * @package System.Data.Common - */ - -/** - * TDbCommandBuilder provides basic methods to create query commands for tables - * giving by {@link setTableInfo TableInfo} the property. - * - * @author Wei Zhuo - * @version $Id$ - * @package System.Data.Common - * @since 3.1 - */ -class TDbCommandBuilder extends TComponent -{ - private $_connection; - private $_tableInfo; - - /** - * @param TDbConnection database connection. - * @param TDbTableInfo table information. - */ - public function __construct($connection=null, $tableInfo=null) - { - parent::__construct(); - $this->setDbConnection($connection); - $this->setTableInfo($tableInfo); - } - - /** - * @return TDbConnection database connection. - */ - public function getDbConnection() - { - return $this->_connection; - } - - /** - * @param TDbConnection database connection. - */ - public function setDbConnection($value) - { - $this->_connection=$value; - } - - /** - * @param TDbTableInfo table information. - */ - public function setTableInfo($value) - { - $this->_tableInfo=$value; - } - - /** - * @param TDbTableInfo table information. - */ - public function getTableInfo() - { - return $this->_tableInfo; - } - - /** - * Iterate through all the columns and returns the last insert id of the - * first column that has a sequence or serial. - * @return mixed last insert id, null if none is found. - */ - public function getLastInsertID() - { - foreach($this->getTableInfo()->getColumns() as $column) - { - if($column->hasSequence()) - return $this->getDbConnection()->getLastInsertID($column->getSequenceName()); - } - } - - /** - * Alters the sql to apply $limit and $offset. Default implementation is applicable - * for PostgreSQL, MySQL and SQLite. - * @param string SQL query string. - * @param integer maximum number of rows, -1 to ignore limit. - * @param integer row offset, -1 to ignore offset. - * @return string SQL with limit and offset. - */ - public function applyLimitOffset($sql, $limit=-1, $offset=-1) - { - $limit = $limit!==null ? (int)$limit : -1; - $offset = $offset!==null ? (int)$offset : -1; - $limitStr = $limit >= 0 ? ' LIMIT '.$limit : ''; - $offsetStr = $offset >= 0 ? ' OFFSET '.$offset : ''; - return $sql.$limitStr.$offsetStr; - } - - /** - * @param string SQL string without existing ordering. - * @param array pairs of column names as key and direction as value. - * @return string modified SQL applied with ORDER BY. - */ - public function applyOrdering($sql, $ordering) - { - $orders=array(); - foreach($ordering as $name => $direction) - { - $direction = strtolower($direction) == 'desc' ? 'DESC' : 'ASC'; - if(false !== strpos($name, '(') && false !== strpos($name, ')')) { - // key is a function (bad practice, but we need to handle it) - $key = $name; - } else { - // key is a column - $key = $this->getTableInfo()->getColumn($name)->getColumnName(); - } - $orders[] = $key.' '.$direction; - } - if(count($orders) > 0) - $sql .= ' ORDER BY '.implode(', ', $orders); - return $sql; - } - - /** - * Computes the SQL condition for search a set of column using regular expression - * (or LIKE, depending on database implementation) to match a string of - * keywords (default matches all keywords). - * @param array list of column id for potential search condition. - * @param string string of keywords - * @return string SQL search condition matching on a set of columns. - */ - public function getSearchExpression($fields, $keywords) - { - if(strlen(trim($keywords)) == 0) return ''; - $words = preg_split('/\s/u', $keywords); - $conditions = array(); - foreach($fields as $field) - { - $column = $this->getTableInfo()->getColumn($field)->getColumnName(); - $conditions[] = $this->getSearchCondition($column, $words); - } - return '('.implode(' OR ', $conditions).')'; - } - - /** - * @param string column name. - * @param array keywords - * @return string search condition for all words in one column. - */ - protected function getSearchCondition($column, $words) - { - $conditions=array(); - foreach($words as $word) - $conditions[] = $column.' LIKE '.$this->getDbConnection()->quoteString('%'.$word.'%'); - return '('.implode(' AND ', $conditions).')'; - } - - /** - * - * Different behavior depends on type of passed data - * string - * usage without modification - * - * null - * will be expanded to full list of quoted table column names (quoting depends on database) - * - * array - * - Column names will be quoted if used as key or value of array - * - * array('col1', 'col2', 'col2') - * // SELECT `col1`, `col2`, `col3` FROM... - * - * - * - Column aliasing - * - * array('mycol1' => 'col1', 'mycol2' => 'COUNT(*)') - * // SELECT `col1` AS mycol1, COUNT(*) AS mycol2 FROM... - * - * - * - NULL and scalar values (strings will be quoted depending on database) - * - * array('col1' => 'my custom string', 'col2' => 1.0, 'col3' => 'NULL') - * // SELECT "my custom string" AS `col1`, 1.0 AS `col2`, NULL AS `col3` FROM... - * - * - * - If the *-wildcard char is used as key or value, add the full list of quoted table column names - * - * array('col1' => 'NULL', '*') - * // SELECT `col1`, `col2`, `col3`, NULL AS `col1` FROM... - * - * @param mixed $value - * @return array of generated fields - use implode(', ', $selectfieldlist) to collapse field list for usage - * @since 3.1.7 - * @todo add support for table aliasing - * @todo add support for quoting of column aliasing - */ - public function getSelectFieldList($data='*') { - if(is_scalar($data)) { - $tmp = explode(',', $data); - $result = array(); - foreach($tmp as $v) - $result[] = trim($v); - return $result; - } - - $bHasWildcard = false; - $result = array(); - if(is_array($data) || $data instanceof Traversable) { - $columns = $this->getTableInfo()->getColumns(); - foreach($data as $key=>$value) { - if($key==='*' || $value==='*') { - $bHasWildcard = true; - continue; - } - - if(strToUpper($key)==='NULL') { - $result[] = 'NULL'; - continue; - } - - if(strpos($key, '(')!==false && strpos($key, ')')!==false) { - $result[] = $key; - continue; - } - - if(stripos($key, 'AS')!==false) { - $result[] = $key; - continue; - } - - if(stripos($value, 'AS')!==false) { - $result[] = $value; - continue; - } - - $v = isset($columns[$value]); - $k = isset($columns[$key]); - if(is_integer($key) && $v) { - $key = $value; - $k = $v; - } - - if(strToUpper($value)==='NULL') { - if($k) - $result[] = 'NULL AS ' . $columns[$key]->getColumnName(); - else - $result[] = 'NULL' . (is_string($key) ? (' AS ' . (string)$key) : ''); - continue; - } - - if(strpos($value, '(')!==false && strpos($value, ')')!==false) { - if($k) - $result[] = $value . ' AS ' . $columns[$key]->getColumnName(); - else - $result[] = $value . (is_string($key) ? (' AS ' . (string)$key) : ''); - continue; - } - - if($v && $key==$value) { - $result[] = $columns[$value]->getColumnName(); - continue; - } - - if($k && $value==null) { - $result[] = $columns[$key]->getColumnName(); - continue; - } - - if(is_string($key) && $v) { - $result[] = $columns[$value]->getColumnName() . ' AS ' . $key; - continue; - } - - if(is_numeric($value) && $k) { - $result[] = $value . ' AS ' . $columns[$key]->getColumnName(); - continue; - } - - if(is_string($value) && $k) { - $result[] = $this->getDbConnection()->quoteString($value) . ' AS ' . $columns[$key]->getColumnName(); - continue; - } - - if(!$v && !$k && is_integer($key)) { - $result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value); - continue; - } - - $result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value)) . ' AS ' . $key; - } - } - - if($data===null || count($result) == 0 || $bHasWildcard) - $result = $result = array_merge($this->getTableInfo()->getColumnNames(), $result); - - return $result; - } - - /** - * Appends the $where condition to the string "SELECT * FROM tableName WHERE ". - * The tableName is obtained from the {@link setTableInfo TableInfo} property. - * @param string query condition - * @param array condition parameters. - * @return TDbCommand query command. - */ - public function createFindCommand($where='1=1', $parameters=array(), $ordering=array(), $limit=-1, $offset=-1, $select='*') - { - $table = $this->getTableInfo()->getTableFullName(); - $fields = implode(', ', $this -> getSelectFieldList($select)); - $sql = "SELECT {$fields} FROM {$table}"; - if(!empty($where)) - $sql .= " WHERE {$where}"; - return $this->applyCriterias($sql, $parameters, $ordering, $limit, $offset); - } - - public function applyCriterias($sql, $parameters=array(),$ordering=array(), $limit=-1, $offset=-1) - { - if(count($ordering) > 0) - $sql = $this->applyOrdering($sql, $ordering); - if($limit>=0 || $offset>=0) - $sql = $this->applyLimitOffset($sql, $limit, $offset); - $command = $this->createCommand($sql); - $this->bindArrayValues($command, $parameters); - return $command; - } - - /** - * Creates a count(*) command for the table described in {@link setTableInfo TableInfo}. - * @param string count condition. - * @param array binding parameters. - * @return TDbCommand count command. - */ - public function createCountCommand($where='1=1', $parameters=array(),$ordering=array(), $limit=-1, $offset=-1) - { - return $this->createFindCommand($where, $parameters, $ordering, $limit, $offset, 'COUNT(*)'); - } - - /** - * Creates a delete command for the table described in {@link setTableInfo TableInfo}. - * The conditions for delete is given by the $where argument and the parameters - * for the condition is given by $parameters. - * @param string delete condition. - * @param array delete parameters. - * @return TDbCommand delete command. - */ - public function createDeleteCommand($where,$parameters=array()) - { - $table = $this->getTableInfo()->getTableFullName(); - if (!empty($where)) - $where = ' WHERE '.$where; - $command = $this->createCommand("DELETE FROM {$table}".$where); - $this->bindArrayValues($command, $parameters); - return $command; - } - - /** - * Creates an insert command for the table described in {@link setTableInfo TableInfo} for the given data. - * Each array key in the $data array must correspond to the column name of the table - * (if a column allows to be null, it may be omitted) to be inserted with - * the corresponding array value. - * @param array name-value pairs of new data to be inserted. - * @return TDbCommand insert command - */ - public function createInsertCommand($data) - { - $table = $this->getTableInfo()->getTableFullName(); - list($fields, $bindings) = $this->getInsertFieldBindings($data); - $command = $this->createCommand("INSERT INTO {$table}({$fields}) VALUES ($bindings)"); - $this->bindColumnValues($command, $data); - return $command; - } - - /** - * Creates an update command for the table described in {@link setTableInfo TableInfo} for the given data. - * Each array key in the $data array must correspond to the column name to be updated with the corresponding array value. - * @param array name-value pairs of data to be updated. - * @param string update condition. - * @param array update parameters. - * @return TDbCommand update command. - */ - public function createUpdateCommand($data, $where, $parameters=array()) - { - $table = $this->getTableInfo()->getTableFullName(); - if($this->hasIntegerKey($parameters)) - $fields = implode(', ', $this->getColumnBindings($data, true)); - else - $fields = implode(', ', $this->getColumnBindings($data)); - - if (!empty($where)) - $where = ' WHERE '.$where; - $command = $this->createCommand("UPDATE {$table} SET {$fields}".$where); - $this->bindArrayValues($command, array_merge($data, $parameters)); - return $command; - } - - /** - * Returns a list of insert field name and a list of binding names. - * @param object array or object to be inserted. - * @return array tuple ($fields, $bindings) - */ - protected function getInsertFieldBindings($values) - { - $fields = array(); $bindings=array(); - foreach(array_keys($values) as $name) - { - $fields[] = $this->getTableInfo()->getColumn($name)->getColumnName(); - $bindings[] = ':'.$name; - } - return array(implode(', ',$fields), implode(', ', $bindings)); - } - - /** - * Create a name-value or position-value if $position=true binding strings. - * @param array data for binding. - * @param boolean true to bind as position values. - * @return string update column names with corresponding binding substrings. - */ - protected function getColumnBindings($values, $position=false) - { - $bindings=array(); - foreach(array_keys($values) as $name) - { - $column = $this->getTableInfo()->getColumn($name)->getColumnName(); - $bindings[] = $position ? $column.' = ?' : $column.' = :'.$name; - } - return $bindings; - } - - /** - * @param string SQL query string. - * @return TDbCommand corresponding database command. - */ - public function createCommand($sql) - { - $this->getDbConnection()->setActive(true); - return $this->getDbConnection()->createCommand($sql); - } - - /** - * Bind the name-value pairs of $values where the array keys correspond to column names. - * @param TDbCommand database command. - * @param array name-value pairs. - */ - public function bindColumnValues($command, $values) - { - foreach($values as $name=>$value) - { - $column = $this->getTableInfo()->getColumn($name); - if($value === null && $column->getAllowNull()) - $command->bindValue(':'.$name, null, PDO::PARAM_NULL); - else - $command->bindValue(':'.$name, $value, $column->getPdoType()); - } - } - - /** - * @param TDbCommand database command - * @param array values for binding. - */ - public function bindArrayValues($command, $values) - { - if($this->hasIntegerKey($values)) - { - $values = array_values($values); - for($i = 0, $max=count($values); $i<$max; $i++) - $command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i])); - } - else - { - foreach($values as $name=>$value) - { - $prop = $name[0]===':' ? $name : ':'.$name; - $command->bindValue($prop, $value, $this->getPdoType($value)); - } - } - } - - /** - * @param mixed PHP value - * @return integer PDO parameter types. - */ - public static function getPdoType($value) - { - switch(gettype($value)) - { - case 'boolean': return PDO::PARAM_BOOL; - case 'integer': return PDO::PARAM_INT; - case 'string' : return PDO::PARAM_STR; - case 'NULL' : return PDO::PARAM_NULL; - } - } - - /** - * @param array - * @return boolean true if any array key is an integer. - */ - protected function hasIntegerKey($array) - { - foreach($array as $k=>$v) - { - if(gettype($k)==='integer') - return true; - } - return false; - } -} + + * @link http://www.pradosoft.com/ + * @copyright Copyright © 2005-2008 PradoSoft + * @license http://www.pradosoft.com/license/ + * @version $Id$ + * @package System.Data.Common + */ + +/** + * TDbCommandBuilder provides basic methods to create query commands for tables + * giving by {@link setTableInfo TableInfo} the property. + * + * @author Wei Zhuo + * @version $Id$ + * @package System.Data.Common + * @since 3.1 + */ +class TDbCommandBuilder extends TComponent +{ + private $_connection; + private $_tableInfo; + + /** + * @param TDbConnection database connection. + * @param TDbTableInfo table information. + */ + public function __construct($connection=null, $tableInfo=null) + { + $this->setDbConnection($connection); + $this->setTableInfo($tableInfo); + } + + /** + * @return TDbConnection database connection. + */ + public function getDbConnection() + { + return $this->_connection; + } + + /** + * @param TDbConnection database connection. + */ + public function setDbConnection($value) + { + $this->_connection=$value; + } + + /** + * @param TDbTableInfo table information. + */ + public function setTableInfo($value) + { + $this->_tableInfo=$value; + } + + /** + * @param TDbTableInfo table information. + */ + public function getTableInfo() + { + return $this->_tableInfo; + } + + /** + * Iterate through all the columns and returns the last insert id of the + * first column that has a sequence or serial. + * @return mixed last insert id, null if none is found. + */ + public function getLastInsertID() + { + foreach($this->getTableInfo()->getColumns() as $column) + { + if($column->hasSequence()) + return $this->getDbConnection()->getLastInsertID($column->getSequenceName()); + } + } + + /** + * Alters the sql to apply $limit and $offset. Default implementation is applicable + * for PostgreSQL, MySQL and SQLite. + * @param string SQL query string. + * @param integer maximum number of rows, -1 to ignore limit. + * @param integer row offset, -1 to ignore offset. + * @return string SQL with limit and offset. + */ + public function applyLimitOffset($sql, $limit=-1, $offset=-1) + { + $limit = $limit!==null ? (int)$limit : -1; + $offset = $offset!==null ? (int)$offset : -1; + $limitStr = $limit >= 0 ? ' LIMIT '.$limit : ''; + $offsetStr = $offset >= 0 ? ' OFFSET '.$offset : ''; + return $sql.$limitStr.$offsetStr; + } + + /** + * @param string SQL string without existing ordering. + * @param array pairs of column names as key and direction as value. + * @return string modified SQL applied with ORDER BY. + */ + public function applyOrdering($sql, $ordering) + { + $orders=array(); + foreach($ordering as $name => $direction) + { + $direction = strtolower($direction) == 'desc' ? 'DESC' : 'ASC'; + if(strpos($name, '(') && strpos($name, ')')) { + // key is a function (bad practice, but we need to handle it) + $key = $name; + } else { + // key is a column + $key = $this->getTableInfo()->getColumn($name)->getColumnName(); + } + $orders[] = $key.' '.$direction; + } + if(count($orders) > 0) + $sql .= ' ORDER BY '.implode(', ', $orders); + return $sql; + } + + /** + * Computes the SQL condition for search a set of column using regular expression + * (or LIKE, depending on database implementation) to match a string of + * keywords (default matches all keywords). + * @param array list of column id for potential search condition. + * @param string string of keywords + * @return string SQL search condition matching on a set of columns. + */ + public function getSearchExpression($fields, $keywords) + { + if(strlen(trim($keywords)) == 0) return ''; + $words = preg_split('/\s/u', $keywords); + $conditions = array(); + foreach($fields as $field) + { + $column = $this->getTableInfo()->getColumn($field)->getColumnName(); + $conditions[] = $this->getSearchCondition($column, $words); + } + return '('.implode(' OR ', $conditions).')'; + } + + /** + * @param string column name. + * @param array keywords + * @return string search condition for all words in one column. + */ + protected function getSearchCondition($column, $words) + { + $conditions=array(); + foreach($words as $word) + $conditions[] = $column.' LIKE '.$this->getDbConnection()->quoteString('%'.$word.'%'); + return '('.implode(' AND ', $conditions).')'; + } + + /** + * + * Different behavior depends on type of passed data + * string + * usage without modification + * + * null + * will be expanded to full list of quoted table column names (quoting depends on database) + * + * array + * - Column names will be quoted if used as key or value of array + * + * array('col1', 'col2', 'col2') + * // SELECT `col1`, `col2`, `col3` FROM... + * + * + * - Column aliasing + * + * array('mycol1' => 'col1', 'mycol2' => 'COUNT(*)') + * // SELECT `col1` AS mycol1, COUNT(*) AS mycol2 FROM... + * + * + * - NULL and scalar values (strings will be quoted depending on database) + * + * array('col1' => 'my custom string', 'col2' => 1.0, 'col3' => 'NULL') + * // SELECT "my custom string" AS `col1`, 1.0 AS `col2`, NULL AS `col3` FROM... + * + * + * - If the *-wildcard char is used as key or value, add the full list of quoted table column names + * + * array('col1' => 'NULL', '*') + * // SELECT `col1`, `col2`, `col3`, NULL AS `col1` FROM... + * + * @param mixed $value + * @return array of generated fields - use implode(', ', $selectfieldlist) to collapse field list for usage + * @since 3.1.7 + * @todo add support for table aliasing + * @todo add support for quoting of column aliasing + */ + public function getSelectFieldList($data='*') { + if(is_scalar($data)) { + $tmp = explode(',', $data); + $result = array(); + foreach($tmp as $v) + $result[] = trim($v); + return $result; + } + + $bHasWildcard = false; + $result = array(); + if(is_array($data) || $data instanceof Traversable) { + $columns = $this->getTableInfo()->getColumns(); + foreach($data as $key=>$value) { + if($key==='*' || $value==='*') { + $bHasWildcard = true; + continue; + } + + if(strToUpper($key)==='NULL') { + $result[] = 'NULL'; + continue; + } + + if(strpos($key, '(')!==false && strpos($key, ')')!==false) { + $result[] = $key; + continue; + } + + if(stripos($key, 'AS')!==false) { + $result[] = $key; + continue; + } + + if(stripos($value, 'AS')!==false) { + $result[] = $value; + continue; + } + + $v = isset($columns[$value]); + $k = isset($columns[$key]); + if(is_integer($key) && $v) { + $key = $value; + $k = $v; + } + + if(strToUpper($value)==='NULL') { + if($k) + $result[] = 'NULL AS ' . $columns[$key]->getColumnName(); + else + $result[] = 'NULL' . (is_string($key) ? (' AS ' . (string)$key) : ''); + continue; + } + + if(strpos($value, '(')!==false && strpos($value, ')')!==false) { + if($k) + $result[] = $value . ' AS ' . $columns[$key]->getColumnName(); + else + $result[] = $value . (is_string($key) ? (' AS ' . (string)$key) : ''); + continue; + } + + if($v && $key==$value) { + $result[] = $columns[$value]->getColumnName(); + continue; + } + + if($k && $value==null) { + $result[] = $columns[$key]->getColumnName(); + continue; + } + + if(is_string($key) && $v) { + $result[] = $columns[$value]->getColumnName() . ' AS ' . $key; + continue; + } + + if(is_numeric($value) && $k) { + $result[] = $value . ' AS ' . $columns[$key]->getColumnName(); + continue; + } + + if(is_string($value) && $k) { + $result[] = $this->getDbConnection()->quoteString($value) . ' AS ' . $columns[$key]->getColumnName(); + continue; + } + + if(!$v && !$k && is_integer($key)) { + $result[] = is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value); + continue; + } + + $result[] = (is_numeric($value) ? $value : $this->getDbConnection()->quoteString((string)$value)) . ' AS ' . $key; + } + } + + if($data===null || count($result) == 0 || $bHasWildcard) + $result = $result = array_merge($this->getTableInfo()->getColumnNames(), $result); + + return $result; + } + + /** + * Appends the $where condition to the string "SELECT * FROM tableName WHERE ". + * The tableName is obtained from the {@link setTableInfo TableInfo} property. + * @param string query condition + * @param array condition parameters. + * @return TDbCommand query command. + */ + public function createFindCommand($where='1=1', $parameters=array(), $ordering=array(), $limit=-1, $offset=-1, $select='*') + { + $table = $this->getTableInfo()->getTableFullName(); + $fields = implode(', ', $this -> getSelectFieldList($select)); + $sql = "SELECT {$fields} FROM {$table}"; + if(!empty($where)) + $sql .= " WHERE {$where}"; + return $this->applyCriterias($sql, $parameters, $ordering, $limit, $offset); + } + + public function applyCriterias($sql, $parameters=array(),$ordering=array(), $limit=-1, $offset=-1) + { + if(count($ordering) > 0) + $sql = $this->applyOrdering($sql, $ordering); + if($limit>=0 || $offset>=0) + $sql = $this->applyLimitOffset($sql, $limit, $offset); + $command = $this->createCommand($sql); + $this->bindArrayValues($command, $parameters); + return $command; + } + + /** + * Creates a count(*) command for the table described in {@link setTableInfo TableInfo}. + * @param string count condition. + * @param array binding parameters. + * @return TDbCommand count command. + */ + public function createCountCommand($where='1=1', $parameters=array(),$ordering=array(), $limit=-1, $offset=-1) + { + return $this->createFindCommand($where, $parameters, $ordering, $limit, $offset, 'COUNT(*)'); + } + + /** + * Creates a delete command for the table described in {@link setTableInfo TableInfo}. + * The conditions for delete is given by the $where argument and the parameters + * for the condition is given by $parameters. + * @param string delete condition. + * @param array delete parameters. + * @return TDbCommand delete command. + */ + public function createDeleteCommand($where,$parameters=array()) + { + $table = $this->getTableInfo()->getTableFullName(); + if (!empty($where)) + $where = ' WHERE '.$where; + $command = $this->createCommand("DELETE FROM {$table}".$where); + $this->bindArrayValues($command, $parameters); + return $command; + } + + /** + * Creates an insert command for the table described in {@link setTableInfo TableInfo} for the given data. + * Each array key in the $data array must correspond to the column name of the table + * (if a column allows to be null, it may be omitted) to be inserted with + * the corresponding array value. + * @param array name-value pairs of new data to be inserted. + * @return TDbCommand insert command + */ + public function createInsertCommand($data) + { + $table = $this->getTableInfo()->getTableFullName(); + list($fields, $bindings) = $this->getInsertFieldBindings($data); + $command = $this->createCommand("INSERT INTO {$table}({$fields}) VALUES ($bindings)"); + $this->bindColumnValues($command, $data); + return $command; + } + + /** + * Creates an update command for the table described in {@link setTableInfo TableInfo} for the given data. + * Each array key in the $data array must correspond to the column name to be updated with the corresponding array value. + * @param array name-value pairs of data to be updated. + * @param string update condition. + * @param array update parameters. + * @return TDbCommand update command. + */ + public function createUpdateCommand($data, $where, $parameters=array()) + { + $table = $this->getTableInfo()->getTableFullName(); + if($this->hasIntegerKey($parameters)) + $fields = implode(', ', $this->getColumnBindings($data, true)); + else + $fields = implode(', ', $this->getColumnBindings($data)); + + if (!empty($where)) + $where = ' WHERE '.$where; + $command = $this->createCommand("UPDATE {$table} SET {$fields}".$where); + $this->bindArrayValues($command, array_merge($data, $parameters)); + return $command; + } + + /** + * Returns a list of insert field name and a list of binding names. + * @param object array or object to be inserted. + * @return array tuple ($fields, $bindings) + */ + protected function getInsertFieldBindings($values) + { + $fields = array(); $bindings=array(); + foreach(array_keys($values) as $name) + { + $fields[] = $this->getTableInfo()->getColumn($name)->getColumnName(); + $bindings[] = ':'.$name; + } + return array(implode(', ',$fields), implode(', ', $bindings)); + } + + /** + * Create a name-value or position-value if $position=true binding strings. + * @param array data for binding. + * @param boolean true to bind as position values. + * @return string update column names with corresponding binding substrings. + */ + protected function getColumnBindings($values, $position=false) + { + $bindings=array(); + foreach(array_keys($values) as $name) + { + $column = $this->getTableInfo()->getColumn($name)->getColumnName(); + $bindings[] = $position ? $column.' = ?' : $column.' = :'.$name; + } + return $bindings; + } + + /** + * @param string SQL query string. + * @return TDbCommand corresponding database command. + */ + public function createCommand($sql) + { + $this->getDbConnection()->setActive(true); + return $this->getDbConnection()->createCommand($sql); + } + + /** + * Bind the name-value pairs of $values where the array keys correspond to column names. + * @param TDbCommand database command. + * @param array name-value pairs. + */ + public function bindColumnValues($command, $values) + { + foreach($values as $name=>$value) + { + $column = $this->getTableInfo()->getColumn($name); + if($value === null && $column->getAllowNull()) + $command->bindValue(':'.$name, null, PDO::PARAM_NULL); + else + $command->bindValue(':'.$name, $value, $column->getPdoType()); + } + } + + /** + * @param TDbCommand database command + * @param array values for binding. + */ + public function bindArrayValues($command, $values) + { + if($this->hasIntegerKey($values)) + { + $values = array_values($values); + for($i = 0, $max=count($values); $i<$max; $i++) + $command->bindValue($i+1, $values[$i], $this->getPdoType($values[$i])); + } + else + { + foreach($values as $name=>$value) + { + $prop = $name[0]===':' ? $name : ':'.$name; + $command->bindValue($prop, $value, $this->getPdoType($value)); + } + } + } + + /** + * @param mixed PHP value + * @return integer PDO parameter types. + */ + public static function getPdoType($value) + { + switch(gettype($value)) + { + case 'boolean': return PDO::PARAM_BOOL; + case 'integer': return PDO::PARAM_INT; + case 'string' : return PDO::PARAM_STR; + case 'NULL' : return PDO::PARAM_NULL; + } + } + + /** + * @param array + * @return boolean true if any array key is an integer. + */ + protected function hasIntegerKey($array) + { + foreach($array as $k=>$v) + { + if(gettype($k)==='integer') + return true; + } + return false; + } +} + +?> \ No newline at end of file diff --git a/framework/Data/Common/TDbMetaData.php b/framework/Data/Common/TDbMetaData.php index 1a194056..bcdf0e46 100644 --- a/framework/Data/Common/TDbMetaData.php +++ b/framework/Data/Common/TDbMetaData.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.Common @@ -31,7 +31,6 @@ abstract class TDbMetaData extends TComponent */ public function __construct($conn) { - parent::__construct(); $this->_connection=$conn; } diff --git a/framework/Data/Common/TDbTableColumn.php b/framework/Data/Common/TDbTableColumn.php index 84fa6c55..3bb9454b 100644 --- a/framework/Data/Common/TDbTableColumn.php +++ b/framework/Data/Common/TDbTableColumn.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.Common @@ -30,7 +30,6 @@ class TDbTableColumn extends TComponent */ public function __construct($columnInfo) { - parent::__construct(); $this->_info=$columnInfo; } diff --git a/framework/Data/Common/TDbTableInfo.php b/framework/Data/Common/TDbTableInfo.php index 6f37791a..455dbc33 100644 --- a/framework/Data/Common/TDbTableInfo.php +++ b/framework/Data/Common/TDbTableInfo.php @@ -1,10 +1,10 @@ - * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.Common @@ -27,11 +27,11 @@ class TDbTableInfo extends TComponent private $_columns; - private $_lowercase; - - /** - * @var null|array - * @since 3.1.7 + private $_lowercase; + + /** + * @var null|array + * @since 3.1.7 */ private $_names = null; @@ -41,7 +41,6 @@ class TDbTableInfo extends TComponent */ public function __construct($tableInfo=array(),$primary=array(),$foreign=array()) { - parent::__construct(); $this->_info=$tableInfo; $this->_primaryKeys=$primary; $this->_foreignKeys=$foreign; @@ -125,12 +124,12 @@ class TDbTableInfo extends TComponent * @return array table column names (identifier quoted) */ public function getColumnNames() - { - if($this->_names===null) + { + if($this->_names===null) { $this->_names=array(); foreach($this->getColumns() as $column) - $this->_names[] = $column->getColumnName(); + $this->_names[] = $column->getColumnName(); } return $this->_names; } diff --git a/framework/Data/DataGateway/TDataGatewayCommand.php b/framework/Data/DataGateway/TDataGatewayCommand.php index 034ea36e..e290f457 100644 --- a/framework/Data/DataGateway/TDataGatewayCommand.php +++ b/framework/Data/DataGateway/TDataGatewayCommand.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.DataGateway @@ -43,7 +43,6 @@ class TDataGatewayCommand extends TComponent */ public function __construct($builder) { - parent::__construct(); $this->_builder = $builder; } @@ -470,7 +469,6 @@ class TDataGatewayEventParameter extends TEventParameter public function __construct($command,$criteria) { - parent::__construct(); $this->_command=$command; $this->_criteria=$criteria; } diff --git a/framework/Data/DataGateway/TSqlCriteria.php b/framework/Data/DataGateway/TSqlCriteria.php index 1b85c7d3..14e37b35 100644 --- a/framework/Data/DataGateway/TSqlCriteria.php +++ b/framework/Data/DataGateway/TSqlCriteria.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id: TDbSqlCriteria.php 1835 2007-04-03 01:38:15Z wei $ * @package System.Data.DataGateway @@ -49,7 +49,6 @@ class TSqlCriteria extends TComponent */ public function __construct($condition=null, $parameters=array()) { - parent::__construct(); if(!is_array($parameters) && func_num_args() > 1) $parameters = array_slice(func_get_args(),1); $this->_parameters=new TAttributeCollection; diff --git a/framework/Data/SqlMap/Configuration/TParameterMap.php b/framework/Data/SqlMap/Configuration/TParameterMap.php index 60b05662..dfb258f7 100644 --- a/framework/Data/SqlMap/Configuration/TParameterMap.php +++ b/framework/Data/SqlMap/Configuration/TParameterMap.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -43,7 +43,6 @@ class TParameterMap extends TComponent */ public function __construct() { - parent::__construct(); $this->_properties = new TList; $this->_propertyMap = new TMap; } diff --git a/framework/Data/SqlMap/Configuration/TResultMap.php b/framework/Data/SqlMap/Configuration/TResultMap.php index b20a81f6..e85dc1aa 100644 --- a/framework/Data/SqlMap/Configuration/TResultMap.php +++ b/framework/Data/SqlMap/Configuration/TResultMap.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -51,7 +51,6 @@ class TResultMap extends TComponent */ public function __construct() { - parent::__construct(); $this->_columns=new TMap; } diff --git a/framework/Data/SqlMap/Configuration/TResultProperty.php b/framework/Data/SqlMap/Configuration/TResultProperty.php index d4c849bf..add70227 100644 --- a/framework/Data/SqlMap/Configuration/TResultProperty.php +++ b/framework/Data/SqlMap/Configuration/TResultProperty.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration @@ -57,7 +57,6 @@ class TResultProperty extends TComponent */ public function __construct($resultMap=null) { - parent::__construct(); if($resultMap instanceof TResultMap) $this->_hostResultMapID = $resultMap->getID(); } diff --git a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php index 2448659a..c49a4219 100644 --- a/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php +++ b/framework/Data/SqlMap/Configuration/TSqlMapXmlConfiguration.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Configuration diff --git a/framework/Data/SqlMap/Statements/TMappedStatement.php b/framework/Data/SqlMap/Statements/TMappedStatement.php index 7aab3510..c4bb53dd 100644 --- a/framework/Data/SqlMap/Statements/TMappedStatement.php +++ b/framework/Data/SqlMap/Statements/TMappedStatement.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Statements @@ -116,7 +116,6 @@ class TMappedStatement extends TComponent implements IMappedStatement */ public function __construct(TSqlMapManager $sqlMap, TSqlMapStatement $statement) { - parent::__construct(); $this->_manager = $sqlMap; $this->_statement = $statement; $this->_command = new TPreparedCommand(); diff --git a/framework/Data/SqlMap/Statements/TPreparedStatement.php b/framework/Data/SqlMap/Statements/TPreparedStatement.php index c9faf4ee..7d862378 100644 --- a/framework/Data/SqlMap/Statements/TPreparedStatement.php +++ b/framework/Data/SqlMap/Statements/TPreparedStatement.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Statements @@ -26,7 +26,6 @@ class TPreparedStatement extends TComponent public function __construct() { - parent::__construct(); $this->_parameterNames=new TList; $this->_parameterValues=new TMap; } diff --git a/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php b/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php index 5335c41c..5d85ded9 100644 --- a/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php +++ b/framework/Data/SqlMap/Statements/TSimpleDynamicSql.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap.Statements @@ -24,7 +24,6 @@ class TSimpleDynamicSql extends TStaticSql public function __construct($mappings) { - parent::__construct(); $this->_mappings = $mappings; } diff --git a/framework/Data/SqlMap/TSqlMapGateway.php b/framework/Data/SqlMap/TSqlMapGateway.php index 3a19d155..97b31b50 100644 --- a/framework/Data/SqlMap/TSqlMapGateway.php +++ b/framework/Data/SqlMap/TSqlMapGateway.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap @@ -36,7 +36,6 @@ class TSqlMapGateway extends TComponent public function __construct($manager) { - parent::__construct(); $this->_manager=$manager; } @@ -123,7 +122,7 @@ class TSqlMapGateway extends TComponent * @param string The name of the sql statement to execute. * @param mixed The object used to set the parameters in the SQL. * @param integer The maximum number of objects to store in each page. - * @param integer The number of the page to initially load into the list. + * @param integer The number of the page to initially load into the list. * @return TPagedList A PaginatedList of beans containing the rows. */ public function queryForPagedList($statementName, $parameter=null, $pageSize=10, $page=0) @@ -144,7 +143,7 @@ class TSqlMapGateway extends TComponent * @param callback Row delegate handler, a valid callback required. * @param mixed The object used to set the parameters in the SQL. * @param integer The maximum number of objects to store in each page. - * @param integer The number of the page to initially load into the list. + * @param integer The number of the page to initially load into the list. * @return TPagedList A PaginatedList of beans containing the rows. */ public function queryForPagedListWithRowDelegate($statementName,$delegate, $parameter=null, $pageSize=10, $page=0) diff --git a/framework/Data/SqlMap/TSqlMapManager.php b/framework/Data/SqlMap/TSqlMapManager.php index 0af90a3d..432c1c5e 100644 --- a/framework/Data/SqlMap/TSqlMapManager.php +++ b/framework/Data/SqlMap/TSqlMapManager.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data.SqlMap @@ -60,7 +60,6 @@ class TSqlMapManager extends TComponent */ public function __construct($connection=null) { - parent::__construct(); $this->_connection=$connection; $this->_mappedStatements=new TMap; diff --git a/framework/Data/TDbCommand.php b/framework/Data/TDbCommand.php index 749d3ec3..d09c53f4 100644 --- a/framework/Data/TDbCommand.php +++ b/framework/Data/TDbCommand.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data @@ -49,7 +49,6 @@ class TDbCommand extends TComponent */ public function __construct(TDbConnection $connection,$text) { - parent::__construct(); $this->_connection=$connection; $this->setText($text); } diff --git a/framework/Data/TDbConnection.php b/framework/Data/TDbConnection.php index 9078dfe0..54fffb59 100644 --- a/framework/Data/TDbConnection.php +++ b/framework/Data/TDbConnection.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data @@ -119,7 +119,6 @@ class TDbConnection extends TComponent */ public function __construct($dsn='',$username='',$password='', $charset='') { - parent::__construct(); $this->_dsn=$dsn; $this->_username=$username; $this->_password=$password; @@ -180,9 +179,9 @@ class TDbConnection extends TComponent try { $this->_pdo=new PDO($this->getConnectionString(),$this->getUsername(), - $this->getPassword(),$this->_attributes); + $this->getPassword(),$this->_attributes); // This attribute is only useful for PDO::MySql driver. - // Ignore the warning if a driver doesn't understand this. + // Ignore the warning if a driver doesn't understand this. @$this->_pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, true); $this->_pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $this->_active=true; diff --git a/framework/Data/TDbDataReader.php b/framework/Data/TDbDataReader.php index 4a323024..7b54414e 100644 --- a/framework/Data/TDbDataReader.php +++ b/framework/Data/TDbDataReader.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data @@ -47,7 +47,6 @@ class TDbDataReader extends TComponent implements Iterator */ public function __construct(TDbCommand $command) { - parent::__construct(); $this->_statement=$command->getPdoStatement(); $this->_statement->setFetchMode(PDO::FETCH_ASSOC); } diff --git a/framework/Data/TDbTransaction.php b/framework/Data/TDbTransaction.php index 7c646833..60b14a55 100644 --- a/framework/Data/TDbTransaction.php +++ b/framework/Data/TDbTransaction.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Data @@ -51,7 +51,6 @@ class TDbTransaction extends TComponent */ public function __construct(TDbConnection $connection) { - parent::__construct(); $this->_connection=$connection; $this->setActive(true); } diff --git a/framework/Security/TAuthorizationRule.php b/framework/Security/TAuthorizationRule.php index 2f050340..896ce376 100644 --- a/framework/Security/TAuthorizationRule.php +++ b/framework/Security/TAuthorizationRule.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Security @@ -74,7 +74,6 @@ class TAuthorizationRule extends TComponent */ public function __construct($action,$users,$roles,$verb='',$ipRules='') { - parent::__construct(); $action=strtolower(trim($action)); if($action==='allow' || $action==='deny') $this->_action=$action; diff --git a/framework/Security/TUser.php b/framework/Security/TUser.php index 3c7b6507..35e3e3a5 100644 --- a/framework/Security/TUser.php +++ b/framework/Security/TUser.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Security @@ -52,7 +52,6 @@ class TUser extends TComponent implements IUser */ public function __construct(IUserManager $manager) { - parent::__construct(); $this->_state=array(); $this->_manager=$manager; $this->setName($manager->getGuestName()); diff --git a/framework/TApplication.php b/framework/TApplication.php index 679d5632..2eba65fb 100644 --- a/framework/TApplication.php +++ b/framework/TApplication.php @@ -218,10 +218,6 @@ class TApplication extends TComponent * @var TMap list of application parameters */ private $_parameters; - /** - * @var TMap list of final application parameters - */ - private $_parametersfinal; /** * @var string configuration file */ @@ -324,7 +320,6 @@ class TApplication extends TComponent * will be looked for. If found, the file is considered as the application * configuration file. * @param boolean whether to cache application configuration. Defaults to true. - * @param string The type of configuration te app should have. Defaults to {@link CONFIG_TYPE_XML}. * @throws TConfigurationException if configuration file cannot be read or the runtime path is invalid. */ public function __construct($basePath='protected',$cacheConfig=true, $configType=self::CONFIG_TYPE_XML) @@ -340,12 +335,9 @@ class TApplication extends TComponent // generates unique ID by hashing the runtime path $this->_uniqueID=md5($this->_runtimePath); $this->_parameters=new TMap; - $this->_parametersfinal=new TMap; $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); Prado::setPathOfAlias('Application',$this->_basePath); - - parent::__construct(); } /** @@ -990,8 +982,20 @@ class TApplication extends TComponent if(empty($this->_services)) $this->_services=array($this->getPageServiceID()=>array('TPageService',array(),null)); - - $this->mergeParameters($config->getParameters()); + + // load parameters + foreach($config->getParameters() as $id=>$parameter) + { + if(is_array($parameter)) + { + $component=Prado::createComponent($parameter[0]); + foreach($parameter[1] as $name=>$value) + $component->setSubProperty($name,$value); + $this->_parameters->add($id,$component); + } + else + $this->_parameters->add($id,$parameter); + } // load and init modules specified in app config $modules=array(); @@ -1032,47 +1036,6 @@ class TApplication extends TComponent } } } - - /** - * This will merge the parameters into the application - * The parameter looks like this: - * - * $params = array( - * // type = 0 is a class - * 'paramname1' => array('type'=>0, 'class' => $type, 'properties' => $properties->toArray(), - * 'final' => $final, 'value' => $element), - * // type != 0 is a parameter with a value - * 'paramname1' => array('type'=>1, 'value' => $element, 'final' => $final), - * 'paramname2' => array('type'=>2, 'value' => $value, 'final' => $final) - * ); - * - * @param array $parameters the parameters to merge into application - */ - public function mergeParameters($parameters) { - // load parameters - foreach($parameters as $id=>$parameter) - { - if(isset($this->_parametersfinal[$id])) - continue; - - if(!$parameter['type']) - { - $component=Prado::createComponent($parameter['class']); - foreach($parameter['properties'] as $name=>$value) - $component->setSubProperty($name,$value); - if($component instanceof IModule && isset($parameter['value'])) - $component->init($parameter['value']); - $this->_parameters->add($id,$component); - } - else - $this->_parameters->add($id,$parameter['value']); - - // If this parameter is final, and not set yet, set it - if($parameter['final'] && !isset($this->_parametersfinal[$id])) - $this->_parametersfinal->add($id, $parameter['value']); - } - } - /** * Loads configuration and initializes application. @@ -1098,7 +1061,7 @@ class TApplication extends TComponent } else $config=Prado::unserialize(file_get_contents($this->_cacheFile)); - + $this->applyConfiguration($config,false); } @@ -1664,20 +1627,13 @@ class TApplicationConfiguration extends TComponent { if(is_array($parameter)) { - $final = TPropertyValue::ensureBoolean($parameter['final']); - unset($parameter['final']); if(isset($parameter['class'])) { - $properties = isset($parameter['properties']) ? $parameter['properties'] : array(); + $type = $parameter['class']; + unset($parameter['class']); + $properties = isset($service['properties']) ? $service['properties'] : array(); $properties['id'] = $id; - $this->_parameters[$id] = array('type'=>0, 'class' => $parameter['class'], 'properties' => $properties, - 'final' => $final, 'value' => $parameter); - } else { - if(!isset($parameter['value'])) { - $this->_parameters[$id]=array('type'=>1, 'value' => $parameter, 'final' => $final); - } else { - $this->_parameters[$id]=array('type'=>2, 'value' => $parameter['value'], 'final' => $final); - } + $this->_parameters[$id] = array($type,$properties); } } else @@ -1701,18 +1657,15 @@ class TApplicationConfiguration extends TComponent $properties=$element->getAttributes(); if(($id=$properties->remove('id'))===null) throw new TConfigurationException('appconfig_parameterid_required'); - $final = TPropertyValue::ensureBoolean($properties->remove('final')); if(($type=$properties->remove('class'))===null) { if(($value=$properties->remove('value'))===null) - $this->_parameters[$id]=array('type'=>1, 'value' => $element, 'final' => $final); + $this->_parameters[$id]=$element; else - $this->_parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final); - } - else { - $this->_parameters[$id]=array('type'=>0, 'class' => $type, 'properties' => $properties->toArray(), - 'final' => $final, 'value' => $element); + $this->_parameters[$id]=$value; } + else + $this->_parameters[$id]=array($type,$properties->toArray()); $this->_empty=false; } else diff --git a/framework/TComponent.php b/framework/TComponent.php index 9f51a4ef..ab04c10f 100644 --- a/framework/TComponent.php +++ b/framework/TComponent.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System @@ -49,7 +49,6 @@ * To raise an event (assuming named as 'Click') of a component, use * * $component->raiseEvent('OnClick'); - * $component->raiseEvent('OnClick', $this, $param); * * To attach an event handler to an event, use one of the following ways, * @@ -84,14 +83,6 @@ class TComponent */ private $_m=array(); - - /** - * The Common __construct - */ - public function __construct() { - } - - /** * Returns a property value or an event handler list by property or event name. * Do not call this method. This is a PHP magic method that we override diff --git a/framework/Testing/Data/ActiveRecord/TActiveFinder.php b/framework/Testing/Data/ActiveRecord/TActiveFinder.php index 75787e77..d1c35bdf 100644 --- a/framework/Testing/Data/ActiveRecord/TActiveFinder.php +++ b/framework/Testing/Data/ActiveRecord/TActiveFinder.php @@ -47,7 +47,6 @@ class TActiveFinder extends TComponent */ public function __construct($model,$with,$criteria=null) { - parent::__construct(); $this->_criteria=$criteria; $this->_builder=$model->getCommandBuilder(); $this->_joinTree=new TJoinElement($this,$model); diff --git a/framework/Testing/Data/ActiveRecord/TActiveRecord.php b/framework/Testing/Data/ActiveRecord/TActiveRecord.php index e1484f03..8d6c5e10 100644 --- a/framework/Testing/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Testing/Data/ActiveRecord/TActiveRecord.php @@ -68,8 +68,7 @@ abstract class TActiveRecord extends TModel { if($scenario===null) // internally used by populateRecord() and model() return; - - parent::__construct(); + $this->setScenario($scenario); $this->setIsNewRecord(true); $this->_attributes=$this->getMetaData()->attributeDefaults; diff --git a/framework/Testing/Data/ActiveRecord/TActiveRecordCriteria.php b/framework/Testing/Data/ActiveRecord/TActiveRecordCriteria.php index 2a00cbda..46eddaf9 100644 --- a/framework/Testing/Data/ActiveRecord/TActiveRecordCriteria.php +++ b/framework/Testing/Data/ActiveRecord/TActiveRecordCriteria.php @@ -16,7 +16,6 @@ class TSqlCriteria extends TDbCriteria public function __construct($condition=null, $parameters=array()) { - parent::__construct(); if(!is_array($parameters) && func_num_args() > 1) $parameters = array_slice(func_get_args(), 1); diff --git a/framework/Testing/Data/Schema/TDbCommandBuilder.php b/framework/Testing/Data/Schema/TDbCommandBuilder.php index 3bfb6b54..7a196439 100755 --- a/framework/Testing/Data/Schema/TDbCommandBuilder.php +++ b/framework/Testing/Data/Schema/TDbCommandBuilder.php @@ -31,7 +31,6 @@ class TDbCommandBuilder extends TComponent */ public function __construct($schema) { - parent::__construct(); $this->_schema=$schema; $this->_connection=$schema->getDbConnection(); } diff --git a/framework/Testing/Data/Schema/TDbExpression.php b/framework/Testing/Data/Schema/TDbExpression.php index fdfeb8bb..a1819000 100755 --- a/framework/Testing/Data/Schema/TDbExpression.php +++ b/framework/Testing/Data/Schema/TDbExpression.php @@ -35,7 +35,6 @@ class TDbExpression extends TComponent */ public function __construct($expression) { - parent::__construct(); $this->expression=$expression; } diff --git a/framework/Testing/Data/Schema/TDbSchema.php b/framework/Testing/Data/Schema/TDbSchema.php index a4e633a9..2c568e7e 100755 --- a/framework/Testing/Data/Schema/TDbSchema.php +++ b/framework/Testing/Data/Schema/TDbSchema.php @@ -38,7 +38,6 @@ abstract class TDbSchema extends TComponent */ public function __construct($conn) { - parent::__construct(); $conn->setActive(true); $this->_connection=$conn; foreach($conn->schemaCachingExclude as $name) diff --git a/framework/Testing/Data/TDbCommand.php b/framework/Testing/Data/TDbCommand.php index 9a1bb5b7..dd3a9fe6 100755 --- a/framework/Testing/Data/TDbCommand.php +++ b/framework/Testing/Data/TDbCommand.php @@ -47,7 +47,6 @@ class TDbCommand extends TComponent */ public function __construct(TDbConnection $connection,$text) { - parent::__construct(); $this->_connection=$connection; $this->setText($text); } diff --git a/framework/Testing/Data/TDbConnection.php b/framework/Testing/Data/TDbConnection.php index 54061239..d2d268de 100755 --- a/framework/Testing/Data/TDbConnection.php +++ b/framework/Testing/Data/TDbConnection.php @@ -156,7 +156,6 @@ class TDbConnection extends TComponent */ public function __construct($dsn='',$username='',$password='') { - parent::__construct(); $this->connectionString=$dsn; $this->username=$username; $this->password=$password; diff --git a/framework/Testing/Data/TDbDataReader.php b/framework/Testing/Data/TDbDataReader.php index ae14e18a..6014ff04 100755 --- a/framework/Testing/Data/TDbDataReader.php +++ b/framework/Testing/Data/TDbDataReader.php @@ -43,7 +43,6 @@ class TDbDataReader extends TComponent implements Iterator */ public function __construct(TDbCommand $command) { - parent::__construct(); $this->_statement=$command->getPdoStatement(); $this->_statement->setFetchMode(PDO::FETCH_ASSOC); } diff --git a/framework/Testing/Data/TDbTransaction.php b/framework/Testing/Data/TDbTransaction.php index 60fd7c23..41a2c1f9 100755 --- a/framework/Testing/Data/TDbTransaction.php +++ b/framework/Testing/Data/TDbTransaction.php @@ -49,7 +49,6 @@ class TDbTransaction extends TComponent */ public function __construct(TDbConnection $connection) { - parent::__construct(); $this->_connection=$connection; $this->setActive(true); } diff --git a/framework/Util/TParameterModule.php b/framework/Util/TParameterModule.php index 265bdd38..0109ca32 100644 --- a/framework/Util/TParameterModule.php +++ b/framework/Util/TParameterModule.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Util @@ -24,7 +24,6 @@ * * * - * * * * @@ -34,19 +33,12 @@ * * * - * * * * - * Setting the final attribute to true will cause that parameter to be unchangable - * by any future mergeParameters. - * * If a parameter is defined both in the external file and within the module * tag, the former takes precedence. * - * the application parameters are processed first before the modules parameters - * are processed. - * * @author Qiang Xue * @author Carl G. Mathisen * @version $Id$ @@ -101,7 +93,7 @@ class TParameterModule extends TModule /** * Loads parameters into application. - * @param mixed XML or PHP representation of the parameters + * @param mixed XML of PHP representation of the parameters * @throws TConfigurationException if the parameter file format is invalid */ protected function loadParameters($config) @@ -111,23 +103,10 @@ class TParameterModule extends TModule { foreach($config as $id => $parameter) { - if(is_array($parameter)) + if(is_array($parameter) && isset($parameter['class'])) { - $final = TPropertyValue::ensureBoolean($parameter['final']); - unset($parameter['final']); - if(isset($parameter['class'])) - { - $properties = isset($parameter['properties']) ? $parameter['properties'] : array(); - $properties['id'] = $id; - $parameters[$id] = array('type'=>0, 'class' => $parameter['class'], 'properties' => $properties, - 'final' => $final, 'value' => $parameter); - } else { - if(!isset($parameter['value'])) { - $parameters[$id]=array('type'=>1, 'value' => $parameter, 'final' => $final); - } else { - $parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final); - } - } + $properties = isset($parameter['properties'])?$parameter['properties']:array(); + $parameters[$id]=array($parameter['class'],$properties); } else { @@ -142,22 +121,31 @@ class TParameterModule extends TModule $properties=$node->getAttributes(); if(($id=$properties->remove('id'))===null) throw new TConfigurationException('parametermodule_parameterid_required'); - $final = TPropertyValue::ensureBoolean($properties->remove('final')); if(($type=$properties->remove('class'))===null) { if(($value=$properties->remove('value'))===null) - $parameters[$id]=array('type'=>1, 'value' => $node, 'final' => $final); + $parameters[$id]=$node; else - $parameters[$id]=array('type'=>2, 'value' => $value, 'final' => $final); - } - else { - $parameters[$id]=array('type'=>0, 'class' => $type, 'properties' => $properties->toArray(), - 'final' => $final, 'value' => $node); + $parameters[$id]=$value; } + else + $parameters[$id]=array($type,$properties->toArray()); + } + } + + $appParams=$this->getApplication()->getParameters(); + foreach($parameters as $id=>$parameter) + { + if(is_array($parameter)) + { + $component=Prado::createComponent($parameter[0]); + foreach($parameter[1] as $name=>$value) + $component->setSubProperty($name,$value); + $appParams->add($id,$component); } + else + $appParams->add($id,$parameter); } - - $this->getApplication()->mergeParameters($parameters); } /** diff --git a/framework/Util/TRpcClient.php b/framework/Util/TRpcClient.php index dbda931e..fbfb528a 100644 --- a/framework/Util/TRpcClient.php +++ b/framework/Util/TRpcClient.php @@ -66,7 +66,6 @@ class TRpcClient extends TApplicationComponent */ public function __construct($serverUrl, $isNotification = false) { - parent::__construct(); $this->_serverUrl = $serverUrl; $this->_isNotification = TPropertyValue::ensureBoolean($isNotification); } diff --git a/framework/Web/Services/TRpcService.php b/framework/Web/Services/TRpcService.php index afde9bb1..6eff6542 100644 --- a/framework/Web/Services/TRpcService.php +++ b/framework/Web/Services/TRpcService.php @@ -166,7 +166,6 @@ class TRpcServer extends TModule */ public function __construct(TRpcProtocol $protocolHandler) { - parent::__construct(); $this->handler = $protocolHandler; } @@ -247,7 +246,6 @@ abstract class TRpcApiProvider extends TModule public function __construct(TRpcServer $rpcServer) { - parent::__construct(); $this->rpcServer = $rpcServer; foreach($this->registerMethods() as $_methodName => $_methodDetails) diff --git a/framework/Web/Services/TSoapService.php b/framework/Web/Services/TSoapService.php index 4db97544..ddb5cecb 100644 --- a/framework/Web/Services/TSoapService.php +++ b/framework/Web/Services/TSoapService.php @@ -101,7 +101,6 @@ class TSoapService extends TService */ public function __construct() { - parent::__construct(); $this->setID('soap'); } diff --git a/framework/Web/THttpRequest.php b/framework/Web/THttpRequest.php index 925160c8..c16b07a8 100644 --- a/framework/Web/THttpRequest.php +++ b/framework/Web/THttpRequest.php @@ -70,6 +70,8 @@ Prado::using('System.Web.TUrlManager'); */ class THttpRequest extends TApplicationComponent implements IteratorAggregate,ArrayAccess,Countable,IModule { + const CGIFIX__PATH_INFO = 1; + const CGIFIX__SCRIPT_NAME = 2; /** * @var TUrlManager the URL manager module */ @@ -110,6 +112,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar private $_services; private $_requestResolved=false; private $_enableCookieValidation=false; + private $_cgiFix=0; /** * @var string request URL */ @@ -183,7 +186,9 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar else // TBD: in this case, SCRIPT_NAME need to be escaped $this->_requestUri=$_SERVER['SCRIPT_NAME'].(empty($_SERVER['QUERY_STRING'])?'':'?'.$_SERVER['QUERY_STRING']); - if(isset($_SERVER['PATH_INFO'])) + if($this->_cgiFix&self::CGIFIX__PATH_INFO && isset($_SERVER['ORIG_PATH_INFO'])) + $this->_pathInfo=substr($_SERVER['ORIG_PATH_INFO'], strlen($_SERVER['SCRIPT_NAME'])); + elseif(isset($_SERVER['PATH_INFO'])) $this->_pathInfo=$_SERVER['PATH_INFO']; else if(strpos($_SERVER['PHP_SELF'],$_SERVER['SCRIPT_NAME'])===0 && $_SERVER['PHP_SELF']!==$_SERVER['SCRIPT_NAME']) $this->_pathInfo=substr($_SERVER['PHP_SELF'],strlen($_SERVER['SCRIPT_NAME'])); @@ -394,6 +399,9 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar */ public function getApplicationUrl() { + if($this->_cgiFix&self::CGIFIX__SCRIPT_NAME && isset($_SERVER['ORIG_SCRIPT_NAME'])) + return $_SERVER['ORIG_SCRIPT_NAME']; + return $_SERVER['SCRIPT_NAME']; } @@ -518,6 +526,26 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar $this->_enableCookieValidation=TPropertyValue::ensureBoolean($value); } + /** + * @return integer whether to use ORIG_PATH_INFO and/or ORIG_SCRIPT_NAME. Defaults to 0. + * @see THttpRequest::CGIFIX__PATH_INFO, THttpRequest::CGIFIX__SCRIPT_NAME + */ + public function getCgiFix() + { + return $this->_cgiFix; + } + + /** + * Enable this, if you're using PHP via CGI with php.ini setting "cgi.fix_pathinfo=1" + * and have trouble with friendly URL feature. Enable this only if you really know what you are doing! + * @param integer enable bitwise to use ORIG_PATH_INFO and/or ORIG_SCRIPT_NAME. + * @see THttpRequest::CGIFIX__PATH_INFO, THttpRequest::CGIFIX__SCRIPT_NAME + */ + public function setCgiFix($value) + { + $this->_cgiFix=TPropertyValue::ensureInteger($value); + } + /** * @return THttpCookieCollection list of cookies to be sent */ @@ -857,7 +885,6 @@ class THttpCookieCollection extends TList public function __construct($owner=null) { $this->_o=$owner; - parent::__construct(); } /** diff --git a/framework/Web/THttpResponseAdapter.php b/framework/Web/THttpResponseAdapter.php index 2d06d620..6aaaf775 100644 --- a/framework/Web/THttpResponseAdapter.php +++ b/framework/Web/THttpResponseAdapter.php @@ -34,7 +34,6 @@ class THttpResponseAdapter extends TApplicationComponent */ public function __construct($response) { - parent::__construct(); $this->_response=$response; } diff --git a/framework/Web/TUrlMapping.php b/framework/Web/TUrlMapping.php index 049a02a0..732d1a54 100644 --- a/framework/Web/TUrlMapping.php +++ b/framework/Web/TUrlMapping.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web @@ -328,8 +328,8 @@ class TUrlMapping extends TUrlManager if(!(is_array($getItems) || ($getItems instanceof Traversable))) $getItems=array(); $key=$serviceID.':'.$serviceParam; - $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ? - $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*'; + $wildCardKey = ($pos=strrpos($serviceParam,'.'))!==false ? + $serviceID.':'.substr($serviceParam,0,$pos).'.*' : $serviceID.':*'; if(isset($this->_constructRules[$key])) { foreach($this->_constructRules[$key] as $rule) @@ -337,16 +337,16 @@ class TUrlMapping extends TUrlManager if($rule->supportCustomUrl($getItems)) return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); } - } - elseif(isset($this->_constructRules[$wildCardKey])) - { + } + elseif(isset($this->_constructRules[$wildCardKey])) + { foreach($this->_constructRules[$wildCardKey] as $rule) { if($rule->supportCustomUrl($getItems)) - { - $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam; + { + $getItems['*']= $pos ? substr($serviceParam,$pos+1) : $serviceParam; return $rule->constructUrl($getItems,$encodeAmpersand,$encodeGetItems); - } + } } } } @@ -408,42 +408,42 @@ class TUrlMapping extends TUrlManager * The {@link setServiceParameter ServiceParameter} and {@link setServiceID ServiceID} * (the default ID is 'page') set the service parameter and service id respectively. * - * Since 3.1.4 you can also use simplyfied wildcard patterns to match multiple - * ServiceParameters with a single rule. The pattern must contain the placeholder - * {*} for the ServiceParameter. For example - * - * - * - * This rule will match an URL like http://example.com/index.php/admin/edituser - * and resolve it to the page Application.pages.admin.edituser. The wildcard matching - * is non-recursive. That means you have to add a rule for every subdirectory you - * want to access pages in: - * - * - * - * It is still possible to define an explicit rule for a page in the wildcard path. - * This rule has to preceed the wildcard rule. - * - * You can also use parameters with wildcard patterns. The parameters are then - * available with every matching page: - * - * - * - * To enable automatic parameter encoding in a path format fro wildcard patterns you can set - * {@setUrlFormat UrlFormat} to 'Path': - * - * - * - * This will create and parse URLs of the form - * .../index.php/admin/listuser/param1/value1/param2/value2. - * - * Use {@setUrlParamSeparator} to define another separator character between parameter - * name and value. Parameter/value pairs are always separated by a '/'. - * - * - * - * .../index.php/admin/listuser/param1-value1/param2-value2. - * + * Since 3.1.4 you can also use simplyfied wildcard patterns to match multiple + * ServiceParameters with a single rule. The pattern must contain the placeholder + * {*} for the ServiceParameter. For example + * + * + * + * This rule will match an URL like http://example.com/index.php/admin/edituser + * and resolve it to the page Application.pages.admin.edituser. The wildcard matching + * is non-recursive. That means you have to add a rule for every subdirectory you + * want to access pages in: + * + * + * + * It is still possible to define an explicit rule for a page in the wildcard path. + * This rule has to preceed the wildcard rule. + * + * You can also use parameters with wildcard patterns. The parameters are then + * available with every matching page: + * + * + * + * To enable automatic parameter encoding in a path format fro wildcard patterns you can set + * {@setUrlFormat UrlFormat} to 'Path': + * + * + * + * This will create and parse URLs of the form + * .../index.php/admin/listuser/param1/value1/param2/value2. + * + * Use {@setUrlParamSeparator} to define another separator character between parameter + * name and value. Parameter/value pairs are always separated by a '/'. + * + * + * + * .../index.php/admin/listuser/param1-value1/param2-value2. + * * @author Wei Zhuo * @version $Id$ * @package System.Web @@ -477,7 +477,7 @@ class TUrlMappingPattern extends TComponent private $_manager; private $_caseSensitive=true; - + private $_isWildCardPattern=false; private $_urlFormat=THttpRequestUrlFormat::Get; @@ -496,7 +496,6 @@ class TUrlMappingPattern extends TComponent */ public function __construct(TUrlManager $manager) { - parent::__construct(); $this->_manager=$manager; $this->_parameters=new TAttributeCollection; $this->_parameters->setCaseSensitive(true); @@ -519,8 +518,8 @@ class TUrlMappingPattern extends TComponent { if($this->_serviceParameter===null) throw new TConfigurationException('urlmappingpattern_serviceparameter_required', $this->getPattern()); - if(strpos($this->_serviceParameter,'*')!==false) - $this->_isWildCardPattern=true; + if(strpos($this->_serviceParameter,'*')!==false) + $this->_isWildCardPattern=true; } /** @@ -537,19 +536,19 @@ class TUrlMappingPattern extends TComponent $params[]='{'.$key.'}'; $values[]='(?P<'.$key.'>'.$value.')'; } - if ($this->getIsWildCardPattern()) { - $params[]='{*}'; - // service parameter must not contain '=' and '/' - $values[]='(?P<'.$this->getServiceID().'>[^=/]+)'; - } + if ($this->getIsWildCardPattern()) { + $params[]='{*}'; + // service parameter must not contain '=' and '/' + $values[]='(?P<'.$this->getServiceID().'>[^=/]+)'; + } $params[]='/'; $values[]='\\/'; $regexp=str_replace($params,$values,trim($this->getPattern(),'/').'/'); - if ($this->_urlFormat===THttpRequestUrlFormat::Get) + if ($this->_urlFormat===THttpRequestUrlFormat::Get) $regexp='/^'.$regexp.'$/u'; - else + else $regexp='/^'.$regexp.'(?P.*)$/u'; - + if(!$this->getCaseSensitive()) $regexp.='i'; return $regexp; @@ -664,30 +663,30 @@ class TUrlMappingPattern extends TComponent preg_match($pattern,$request->getPathInfo(),$matches); else preg_match($this->getParameterizedPattern(),trim($request->getPathInfo(),'/').'/',$matches); - - if($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) - $matches[$this->_serviceID]=str_replace('*',$matches[$this->_serviceID],$this->_serviceParameter); - - if (isset($matches['urlparams'])) - { - $params=explode('/',$matches['urlparams']); - if ($this->_separator==='/') - { - while($key=array_shift($params)) - $matches[$key]=($value=array_shift($params)) ? $value : ''; - } - else - { - array_pop($params); - foreach($params as $param) - { - list($key,$value)=explode($this->_separator,$param,2); - $matches[$key]=$value; - } - } - unset($matches['urlparams']); - } - + + if($this->getIsWildCardPattern() && isset($matches[$this->_serviceID])) + $matches[$this->_serviceID]=str_replace('*',$matches[$this->_serviceID],$this->_serviceParameter); + + if (isset($matches['urlparams'])) + { + $params=explode('/',$matches['urlparams']); + if ($this->_separator==='/') + { + while($key=array_shift($params)) + $matches2[$key]=($value=array_shift($params)) ? $value : ''; + } + else + { + array_pop($params); + foreach($params as $param) + { + list($key,$value)=explode($this->_separator,$param,2); + $matches[$key]=$value; + } + } + unset($matches['urlparams']); + } + return $matches; } @@ -823,12 +822,12 @@ class TUrlMappingPattern extends TComponent // for the rest of the GET variables, put them in the query string if(count($extra)>0) { - if ($this->_urlFormat===THttpRequestUrlFormat::Path && $this->getIsWildCardPattern()) { - foreach ($extra as $name=>$value) - $url.='/'.$name.$this->_separator.($encodeGetItems?rawurlencode($value):$value); - return $url; - } - + if ($this->_urlFormat===THttpRequestUrlFormat::Path && $this->getIsWildCardPattern()) { + foreach ($extra as $name=>$value) + $url.='/'.$name.$this->_separator.($encodeGetItems?rawurlencode($value):$value); + return $url; + } + $url2=''; $amp=$encodeAmpersand?'&':'&'; if($encodeGetItems) diff --git a/framework/Web/UI/ActiveControls/TActiveDataGrid.php b/framework/Web/UI/ActiveControls/TActiveDataGrid.php index c298bd2a..13ba650a 100644 --- a/framework/Web/UI/ActiveControls/TActiveDataGrid.php +++ b/framework/Web/UI/ActiveControls/TActiveDataGrid.php @@ -49,7 +49,7 @@ Prado::using('System.Web.UI.WebControls.TCheckBoxColumn'); * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveDataGrid extends TDataGrid implements IActiveControl, ISurroundable { /** @@ -185,7 +185,7 @@ class TActiveDataGrid extends TDataGrid implements IActiveControl, ISurroundable * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveBoundColumn extends TBoundColumn { protected function initializeHeaderCell($cell,$columnIndex) { @@ -264,7 +264,7 @@ class TActiveBoundColumn extends TBoundColumn { * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveEditCommandColumn extends TEditCommandColumn { protected function createButton($commandName,$text,$causesValidation,$validationGroup) { @@ -306,7 +306,7 @@ class TActiveEditCommandColumn extends TEditCommandColumn { * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveButtonColumn extends TButtonColumn { public function initializeCell($cell,$columnIndex,$itemType) { @@ -353,7 +353,7 @@ class TActiveButtonColumn extends TButtonColumn { * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveTemplateColumn extends TTemplateColumn { protected function initializeHeaderCell($cell,$columnIndex) { @@ -422,7 +422,7 @@ class TActiveTemplateColumn extends TTemplateColumn { * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveHyperLinkColumn extends THyperLinkColumn { @@ -502,7 +502,7 @@ class TActiveHyperLinkColumn extends THyperLinkColumn * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveCheckBoxColumn extends TCheckBoxColumn { @@ -608,7 +608,7 @@ class TActiveCheckBoxColumn extends TCheckBoxColumn * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveDropDownListColumn extends TDropDownListColumn { @@ -696,7 +696,7 @@ class TActiveDropDownListColumn extends TDropDownListColumn * * @author Fabio Bas * @package System.Web.UI.ActiveControls - * @since 3.2.0a + * @since 3.1.9 */ class TActiveLiteralColumn extends TLiteralColumn { protected function initializeHeaderCell($cell,$columnIndex) { diff --git a/framework/Web/UI/ActiveControls/TActiveRatingList.php b/framework/Web/UI/ActiveControls/TActiveRatingList.php index cee1bcd4..473ca06a 100644 --- a/framework/Web/UI/ActiveControls/TActiveRatingList.php +++ b/framework/Web/UI/ActiveControls/TActiveRatingList.php @@ -31,9 +31,9 @@ class TActiveRatingList extends TRatingList implements IActiveControl, ICallback */ public function __construct() { - parent::__construct(); $this->setAdapter(new TActiveListControlAdapter($this)); $this->setAutoPostBack(true); + parent::__construct(); } /** diff --git a/framework/Web/UI/ActiveControls/TActiveRepeater.php b/framework/Web/UI/ActiveControls/TActiveRepeater.php index ccfda4aa..8b30bbe2 100644 --- a/framework/Web/UI/ActiveControls/TActiveRepeater.php +++ b/framework/Web/UI/ActiveControls/TActiveRepeater.php @@ -4,7 +4,7 @@ * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 * @version $Id: TActiveRepeater.php 2707 2009-09-29 10:33:30Z Christophe.Boulain $ */ @@ -22,7 +22,7 @@ * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveRepeater extends TRepeater implements IActiveControl, ISurroundable { diff --git a/framework/Web/UI/ActiveControls/TActiveTableCell.php b/framework/Web/UI/ActiveControls/TActiveTableCell.php index 833ce6e7..32c9bd46 100644 --- a/framework/Web/UI/ActiveControls/TActiveTableCell.php +++ b/framework/Web/UI/ActiveControls/TActiveTableCell.php @@ -47,7 +47,7 @@ Prado::using('System.Web.UI.ActiveControls.TCallbackEventParameter'); * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls * @version $Id$ - * @since 3.2 + * @since 3.1.9 */ class TActiveTableCell extends TTableCell implements ICallbackEventHandler, IActiveControl { @@ -212,7 +212,7 @@ class TActiveTableCell extends TTableCell implements ICallbackEventHandler, IAct * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveTableCellEventParameter extends TCallbackEventParameter { diff --git a/framework/Web/UI/ActiveControls/TActiveTableRow.php b/framework/Web/UI/ActiveControls/TActiveTableRow.php index 31287617..f021de7e 100644 --- a/framework/Web/UI/ActiveControls/TActiveTableRow.php +++ b/framework/Web/UI/ActiveControls/TActiveTableRow.php @@ -48,7 +48,7 @@ Prado::using('System.Web.UI.ActiveControls.TCallbackEventParameter'); * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls * @version $Id$ - * @since 3.2 + * @since 3.1.9 */ class TActiveTableRow extends TTableRow implements ICallbackEventHandler, IActiveControl { @@ -231,7 +231,7 @@ class TActiveTableRow extends TTableRow implements ICallbackEventHandler, IActiv * * @author LANDWEHR Computer und Software GmbH * @package System.Web.UI.ActiveControls - * @since 3.2 + * @since 3.1.9 */ class TActiveTableRowEventParameter extends TCallbackEventParameter { diff --git a/framework/Web/UI/ActiveControls/TAutoComplete.php b/framework/Web/UI/ActiveControls/TAutoComplete.php index f5977a01..2ae01d2b 100644 --- a/framework/Web/UI/ActiveControls/TAutoComplete.php +++ b/framework/Web/UI/ActiveControls/TAutoComplete.php @@ -425,7 +425,6 @@ class TAutoCompleteTemplate extends TComponent implements ITemplate public function __construct($template) { - parent::__construct(); $this->_template = $template; } /** diff --git a/framework/Web/UI/ActiveControls/TBaseActiveControl.php b/framework/Web/UI/ActiveControls/TBaseActiveControl.php index 2afec4d1..92dd3194 100644 --- a/framework/Web/UI/ActiveControls/TBaseActiveControl.php +++ b/framework/Web/UI/ActiveControls/TBaseActiveControl.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.ActiveControls @@ -44,7 +44,6 @@ class TBaseActiveControl extends TComponent */ public function __construct($control) { - parent::__construct(); $this->_control = $control; $this->_options = new TMap; } diff --git a/framework/Web/UI/ActiveControls/TCallbackClientScript.php b/framework/Web/UI/ActiveControls/TCallbackClientScript.php index 220b5323..d35e89a0 100644 --- a/framework/Web/UI/ActiveControls/TCallbackClientScript.php +++ b/framework/Web/UI/ActiveControls/TCallbackClientScript.php @@ -44,7 +44,6 @@ class TCallbackClientScript extends TApplicationComponent */ public function __construct() { - parent::__construct(); $this->_actions = new TList; } diff --git a/framework/Web/UI/ActiveControls/TCallbackEventParameter.php b/framework/Web/UI/ActiveControls/TCallbackEventParameter.php index 060c4431..2dbb581c 100644 --- a/framework/Web/UI/ActiveControls/TCallbackEventParameter.php +++ b/framework/Web/UI/ActiveControls/TCallbackEventParameter.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.ActiveControls @@ -14,7 +14,7 @@ * TCallbackEventParameter class. * * The TCallbackEventParameter provides the parameter passed during the callback - * requestion in the {@link getCallbackParameter CallbackParameter} property. The + * request in the {@link getCallbackParameter CallbackParameter} property. The * callback response content (e.g. new HTML content) must be rendered * using an THtmlWriter obtained from the {@link getNewWriter NewWriter} * property, which returns a NEW instance of TCallbackResponseWriter. @@ -48,7 +48,6 @@ class TCallbackEventParameter extends TEventParameter */ public function __construct($response, $parameter) { - parent::__construct(); $this->_response = $response; $this->_parameter = $parameter; } diff --git a/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php b/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php index 32e93a86..6425b123 100755 --- a/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php +++ b/framework/Web/UI/ActiveControls/TCallbackResponseAdapter.php @@ -126,7 +126,6 @@ class TCallbackResponseWriter extends TTextWriter */ public function __construct() { - parent::__construct(); $this->_boundary = sprintf('%x',crc32(microtime())); } diff --git a/framework/Web/UI/ActiveControls/TDraggable.php b/framework/Web/UI/ActiveControls/TDraggable.php index 773babca..34d8c548 100755 --- a/framework/Web/UI/ActiveControls/TDraggable.php +++ b/framework/Web/UI/ActiveControls/TDraggable.php @@ -238,4 +238,3 @@ class TDraggableRevertOptions extends TEnumerable const Revert='Revert'; const Failure='Failure'; } -?> diff --git a/framework/Web/UI/ActiveControls/TDropContainer.php b/framework/Web/UI/ActiveControls/TDropContainer.php index 5271cde6..915aa8f9 100755 --- a/framework/Web/UI/ActiveControls/TDropContainer.php +++ b/framework/Web/UI/ActiveControls/TDropContainer.php @@ -265,7 +265,6 @@ class TDropContainerEventParameter extends TEventParameter public function __construct($dropParams) { - parent::__construct(); $this->_dragElementId = $dropParams->DragElementID; $this->_screenX = $dropParams->ScreenX; $this->_screenY = $dropParams->ScreenY; @@ -309,4 +308,3 @@ class TDropContainerEventParameter extends TEventParameter return $control; } } -?> diff --git a/framework/Web/UI/ActiveControls/TTriggeredCallback.php b/framework/Web/UI/ActiveControls/TTriggeredCallback.php index 7ae0781d..72a709d0 100644 --- a/framework/Web/UI/ActiveControls/TTriggeredCallback.php +++ b/framework/Web/UI/ActiveControls/TTriggeredCallback.php @@ -4,14 +4,13 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.ActiveControls */ - -prado::using('System.Web.UI.ActiveControls.TCallback'); +Prado::using('System.Web.UI.ActiveControls.TCallback'); /** * TTriggeredCallback abstract Class * diff --git a/framework/Web/UI/TClientScriptManager.php b/framework/Web/UI/TClientScriptManager.php index cf5f33d4..ee078b9b 100644 --- a/framework/Web/UI/TClientScriptManager.php +++ b/framework/Web/UI/TClientScriptManager.php @@ -88,7 +88,6 @@ class TClientScriptManager extends TApplicationComponent */ public function __construct(TPage $owner) { - parent::__construct(); $this->_page=$owner; } @@ -696,7 +695,6 @@ abstract class TClientSideOptions extends TComponent */ public function __construct() { - parent::__construct(); $this->_options = Prado::createComponent('System.Collections.TMap'); } diff --git a/framework/Web/UI/TControl.php b/framework/Web/UI/TControl.php index 0181d206..1c03a04d 100644 --- a/framework/Web/UI/TControl.php +++ b/framework/Web/UI/TControl.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI @@ -172,17 +172,12 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable * @var array a collection of rare control data */ private $_rf=array(); - /** - * @var number this is how many times the control was told not to render - */ - private $_renderblockcount=0; /** * Constructor. */ public function __construct() { - parent::__construct(); } /** @@ -241,21 +236,6 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable return $this->_parent; } - /** - * @return TControl the parent of this control of type - */ - public function getParentOfType($type,$strict=false) - { - $control = $this->Parent; - do { - if(is_object($control) && (get_class($control)===$type || (!$strict && ($control instanceof $type)))) - return $control; - $control = $control->Parent; - } while($control); - - return null; - } - /** * @return TControl the naming container of this control */ @@ -316,32 +296,6 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable return $this->_tplControl; } - /** - * This adds a block to the rendering of the control - */ - public function addRenderBlock() - { - ++$this->_renderblockcount; - } - - /** - * @return boolean true if the rendering is currently blocked - */ - public function getIsRenderBlocked() - { - return $this->_renderblockcount > 0; - } - - /** - * removes a block. This also has an interesting effect of forcing the render if called in the reverse - * of the typical order. eg. removeRenderBlock(); ...... addRenderBlock(); - */ - public function removeRenderBlock() - { - --$this->_renderblockcount; - } - - /** * @return TTemplateControl the control whose template is loaded from * some external storage, such as file, db, and whose template ultimately @@ -490,13 +444,6 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable $this->_rf[self::RF_SKIN_ID]=$value; } - /** - * @return boolean whether the skin has been applied or is past the phase of skin application - */ - public function getIsSkinApplied() { - return ($this->_flags & self::IS_SKIN_APPLIED) || $this->_stage>self::CS_CHILD_INITIALIZED; - } - /** * @return boolean whether theming is enabled for this control. * The theming is enabled if the control and all its parents have it enabled. @@ -1617,8 +1564,6 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable { if($this->getHasControls()) { - if($this->IsRenderBlocked) return; - foreach($this->_rf[self::RF_CONTROLS] as $control) { if(is_string($control)) @@ -2052,14 +1997,14 @@ interface IValidatable * @return mixed the value of the property to be validated. */ public function getValidationPropertyValue(); - /** - * @return boolean wether this control's validators validated successfully (must default to true) - */ - public function getIsValid(); - /** - * @return boolean wether this control's validators validated successfully - */ - public function setIsValid($value); + /** + * @return boolean wether this control's validators validated successfully (must default to true) + */ + public function getIsValid(); + /** + * @return boolean wether this control's validators validated successfully + */ + public function setIsValid($value); } /** @@ -2318,7 +2263,6 @@ class TCommandEventParameter extends TEventParameter */ public function __construct($name='',$parameter='') { - parent::__construct(); $this->_name=$name; $this->_param=$parameter; } diff --git a/framework/Web/UI/TControlAdapter.php b/framework/Web/UI/TControlAdapter.php index b59da59c..16a8c839 100644 --- a/framework/Web/UI/TControlAdapter.php +++ b/framework/Web/UI/TControlAdapter.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI @@ -34,7 +34,6 @@ class TControlAdapter extends TApplicationComponent */ public function __construct($control) { - parent::__construct(); $this->_control=$control; } diff --git a/framework/Web/UI/THtmlWriter.php b/framework/Web/UI/THtmlWriter.php index 1a888508..8af52452 100644 --- a/framework/Web/UI/THtmlWriter.php +++ b/framework/Web/UI/THtmlWriter.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI @@ -108,7 +108,6 @@ class THtmlWriter extends TApplicationComponent implements ITextWriter */ public function __construct($writer) { - parent::__construct(); $this->_writer=$writer; } diff --git a/framework/Web/UI/TPage.php b/framework/Web/UI/TPage.php index 5405391d..cde3b3db 100644 --- a/framework/Web/UI/TPage.php +++ b/framework/Web/UI/TPage.php @@ -22,6 +22,7 @@ Prado::using('System.Web.UI.TClientScriptManager'); * TPage class * * @author Qiang Xue + * @author Brad Anderson * @version $Id$ * @package System.Web.UI * @since 3.0 @@ -50,21 +51,13 @@ class TPage extends TTemplateControl implements IPageEvents 'PRADO_CALLBACK_PARAMETER'=>true ); /** - * @var THtml html instance + * @var TForm form instance */ - private $_html; + private $_form; /** * @var THead head instance */ private $_head; - /** - * @var TBody body instance - */ - private $_body; - /** - * @var TForm form instance - */ - private $_form; /** * @var array list of registered validators */ @@ -77,10 +70,6 @@ class TPage extends TTemplateControl implements IPageEvents * @var TTheme page theme */ private $_theme; - /** - * @var collection of all the skins - */ - private $_skincontrols = array(); /** * @var string page title set when Head is not in page yet */ @@ -578,11 +567,8 @@ class TPage extends TTemplateControl implements IPageEvents */ public function applyControlSkin($control) { - if(($theme=$this->getTheme())!==null) { + if(($theme=$this->getTheme())!==null) $theme->applySkin($control); - if($control->SkinID) - $this->registerSkin($control); - } } /** @@ -1012,48 +998,6 @@ class TPage extends TTemplateControl implements IPageEvents $this->_enableJavaScript=TPropertyValue::ensureBoolean($value); } - /** - * @return THtml, null if not available - */ - public function getHtml() - { - return $this->_html; - } - - /** - * @param THead page head - * @throws TInvalidOperationException if a head already exists - */ - public function setHtml(THtml $value) - { - if($this->_html===null) - $this->_html = $value; - else - throw new TInvalidOperationException('page_body_duplicated'); - } - - /** - * @return TBody the body on the page - */ - public function getBody() - { - return $this->_body; - } - - /** - * Registers the TBody instance on the page. - * Note, a page can contain at most one TBody instance. - * @param TBody the form on the page - * @throws TInvalidOperationException if this method is invoked more than once. - */ - public function setBody(TBody $body) - { - if($this->_body===null) - $this->_body=$body; - else - throw new TInvalidOperationException('page_body_duplicated'); - } - /** * @return THead page head, null if not available */ @@ -1246,78 +1190,6 @@ class TPage extends TTemplateControl implements IPageEvents } } - /** - * Registers a controls skin id with the page. This function links the control to its skin on the page for access. - * @param TControl the object to register the skinid - */ - protected function registerSkin($control) - { - $id = $control->SkinID; - if(!$id) return; - - if(!is_array($this->_skincontrols)) - $this->_skincontrols = array(); - - if(!isset($this->_skincontrols[$id])) - $this->_skincontrols[$id] = array(); - - $this->_skincontrols[$id][] = $control; - } - - /** - * This gets a control based on its SkinId. If there are multiple controls with the same skin, - * you can give this method the second parameter for an index into all the controls with that - * skin id. This will return the first one if and index is not specifiec - * @param string $skinid the skin to look for within the page - * @param index $index the index of the skin if there are many of the same name, defaults to 0 or the first - */ - public function getSkinControl($skinid, $index = 0) - { - if(isset($this->_skincontrols[$skinid][$index])) - return $this->_skincontrols[$skinid][$index]; - } - - /** - * This gets a control based on its SkinId. If there are multiple controls with the same skin, - * you can give this method the second parameter for an index into all the controls with that - * skin id. This will return the first one if and index is not specifiec - * @param string $skinid the skin to look for within the page - */ - public function getSkinControls($skinid) - { - if(isset($this->_skincontrols[$skinid])) - return $this->_skincontrols[$skinid]; - } - - /** - * Return the count of the skins with that id - * @param integer $skinid the skin to look for within the page - */ - public function getSkinControlCount($skinid) - { - if(isset($this->_skincontrols[$skinid])) - return count($this->_skincontrols[$skinid]); - } - public function getSkinControlsByType($skinid, $type) - { - $result = array(); - if(isset($this->_skincontrols[$skinid])) - foreach($this->_skincontrols[$skinid] as $ctl) - if($ctl instanceof $type) - $result[] = $ctl; - - return $result; - } - - public function getSkinControlByType($skinid, $type, $index = 0) - { - if(isset($this->_skincontrols[$skinid])) - foreach($this->_skincontrols[$skinid] as $ctl) - if(($ctl instanceof $type) && $index--) - return $ctl; - } - - /** * @return TStack stack of {@link TOutputCache} objects */ diff --git a/framework/Web/UI/TTemplateManager.php b/framework/Web/UI/TTemplateManager.php index 49873340..5d1f5e44 100644 --- a/framework/Web/UI/TTemplateManager.php +++ b/framework/Web/UI/TTemplateManager.php @@ -239,7 +239,6 @@ class TTemplate extends TApplicationComponent implements ITemplate */ public function __construct($template,$contextPath,$tplFile=null,$startingLine=0,$sourceTemplate=true) { - parent::__construct(); $this->_sourceTemplate=$sourceTemplate; $this->_contextPath=$contextPath; $this->_tplFile=$tplFile; diff --git a/framework/Web/UI/TThemeManager.php b/framework/Web/UI/TThemeManager.php index 59b794ce..410976c4 100644 --- a/framework/Web/UI/TThemeManager.php +++ b/framework/Web/UI/TThemeManager.php @@ -229,7 +229,6 @@ class TTheme extends TApplicationComponent implements ITheme */ public function __construct($themePath,$themeUrl) { - parent::__construct(); $this->_themeUrl=$themeUrl; $this->_themePath=realpath($themePath); $this->_name=basename($themePath); diff --git a/framework/Web/UI/WebControls/TBulletedList.php b/framework/Web/UI/WebControls/TBulletedList.php index 2c8e3c97..5f4aa49c 100644 --- a/framework/Web/UI/WebControls/TBulletedList.php +++ b/framework/Web/UI/WebControls/TBulletedList.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -431,7 +431,6 @@ class TBulletedListEventParameter extends TEventParameter */ public function __construct($index) { - parent::__construct(); $this->_index=$index; } diff --git a/framework/Web/UI/WebControls/TCustomValidator.php b/framework/Web/UI/WebControls/TCustomValidator.php index f0e05370..7fed2b84 100644 --- a/framework/Web/UI/WebControls/TCustomValidator.php +++ b/framework/Web/UI/WebControls/TCustomValidator.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -180,7 +180,6 @@ class TServerValidateEventParameter extends TEventParameter */ public function __construct($value,$isValid) { - parent::__construct(); $this->_value=$value; $this->setIsValid($isValid); } diff --git a/framework/Web/UI/WebControls/TDataGrid.php b/framework/Web/UI/WebControls/TDataGrid.php index 4c7fca97..b4916342 100644 --- a/framework/Web/UI/WebControls/TDataGrid.php +++ b/framework/Web/UI/WebControls/TDataGrid.php @@ -9,7 +9,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -1689,7 +1689,6 @@ class TDataGridItemEventParameter extends TEventParameter */ public function __construct(TDataGridItem $item) { - parent::__construct(); $this->_item=$item; } @@ -1728,7 +1727,6 @@ class TDataGridPagerEventParameter extends TEventParameter */ public function __construct(TDataGridPager $pager) { - parent::__construct(); $this->_pager=$pager; } @@ -1830,7 +1828,6 @@ class TDataGridSortCommandEventParameter extends TEventParameter */ public function __construct($source,TDataGridCommandEventParameter $param) { - parent::__construct(); $this->_source=$source; $this->_sortExpression=$param->getCommandParameter(); } @@ -1885,7 +1882,6 @@ class TDataGridPageChangedEventParameter extends TEventParameter */ public function __construct($source,$newPageIndex) { - parent::__construct(); $this->_source=$source; $this->_newIndex=$newPageIndex; } @@ -1950,7 +1946,6 @@ class TDataGridItem extends TTableRow implements INamingContainer */ public function __construct($itemIndex,$dataSourceIndex,$itemType) { - parent::__construct(); $this->_itemIndex=$itemIndex; $this->_dataSourceIndex=$dataSourceIndex; $this->setItemType($itemType); @@ -2070,7 +2065,6 @@ class TDataGridPager extends TPanel implements INamingContainer */ public function __construct($dataGrid) { - parent::__construct(); $this->_dataGrid=$dataGrid; } @@ -2162,7 +2156,6 @@ class TDataGridColumnCollection extends TList */ public function __construct(TDataGrid $owner) { - parent::__construct(); $this->_o=$owner; } diff --git a/framework/Web/UI/WebControls/TDataList.php b/framework/Web/UI/WebControls/TDataList.php index 0bbfc9ac..1349d6a6 100644 --- a/framework/Web/UI/WebControls/TDataList.php +++ b/framework/Web/UI/WebControls/TDataList.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -1517,7 +1517,6 @@ class TDataListItemEventParameter extends TEventParameter */ public function __construct($item) { - parent::__construct(); $this->_item=$item; } diff --git a/framework/Web/UI/WebControls/TDataSourceControl.php b/framework/Web/UI/WebControls/TDataSourceControl.php index 1deaa857..1d0823ff 100644 --- a/framework/Web/UI/WebControls/TDataSourceControl.php +++ b/framework/Web/UI/WebControls/TDataSourceControl.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -103,8 +103,6 @@ class TReadOnlyDataSource extends TDataSourceControl { if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable)) throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid'); - - parent::__construct(); $this->_dataSource=$dataSource; $this->_dataMember=$dataMember; } diff --git a/framework/Web/UI/WebControls/TDataSourceView.php b/framework/Web/UI/WebControls/TDataSourceView.php index d631352d..7297fd45 100644 --- a/framework/Web/UI/WebControls/TDataSourceView.php +++ b/framework/Web/UI/WebControls/TDataSourceView.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -87,8 +87,6 @@ abstract class TDataSourceView extends TComponent public function __construct(IDataSource $owner,$viewName) { - parent::__construct(); - $this->_owner=$owner; $this->_name=$viewName; } diff --git a/framework/Web/UI/WebControls/TDropDownListColumn.php b/framework/Web/UI/WebControls/TDropDownListColumn.php index c7bd5ef8..a225abac 100644 --- a/framework/Web/UI/WebControls/TDropDownListColumn.php +++ b/framework/Web/UI/WebControls/TDropDownListColumn.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -66,7 +66,6 @@ class TDropDownListColumn extends TDataGridColumn public function __construct() { - parent::__construct(); $this->_listControl=new TDropDownList; } diff --git a/framework/Web/UI/WebControls/THtmlArea.php b/framework/Web/UI/WebControls/THtmlArea.php index ba31b713..0352319b 100644 --- a/framework/Web/UI/WebControls/THtmlArea.php +++ b/framework/Web/UI/WebControls/THtmlArea.php @@ -4,7 +4,7 @@ * * @author Wei Zhuo * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -221,7 +221,6 @@ class THtmlArea extends TTextBox */ public function __construct() { - parent::__construct(); $this->setWidth('470px'); $this->setHeight('250px'); } diff --git a/framework/Web/UI/WebControls/TImageButton.php b/framework/Web/UI/WebControls/TImageButton.php index 65cf972f..3fa9845a 100644 --- a/framework/Web/UI/WebControls/TImageButton.php +++ b/framework/Web/UI/WebControls/TImageButton.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -402,7 +402,6 @@ class TImageClickEventParameter extends TEventParameter */ public function __construct($x,$y) { - parent::__construct(); $this->_x=$x; $this->_y=$y; } diff --git a/framework/Web/UI/WebControls/TImageMap.php b/framework/Web/UI/WebControls/TImageMap.php index 89b77c71..d0cd8a0a 100644 --- a/framework/Web/UI/WebControls/TImageMap.php +++ b/framework/Web/UI/WebControls/TImageMap.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -244,7 +244,6 @@ class TImageMapEventParameter extends TEventParameter */ public function __construct($postBackValue) { - parent::__construct(); $this->_postBackValue=$postBackValue; } diff --git a/framework/Web/UI/WebControls/TListItem.php b/framework/Web/UI/WebControls/TListItem.php index 9ba24bec..eb72d183 100644 --- a/framework/Web/UI/WebControls/TListItem.php +++ b/framework/Web/UI/WebControls/TListItem.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-20010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -57,8 +57,6 @@ class TListItem extends TComponent */ public function __construct($text='',$value='',$enabled=true,$selected=false) { - parent::__construct(); - $this->setText($text); $this->setValue($value); $this->setEnabled($enabled); diff --git a/framework/Web/UI/WebControls/TPager.php b/framework/Web/UI/WebControls/TPager.php index a33b523a..51ea2a11 100644 --- a/framework/Web/UI/WebControls/TPager.php +++ b/framework/Web/UI/WebControls/TPager.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2008 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -726,8 +726,6 @@ class TPagerPageChangedEventParameter extends TEventParameter */ public function __construct($source,$newPageIndex) { - parent::__construct(); - $this->_source=$source; $this->_newIndex=$newPageIndex; } diff --git a/framework/Web/UI/WebControls/TRepeater.php b/framework/Web/UI/WebControls/TRepeater.php index fa4d7b7f..a6c9903d 100644 --- a/framework/Web/UI/WebControls/TRepeater.php +++ b/framework/Web/UI/WebControls/TRepeater.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -802,7 +802,6 @@ class TRepeaterItemEventParameter extends TEventParameter */ public function __construct($item) { - parent::__construct(); $this->_item=$item; } diff --git a/framework/Web/UI/WebControls/TStyle.php b/framework/Web/UI/WebControls/TStyle.php index b507c8e3..1b94cc8e 100644 --- a/framework/Web/UI/WebControls/TStyle.php +++ b/framework/Web/UI/WebControls/TStyle.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -54,8 +54,6 @@ class TStyle extends TComponent */ public function __construct($style=null) { - parent::__construct(); - if($style!==null) $this->copyFrom($style); } diff --git a/framework/Web/UI/WebControls/TWizard.php b/framework/Web/UI/WebControls/TWizard.php index 4252a159..a9268b2b 100644 --- a/framework/Web/UI/WebControls/TWizard.php +++ b/framework/Web/UI/WebControls/TWizard.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Web.UI.WebControls @@ -1397,21 +1397,21 @@ class TWizard extends TWebControl implements INamingContainer else if(strcasecmp($command,self::CMD_MOVETO)===0) { if($this->_cancelNavigation) // may be set in onSideBarButtonClick - $navParam->setCancelNavigation(true); - $requestedStep=$param->getCommandParameter(); - if (!is_numeric($requestedStep)) - { - $requestedIndex=-1; - foreach ($this->getWizardSteps() as $index=>$step) - if ($step->getId()===$requestedStep) - { - $requestedIndex=$index; - break; - } - if ($requestedIndex<0) - throw new TConfigurationException('wizard_step_invalid'); - } - else + $navParam->setCancelNavigation(true); + $requestedStep=$param->getCommandParameter(); + if (!is_numeric($requestedStep)) + { + $requestedIndex=-1; + foreach ($this->getWizardSteps() as $index=>$step) + if ($step->getId()===$requestedStep) + { + $requestedIndex=$index; + break; + } + if ($requestedIndex<0) + throw new TConfigurationException('wizard_step_invalid'); + } + else $requestedIndex=TPropertyValue::ensureInteger($requestedStep); $navParam->setNextStepIndex($requestedIndex); $handled=true; @@ -1693,7 +1693,6 @@ class TWizardStepCollection extends TList */ public function __construct(TWizard $wizard) { - parent::__construct(); $this->_wizard=$wizard; } diff --git a/framework/Web/UI/WebControls/TXmlTransform.php b/framework/Web/UI/WebControls/TXmlTransform.php index d00ab974..c1a372e1 100644 --- a/framework/Web/UI/WebControls/TXmlTransform.php +++ b/framework/Web/UI/WebControls/TXmlTransform.php @@ -5,7 +5,7 @@ * @author Knut Urdalen * @author Qiang Xue * @link http://www.pradosoft.com - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @package System.Web.UI.WebControls */ @@ -49,7 +49,6 @@ class TXmlTransform extends TControl { if(!class_exists('XSLTProcessor', false)) { throw new TConfigurationException('xmltransform_xslextension_required'); } - parent::__construct(); } /** diff --git a/framework/Xml/TXmlDocument.php b/framework/Xml/TXmlDocument.php index 42a302f1..4ea2056e 100644 --- a/framework/Xml/TXmlDocument.php +++ b/framework/Xml/TXmlDocument.php @@ -4,7 +4,7 @@ * * @author Qiang Xue * @link http://www.pradosoft.com/ - * @copyright Copyright © 2005-2010 PradoSoft + * @copyright Copyright © 2005-2008 PradoSoft * @license http://www.pradosoft.com/license/ * @version $Id$ * @package System.Xml @@ -55,7 +55,6 @@ class TXmlElement extends TComponent */ public function __construct($tagName) { - parent::__construct(); $this->setTagName($tagName); } @@ -520,7 +519,6 @@ class TXmlElementList extends TList */ public function __construct(TXmlElement $owner) { - parent::__construct(); $this->_o=$owner; } -- cgit v1.2.3