summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
Diffstat (limited to 'framework')
-rw-r--r--framework/pradolite.php7457
1 files changed, 138 insertions, 7319 deletions
diff --git a/framework/pradolite.php b/framework/pradolite.php
index 2558e7ce..ac380d8c 100644
--- a/framework/pradolite.php
+++ b/framework/pradolite.php
@@ -396,7 +396,7 @@ return $this->_c;
}
public function itemAt($index)
{
-if(isset($this->_d[$index]))
+if($index>=0 && $index<$this->_c)
return $this->_d[$index];
else
throw new TInvalidDataValueException('list_index_invalid',$index);
@@ -426,16 +426,18 @@ throw new TInvalidDataValueException('list_item_inexistent');
}
public function removeAt($index)
{
-if(isset($this->_d[$index]))
+if($index>=0 && $index<$this->_c)
{
-$item=$this->_d[$index];
-if($index===$this->_c-1)
-unset($this->_d[$index]);
+$this->_c--;
+if($index===$this->_c)
+return array_pop($this->_d);
else
+{
+$item=$this->_d[$index];
array_splice($this->_d,$index,1);
-$this->_c--;
return $item;
}
+}
else
throw new TInvalidDataValueException('list_index_invalid',$index);
}
@@ -483,11 +485,11 @@ throw new TInvalidDataTypeException('list_data_not_iterable');
}
public function offsetExists($offset)
{
-return isset($this->_d[$offset]);
+return ($offset>=0 && $offset<$this->_c);
}
public function offsetGet($offset)
{
-if(isset($this->_d[$offset]))
+if($offset>=0 && $offset<$this->_c)
return $this->_d[$offset];
else
throw new TInvalidDataValueException('list_index_invalid',$offset);
@@ -511,10 +513,12 @@ class TListIterator implements Iterator
{
private $_d;
private $_i;
+private $_c;
public function __construct(&$data)
{
$this->_d=&$data;
$this->_i=0;
+$this->_c=count($this->_d);
}
public function rewind()
{
@@ -534,7 +538,7 @@ $this->_i++;
}
public function valid()
{
-return isset($this->_d[$this->_i]);
+return $this->_i<$this->_c;
}
}
@@ -565,13 +569,11 @@ return isset($this->_d[$key]) ? $this->_d[$key] : null;
}
public function add($key,$value)
{
-if(isset($this->_d[$key]))
-$this->remove($key);
$this->_d[$key]=$value;
}
public function remove($key)
{
-if(isset($this->_d[$key]))
+if(isset($this->_d[$key]) || array_key_exists($key,$this->_d))
{
$value=$this->_d[$key];
unset($this->_d[$key]);
@@ -587,7 +589,7 @@ $this->remove($key);
}
public function contains($key)
{
-return isset($this->_d[$key]);
+return isset($this->_d[$key]) || array_key_exists($key,$this->_d);
}
public function toArray()
{
@@ -656,11 +658,7 @@ return $this->_d[$this->_key];
}
public function next()
{
-do
-{
$this->_key=next($this->_keys);
-}
-while(!isset($this->_d[$this->_key]) && $this->_key!==false);
}
public function valid()
{
@@ -708,266 +706,6 @@ return true;
}
}
-class TPagedDataSource extends TComponent implements IteratorAggregate
-{
-private $_dataSource=null;
-private $_pageSize=10;
-private $_currentPageIndex=0;
-private $_allowPaging=false;
-private $_allowCustomPaging=false;
-private $_virtualCount=0;
-public function getDataSource()
-{
-return $this->_dataSource;
-}
-public function setDataSource($value)
-{
-if(!($value instanceof TMap) && !($value instanceof TList))
-{
-if(is_array($value))
-$value=new TMap($value);
-else if($value instanceof Traversable)
-$value=new TList($value);
-else if($value!==null)
-throw new TInvalidDataTypeException('pageddatasource_datasource_invalid');
-}
-$this->_dataSource=$value;
-}
-public function getPageSize()
-{
-return $this->_pageSize;
-}
-public function setPageSize($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))>0)
-$this->_pageSize=$value;
-else
-throw new TInvalidDataValueException('pageddatasource_pagesize_invalid');
-}
-public function getCurrentPageIndex()
-{
-return $this->_currentPageIndex;
-}
-public function setCurrentPageIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=0;
-$this->_currentPageIndex=$value;
-}
-public function getAllowPaging()
-{
-return $this->_allowPaging;
-}
-public function setAllowPaging($value)
-{
-$this->_allowPaging=TPropertyValue::ensureBoolean($value);
-}
-public function getAllowCustomPaging()
-{
-return $this->_allowCustomPaging;
-}
-public function setAllowCustomPaging($value)
-{
-$this->_allowCustomPaging=TPropertyValue::ensureBoolean($value);
-}
-public function getVirtualCount()
-{
-return $this->_virtualCount;
-}
-public function setVirtualCount($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))>=0)
-$this->_virtualCount=$value;
-else
-throw new TInvalidDataValueException('pageddatasource_virtualcount_invalid');
-}
-public function getCount()
-{
-if($this->_dataSource===null)
-return 0;
-if(!$this->_allowPaging)
-return $this->getDataSourceCount();
-if(!$this->_allowCustomPaging && $this->getIsLastPage())
-return $this->getDataSourceCount()-$this->getFirstIndexInPage();
-return $this->_pageSize;
-}
-public function getPageCount()
-{
-if($this->_dataSource===null)
-return 0;
-$count=$this->getDataSourceCount();
-if(!$this->_allowPaging || $count<=0)
-return 1;
-return (int)(($count+$this->_pageSize-1)/$this->_pageSize);
-}
-public function getIsFirstPage()
-{
-if($this->_allowPaging)
-return $this->_currentPageIndex===0;
-else
-return true;
-}
-public function getIsLastPage()
-{
-if($this->_allowPaging)
-return $this->_currentPageIndex===$this->getPageCount()-1;
-else
-return true;
-}
-public function getFirstIndexInPage()
-{
-if($this->_dataSource!==null && $this->_allowPaging && !$this->_allowCustomPaging)
-return $this->_currentPageIndex*$this->_pageSize;
-else
-return 0;
-}
-public function getDataSourceCount()
-{
-if($this->_dataSource===null)
-return 0;
-else if($this->_allowCustomPaging)
-return $this->_virtualCount;
-else
-return $this->_dataSource->getCount();
-}
-public function getIterator()
-{
-if($this->_dataSource instanceof TList)
-return new TPagedListIterator($this->_dataSource,$this->getFirstIndexInPage(),$this->getCount());
-else if($this->_dataSource instanceof TMap)
-return new TPagedMapIterator($this->_dataSource,$this->getFirstIndexInPage(),$this->getCount());
-else
-return null;
-}
-}
-class TPagedListIterator implements Iterator
-{
-private $_list;
-private $_startIndex;
-private $_count;
-private $_index;
-public function __construct(TList $list,$startIndex,$count)
-{
-$this->_list=$list;
-$this->_index=0;
-$this->_startIndex=$startIndex;
-if($startIndex+$count>$list->getCount())
-$this->_count=$list->getCount()-$startIndex;
-else
-$this->_count=$count;
-}
-public function rewind()
-{
-$this->_index=0;
-}
-public function key()
-{
-return $this->_index;
-}
-public function current()
-{
-return $this->_list->itemAt($this->_startIndex+$this->_index);
-}
-public function next()
-{
-$this->_index++;
-}
-public function valid()
-{
-return $this->_index<$this->_count;
-}
-}
-class TPagedMapIterator implements Iterator
-{
-private $_map;
-private $_startIndex;
-private $_count;
-private $_index;
-private $_iterator;
-public function __construct(TMap $map,$startIndex,$count)
-{
-$this->_map=$map;
-$this->_index=0;
-$this->_startIndex=$startIndex;
-if($startIndex+$count>$map->getCount())
-$this->_count=$map->getCount()-$startIndex;
-else
-$this->_count=$count;
-$this->_iterator=$map->getIterator();
-}
-public function rewind()
-{
-$this->_iterator->rewind();
-for($i=0;$i<$this->_startIndex;++$i)
-$this->_iterator->next();
-$this->_index=0;
-}
-public function key()
-{
-return $this->_iterator->key();
-}
-public function current()
-{
-return $this->_iterator->current();
-}
-public function next()
-{
-$this->_index++;
-$this->_iterator->next();
-}
-public function valid()
-{
-return $this->_index<$this->_count;
-}
-}
-
-class TDummyDataSource extends TComponent implements IteratorAggregate
-{
-private $_count;
-public function __construct($count)
-{
-$this->_count=$count;
-}
-public function getCount()
-{
-return $this->_count;
-}
-public function getIterator()
-{
-return new TDummyDataSourceIterator($this->_count);
-}
-}
-class TDummyDataSourceIterator implements Iterator
-{
-private $_index;
-private $_count;
-public function __construct($count)
-{
-$this->_count=$count;
-$this->_index=0;
-}
-public function rewind()
-{
-$this->_index=0;
-}
-public function key()
-{
-return $this->_index;
-}
-public function current()
-{
-return null;
-}
-public function next()
-{
-$this->_index++;
-}
-public function valid()
-{
-return $this->_index<$this->_count;
-}
-}
-
class TXmlElement extends TComponent
{
private $_parent=null;
@@ -1673,7 +1411,7 @@ if(!function_exists('__autoload'))
function __autoload($className)
{
include_once($className.Prado::CLASS_FILE_EXT);
-if(!class_exists($className,false))
+if(!class_exists($className,false) && !interface_exists($className,false))
Prado::fatalError("Class file for '$className' cannot be found.");
}
}
@@ -1692,19 +1430,19 @@ const RUNTIME_PATH='runtime';
const CONFIGCACHE_FILE='config.cache';
const GLOBAL_FILE='global.cache';
private static $_steps=array(
-'BeginRequest',
-'Authentication',
-'PostAuthentication',
-'Authorization',
-'PostAuthorization',
-'LoadState',
-'PostLoadState',
-'PreRunService',
-'RunService',
-'PostRunService',
-'SaveState',
-'PostSaveState',
-'EndRequest'
+'onBeginRequest',
+'onAuthentication',
+'onPostAuthentication',
+'onAuthorization',
+'onPostAuthorization',
+'onLoadState',
+'onPostLoadState',
+'onPreRunService',
+'onRunService',
+'onPostRunService',
+'onSaveState',
+'onPostSaveState',
+'onEndRequest'
);
private $_id;
private $_uniqueID;
@@ -1734,15 +1472,36 @@ public function __construct($basePath='protected',$cacheConfig=true)
{
parent::__construct();
Prado::setApplication($this);
-if(($this->_basePath=realpath($basePath))===false || !is_dir($this->_basePath))
+if(($this->_basePath=realpath($basePath))===false)
throw new TConfigurationException('application_basepath_invalid',$basePath);
-$configFile=$this->_basePath.'/'.self::CONFIG_FILE;
-$this->_configFile=is_file($configFile) ? $configFile : null;
+if(is_file($this->_basePath))
+{
+$this->_configFile=$this->_basePath;
+$this->_basePath=dirname($this->_basepath);
+}
+else if(is_file($this->_basePath.'/'.self::CONFIG_FILE))
+$this->_configFile=$this->_basePath.'/'.self::CONFIG_FILE;
+else
+$this->_configFile=null;
$this->_runtimePath=$this->_basePath.'/'.self::RUNTIME_PATH;
-if(!is_dir($this->_runtimePath) || !is_writable($this->_runtimePath))
+if(is_writable($this->_runtimePath))
+{
+if($this->_configFile!==null)
+{
+$subdir=basename($this->_configFile);
+$this->_runtimePath.='/'.$subdir;
+if(!is_dir($this->_runtimePath))
+mkdir($this->_runtimePath);
+}
+}
+else
throw new TConfigurationException('application_runtimepath_invalid',$this->_runtimePath);
$this->_cacheFile=$cacheConfig ? $this->_runtimePath.'/'.self::CONFIGCACHE_FILE : null;
-$this->_uniqueID=md5($this->_basePath);
+$this->_uniqueID=md5($this->_runtimePath);
+}
+public function __destruct()
+{
+$this->onExitApplication();
}
public function run()
{
@@ -1756,9 +1515,9 @@ while($this->_step<$n)
{
if($this->_mode===self::STATE_OFF)
throw new THttpException(503,'application_service_unavailable');
-$method='on'.self::$_steps[$this->_step];
+$method=self::$_steps[$this->_step];
-$this->$method($this);
+$this->$method();
if($this->_requestCompleted && $this->_step<$n-1)
$this->_step=$n-1;
else
@@ -2049,61 +1808,65 @@ Prado::log($param->getMessage(),TLogger::ERROR,'System.TApplication');
$this->getErrorHandler()->handleError($this,$param);
$this->raiseEvent('OnError',$this,$param);
}
-public function onBeginRequest($param)
+public function onBeginRequest()
{
-$this->raiseEvent('OnBeginRequest',$this,$param);
+$this->raiseEvent('OnBeginRequest',$this,null);
}
-public function onAuthentication($param)
+public function onAuthentication()
{
-$this->raiseEvent('OnAuthentication',$this,$param);
+$this->raiseEvent('OnAuthentication',$this,null);
}
-public function onPostAuthentication($param)
+public function onPostAuthentication()
{
-$this->raiseEvent('OnPostAuthentication',$this,$param);
+$this->raiseEvent('OnPostAuthentication',$this,null);
}
-public function onAuthorization($param)
+public function onAuthorization()
{
-$this->raiseEvent('OnAuthorization',$this,$param);
+$this->raiseEvent('OnAuthorization',$this,null);
}
-public function onPostAuthorization($param)
+public function onPostAuthorization()
{
-$this->raiseEvent('OnPostAuthorization',$this,$param);
+$this->raiseEvent('OnPostAuthorization',$this,null);
}
-public function onLoadState($param)
+public function onLoadState()
{
$this->loadGlobals();
-$this->raiseEvent('OnLoadState',$this,$param);
+$this->raiseEvent('OnLoadState',$this,null);
}
-public function onPostLoadState($param)
+public function onPostLoadState()
{
-$this->raiseEvent('OnPostLoadState',$this,$param);
+$this->raiseEvent('OnPostLoadState',$this,null);
}
-public function onPreRunService($param)
+public function onPreRunService()
{
-$this->raiseEvent('OnPreRunService',$this,$param);
+$this->raiseEvent('OnPreRunService',$this,null);
}
-public function onRunService($param)
+public function onRunService()
{
-$this->raiseEvent('OnRunService',$this,$param);
+$this->raiseEvent('OnRunService',$this,null);
if($this->_service)
$this->_service->run();
}
-public function onPostRunService($param)
+public function onPostRunService()
{
-$this->raiseEvent('OnPostRunService',$this,$param);
+$this->raiseEvent('OnPostRunService',$this,null);
}
-public function onSaveState($param)
+public function onSaveState()
{
-$this->raiseEvent('OnSaveState',$this,$param);
+$this->raiseEvent('OnSaveState',$this,null);
$this->saveGlobals();
}
-public function onPostSaveState($param)
+public function onPostSaveState()
+{
+$this->raiseEvent('OnPostSaveState',$this,null);
+}
+public function onEndRequest()
{
-$this->raiseEvent('OnPostSaveState',$this,$param);
+$this->raiseEvent('OnEndRequest',$this,null);
}
-public function onEndRequest($param)
+public function onExitApplication()
{
-$this->raiseEvent('OnEndRequest',$this,$param);
+$this->raiseEvent('OnExitApplication',$this,null);
}
}
class TApplicationConfiguration extends TComponent
@@ -2283,7 +2046,7 @@ return $this->_templatePath;
}
public function setErrorTemplatePath($value)
{
-if(($templatePath=Prado::getPathOfNamespace($this->_templatePath))!==null && is_dir($templatePath))
+if(($templatePath=Prado::getPathOfNamespace($value))!==null && is_dir($templatePath))
$this->_templatePath=$templatePath;
else
throw new TConfigurationException('errorhandler_errortemplatepath_invalid',$value);
@@ -2398,6 +2161,7 @@ private $_serviceParam=null;
private $_cookies=null;
private $_requestUri;
private $_pathInfo;
+private $_urlFormat='Get';
private $_services;
private $_requestResolved=false;
private $_id;
@@ -2431,6 +2195,19 @@ $_REQUEST=$this->stripSlashes($_REQUEST);
if(isset($_COOKIE))
$_COOKIE=$this->stripSlashes($_COOKIE);
}
+if($this->getUrlFormat()==='Path' && ($pathInfo=trim($this->_pathInfo,'/'))!=='')
+{
+$paths=explode('/',$pathInfo);
+$n=count($paths);
+$getVariables=array();
+for($i=0;$i<$n;++$i)
+{
+if($i+1<$n)
+$getVariables[$paths[$i]]=$paths[++$i];
+}
+$this->copyFrom(array_merge($getVariables,array_merge($_GET,$_POST)));
+}
+else
$this->copyFrom(array_merge($_GET,$_POST));
$this->_initialized=true;
$this->getApplication()->setRequest($this);
@@ -2459,6 +2236,14 @@ $this->_url=new TUri($url);
}
return $this->_url;
}
+public function getUrlFormat()
+{
+return $this->_urlFormat;
+}
+public function setUrlFormat($value)
+{
+$this->_urlFormat=TPropertyValue::ensureEnum($value,'Path','Get');
+}
public function getRequestType()
{
return $_SERVER['REQUEST_METHOD'];
@@ -2547,19 +2332,26 @@ return $_ENV;
}
public function constructUrl($serviceID,$serviceParam,$getItems=null,$encodeAmpersand=false)
{
-$url=$this->getApplicationPath();
-$url.='?'.$serviceID.'=';
-if(!empty($serviceParam))
-$url.=$serviceParam;
+$url=$serviceID.'='.$serviceParam;
$amp=$encodeAmpersand?'&amp;':'&';
if(is_array($getItems) || $getItems instanceof Traversable)
{
foreach($getItems as $name=>$value)
$url.=$amp.urlencode($name).'='.urlencode($value);
}
+if($this->getUrlFormat()==='Path')
+{
+$url=strtr($url,array($amp=>'/','?'=>'/','='=>'/'));
+if(defined('SID') && SID != '')
+$url.='?'.SID;
+return $this->getApplicationPath().'/'.$url;
+}
+else
+{
if(defined('SID') && SID != '')
$url.=$amp.SID;
-return $url;
+return $this->getApplicationPath().'?'.$url;
+}
}
protected function resolveRequest()
{
@@ -2567,10 +2359,10 @@ protected function resolveRequest()
$this->_requestResolved=true;
foreach($this->_services as $id)
{
-if(isset($_GET[$id]))
+if($this->contains($id))
{
$this->setServiceID($id);
-$this->setServiceParameter($_GET[$id]);
+$this->setServiceParameter($this->itemAt($id));
break;
}
}
@@ -2895,20 +2687,21 @@ exit();
}
public function flush()
{
-$header = $this->getContentTypeHeader();
-$this->appendHeader($header);
+
+$this->sendContentTypeHeader();
if($this->_bufferOutput)
ob_flush();
-
}
-protected function getContentTypeHeader()
+protected function sendContentTypeHeader()
{
-$app = $this->getApplication()->getGlobalization();
$charset = $this->getCharset();
-if(empty($charset))
-$charset = !is_null($app) ? $app->getCharset() : 'UTF-8';
-$type = $this->getContentType();
-return "Content-Type: $type; charset=$charset";
+if(empty($charset) && ($globalization=$this->getApplication()->getGlobalization())!==null)
+$charset = $globalization->getCharset();
+if(!empty($charset))
+{
+$header='Content-Type: '.$this->getContentType().';charset='.$charset;
+$this->appendHeader($header);
+}
}
public function clear()
{
@@ -2918,11 +2711,9 @@ ob_clean();
}
public function appendHeader($value)
{
+
header($value);
}
-public function sendContentTypeHeader($type=null)
-{
-}
public function appendLog($message,$messageType=0,$destination='',$extraHeaders='')
{
error_log($message,$messageType,$destination,$extraHeaders);
@@ -4535,7 +4326,7 @@ $appPath=dirname($this->getRequest()->getPhysicalApplicationPath());
$basePath=$this->getBasePath();
if(strpos($basePath,$appPath)===false)
throw new TConfigurationException('thememanager_baseurl_required');
-$appUrl=dirname($this->getRequest()->getApplicationPath());
+$appUrl=rtrim(dirname($this->getRequest()->getApplicationPath()),'/');
$this->_baseUrl=$appUrl.strtr(substr($basePath,strlen($appPath)),'\\','/');
}
return $this->_baseUrl;
@@ -4703,7 +4494,7 @@ $this->_basePath=dirname($application->getRequest()->getPhysicalApplicationPath(
if(!is_writable($this->_basePath) || !is_dir($this->_basePath))
throw new TConfigurationException('assetmanager_basepath_invalid',$this->_basePath);
if($this->_baseUrl===null)
-$this->_baseUrl=dirname($application->getRequest()->getApplicationPath()).'/'.self::DEFAULT_BASEPATH;
+$this->_baseUrl=rtrim(dirname($application->getRequest()->getApplicationPath()),'/').'/'.self::DEFAULT_BASEPATH;
$application->getService()->setAssetManager($this);
}
public function getBasePath()
@@ -4730,7 +4521,7 @@ public function setBaseUrl($value)
if($this->_initialized)
throw new TInvalidOperationException('assetmanager_baseurl_unchangeable');
else
-$this->_baseUrl=$value;
+$this->_baseUrl=rtrim($value,'/');
}
public function getPublishedUrl($path)
{
@@ -7320,1060 +7111,6 @@ $writer->renderEndTag();
}
}
-class TPlaceHolder extends TControl
-{
-}
-
-class TLiteral extends TControl
-{
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-public function getEncode()
-{
-return $this->getViewState('Encode',false);
-}
-public function setEncode($value)
-{
-$this->setViewState('Encode',TPropertyValue::ensureBoolean($value),false);
-}
-protected function render($writer)
-{
-if(($text=$this->getText())!=='')
-{
-if($this->getEncode())
-$writer->write(THttpUtility::htmlEncode($text));
-else
-$writer->write($text);
-}
-}
-}
-
-class TLabel extends TWebControl
-{
-protected function getTagName()
-{
-return ($this->getForControl()==='')?'span':'label';
-}
-protected function addAttributesToRender($writer)
-{
-if(($aid=$this->getForControl())!=='')
-{
-if($control=$this->findControl($aid))
-$writer->addAttribute('for',$control->getClientID());
-else
-throw new TInvalidDataValueException('label_associatedcontrol_invalid',$aid);
-}
-parent::addAttributesToRender($writer);
-}
-protected function renderContents($writer)
-{
-if(($text=$this->getText())==='')
-parent::renderContents($writer);
-else
-$writer->write($text);
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-public function getForControl()
-{
-return $this->getViewState('ForControl','');
-}
-public function setForControl($value)
-{
-$this->setViewState('ForControl',$value,'');
-}
-}
-
-class TImage extends TWebControl
-{
-protected function getTagName()
-{
-return 'img';
-}
-protected function addAttributesToRender($writer)
-{
-$writer->addAttribute('src',$this->getImageUrl());
-$writer->addAttribute('alt',$this->getAlternateText());
-if(($desc=$this->getDescriptionUrl())!=='')
-$writer->addAttribute('longdesc',$desc);
-if(($align=$this->getImageAlign())!=='')
-$writer->addAttribute('align',$align);
-if(($width=$this->getBorderWidth())==='')
-$writer->addStyleAttribute('border-width','0px');
-parent::addAttributesToRender($writer);
-}
-protected function renderContents($writer)
-{
-}
-public function getAlternateText()
-{
-return $this->getViewState('AlternateText','');
-}
-public function setAlternateText($value)
-{
-$this->setViewState('AlternateText',$value,'');
-}
-public function getImageAlign()
-{
-return $this->getViewState('ImageAlign','');
-}
-public function setImageAlign($value)
-{
-$this->setViewState('ImageAlign',$value,'');
-}
-public function getImageUrl()
-{
-return $this->getViewState('ImageUrl','');
-}
-public function setImageUrl($value)
-{
-$this->setViewState('ImageUrl',$value,'');
-}
-public function getDescriptionUrl()
-{
-return $this->getViewState('DescriptionUrl','');
-}
-public function setDescriptionUrl($value)
-{
-$this->setViewState('DescriptionUrl',$value,'');
-}
-}
-
-class TImageButton extends TImage implements IPostBackDataHandler, IPostBackEventHandler
-{
-private $_x=0;
-private $_y=0;
-protected function getTagName()
-{
-return 'input';
-}
-protected function addAttributesToRender($writer)
-{
-$page=$this->getPage();
-$page->ensureRenderInForm($this);
-$writer->addAttribute('type','image');
-if(($uniqueID=$this->getUniqueID())!=='')
-$writer->addAttribute('name',$uniqueID);
-if($this->getEnabled(true))
-{
-if($this->canCauseValidation())
-{
-$writer->addAttribute('id',$this->getClientID());
-$this->getPage()->getClientScript()->registerPostBackControl($this);
-}
-}
-else if($this->getEnabled()) $writer->addAttribute('disabled','disabled');
-parent::addAttributesToRender($writer);
-}
-protected function canCauseValidation()
-{
-if($this->getCausesValidation())
-{
-$group=$this->getValidationGroup();
-return $this->getPage()->getValidators($group)->getCount()>0;
-}
-else
-return false;
-}
-public function getPostBackOptions()
-{
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['ValidationGroup'] = $this->getValidationGroup();
-return $options;
-}
-public function loadPostData($key,$values)
-{
-$uid=$this->getUniqueID();
-if(isset($values["{$uid}_x"]) && isset($values["{$uid}_y"]))
-{
-$this->_x=intval($values["{$uid}_x"]);
-$this->_y=intval($values["{$uid}_y"]);
-$this->getPage()->setPostBackEventTarget($this);
-}
-return false;
-}
-public function raisePostDataChangedEvent()
-{
-}
-public function onClick($param)
-{
-$this->raiseEvent('OnClick',$this,$param);
-}
-public function onCommand($param)
-{
-$this->raiseEvent('OnCommand',$this,$param);
-$this->raiseBubbleEvent($this,$param);
-}
-public function raisePostBackEvent($param)
-{
-if($this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onClick(new TImageClickEventParameter($this->_x,$this->_y));
-$this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter()));
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-}
-public function getCommandName()
-{
-return $this->getViewState('CommandName','');
-}
-public function setCommandName($value)
-{
-$this->setViewState('CommandName',$value,'');
-}
-public function getCommandParameter()
-{
-return $this->getViewState('CommandParameter','');
-}
-public function setCommandParameter($value)
-{
-$this->setViewState('CommandParameter',$value,'');
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-public function getText()
-{
-return $this->getAlternateText();
-}
-public function setText($value)
-{
-$this->setAlternateText($value);
-}
-public function onPreRender($param)
-{
-parent::onPreRender($param);
-$this->getPage()->registerRequiresPostData($this);
-}
-protected function renderContents($writer)
-{
-}
-}
-class TImageClickEventParameter extends TEventParameter
-{
-public $_x=0;
-public $_y=0;
-public function __construct($x,$y)
-{
-$this->_x=$x;
-$this->_y=$y;
-}
-public function getX()
-{
-return $this->_x;
-}
-public function setX($value)
-{
-$this->_x=TPropertyValue::ensureInteger($value);
-}
-public function getY()
-{
-return $this->_y;
-}
-public function setY($value)
-{
-$this->_y=TPropertyValue::ensureInteger($value);
-}
-}
-
-class TButton extends TWebControl implements IPostBackEventHandler
-{
-protected function getTagName()
-{
-return 'input';
-}
-protected function addAttributesToRender($writer)
-{
-$page=$this->getPage();
-$page->ensureRenderInForm($this);
-$writer->addAttribute('type','submit');
-if(($uniqueID=$this->getUniqueID())!=='')
-$writer->addAttribute('name',$uniqueID);
-$writer->addAttribute('value',$this->getText());
-if($this->getEnabled(true))
-{
-if($this->canCauseValidation())
-{
-$writer->addAttribute('id',$this->getClientID());
-$this->getPage()->getClientScript()->registerPostBackControl($this);
-}
-}
-else if($this->getEnabled()) $writer->addAttribute('disabled','disabled');
-parent::addAttributesToRender($writer);
-}
-protected function canCauseValidation()
-{
-if($this->getCausesValidation())
-{
-$group=$this->getValidationGroup();
-return $this->getPage()->getValidators($group)->getCount()>0;
-}
-else
-return false;
-}
-public function getPostBackOptions()
-{
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['ValidationGroup'] = $this->getValidationGroup();
-return $options;
-}
-protected function renderContents($writer)
-{
-}
-public function onClick($param)
-{
-$this->raiseEvent('OnClick',$this,$param);
-}
-public function onCommand($param)
-{
-$this->raiseEvent('OnCommand',$this,$param);
-$this->raiseBubbleEvent($this,$param);
-}
-public function raisePostBackEvent($param)
-{
-if($this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onClick(null);
-$this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter()));
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-}
-public function getCommandName()
-{
-return $this->getViewState('CommandName','');
-}
-public function setCommandName($value)
-{
-$this->setViewState('CommandName',$value,'');
-}
-public function getCommandParameter()
-{
-return $this->getViewState('CommandParameter','');
-}
-public function setCommandParameter($value)
-{
-$this->setViewState('CommandParameter',$value,'');
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-}
-
-class TCheckBox extends TWebControl implements IPostBackDataHandler, IValidatable
-{
-protected function getTagName()
-{
-return 'input';
-}
-public function loadPostData($key,$values)
-{
-$checked=$this->getChecked();
-if(isset($values[$key])!=$checked)
-{
-$this->setChecked(!$checked);
-return true;
-}
-else
-return false;
-}
-public function raisePostDataChangedEvent()
-{
-if($this->getAutoPostBack() && $this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onCheckedChanged(null);
-}
-public function onCheckedChanged($param)
-{
-$this->raiseEvent('OnCheckedChanged',$this,$param);
-}
-public function onPreRender($param)
-{
-parent::onPreRender($param);
-if($this->getEnabled(true))
-$this->getPage()->registerRequiresPostData($this);
-}
-public function getValidationPropertyValue()
-{
-return $this->getChecked();
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-public function getTextAlign()
-{
-return $this->getViewState('TextAlign','Right');
-}
-public function setTextAlign($value)
-{
-$this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,array('Left','Right')),'Right');
-}
-public function getChecked()
-{
-return $this->getViewState('Checked',false);
-}
-public function setChecked($value)
-{
-$this->setViewState('Checked',TPropertyValue::ensureBoolean($value),false);
-}
-public function getAutoPostBack()
-{
-return $this->getViewState('AutoPostBack',false);
-}
-public function setAutoPostBack($value)
-{
-$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false);
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-protected function render($writer)
-{
-$this->addAttributesToRender($writer);
-$this->getPage()->ensureRenderInForm($this);
-$needSpan=false;
-if($this->getHasStyle())
-{
-$this->getStyle()->addAttributesToRender($writer);
-$needSpan=true;
-}
-if(!$this->getEnabled(true))
-{
-$writer->addAttribute('disabled','disabled');
-$needSpan=true;
-}
-if(($tooltip=$this->getToolTip())!=='')
-{
-$writer->addAttribute('title',$tooltip);
-$needSpan=true;
-}
-if($this->getHasAttributes())
-{
-$attributes=$this->getAttributes();
-$value=$attributes->remove('value');
-if($attributes->getCount())
-{
-$writer->addAttributes($attributes);
-$needSpan=true;
-}
-if($value!==null)
-$attributes->add('value',$value);
-}
-if($needSpan)
-$writer->renderBeginTag('span');
-$clientID=$this->getClientID();
-if(($text=$this->getText())!=='')
-{
-if($this->getTextAlign()==='Left')
-{
-$this->renderLabel($writer,$clientID,$text);
-$this->renderInputTag($writer,$clientID);
-}
-else
-{
-$this->renderInputTag($writer,$clientID);
-$this->renderLabel($writer,$clientID,$text);
-}
-}
-else
-$this->renderInputTag($writer,$clientID);
-if($needSpan)
-$writer->renderEndTag();
-}
-public function getLabelAttributes()
-{
-if($attributes=$this->getViewState('LabelAttributes',null))
-return $attributes;
-else
-{
-$attributes=new TAttributeCollection;
-$this->setViewState('LabelAttributes',$attributes,null);
-return $attributes;
-}
-}
-public function getInputAttributes()
-{
-if($attributes=$this->getViewState('InputAttributes',null))
-return $attributes;
-else
-{
-$attributes=new TAttributeCollection;
-$this->setViewState('InputAttributes',$attributes,null);
-return $attributes;
-}
-}
-protected function getValueAttribute()
-{
-$attributes=$this->getViewState('InputAttributes',null);
-if($attributes && $attributes->contains('value'))
-$value=$attributes->itemAt('value');
-else if($this->hasAttribute('value'))
-$value=$this->getAttribute('value');
-else
-$value='';
-return $value===''?$this->getUniqueID():$value;
-}
-protected function renderLabel($writer,$clientID,$text)
-{
-$writer->addAttribute('for',$clientID);
-if($attributes=$this->getViewState('LabelAttributes',null))
-$writer->addAttributes($attributes);
-$writer->renderBeginTag('label');
-$writer->write($text);
-$writer->renderEndTag();
-}
-protected function renderInputTag($writer,$clientID)
-{
-if($clientID!=='')
-$writer->addAttribute('id',$clientID);
-$writer->addAttribute('type','checkbox');
-$writer->addAttribute('value',$this->getValueAttribute());
-if(($uniqueID=$this->getUniqueID())!=='')
-$writer->addAttribute('name',$uniqueID);
-if($this->getChecked())
-$writer->addAttribute('checked','checked');
-if(!$this->getEnabled(true))
-$writer->addAttribute('disabled','disabled');
-$page=$this->getPage();
-if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript())
-$page->getClientScript()->registerPostBackControl($this);
-if(($accesskey=$this->getAccessKey())!=='')
-$writer->addAttribute('accesskey',$accesskey);
-if(($tabindex=$this->getTabIndex())>0)
-$writer->addAttribute('tabindex',"$tabindex");
-if($attributes=$this->getViewState('InputAttributes',null))
-$writer->addAttributes($attributes);
-$writer->renderBeginTag('input');
-$writer->renderEndTag();
-}
-public function getPostBackOptions()
-{
-$options['ValidationGroup'] = $this->getValidationGroup();
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['EventTarget'] = $this->getUniqueID();
-return $options;
-}
-}
-
-class TRadioButton extends TCheckBox
-{
-private $_uniqueGroupName=null;
-public function loadPostData($key,$values)
-{
-$uniqueGroupName=$this->getUniqueGroupName();
-$value=isset($values[$uniqueGroupName])?$values[$uniqueGroupName]:null;
-if($value!==null && $value===$this->getValueAttribute())
-{
-if(!$this->getChecked())
-{
-$this->setChecked(true);
-return true;
-}
-else
-return false;
-}
-else if($this->getChecked())
-$this->setChecked(false);
-return false;
-}
-public function getGroupName()
-{
-return $this->getViewState('GroupName','');
-}
-public function setGroupName($value)
-{
-$this->setViewState('GroupName',$value,'');
-}
-private function getUniqueGroupName()
-{
-if($this->_uniqueGroupName===null)
-{
-$groupName=$this->getGroupName();
-$uniqueID=$this->getUniqueID();
-if($uniqueID!=='')
-{
-if(($pos=strrpos($uniqueID,TControl::ID_SEPARATOR))!==false)
-{
-if($groupName!=='')
-$groupName=substr($uniqueID,0,$pos+1).$groupName;
-else if($this->getNamingContainer() instanceof TRadioButtonList)
-$groupName=substr($uniqueID,0,$pos);
-}
-if($groupName==='')
-$groupName=$uniqueID;
-}
-$this->_uniqueGroupName=$groupName;
-}
-return $this->_uniqueGroupName;
-}
-protected function renderInputTag($writer,$clientID)
-{
-if($clientID!=='')
-$writer->addAttribute('id',$clientID);
-$writer->addAttribute('type','radio');
-$writer->addAttribute('name',$this->getUniqueGroupName());
-$writer->addAttribute('value',$this->getValueAttribute());
-if($this->getChecked())
-$writer->addAttribute('checked','checked');
-if(!$this->getEnabled(true))
-$writer->addAttribute('disabled','disabled');
-$page=$this->getPage();
-if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript())
-$page->getClientScript()->registerPostBackControl($this);
-if(($accesskey=$this->getAccessKey())!=='')
-$writer->addAttribute('accesskey',$accesskey);
-if(($tabindex=$this->getTabIndex())>0)
-$writer->addAttribute('tabindex',"$tabindex");
-if($attributes=$this->getViewState('InputAttributes',null))
-$writer->addAttributes($attributes);
-$writer->renderBeginTag('input');
-$writer->renderEndTag();
-}
-}
-
-class TTextBox extends TWebControl implements IPostBackDataHandler, IValidatable
-{
-const DEFAULT_ROWS=4;
-const DEFAULT_COLUMNS=20;
-private static $_autoCompleteTypes=array('BusinessCity','BusinessCountryRegion','BusinessFax','BusinessPhone','BusinessState','BusinessStreetAddress','BusinessUrl','BusinessZipCode','Cellular','Company','Department','Disabled','DisplayName','Email','FirstName','Gender','HomeCity','HomeCountryRegion','HomeFax','Homepage','HomePhone','HomeState','HomeStreetAddress','HomeZipCode','JobTitle','LastName','MiddleName','None','Notes','Office','Pager','Search');
-private static $_safeTextParser=null;
-private $_safeText;
-protected function getTagName()
-{
-return ($this->getTextMode()==='MultiLine')?'textarea':'input';
-}
-protected function addAttributesToRender($writer)
-{
-$page=$this->getPage();
-$page->ensureRenderInForm($this);
-if(($uid=$this->getUniqueID())!=='')
-$writer->addAttribute('name',$uid);
-if(($textMode=$this->getTextMode())==='MultiLine')
-{
-if(($rows=$this->getRows())<=0)
-$rows=self::DEFAULT_ROWS;
-if(($cols=$this->getColumns())<=0)
-$cols=self::DEFAULT_COLUMNS;
-$writer->addAttribute('rows',"$rows");
-$writer->addAttribute('cols',"$cols");
-if(!$this->getWrap())
-$writer->addAttribute('wrap','off');
-}
-else
-{
-if($textMode==='SingleLine')
-{
-$writer->addAttribute('type','text');
-if(($text=$this->getText())!=='')
-$writer->addAttribute('value',$text);
-if(($act=$this->getAutoCompleteType())!=='None')
-{
-if($act==='Disabled')
-$writer->addAttribute('autocomplete','off');
-else if($act==='Search')
-$writer->addAttribute('vcard_name','search');
-else if($act==='HomeCountryRegion')
-$writer->addAttribute('vcard_name','HomeCountry');
-else if($act==='BusinessCountryRegion')
-$writer->addAttribute('vcard_name','BusinessCountry');
-else
-{
-if(($pos=strpos($act,'Business'))===0)
-$act='Business'.'.'.substr($act,8);
-else if(($pos=strpos($act,'Home'))===0)
-$act='Home'.'.'.substr($act,4);
-$writer->addAttribute('vcard_name','vCard.'.$act);
-}
-}
-}
-else
-{
-$writer->addAttribute('type','password');
-}
-if(($cols=$this->getColumns())>0)
-$writer->addAttribute('size',"$cols");
-if(($maxLength=$this->getMaxLength())>0)
-$writer->addAttribute('maxlength',"$maxLength");
-}
-if($this->getReadOnly())
-$writer->addAttribute('readonly','readonly');
-if(!$this->getEnabled(true) && $this->getEnabled()) $writer->addAttribute('disabled','disabled');
-if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript())
-{
-$writer->addAttribute('id',$this->getClientID());
-$this->getPage()->getClientScript()->registerPostBackControl($this);
-}
-parent::addAttributesToRender($writer);
-}
-public function getPostBackOptions()
-{
-$options['EventTarget'] = $this->getUniqueID();
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['ValidationGroup'] = $this->getValidationGroup();
-$options['TextMode'] = $this->getTextMode();
-return $options;
-}
-public function loadPostData($key,$values)
-{
-$value=$values[$key];
-if(!$this->getReadOnly() && $this->getText()!==$value)
-{
-$this->setText($value);
-return true;
-}
-else
-return false;
-}
-public function getValidationPropertyValue()
-{
-return $this->getText();
-}
-public function onTextChanged($param)
-{
-$this->raiseEvent('OnTextChanged',$this,$param);
-}
-public function raisePostDataChangedEvent()
-{
-if($this->getAutoPostBack() && $this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onTextChanged(null);
-}
-protected function renderContents($writer)
-{
-if($this->getTextMode()==='MultiLine')
-$writer->write(THttpUtility::htmlEncode($this->getText()));
-}
-public function getAutoCompleteType()
-{
-return $this->getViewState('AutoCompleteType','None');
-}
-public function setAutoCompleteType($value)
-{
-$this->setViewState('AutoCompleteType',TPropertyValue::ensureEnum($value,self::$_autoCompleteTypes),'None');
-}
-public function getAutoPostBack()
-{
-return $this->getViewState('AutoPostBack',false);
-}
-public function setAutoPostBack($value)
-{
-$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false);
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-}
-public function getColumns()
-{
-return $this->getViewState('Columns',0);
-}
-public function setColumns($value)
-{
-$this->setViewState('Columns',TPropertyValue::ensureInteger($value),0);
-}
-public function getMaxLength()
-{
-return $this->getViewState('MaxLength',0);
-}
-public function setMaxLength($value)
-{
-$this->setViewState('MaxLength',TPropertyValue::ensureInteger($value),0);
-}
-public function getReadOnly()
-{
-return $this->getViewState('ReadOnly',false);
-}
-public function setReadOnly($value)
-{
-$this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
-}
-public function getRows()
-{
-return $this->getViewState('Rows',self::DEFAULT_ROWS);
-}
-public function setRows($value)
-{
-$this->setViewState('Rows',TPropertyValue::ensureInteger($value),self::DEFAULT_ROWS);
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-$this->_safeText = null;
-}
-public function getSafeText()
-{
-if($this->_safeText===null)
-$this->_safeText=$this->getSafeTextParser()->parse($this->getText());
-return $this->_safeText;
-}
-protected function getSafeTextParser()
-{
-if(!self::$_safeTextParser)
-self::$_safeTextParser=Prado::createComponent('System.3rdParty.SafeHtml.TSafeHtmlParser');
-return self::$_safeTextParser;
-}
-public function getTextMode()
-{
-return $this->getViewState('TextMode','SingleLine');
-}
-public function setTextMode($value)
-{
-$this->setViewState('TextMode',TPropertyValue::ensureEnum($value,array('SingleLine','MultiLine','Password')),'SingleLine');
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-public function getWrap()
-{
-return $this->getViewState('Wrap',true);
-}
-public function setWrap($value)
-{
-$this->setViewState('Wrap',TPropertyValue::ensureBoolean($value),true);
-}
-}
-
-class TPanel extends TWebControl
-{
-private $_defaultButton='';
-protected function getTagName()
-{
-return 'div';
-}
-protected function createStyle()
-{
-return new TPanelStyle;
-}
-protected function addAttributesToRender($writer)
-{
-parent::addAttributesToRender($writer);
-if(($butt=$this->getDefaultButton())!=='')
-{
-if(($button=$this->findControl($butt))===null)
-throw new TInvalidDataValueException('panel_defaultbutton_invalid',$butt);
-else
-{
-$writer->addAttribute('id',$this->getClientID());
-$this->getPage()->getClientScript()->registerDefaultButton($this, $button);
-}
-}
-}
-public function getWrap()
-{
-return $this->getStyle()->getWrap();
-}
-public function setWrap($value)
-{
-$this->getStyle()->setWrap($value);
-}
-public function getHorizontalAlign()
-{
-return $this->getStyle()->getHorizontalAlign();
-}
-public function setHorizontalAlign($value)
-{
-$this->getStyle()->setHorizontalAlign($value);
-}
-public function getBackImageUrl()
-{
-return $this->getStyle()->getBackImageUrl();
-}
-public function setBackImageUrl($value)
-{
-$this->getStyle()->setBackImageUrl($value);
-}
-public function getDirection()
-{
-return $this->getStyle()->getDirection();
-}
-public function setDirection($value)
-{
-$this->getStyle()->setDirection($value);
-}
-public function getDefaultButton()
-{
-return $this->_defaultButton;
-}
-public function setDefaultButton($value)
-{
-$this->_defaultButton=$value;
-}
-public function getGroupingText()
-{
-return $this->getViewState('GroupingText','');
-}
-public function setGroupingText($value)
-{
-$this->setViewState('GroupingText',$value,'');
-}
-public function getScrollBars()
-{
-return $this->getStyle()->getScrollBars();
-}
-public function setScrollBars($value)
-{
-$this->getStyle()->setScrollBars($value);
-}
-public function renderBeginTag($writer)
-{
-parent::renderBeginTag($writer);
-if(($text=$this->getGroupingText())!=='')
-{
-$writer->renderBeginTag('fieldset');
-$writer->renderBeginTag('legend');
-$writer->write($text);
-$writer->renderEndTag();
-}
-}
-public function renderEndTag($writer)
-{
-if($this->getGroupingText()!=='')
-$writer->renderEndTag();
-parent::renderEndTag($writer);
-}
-}
-class TPanelStyle extends TStyle
-{
-private $_backImageUrl='';
-private $_direction='NotSet';
-private $_horizontalAlign='NotSet';
-private $_scrollBars='None';
-private $_wrap=true;
-public function addAttributesToRender($writer)
-{
-if(($url=trim($this->_backImageUrl))!=='')
-$this->setStyleField('background-image','url('.$url.')');
-switch($this->_scrollBars)
-{
-case 'Horizontal': $this->setStyleField('overflow-x','scroll'); break;
-case 'Vertical': $this->setStyleField('overflow-y','scroll'); break;
-case 'Both': $this->setStyleField('overflow','scroll'); break;
-case 'Auto': $this->setStyleField('overflow','auto'); break;
-}
-if($this->_horizontalAlign!=='NotSet')
-$this->setStyleField('text-align',strtolower($this->_horizontalAlign));
-if(!$this->_wrap)
-$this->setStyleField('white-space','nowrap');
-if($this->_direction==='LeftToRight')
-$this->setStyleField('direction','ltr');
-else if($this->_direction==='RightToLeft')
-$this->setStyleField('direction','rtl');
-parent::addAttributesToRender($writer);
-}
-public function getBackImageUrl()
-{
-return $this->_backImageUrl;
-}
-public function setBackImageUrl($value)
-{
-$this->_backImageUrl=$value;
-}
-public function getDirection()
-{
-return $this->_direction;
-}
-public function setDirection($value)
-{
-$this->_direction=TPropertyValue::ensureEnum($value,array('NotSet','LeftToRight','RightToLeft'));
-}
-public function getWrap()
-{
-return $this->_wrap;
-}
-public function setWrap($value)
-{
-$this->_wrap=TPropertyValue::ensureBoolean($value);
-}
-public function getHorizontalAlign()
-{
-return $this->_horizontalAlign;
-}
-public function setHorizontalAlign($value)
-{
-$this->_horizontalAlign=TPropertyValue::ensureEnum($value,array('NotSet','Left','Right','Center','Justify'));
-}
-public function getScrollBars()
-{
-return $this->_scrollBars;
-}
-public function setScrollBars($value)
-{
-$this->_scrollBars=TPropertyValue::ensureEnum($value,array('None','Auto','Both','Horizontal','Vertical'));
-}
-}
-
class TContent extends TControl implements INamingContainer
{
public function createdOnTemplate($parent)
@@ -8432,108 +7169,6 @@ $writer->write($this->evaluateStatements($this->_s));
}
}
-class TFileUpload extends TWebControl implements IPostBackDataHandler, IValidatable
-{
-const MAX_FILE_SIZE=1048576;
-private $_fileSize=0;
-private $_fileName='';
-private $_localName='';
-private $_fileType='';
-private $_errorCode=UPLOAD_ERR_NO_FILE;
-protected function getTagName()
-{
-return 'input';
-}
-protected function addAttributesToRender($writer)
-{
-$this->getPage()->ensureRenderInForm($this);
-parent::addAttributesToRender($writer);
-$writer->addAttribute('type','file');
-$writer->addAttribute('name',$this->getUniqueID());
-}
-public function onPreRender($param)
-{
-parent::onPreRender($param);
-if(($form=$this->getPage()->getForm())!==null)
-$form->setEnctype('multipart/form-data');
-$this->getPage()->getClientScript()->registerHiddenField('MAX_FILE_SIZE',$this->getMaxFileSize());
-if($this->getEnabled(true))
-$this->getPage()->registerRequiresPostData($this);
-}
-public function getMaxFileSize()
-{
-return $this->getViewState('MaxFileSize',self::MAX_FILE_SIZE);
-}
-public function setMaxFileSize($size)
-{
-$this->setViewState('MaxFileSize',TPropertyValue::ensureInteger($size),self::MAX_FILE_SIZE);
-}
-public function getFileName()
-{
-return $this->_fileName;
-}
-public function getFileSize()
-{
-return $this->_fileSize;
-}
-public function getFileType()
-{
-return $this->_fileType;
-}
-public function getLocalName()
-{
-return $this->_localName;
-}
-public function getErrorCode()
-{
-return $this->_errorCode;
-}
-public function getHasFile()
-{
-return $this->_errorCode===UPLOAD_ERR_OK;
-}
-public function saveAs($fileName,$deleteTempFile=true)
-{
-if($this->_errorCode===UPLOAD_ERR_OK)
-{
-if($deleteTempFile)
-move_uploaded_file($this->_localName,$fileName);
-else if(is_uploaded_file($this->_localName))
-file_put_contents($fileName,file_get_contents($this->_localName));
-else
-throw new TInvalidOperationException('fileupload_saveas_failed');
-}
-else
-throw new TInvalidOperation('fileupload_saveas_forbidden');
-}
-public function loadPostData($key,$values)
-{
-if(isset($_FILES[$key]))
-{
-$this->_fileName=$_FILES[$key]['name'];
-$this->_fileSize=$_FILES[$key]['size'];
-$this->_fileType=$_FILES[$key]['type'];
-$this->_errorCode=$_FILES[$key]['error'];
-$this->_localName=$_FILES[$key]['tmp_name'];
-return true;
-}
-else
-return false;
-}
-public function raisePostDataChangedEvent()
-{
-$this->onFileUpload(null);
-}
-public function onFileUpload($param)
-{
-$this->raiseEvent('OnFileUpload',$this,$param);
-}
-public function getValidationPropertyValue()
-{
-return $this->getFileName();
-}
-}
-
class THead extends TControl
{
private $_metaTags=array();
@@ -8639,5820 +7274,4 @@ $writer->renderBeginTag('meta');
$writer->renderEndTag();
}
}
-
-class THiddenField extends TControl implements IPostBackDataHandler
-{
-protected function getTagName()
-{
-return 'input';
-}
-public function focus()
-{
-throw new TNotSupportedException('hiddenfield_focus_unsupported');
-}
-protected function render($writer)
-{
-$uniqueID=$this->getUniqueID();
-$this->getPage()->ensureRenderInForm($this);
-$writer->addAttribute('type','hidden');
-if($uniqueID!=='')
-$writer->addAttribute('name',$uniqueID);
-if($this->getID()!=='')
-$writer->addAttribute('id',$this->getClientID());
-if(($value=$this->getValue())!=='')
-$writer->addAttribute('value',$value);
-$writer->renderBeginTag('input');
-$writer->renderEndTag();
-}
-public function loadPostData($key,$values)
-{
-$value=$values[$key];
-if($value===$this->getValue())
-return false;
-else
-{
-$this->setValue($value);
-return true;
-}
-}
-public function raisePostDataChangedEvent()
-{
-$this->onValueChanged(null);
-}
-public function onValueChanged($param)
-{
-$this->raiseEvent('OnValueChanged',$this,$param);
-}
-public function getValue()
-{
-return $this->getViewState('Value','');
-}
-public function setValue($value)
-{
-$this->setViewState('Value',$value,'');
-}
-public function getEnableTheming()
-{
-return false;
-}
-public function setEnableTheming($value)
-{
-throw new TNotSupportedException('hiddenfield_theming_unsupported');
-}
-public function setSkinID($value)
-{
-throw new TNotSupportedException('hiddenfield_skinid_unsupported');
-}
-}
-
-class THyperLink extends TWebControl
-{
-protected function getTagName()
-{
-return 'a';
-}
-protected function addAttributesToRender($writer)
-{
-$isEnabled=$this->getEnabled(true);
-if($this->getEnabled() && !$isEnabled)
-$writer->addAttribute('disabled','disabled');
-parent::addAttributesToRender($writer);
-if(($url=$this->getNavigateUrl())!=='' && $isEnabled)
-$writer->addAttribute('href',$url);
-if(($target=$this->getTarget())!=='')
-$writer->addAttribute('target',$target);
-}
-protected function renderContents($writer)
-{
-if(($imageUrl=$this->getImageUrl())==='')
-{
-if(($text=$this->getText())!=='')
-$writer->write($text);
-else
-parent::renderContents($writer);
-}
-else
-{
-$image=Prado::createComponent('System.Web.UI.WebControls.TImage');
-$image->setImageUrl($imageUrl);
-if(($toolTip=$this->getToolTip())!=='')
-$image->setToolTip($toolTip);
-if(($text=$this->getText())!=='')
-$image->setAlternateText($text);
-$image->renderControl($writer);
-}
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-public function getImageUrl()
-{
-return $this->getViewState('ImageUrl','');
-}
-public function setImageUrl($value)
-{
-$this->setViewState('ImageUrl',$value,'');
-}
-public function getNavigateUrl()
-{
-return $this->getViewState('NavigateUrl','');
-}
-public function setNavigateUrl($value)
-{
-$this->setViewState('NavigateUrl',$value,'');
-}
-public function getTarget()
-{
-return $this->getViewState('Target','');
-}
-public function setTarget($value)
-{
-$this->setViewState('Target',$value,'');
-}
-}
-
-class TTableCell extends TWebControl
-{
-protected function getTagName()
-{
-return 'td';
-}
-protected function createStyle()
-{
-return new TTableItemStyle;
-}
-public function getHorizontalAlign()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getHorizontalAlign();
-else
-return 'NotSet';
-}
-public function setHorizontalAlign($value)
-{
-$this->getStyle()->setHorizontalAlign($value);
-}
-public function getVerticalAlign()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getVerticalAlign();
-else
-return 'NotSet';
-}
-public function setVerticalAlign($value)
-{
-$this->getStyle()->setVerticalAlign($value);
-}
-public function getColumnSpan()
-{
-return $this->getViewState('ColumnSpan', 0);
-}
-public function setColumnSpan($value)
-{
-$this->setViewState('ColumnSpan', TPropertyValue::ensureInteger($value), 0);
-}
-public function getRowSpan()
-{
-return $this->getViewState('RowSpan', 0);
-}
-public function setRowSpan($value)
-{
-$this->setViewState('RowSpan', TPropertyValue::ensureInteger($value), 0);
-}
-public function getWrap()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getWrap();
-else
-return true;
-}
-public function setWrap($value)
-{
-$this->getStyle()->setWrap($value);
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-protected function addAttributesToRender($writer)
-{
-parent::addAttributesToRender($writer);
-if(($colspan=$this->getColumnSpan())>0)
-$writer->addAttribute('colspan',"$colspan");
-if(($rowspan=$this->getRowSpan())>0)
-$writer->addAttribute('rowspan',"$rowspan");
-}
-protected function renderContents($writer)
-{
-if(($text=$this->getText())==='')
-parent::renderContents($writer);
-else
-$writer->write($text);
-}
-}
-
-class TTableHeaderCell extends TTableCell
-{
-protected function getTagName()
-{
-return 'th';
-}
-protected function addAttributesToRender($writer)
-{
-parent::addAttributesToRender($writer);
-if(($scope=$this->getScope())!=='NotSet')
-$writer->addAttribute('scope',$scope==='Row'?'row':'col');
-if(($text=$this->getAbbreviatedText())!=='')
-$writer->addAttribute('abbr',$text);
-if(($text=$this->getCategoryText())!=='')
-$writer->addAttribute('axis',$text);
-}
-public function getScope()
-{
-return $this->getViewState('Scope','NotSet');
-}
-public function setScope($value)
-{
-$this->setViewState('Scope',TPropertyValue::ensureEnum($value,'NotSet','Row','Column'),'NotSet');
-}
-public function getAbbreviatedText()
-{
-return $this->getViewState('AbbreviatedText','');
-}
-public function setAbbreviatedText($value)
-{
-$this->setViewState('AbbreviatedText',$value,'');
-}
-public function getCategoryText()
-{
-return $this->getViewState('CategoryText','');
-}
-public function setCategoryText($value)
-{
-$this->setViewState('CategoryText',$value,'');
-}
-}
-
-class TTableRow extends TWebControl
-{
-private $_cells=null;
-protected function getTagName()
-{
-return 'tr';
-}
-public function addParsedObject($object)
-{
-if($object instanceof TTableCell)
-$this->getCells()->add($object);
-}
-protected function createStyle()
-{
-return new TTableItemStyle;
-}
-public function getCells()
-{
-if(!$this->_cells)
-$this->_cells=new TTableCellCollection($this);
-return $this->_cells;
-}
-public function getHorizontalAlign()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getHorizontalAlign();
-else
-return 'NotSet';
-}
-public function setHorizontalAlign($value)
-{
-$this->getStyle()->setHorizontalAlign($value);
-}
-public function getVerticalAlign()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getVerticalAlign();
-else
-return 'NotSet';
-}
-public function setVerticalAlign($value)
-{
-$this->getStyle()->setVerticalAlign($value);
-}
-protected function renderContents($writer)
-{
-if($this->_cells)
-{
-$writer->writeLine();
-foreach($this->_cells as $cell)
-{
-$cell->renderControl($writer);
-$writer->writeLine();
-}
-}
-}
-}
-class TTableCellCollection extends TList
-{
-private $_owner=null;
-public function __construct($owner=null)
-{
-$this->_owner=$owner;
-}
-public function insertAt($index,$item)
-{
-if($item instanceof TTableCell)
-{
-parent::insertAt($index,$item);
-if($this->_owner)
-$this->_owner->getControls()->insertAt($index,$item);
-}
-else
-throw new TInvalidDataTypeException('tablecellcollection_tablecell_required');
-}
-public function removeAt($index)
-{
-$item=parent::removeAt($index);
-if($item instanceof TTableCell)
-$this->_owner->getControls()->remove($item);
-return $item;
-}
-}
-
-class TTable extends TWebControl
-{
-private $_rows=null;
-protected function getTagName()
-{
-return 'table';
-}
-public function addParsedObject($object)
-{
-if($object instanceof TTableRow)
-$this->getRows()->add($object);
-}
-protected function createStyle()
-{
-return new TTableStyle;
-}
-protected function addAttributesToRender($writer)
-{
-parent::addAttributesToRender($writer);
-$border=0;
-if($this->getHasStyle())
-{
-if($this->getGridLines()!=='None')
-{
-if(($border=$this->getBorderWidth())==='')
-$border=1;
-else
-$border=(int)$border;
-}
-}
-$writer->addAttribute('border',"$border");
-}
-public function getRows()
-{
-if(!$this->_rows)
-$this->_rows=new TTableRowCollection($this);
-return $this->_rows;
-}
-public function getCaption()
-{
-return $this->getViewState('Caption','');
-}
-public function setCaption($value)
-{
-$this->setViewState('Caption',$value,'');
-}
-public function getCaptionAlign()
-{
-return $this->getViewState('CaptionAlign','NotSet');
-}
-public function setCaptionAlign($value)
-{
-$this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'NotSet','Top','Bottom','Left','Right'),'NotSet');
-}
-public function getCellSpacing()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getCellSpacing();
-else
-return -1;
-}
-public function setCellSpacing($value)
-{
-$this->getStyle()->setCellSpacing($value);
-}
-public function getCellPadding()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getCellPadding();
-else
-return -1;
-}
-public function setCellPadding($value)
-{
-$this->getStyle()->setCellPadding($value);
-}
-public function getHorizontalAlign()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getHorizontalAlign();
-else
-return 'NotSet';
-}
-public function setHorizontalAlign($value)
-{
-$this->getStyle()->setHorizontalAlign($value);
-}
-public function getGridLines()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getGridLines();
-else
-return 'None';
-}
-public function setGridLines($value)
-{
-$this->getStyle()->setGridLines($value);
-}
-public function getBackImageUrl()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getBackImageUrl();
-else
-return '';
-}
-public function setBackImageUrl($value)
-{
-$this->getStyle()->setBackImageUrl($value);
-}
-public function renderBeginTag($writer)
-{
-parent::renderBeginTag($writer);
-if(($caption=$this->getCaption())!=='')
-{
-if(($align=$this->getCaptionAlign())!=='NotSet')
-$writer->addAttribute('align',strtolower($align));
-$writer->renderBeginTag('caption');
-$writer->write($caption);
-$writer->renderEndTag();
-}
-}
-protected function renderContents($writer)
-{
-if($this->_rows)
-{
-$writer->writeLine();
-foreach($this->_rows as $row)
-{
-$row->renderControl($writer);
-$writer->writeLine();
-}
-}
-}
-}
-class TTableRowCollection extends TList
-{
-private $_owner=null;
-public function __construct($owner=null)
-{
-$this->_owner=$owner;
-}
-public function insertAt($index,$item)
-{
-if($item instanceof TTableRow)
-{
-parent::insertAt($index,$item);
-if($this->_owner)
-$this->_owner->getControls()->insertAt($index,$item);
-}
-else
-throw new TInvalidDataTypeException('tablerowcollection_tablerow_required');
-}
-public function removeAt($index)
-{
-$item=parent::removeAt($index);
-if($item instanceof TTableRow)
-$this->_owner->getControls()->remove($item);
-return $item;
-}
-}
-
-interface IDataSource
-{
-public function getView($viewName);
-public function getViewNames();
-public function onDataSourceChanged($param);
-}
-abstract class TDataSourceControl extends TControl implements IDataSource
-{
-public function getView($viewName)
-{
-return null;
-}
-public function getViewNames()
-{
-return array();
-}
-public function onDataSourceChanged($param)
-{
-$this->raiseEvent('OnDataSourceChanged',$this,$param);
-}
-public function focus()
-{
-throw new TNotSupportedException('datasourcecontrol_focus_unsupported');
-}
-public function getEnableTheming()
-{
-return false;
-}
-public function setEnableTheming($value)
-{
-throw new TNotSupportedException('datasourcecontrol_enabletheming_unsupported');
-}
-public function getSkinID()
-{
-return '';
-}
-public function setSkinID($value)
-{
-throw new TNotSupportedException('datasourcecontrol_skinid_unsupported');
-}
-public function getVisible($checkParents=true)
-{
-return false;
-}
-public function setVisible($value)
-{
-throw new TNotSupportedException('datasourcecontrol_visible_unsupported');
-}
-}
-class TReadOnlyDataSource extends TDataSourceControl
-{
-private $_dataSource;
-private $_dataMember;
-public function __construct($dataSource,$dataMember)
-{
-if(!is_array($dataSource) && !($dataSource instanceof IDataSource) && !($dataSource instanceof Traversable))
-throw new TInvalidDataTypeException('readonlydatasource_datasource_invalid');
-$this->_dataSource=$dataSource;
-$this->_dataMember=$dataMember;
-}
-public function getView($viewName)
-{
-if($this->_dataSource instanceof IDataSource)
-return $this->_dataSource->getView($viewName);
-else
-return new TReadOnlyDataSourceView($this,$this->_dataMember,$this->_dataSource);
-}
-}
-
-class TDataSourceSelectParameters extends TComponent
-{
-private $_retrieveTotalRowCount=false;
-private $_startRowIndex=0;
-private $_totalRowCount=0;
-private $_maximumRows=0;
-public function getStartRowIndex()
-{
-return $this->_startRowIndex;
-}
-public function setStartRowIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=0;
-$this->_startRowIndex=$value;
-}
-public function getMaximumRows()
-{
-return $this->_maximumRows;
-}
-public function setMaximumRows($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=0;
-$this->_maximumRows=$value;
-}
-public function getRetrieveTotalRowCount()
-{
-return $this->_retrieveTotalRowCount;
-}
-public function setRetrieveTotalRowCount($value)
-{
-$this->_retrieveTotalRowCount=TPropertyValue::ensureBoolean($value);
-}
-public function getTotalRowCount()
-{
-return $this->_totalRowCount;
-}
-public function setTotalRowCount($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=0;
-$this->_totalRowCount=$value;
-}
-}
-abstract class TDataSourceView extends TComponent
-{
-private $_owner;
-private $_name;
-public function __construct(IDataSource $owner,$viewName)
-{
-$this->_owner=$owner;
-$this->_name=$viewName;
-}
-abstract public function select($parameters);
-public function insertAt($values)
-{
-throw new TNotSupportedException('datasourceview_insert_unsupported');
-}
-public function update($keys,$values)
-{
-throw new TNotSupportedException('datasourceview_update_unsupported');
-}
-public function delete($keys)
-{
-throw new TNotSupportedException('datasourceview_delete_unsupported');
-}
-public function getCanDelete()
-{
-return false;
-}
-public function getCanInsert()
-{
-return false;
-}
-public function getCanPage()
-{
-return false;
-}
-public function getCanGetRowCount()
-{
-return false;
-}
-public function getCanSort()
-{
-return false;
-}
-public function getCanUpdate()
-{
-return false;
-}
-public function getName()
-{
-return $this->_name;
-}
-public function getDataSource()
-{
-return $this->_owner;
-}
-public function onDataSourceViewChanged($param)
-{
-$this->raiseEvent('OnDataSourceViewChanged',$this,$param);
-}
-}
-class TReadOnlyDataSourceView extends TDataSourceView
-{
-private $_dataSource=null;
-public function __construct(IDataSource $owner,$viewName,$dataSource)
-{
-parent::__construct($owner,$viewName);
-if($dataSource===null || is_array($dataSource))
-$this->_dataSource=new TMap($dataSource);
-else if($dataSource instanceof Traversable)
-$this->_dataSource=$dataSource;
-else
-throw new TInvalidDataTypeException('readonlydatasourceview_datasource_invalid');
-}
-public function select($parameters)
-{
-return $this->_dataSource;
-}
-}
-
-abstract class TDataBoundControl extends TWebControl
-{
-private $_initialized=false;
-private $_dataSource=null;
-private $_requiresBindToNull=false;
-private $_requiresDataBinding=false;
-private $_prerendered=false;
-private $_currentView=null;
-private $_currentDataSource=null;
-private $_currentViewValid=false;
-private $_currentDataSourceValid=false;
-private $_currentViewIsFromDataSourceID=false;
-private $_parameters=null;
-private $_isDataBound=false;
-public function getDataSource()
-{
-return $this->_dataSource;
-}
-public function setDataSource($value)
-{
-$this->_dataSource=$this->validateDataSource($value);;
-$this->onDataSourceChanged();
-}
-public function getDataSourceID()
-{
-return $this->getViewState('DataSourceID','');
-}
-public function setDataSourceID($value)
-{
-$dsid=$this->getViewState('DataSourceID','');
-if($dsid!=='' && $value==='')
-$this->_requiresBindToNull=true;
-$this->setViewState('DataSourceID',$value,'');
-$this->onDataSourceChanged();
-}
-protected function getUsingDataSourceID()
-{
-return $this->getDataSourceID()!=='';
-}
-public function onDataSourceChanged()
-{
-$this->_currentViewValid=false;
-$this->_currentDataSourceValid=false;
-if($this->getInitialized())
-$this->setRequiresDataBinding(true);
-}
-protected function getInitialized()
-{
-return $this->_initialized;
-}
-protected function setInitialized($value)
-{
-$this->_initialized=TPropertyValue::ensureBoolean($value);
-}
-protected function getIsDataBound()
-{
-return $this->_isDataBound;
-}
-protected function setIsDataBound($value)
-{
-$this->_isDataBound=$value;
-}
-protected function getRequiresDataBinding()
-{
-return $this->_requiresDataBinding;
-}
-protected function setRequiresDataBinding($value)
-{
-$value=TPropertyValue::ensureBoolean($value);
-if($value && $this->_prerendered)
-{
-$this->_requiresDataBinding=true;
-$this->ensureDataBound();
-}
-else
-$this->_requiresDataBinding=$value;
-}
-protected function ensureDataBound()
-{
-if($this->_requiresDataBinding && ($this->getUsingDataSourceID() || $this->_requiresBindToNull))
-{
-$this->dataBind();
-$this->_requiresBindToNull=false;
-}
-}
-public function dataBind()
-{
-$this->setRequiresDataBinding(false);
-$this->dataBindProperties();
-$this->onDataBinding(null);
-$data=$this->getData();
-if($data instanceof Traversable)
-$this->performDataBinding($data);
-else if($data!==null)
-throw new TInvalidDataTypeException('databoundcontrol_data_nontraversable');
-$this->setIsDataBound(true);
-$this->onDataBound(null);
-}
-public function dataSourceViewChanged($sender,$param)
-{
-if(!$this->_ignoreDataSourceViewChanged)
-$this->setRequiresDataBinding(true);
-}
-protected function getData()
-{
-if(($view=$this->getDataSourceView())!==null)
-return $view->select($this->getSelectParameters());
-else
-return null;
-}
-protected function getDataSourceView()
-{
-if(!$this->_currentViewValid)
-{
-if($this->_currentView && $this->_currentViewIsFromDataSourceID)
-$this->_currentView->detachEventHandler('DataSourceViewChanged',array($this,'dataSourceViewChanged'));
-if(($dataSource=$this->determineDataSource())!==null)
-{
-if(($view=$dataSource->getView($this->getDataMember()))===null)
-throw new TInvalidDataValueException('databoundcontrol_datamember_invalid',$this->getDataMember());
-if($this->_currentViewIsFromDataSourceID=$this->getUsingDataSourceID())
-$view->attachEventHandler('OnDataSourceViewChanged',array($this,'dataSourceViewChanged'));
-$this->_currentView=$view;
-}
-else
-$this->_currentView=null;
-$this->_currentViewValid=true;
-}
-return $this->_currentView;
-}
-protected function determineDataSource()
-{
-if(!$this->_currentDataSourceValid)
-{
-if(($dsid=$this->getDataSourceID())!=='')
-{
-if(($dataSource=$this->getNamingContainer()->findControl($dsid))===null)
-throw new TInvalidDataValueException('databoundcontrol_datasourceid_inexistent',$dsid);
-else if(!($dataSource instanceof IDataSource))
-throw new TInvalidDataValueException('databoundcontrol_datasourceid_invalid',$dsid);
-else
-$this->_currentDataSource=$dataSource;
-}
-else if(($dataSource=$this->getDataSource())!==null)
-$this->_currentDataSource=new TReadOnlyDataSource($dataSource,$this->getDataMember());
-else
-$this->_currentDataSource=null;
-$this->_currentDataSourceValid=true;
-}
-return $this->_currentDataSource;
-}
-abstract protected function performDataBinding($data);
-public function onDataBound($param)
-{
-$this->raiseEvent('OnDataBound',$this,$param);
-}
-public function onInit($param)
-{
-parent::onInit($param);
-$page=$this->getPage();
-$page->attachEventHandler('OnPreLoad',array($this,'onPagePreLoad'));
-}
-public function onPagePreLoad($sender,$param)
-{
-$this->_initialized=true;
-$isPostBack=$this->getPage()->getIsPostBack();
-if(!$isPostBack || ($isPostBack && (!$this->getEnableViewState(true) || !$this->getIsDataBound())))
-$this->setRequiresDataBinding(true);
-}
-public function onPreRender($param)
-{
-$this->_prerendered=true;
-$this->ensureDataBound();
-parent::onPreRender($param);
-}
-protected function validateDataSource($value)
-{
-if(is_string($value))
-{
-$list=new TList;
-foreach(TPropertyValue::ensureArray($value) as $key=>$value)
-{
-if(is_array($value))
-$list->add($value);
-else
-$list->add(array($value,is_string($key)?$key:$value));
-}
-return $list;
-}
-else if(is_array($value))
-return new TMap($value);
-else if(($value instanceof Traversable) || $value===null)
-return $value;
-else
-throw new TInvalidDataTypeException('databoundcontrol_datasource_invalid');
-}
-public function getDataMember()
-{
-return $this->getViewState('DataMember','');
-}
-public function setDataMember($value)
-{
-$this->setViewState('DataMember',$value,'');
-}
-public function getSelectParameters()
-{
-if(!$this->_parameters)
-$this->_parameters=new TDataSourceSelectParameters;
-return $this->_parameters;
-}
-}
-
-class TCheckBoxList extends TListControl implements IRepeatInfoUser, INamingContainer, IPostBackDataHandler
-{
-private $_repeatedControl;
-private $_isEnabled;
-private $_changedEventRaised=false;
-public function __construct()
-{
-parent::__construct();
-$this->_repeatedControl=$this->createRepeatedControl();
-$this->_repeatedControl->setEnableViewState(false);
-$this->_repeatedControl->setID('0');
-$this->getControls()->add($this->_repeatedControl);
-}
-protected function createRepeatedControl()
-{
-return new TCheckBox;
-}
-public function findControl($id)
-{
-return $this;
-}
-protected function getIsMultiSelect()
-{
-return true;
-}
-protected function createStyle()
-{
-return new TTableStyle;
-}
-public function getTextAlign()
-{
-return $this->getViewState('TextAlign','Right');
-}
-public function setTextAlign($value)
-{
-$this->setViewState('TextAlign',TPropertyValue::ensureEnum($value,array('Left','Right')),'Right');
-}
-protected function getRepeatInfo()
-{
-if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null)
-{
-$repeatInfo=new TRepeatInfo;
-$this->setViewState('RepeatInfo',$repeatInfo,null);
-}
-return $repeatInfo;
-}
-public function getRepeatColumns()
-{
-return $this->getRepeatInfo()->getRepeatColumns();
-}
-public function setRepeatColumns($value)
-{
-$this->getRepeatInfo()->setRepeatColumns($value);
-}
-public function getRepeatDirection()
-{
-return $this->getRepeatInfo()->getRepeatDirection();
-}
-public function setRepeatDirection($value)
-{
-$this->getRepeatInfo()->setRepeatDirection($value);
-}
-public function getRepeatLayout()
-{
-return $this->getRepeatInfo()->getRepeatLayout();
-}
-public function setRepeatLayout($value)
-{
-$this->getRepeatInfo()->setRepeatLayout($value);
-}
-public function getCellSpacing()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getCellSpacing();
-else
-return -1;
-}
-public function setCellSpacing($value)
-{
-$this->getStyle()->setCellSpacing($value);
-}
-public function getCellPadding()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getCellPadding();
-else
-return -1;
-}
-public function setCellPadding($value)
-{
-$this->getStyle()->setCellPadding($value);
-}
-public function getHasHeader()
-{
-return false;
-}
-public function getHasFooter()
-{
-return false;
-}
-public function getHasSeparators()
-{
-return false;
-}
-public function generateItemStyle($itemType,$index)
-{
-return null;
-}
-public function renderItem($writer,$repeatInfo,$itemType,$index)
-{
-$item=$this->getItems()->itemAt($index);
-if($item->getHasAttributes())
-$this->_repeatedControl->getAttributes()->copyFrom($item->getAttributes());
-else if($this->_repeatedControl->getHasAttributes())
-$this->_repeatedControl->getAttributes()->clear();
-$this->_repeatedControl->setID("$index");
-$this->_repeatedControl->setText($item->getText());
-$this->_repeatedControl->setChecked($item->getSelected());
-$this->_repeatedControl->setAttribute('value',$item->getValue());
-$this->_repeatedControl->setEnabled($this->_isEnabled && $item->getEnabled());
-$this->_repeatedControl->renderControl($writer);
-}
-public function loadPostData($key,$values)
-{
-if($this->getEnabled(true))
-{
-$index=(int)substr($key,strlen($this->getUniqueID())+1);
-$this->ensureDataBound();
-if($index>=0 && $index<$this->getItemCount())
-{
-$item=$this->getItems()->itemAt($index);
-if($item->getEnabled())
-{
-$checked=isset($values[$key]);
-if($item->getSelected()!=$checked)
-{
-$item->setSelected($checked);
-if(!$this->_changedEventRaised)
-{
-$this->_changedEventRaised=true;
-return true;
-}
-}
-}
-}
-}
-return false;
-}
-public function raisePostDataChangedEvent()
-{
-if($this->getAutoPostBack() && $this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onSelectedIndexChanged(null);
-}
-public function onPreRender($param)
-{
-parent::onPreRender($param);
-$this->_repeatedControl->setAutoPostBack($this->getAutoPostBack());
-$this->_repeatedControl->setCausesValidation($this->getCausesValidation());
-$this->_repeatedControl->setValidationGroup($this->getValidationGroup());
-$page=$this->getPage();
-$n=$this->getItemCount();
-for($i=0;$i<$n;++$i)
-{
-$this->_repeatedControl->setID("$i");
-$page->registerRequiresPostData($this->_repeatedControl);
-}
-}
-protected function render($writer)
-{
-if($this->getItemCount()>0)
-{
-$this->_isEnabled=$this->getEnabled(true);
-$repeatInfo=$this->getRepeatInfo();
-$accessKey=$this->getAccessKey();
-$tabIndex=$this->getTabIndex();
-$this->_repeatedControl->setTextAlign($this->getTextAlign());
-$this->_repeatedControl->setAccessKey($accessKey);
-$this->_repeatedControl->setTabIndex($tabIndex);
-$this->setAccessKey('');
-$this->setTabIndex(0);
-$repeatInfo->renderRepeater($writer,$this);
-$this->setAccessKey($accessKey);
-$this->setTabIndex($tabIndex);
-}
-}
-}
-
-class TRadioButtonList extends TCheckBoxList
-{
-protected function getIsMultiSelect()
-{
-return false;
-}
-protected function createRepeatedControl()
-{
-return new TRadioButton;
-}
-public function loadPostData($key,$values)
-{
-$value=isset($values[$key])?$values[$key]:'';
-$oldSelection=$this->getSelectedIndex();
-$this->ensureDataBound();
-foreach($this->getItems() as $index=>$item)
-{
-if($item->getEnabled() && $item->getValue()===$value)
-{
-if($index===$oldSelection)
-return false;
-else
-{
-$this->setSelectedIndex($index);
-return true;
-}
-}
-}
-return false;
-}
-public function setSelectedIndices($indices)
-{
-throw new TNotSupportedException('radiobuttonlist_selectedindices_unsupported');
-}
-}
-
-class TBulletedList extends TListControl implements IPostBackEventHandler
-{
-private $_isEnabled;
-private $_postBackOptions;
-private $_currentRenderItemIndex;
-public function raisePostBackEvent($param)
-{
-if($this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onClick(new TBulletedListEventParameter((int)$param));
-}
-protected function getTagName()
-{
-switch($this->getBulletStyle())
-{
-case 'Numbered':
-case 'LowerAlpha':
-case 'UpperAlpha':
-case 'LowerRoman':
-case 'UpperRoman':
-return 'ol';
-}
-return 'ul';
-}
-protected function addAttributesToRender($writer)
-{
-$needStart=false;
-switch($this->getBulletStyle())
-{
-case 'Numbered':
-$writer->addStyleAttribute('list-style-type','decimal');
-$needStart=true;
-break;
-case 'LowerAlpha':
-$writer->addStyleAttribute('list-style-type','lower-alpha');
-$needStart=true;
-break;
-case 'UpperAlpha':
-$writer->addStyleAttribute('list-style-type','upper-alpha');
-$needStart=true;
-break;
-case 'LowerRoman':
-$writer->addStyleAttribute('list-style-type','lower-roman');
-$needStart=true;
-break;
-case 'UpperRoman':
-$writer->addStyleAttribute('list-style-type','upper-roman');
-$needStart=true;
-break;
-case 'Disc':
-$writer->addStyleAttribute('list-style-type','disc');
-break;
-case 'Circle':
-$writer->addStyleAttribute('list-style-type','circle');
-break;
-case 'Square':
-$writer->addStyleAttribute('list-style-type','square');
-break;
-case 'CustomImage':
-$url=$this->getBulletImageUrl();
-$writer->addStyleAttribute('list-style-image',"url($url)");
-break;
-}
-if($needStart && ($start=$this->getFirstBulletNumber())!=1)
-$writer->addAttribute('start',"$start");
-parent::addAttributesToRender($writer);
-}
-public function getBulletImageUrl()
-{
-return $this->getViewState('BulletImageUrl','');
-}
-public function setBulletImageUrl($value)
-{
-$this->setViewState('BulletImageUrl',$value,'');
-}
-public function getBulletStyle()
-{
-return $this->getViewState('BulletStyle','NotSet');
-}
-public function setBulletStyle($value)
-{
-$this->setViewState('BulletStyle',TPropertyValue::ensureEnum($value,'NotSet','Numbered','LowerAlpha','UpperAlpha','LowerRoman','UpperRoman','Disc','Circle','Square','CustomImage'),'NotSet');
-}
-public function getDisplayMode()
-{
-return $this->getViewState('DisplayMode','Text');
-}
-public function setDisplayMode($value)
-{
-$this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'Text','HyperLink','LinkButton'),'Text');
-}
-public function getFirstBulletNumber()
-{
-return $this->getViewState('FirstBulletNumber',1);
-}
-public function setFirstBulletNumber($value)
-{
-$this->setViewState('FirstBulletNumber',TPropertyValue::ensureInteger($value),1);
-}
-public function onClick($param)
-{
-$this->raiseEvent('OnClick',$this,$param);
-}
-public function getTarget()
-{
-return $this->getViewState('Target','');
-}
-public function setTarget($value)
-{
-$this->setViewState('Target',$value,'');
-}
-protected function render($writer)
-{
-if($this->getHasItems())
-parent::render($writer);
-}
-protected function renderContents($writer)
-{
-$this->_isEnabled=$this->getEnabled(true);
-$this->_postBackOptions=$this->getPostBackOptions();
-$writer->writeLine();
-foreach($this->getItems() as $index=>$item)
-{
-if($item->getHasAttributes())
-{
-foreach($item->getAttributes() as $name=>$value)
-$writer->addAttribute($name,$value);
-}
-$writer->renderBeginTag('li');
-$this->renderBulletText($writer,$item,$index);
-$writer->renderEndTag();
-$writer->writeLine();
-}
-}
-protected function renderBulletText($writer,$item,$index)
-{
-switch($this->getDisplayMode())
-{
-case 'Text':
-return $this->renderTextItem($writer, $item, $index);
-case 'HyperLink':
-$this->renderHyperLinkItem($writer, $item, $index);
-break;
-case 'LinkButton':
-$this->renderLinkButtonItem($writer, $item, $index);
-}
-if(($accesskey=$this->getAccessKey())!=='')
-$writer->addAttribute('accesskey',$accesskey);
-$writer->renderBeginTag('a');
-$writer->write(THttpUtility::htmlEncode($item->getText()));
-$writer->renderEndTag();
-}
-protected function renderTextItem($writer, $item, $index)
-{
-if($item->getEnabled())
-$writer->write(THttpUtility::htmlEncode($item->getText()));
-else
-{
-$writer->addAttribute('disabled','disabled');
-$writer->renderBeginTag('span');
-$writer->write(THttpUtility::htmlEncode($item->getText()));
-$writer->renderEndTag();
-}
-}
-protected function renderHyperLinkItem($writer, $item, $index)
-{
-if(!$this->_isEnabled || !$item->getEnabled())
-$writer->addAttribute('disabled','disabled');
-else
-{
-$writer->addAttribute('href',$item->getValue());
-if(($target=$this->getTarget())!=='')
-$writer->addAttribute('target',$target);
-}
-}
-protected function renderLinkButtonItem($writer, $item, $index)
-{
-if(!$this->_isEnabled || !$item->getEnabled())
-$writer->addAttribute('disabled','disabled');
-else
-{
-$this->_currentRenderItemIndex = $index;
-$this->getPage()->getClientScript()->registerPostbackControl($this);
-$writer->addAttribute('id', $this->getClientID().$index);
-$writer->addAttribute('href', "javascript:;//".$this->getClientID().$index);
-}
-}
-public function getPostBackOptions()
-{
-$options['ValidationGroup'] = $this->getValidationGroup();
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['EventTarget'] = $this->getUniqueID();
-$options['EventParameter'] = $this->_currentRenderItemIndex;
-$options['ID'] = $this->getClientID().$this->_currentRenderItemIndex;
-return $options;
-}
-protected function canCauseValidation()
-{
-$group = $this->getValidationGroup();
-$hasValidators = $this->getPage()->getValidators($group)->getCount()>0;
-return $this->getCausesValidation() && $hasValidators;
-}
-public function setAutoPostBack($value)
-{
-throw new TNotSupportedException('bulletedlist_autopostback_unsupported');
-}
-public function setSelectedIndex($index)
-{
-throw new TNotSupportedException('bulletedlist_selectedindex_unsupported');
-}
-public function setSelectedIndices($indices)
-{
-throw new TNotSupportedException('bulletedlist_selectedindices_unsupported');
-}
-public function setSelectedValue($value)
-{
-throw new TNotSupportedException('bulletedlist_selectedvalue_unsupported');
-}
-}
-class TBulletedListEventParameter extends TEventParameter
-{
-private $_index;
-public function __construct($index)
-{
-$this->_index=$index;
-}
-public function getIndex()
-{
-return $this->_index;
-}
-}
-
-abstract class TListControl extends TDataBoundControl
-{
-private $_items=null;
-private $_loadedFromState=false;
-protected function getTagName()
-{
-return 'select';
-}
-protected function addAttributesToRender($writer)
-{
-$page=$this->getPage();
-$page->ensureRenderInForm($this);
-if($this->getIsMultiSelect())
-$writer->addAttribute('multiple','multiple');
-if($this->getEnabled(true) && $this->getAutoPostBack() && $page->getClientSupportsJavaScript())
-{
-$writer->addAttribute('id',$this->getClientID());
-$this->getPage()->getClientScript()->registerPostBackControl($this);
-}
-if($this->getEnabled(true) && !$this->getEnabled())
-$writer->addAttribute('disabled','disabled');
-parent::addAttributesToRender($writer);
-}
-public function getPostBackOptions()
-{
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['ValidationGroup'] = $this->getValidationGroup();
-$options['EventTarget'] = $this->getUniqueID();
-return $options;
-}
-public function addParsedObject($object)
-{
-if(!$this->_loadedFromState && ($object instanceof TListItem))
-$this->getItems()->add($object);
-}
-protected function performDataBinding($data)
-{
-$items=$this->getItems();
-if(!$this->getAppendDataBoundItems())
-$items->clear();
-$textField=$this->getDataTextField();
-if($textField==='')
-$textField=0;
-$valueField=$this->getDataValueField();
-if($valueField==='')
-$valueField=1;
-$textFormat=$this->getDataTextFormatString();
-foreach($data as $key=>$object)
-{
-$item=new TListItem;
-if(!is_string($object) && isset($object[$textField]))
-$text=$object[$textField];
-else
-$text=TPropertyValue::ensureString($object);
-$item->setText($textFormat===''?$text:sprintf($textFormat,$text));
-if(!is_string($object) && isset($object[$valueField]))
-$item->setValue($object[$valueField]);
-else if(!is_integer($key))
-$item->setValue($key);
-$items->add($item);
-}
-}
-public function saveState()
-{
-parent::saveState();
-if($this->_items)
-$this->setViewState('Items',$this->_items->saveState(),null);
-else
-$this->clearViewState('Items');
-}
-public function loadState()
-{
-parent::loadState();
-$this->_loadedFromState=true;
-if(!$this->getIsDataBound())
-{
-$this->_items=new TListItemCollection;
-$this->_items->loadState($this->getViewState('Items',null));
-}
-$this->clearViewState('Items');
-}
-protected function getIsMultiSelect()
-{
-return false;
-}
-public function getAppendDataBoundItems()
-{
-return $this->getViewState('AppendDataBoundItems',false);
-}
-public function setAppendDataBoundItems($value)
-{
-$this->setViewState('AppendDataBoundItems',TPropertyValue::ensureBoolean($value),false);
-}
-public function getAutoPostBack()
-{
-return $this->getViewState('AutoPostBack',false);
-}
-public function setAutoPostBack($value)
-{
-$this->setViewState('AutoPostBack',TPropertyValue::ensureBoolean($value),false);
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-}
-public function getDataTextField()
-{
-return $this->getViewState('DataTextField','');
-}
-public function setDataTextField($value)
-{
-$this->setViewState('DataTextField',$value,'');
-}
-public function getDataTextFormatString()
-{
-return $this->getViewState('DataTextFormatString','');
-}
-public function setDataTextFormatString($value)
-{
-$this->setViewState('DataTextFormatString',$value,'');
-}
-public function getDataValueField()
-{
-return $this->getViewState('DataValueField','');
-}
-public function setDataValueField($value)
-{
-$this->setViewState('DataValueField',$value,'');
-}
-public function getItemCount()
-{
-return $this->_items?$this->_items->getCount():0;
-}
-public function getHasItems()
-{
-return ($this->_items && $this->_items->getCount()>0);
-}
-public function getItems()
-{
-if(!$this->_items)
-$this->_items=new TListItemCollection;
-return $this->_items;
-}
-public function getSelectedIndex()
-{
-if($this->_items)
-{
-$n=$this->_items->getCount();
-for($i=0;$i<$n;++$i)
-if($this->_items->itemAt($i)->getSelected())
-return $i;
-}
-return -1;
-}
-public function setSelectedIndex($index)
-{
-$index=TPropertyValue::ensureInteger($index);
-if($this->_items)
-{
-$this->clearSelection();
-if($index>=0 && $index<$this->_items->getCount())
-$this->_items->itemAt($index)->setSelected(true);
-}
-}
-public function getSelectedIndices()
-{
-$selections=array();
-if($this->_items)
-{
-$n=$this->_items->getCount();
-for($i=0;$i<$n;++$i)
-if($this->_items->itemAt($i)->getSelected())
-$selections[]=$i;
-}
-return $selections;
-}
-public function setSelectedIndices($indices)
-{
-if($this->_items)
-{
-$this->clearSelection();
-$n=$this->_items->getCount();
-foreach($indices as $index)
-{
-if($index>=0 && $index<$n)
-$this->_items->itemAt($index)->setSelected(true);
-}
-}
-}
-public function getSelectedItem()
-{
-if(($index=$this->getSelectedIndex())>=0)
-return $this->_items->itemAt($index);
-else
-return null;
-}
-public function getSelectedValue()
-{
-$index=$this->getSelectedIndex();
-return $index>=0?$this->getItems()->itemAt($index)->getValue():'';
-}
-public function setSelectedValue($value)
-{
-if($this->_items)
-{
-if($value===null)
-$this->clearSelection();
-else if(($item=$this->_items->findItemByValue($value))!==null)
-{
-$this->clearSelection();
-$item->setSelected(true);
-}
-}
-}
-public function getText()
-{
-return $this->getSelectedValue();
-}
-public function setText($value)
-{
-$this->setSelectedValue($value);
-}
-public function clearSelection()
-{
-if($this->_items)
-{
-foreach($this->_items as $item)
-$item->setSelected(false);
-}
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-public function onSelectedIndexChanged($param)
-{
-$this->raiseEvent('OnSelectedIndexChanged',$this,$param);
-}
-public function onTextChanged($param)
-{
-$this->raiseEvent('OnTextChanged',$this,$param);
-}
-protected function renderContents($writer)
-{
-if($this->_items)
-{
-$writer->writeLine();
-foreach($this->_items as $item)
-{
-if($item->getEnabled())
-{
-if($item->getSelected())
-$writer->addAttribute('selected','selected');
-$writer->addAttribute('value',$item->getValue());
-if($item->getHasAttributes())
-{
-foreach($item->getAttributes() as $name=>$value)
-$writer->addAttribute($name,$value);
-}
-$writer->renderBeginTag('option');
-$writer->write(THttpUtility::htmlEncode($item->getText()));
-$writer->renderEndTag();
-$writer->writeLine();
-}
-}
-}
-}
-}
-class TListItemCollection extends TList
-{
-public function insertAt($index,$item)
-{
-if(is_string($item))
-parent::insertAt($index,new TListItem($item));
-else if($item instanceof TListItem)
-parent::insertAt($index,$item);
-else
-throw new TInvalidDataTypeException('listitemcollection_item_invalid');
-}
-public function findIndexByValue($value,$includeDisabled=true)
-{
-$value=TPropertyValue::ensureString($value);
-$index=0;
-foreach($this as $item)
-{
-if($item->getValue()===$value && ($includeDisabled || $item->getEnabled()))
-return $index;
-$index++;
-}
-return -1;
-}
-public function findIndexByText($text,$includeDisabled=true)
-{
-$text=TPropertyValue::ensureString($text);
-$index=0;
-foreach($this as $item)
-{
-if($item->getText()===$text && ($includeDisabled || $item->getEnabled()))
-return $index;
-$index++;
-}
-return -1;
-}
-public function findItemByValue($value,$includeDisabled=true)
-{
-if(($index=$this->findIndexByValue($value,$includeDisabled))>=0)
-return $this->itemAt($index);
-else
-return null;
-}
-public function findItemByText($text,$includeDisabled=true)
-{
-if(($index=$this->findIndexByText($text,$includeDisabled))>=0)
-return $this->itemAt($index);
-else
-return null;
-}
-public function loadState($state)
-{
-$this->clear();
-if($state!==null)
-{
-foreach($state as $item)
-$this->add(new TListItem($item[0],$item[1],$item[2],$item[3]));
-}
-}
-public function saveState()
-{
-if($this->getCount()>0)
-{
-$state=array();
-foreach($this as $item)
-$state[]=array($item->getText(),$item->getValue(),$item->getEnabled(),$item->getSelected());
-return $state;
-}
-else
-return null;
-}
-}
-class TListItem extends TComponent
-{
-private $_attributes=null;
-private $_text;
-private $_value;
-private $_enabled;
-private $_selected;
-public function __construct($text='',$value='',$enabled=true,$selected=false)
-{
-$this->setText($text);
-$this->setValue($value);
-$this->setEnabled($enabled);
-$this->setSelected($selected);
-}
-public function getEnabled()
-{
-return $this->_enabled;
-}
-public function setEnabled($value)
-{
-$this->_enabled=TPropertyValue::ensureBoolean($value);
-}
-public function getSelected()
-{
-return $this->_selected;
-}
-public function setSelected($value)
-{
-$this->_selected=TPropertyValue::ensureBoolean($value);
-}
-public function getText()
-{
-return $this->_text===''?$this->_value:$this->_text;
-}
-public function setText($value)
-{
-$this->_text=TPropertyValue::ensureString($value);
-}
-public function getValue()
-{
-return $this->_value===''?$this->_text:$this->_value;
-}
-public function setValue($value)
-{
-$this->_value=TPropertyValue::ensureString($value);
-}
-public function getAttributes()
-{
-if(!$this->_attributes)
-$this->_attributes=new TAttributeCollection;
-return $this->_attributes;
-}
-public function getHasAttributes()
-{
-return $this->_attributes && $this->_attributes->getCount()>0;
-}
-public function hasAttribute($name)
-{
-return $this->_attributes?$this->_attributes->contains($name):false;
-}
-public function getAttribute($name)
-{
-return $this->_attributes?$this->_attributes->itemAt($name):null;
-}
-public function setAttribute($name,$value)
-{
-$this->getAttributes()->add($name,$value);
-}
-public function removeAttribute($name)
-{
-return $this->_attributes?$this->_attributes->remove($name):null;
-}
-}
-
-class TListBox extends TListControl implements IPostBackDataHandler, IValidatable
-{
-protected function addAttributesToRender($writer)
-{
-$rows=$this->getRows();
-$writer->addAttribute('size',"$rows");
-if($this->getSelectionMode()==='Multiple')
-$writer->addAttribute('name',$this->getUniqueID().'[]');
-else
-$writer->addAttribute('name',$this->getUniqueID());
-parent::addAttributesToRender($writer);
-}
-public function onPreRender($param)
-{
-parent::onPreRender($param);
-if($this->getEnabled(true))
-$this->getPage()->registerRequiresPostData($this);
-}
-public function loadPostData($key,$values)
-{
-if(!$this->getEnabled(true))
-return false;
-$this->ensureDataBound();
-$selections=isset($values[$key])?$values[$key]:null;
-if($selections!==null)
-{
-$items=$this->getItems();
-if($this->getSelectionMode()==='Single')
-{
-$selection=is_array($selections)?$selections[0]:$selections;
-$index=$items->findIndexByValue($selection,false);
-if($this->getSelectedIndex()!==$index)
-{
-$this->setSelectedIndex($index);
-return true;
-}
-else
-return false;
-}
-if(!is_array($selections))
-$selections=array($selections);
-$list=array();
-foreach($selections as $selection)
-$list[]=$items->findIndexByValue($selection,false);
-$list2=$this->getSelectedIndices();
-$n=count($list);
-$flag=false;
-if($n===count($list2))
-{
-sort($list,SORT_NUMERIC);
-for($i=0;$i<$n;++$i)
-{
-if($list[$i]!==$list2[$i])
-{
-$flag=true;
-break;
-}
-}
-}
-else
-$flag=true;
-if($flag)
-$this->setSelectedIndices($list);
-return $flag;
-}
-else if($this->getSelectedIndex()!==-1)
-{
-$this->clearSelection();
-return true;
-}
-else
-return false;
-}
-public function raisePostDataChangedEvent()
-{
-if($this->getAutoPostBack() && $this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onSelectedIndexChanged(null);
-}
-protected function getIsMultiSelect()
-{
-return $this->getSelectionMode()==='Multiple';
-}
-public function getRows()
-{
-return $this->getViewState('Rows', 4);
-}
-public function setRows($value)
-{
-$value=TPropertyValue::ensureInteger($value);
-if($value<=0)
-$value=4;
-$this->setViewState('Rows', $value, 4);
-}
-public function getSelectionMode()
-{
-return $this->getViewState('SelectionMode', 'Single');
-}
-public function setSelectionMode($value)
-{
-$this->setViewState('SelectionMode',TPropertyValue::ensureEnum($value,array('Single','Multiple')),'Single');
-}
-public function getValidationPropertyValue()
-{
-return $this->getSelectedValue();
-}
-}
-
-class TDropDownList extends TListControl implements IPostBackDataHandler, IValidatable
-{
-protected function addAttributesToRender($writer)
-{
-$writer->addAttribute('name',$this->getUniqueID());
-parent::addAttributesToRender($writer);
-}
-public function loadPostData($key,$values)
-{
-if(!$this->getEnabled(true))
-return false;
-$this->ensureDataBound();
-$selection=isset($values[$key])?$values[$key]:null;
-if($selection!==null)
-{
-$index=$this->getItems()->findIndexByValue($selection,false);
-if($this->getSelectedIndex()!==$index)
-{
-$this->setSelectedIndex($index);
-return true;
-}
-}
-return false;
-}
-public function raisePostDataChangedEvent()
-{
-if($this->getAutoPostBack() && $this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onSelectedIndexChanged(null);
-}
-public function getSelectedIndex()
-{
-$index=parent::getSelectedIndex();
-if($index<0 && $this->getHasItems())
-{
-$this->setSelectedIndex(0);
-return 0;
-}
-else
-return $index;
-}
-public function setSelectedIndices($indices)
-{
-throw new TNotSupportedException('dropdownlist_selectedindices_unsupported');
-}
-public function getValidationPropertyValue()
-{
-return $this->getSelectedValue();
-}
-}
-
-class TJavascriptLogger extends TWebControl
-{
-protected function getTagName()
-{
-return 'div';
-}
-protected function renderContents($writer)
-{
-$this->Page->ClientScript->registerClientScript('logger');
-$info = '(<a href="http://gleepglop.com/javascripts/logger/" target="_blank">more info</a>).';
-$usage = 'Press ALT-D (Or CTRL-D on OS X) to toggle the javascript log console';
-$writer->write("{$usage} {$info}");
-parent::renderContents($writer);
-}
-}
-
-class TLinkButton extends TWebControl implements IPostBackEventHandler
-{
-protected function getTagName()
-{
-return 'a';
-}
-protected function addAttributesToRender($writer)
-{
-$page=$this->getPage();
-$page->ensureRenderInForm($this);
-$writer->addAttribute('id',$this->getClientID());
-parent::addAttributesToRender($writer);
-if($this->getEnabled(true))
-{
-$nop = "#".$this->getClientID();
-$writer->addAttribute('href', $nop);
-$this->getPage()->getClientScript()->registerPostBackControl($this);
-}
-else if($this->getEnabled()) $writer->addAttribute('disabled','disabled');
-}
-public function getPostBackOptions()
-{
-$options['EventTarget'] = $this->getUniqueID();
-$options['CausesValidation'] = $this->getCausesValidation();
-$options['ValidationGroup'] = $this->getValidationGroup();
-$options['StopEvent'] = true;
-return $options;
-}
-protected function renderContents($writer)
-{
-if(($text=$this->getText())==='')
-parent::renderContents($writer);
-else
-$writer->write($text);
-}
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-}
-public function getCommandName()
-{
-return $this->getViewState('CommandName','');
-}
-public function setCommandName($value)
-{
-$this->setViewState('CommandName',$value,'');
-}
-public function getCommandParameter()
-{
-return $this->getViewState('CommandParameter','');
-}
-public function setCommandParameter($value)
-{
-$this->setViewState('CommandParameter',$value,'');
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-public function raisePostBackEvent($param)
-{
-if($this->getCausesValidation())
-$this->getPage()->validate($this->getValidationGroup());
-$this->onClick(null);
-$this->onCommand(new TCommandEventParameter($this->getCommandName(),$this->getCommandParameter()));
-}
-public function onClick($param)
-{
-$this->raiseEvent('OnClick',$this,$param);
-}
-public function onCommand($param)
-{
-$this->raiseEvent('OnCommand',$this,$param);
-$this->raiseBubbleEvent($this,$param);
-}
-}
-
-abstract class TBaseValidator extends TLabel implements IValidator
-{
-private $_isValid=true;
-private $_registered=false;
-public function __construct()
-{
-parent::__construct();
-$this->setForeColor('red');
-}
-public function onInit($param)
-{
-parent::onInit($param);
-$this->getPage()->getValidators()->add($this);
-$this->_registered=true;
-}
-public function onUnload($param)
-{
-if($this->_registered && ($page=$this->getPage())!==null)
-$page->getValidators()->remove($this);
-$this->_registered=false;
-parent::onUnload($param);
-}
-protected function addAttributesToRender($writer)
-{
-$display=$this->getDisplay();
-$visible=$this->getEnabled(true) && !$this->getIsValid();
-if($display==='None' || (!$visible && $display==='Dynamic'))
-$writer->addStyleAttribute('display','none');
-else if(!$visible)
-$writer->addStyleAttribute('visibility','hidden');
-$writer->addAttribute('id',$this->getClientID());
-parent::addAttributesToRender($writer);
-}
-protected function getClientScriptOptions()
-{
-$options['id'] = $this->getClientID();
-$options['display'] = $this->getDisplay();
-$options['errormessage'] = $this->getErrorMessage();
-$options['focusonerror'] = $this->getFocusOnError();
-$options['focuselementid'] = $this->getFocusElementID();
-$options['validationgroup'] = $this->getValidationGroup();
-$options['controltovalidate'] = $this->getValidationTarget()->getClientID();
-return $options;
-}
-public function onPreRender($param)
-{
-$scripts = $this->getPage()->getClientScript();
-$formID=$this->getPage()->getForm()->getClientID();
-$scriptKey = "TBaseValidator:$formID";
-if($this->getEnableClientScript() && !$scripts->isEndScriptRegistered($scriptKey))
-{
-$scripts->registerClientScript('validator');
-$scripts->registerEndScript($scriptKey, "Prado.Validation.AddForm('$formID');");
-}
-if($this->getEnableClientScript())
-$this->registerClientScriptValidator();
-parent::onPreRender($param);
-}
-protected function registerClientScriptValidator()
-{
-if($this->getEnabled(true))
-{
-$class = get_class($this);
-$scriptKey = "prado:".$this->getClientID();
-$scripts = $this->getPage()->getClientScript();
-$serializer = new TJavascriptSerializer($this->getClientScriptOptions());
-$options = $serializer->toJavascript();
-$js = "new Prado.Validation(Prado.Validation.{$class}, {$options});";
-$scripts->registerEndScript($scriptKey, $js);
-}
-}
-public function setForControl($value)
-{
-throw new TNotSupportedException('basevalidator_forcontrol_unsupported',get_class($this));
-}
-public function setEnabled($value)
-{
-$value=TPropertyValue::ensureBoolean($value);
-parent::setEnabled($value);
-if(!$value)
-$this->_isValid=true;
-}
-public function getDisplay()
-{
-return $this->getViewState('Display','Static');
-}
-public function setDisplay($value)
-{
-$this->setViewState('Display',TPropertyValue::ensureEnum($value,array('None','Static','Dynamic')),'Static');
-}
-public function getEnableClientScript()
-{
-return $this->getViewState('EnableClientScript',true);
-}
-public function setEnableClientScript($value)
-{
-$this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
-}
-public function getErrorMessage()
-{
-return $this->getViewState('ErrorMessage','');
-}
-public function setErrorMessage($value)
-{
-$this->setViewState('ErrorMessage',$value,'');
-}
-public function getControlToValidate()
-{
-return $this->getViewState('ControlToValidate','');
-}
-public function setControlToValidate($value)
-{
-$this->setViewState('ControlToValidate',$value,'');
-}
-public function getFocusOnError()
-{
-return $this->getViewState('FocusOnError',false);
-}
-public function setFocusOnError($value)
-{
-$this->setViewState('FocusOnError',TPropertyValue::ensureBoolean($value),false);
-}
-public function getFocusElementID()
-{
-if(($id=$this->getViewState('FocusElementID',''))==='')
-$id=$this->getValidationTarget()->getClientID();
-return $id;
-}
-public function setFocusElementID($value)
-{
-$this->setViewState('FocusElementID', $value, '');
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-public function getIsValid()
-{
-return $this->_isValid;
-}
-public function setIsValid($value)
-{
-$this->_isValid=TPropertyValue::ensureBoolean($value);
-}
-protected function getValidationTarget()
-{
-if(($id=$this->getControlToValidate())!=='' && ($control=$this->findControl($id))!==null)
-return $control;
-else
-throw new TConfigurationException('basevalidator_controltovalidate_invalid');
-}
-protected function getValidationValue($control)
-{
-if($control instanceof IValidatable)
-return $control->getValidationPropertyValue();
-else
-throw new TInvalidDataTypeException('basevalidator_validatable_required');
-}
-public function validate()
-{
-$this->setIsValid(true);
-$control=$this->getValidationTarget();
-if($control && $this->getVisible(true) && $this->getEnabled())
-$this->setIsValid($this->evaluateIsValid());
-return $this->getIsValid();
-}
-abstract protected function evaluateIsValid();
-protected function renderContents($writer)
-{
-if(($text=$this->getText())!=='')
-$writer->write($text);
-else if(($text=$this->getErrorMessage())!=='')
-$writer->write($text);
-else
-parent::renderContents($writer);
-}
-}
-
-class TRequiredFieldValidator extends TBaseValidator
-{
-public function getInitialValue()
-{
-return $this->getViewState('InitialValue','');
-}
-public function setInitialValue($value)
-{
-$this->setViewState('InitialValue',TPropertyValue::ensureString($value),'');
-}
-protected function evaluateIsValid()
-{
-$value=$this->getValidationValue($this->getValidationTarget());
-return trim($value)!==trim($this->getInitialValue()) || (is_bool($value) && $value);
-}
-protected function getClientScriptOptions()
-{
-$options = parent::getClientScriptOptions();
-$options['initialvalue']=$this->getInitialValue();
-return $options;
-}
-}
-
-class TCompareValidator extends TBaseValidator
-{
-public function getValueType()
-{
-return $this->getViewState('ValueType','String');
-}
-public function setValueType($value)
-{
-$this->setViewState('ValueType',TPropertyValue::ensureEnum($value,'Integer','Double','Date','Currency','String'),'String');
-}
-public function getControlToCompare()
-{
-return $this->getViewState('ControlToCompare','');
-}
-public function setControlToCompare($value)
-{
-$this->setViewState('ControlToCompare',$value,'');
-}
-public function getValueToCompare()
-{
-return $this->getViewState('ValueToCompare','');
-}
-public function setValueToCompare($value)
-{
-$this->setViewState('ValueToCompare',$value,'');
-}
-public function getOperator()
-{
-return $this->getViewState('Operator','Equal');
-}
-public function setOperator($value)
-{
-$this->setViewState('Operator',TPropertyValue::ensureEnum($value,'Equal','NotEqual','GreaterThan','GreaterThanEqual','LessThan','LessThanEqual'),'Equal');
-}
-public function setDateFormat($value)
-{
-$this->setViewState('DateFormat', $value, '');
-}
-public function getDateFormat()
-{
-return $this->getViewState('DateFormat', '');
-}
-public function evaluateIsValid()
-{
-if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
-return true;
-if(($controlToCompare=$this->getControlToCompare())!=='')
-{
-if(($control2=$this->findControl($controlToCompare))===null)
-throw new TInvalidDataValueException('comparevalidator_controltocompare_invalid');
-if(($value2=$this->getValidationValue($control2))==='')
-return false;
-}
-else
-$value2=$this->getValueToCompare();
-$values = $this->getComparisonValues($value, $value2);
-switch($this->getOperator())
-{
-case 'Equal':
-return $values[0] == $values[1];
-case 'NotEqual':
-return $values[0] != $values[1];
-case 'GreaterThan':
-return $values[0] > $values[1];
-case 'GreaterThanEqual':
-return $values[0] >= $values[1];
-case 'LessThan':
-return $values[0] < $values[1];
-case 'LessThanEqual':
-return $values[0] <= $values[1];
-}
-return false;
-}
-protected function getComparisonValues($value1, $value2)
-{
-switch($this->getValueType())
-{
-case 'Integer':
-return array(intval($value1), intval($value2));
-case 'Float':
-case 'Double':
-return array(floatval($value1), floatval($value2));
-case 'Currency':
-if(preg_match('/[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?/',$value1,$matches))
-$value1=floatval($matches[0]);
-else
-$value1=0;
-if(preg_match('/[-+]?([0-9]*\.)?[0-9]+([eE][-+]?[0-9]+)?/',$value2,$matches))
-$value2=floatval($matches[0]);
-else
-$value2=0;
-return array($value1, $value2);
-case 'Date':
-throw new TNotSupportedException('Date comparison for TCompareValidator is currently not supported. It will be supported in future.');
-$dateFormat = $this->getDateFormat();
-if (strlen($dateFormat))
-return array(pradoParseDate($value1, $dateFormat), pradoParseDate($value2, $dateFormat));
-else
-return array(strtotime($value1), strtotime($value2));
-}
-return array($value1, $value2);
-}
-protected function getClientScriptOptions()
-{
-$options = parent::getClientScriptOptions();
-if(($name=$this->getControlToCompare())!=='')
-{
-if(($control=$this->findControl($name))!==null)
-$options['controltocompare']=$options['controlhookup']=$control->getClientID();
-}
-if(($value=$this->getValueToCompare())!=='')
-$options['valuetocompare']=$value;
-if(($operator=$this->getOperator())!=='Equal')
-$options['operator']=$operator;
-$options['type']=$this->getValueType();
-if(($dateFormat=$this->getDateFormat())!=='')
-$options['dateformat']=$dateFormat;
-return $options;
-}
-}
-
-class TRegularExpressionValidator extends TBaseValidator
-{
-public function getRegularExpression()
-{
-return $this->getViewState('RegularExpression','');
-}
-public function setRegularExpression($value)
-{
-$this->setViewState('RegularExpression',$value,'');
-}
-public function evaluateIsValid()
-{
-if(($value=$this->getValidationValue($this->getValidationTarget()))==='')
-return true;
-if(($expression=$this->getRegularExpression())!=='')
-return preg_match("/^$expression\$/",$value);
-else
-return true;
-}
-protected function getClientScriptOptions()
-{
-$options = parent::getClientScriptOptions();
-$options['validationexpression']=$this->getRegularExpression();
-return $options;
-}
-}
-
-class TEmailAddressValidator extends TRegularExpressionValidator
-{
-const EMAIL_REGEXP="\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*";
-public function getRegularExpression()
-{
-$regex=parent::getRegularExpression();
-return $regex===''?self::EMAIL_REGEXP:$regex;
-}
-public function evaluateIsValid()
-{
-$valid=parent::evaluateIsValid();
-if($valid && function_exists('checkdnsrr'))
-{
-if(($value=$this->getValidationValue($this->getValidationTarget()))!=='')
-{
-if(($pos=strpos($value,'@'))!==false)
-{
-$domain=substr($value,$pos+1);
-return $domain===''?false:checkdnsrr($domain,'MX');
-}
-else
-return false;
-}
-}
-return $valid;
-}
-}
-
-class TCustomValidator extends TBaseValidator
-{
-public function getClientValidationFunction()
-{
-return $this->getViewState('ClientValidationFunction','');
-}
-public function setClientValidationFunction($value)
-{
-$this->setViewState('ClientValidationFunction',$value,'');
-}
-public function evaluateIsValid()
-{
-$value=$this->getValidationValue($this->getValidationTarget());
-return $this->onServerValidate($value);
-}
-public function onServerValidate($value)
-{
-$param=new TServerValidateEventParameter($value,true);
-$this->raiseEvent('OnServerValidate',$this,$param);
-return $param->getIsValid();
-}
-protected function getClientScriptOptions()
-{
-$options=parent::getClientScriptOptions();
-if(($clientJs=$this->getClientValidationFunction())!=='')
-$options['clientvalidationfunction']=$clientJs;
-return $options;
-}
-}
-class TServerValidateEventParameter extends TEventParameter
-{
-private $_value='';
-private $_isValid=true;
-public function __construct($value,$isValid)
-{
-$this->_value=$value;
-$this->setIsValid($isValid);
-}
-public function getValue()
-{
-return $this->_value;
-}
-public function getIsValid()
-{
-return $this->_isValid;
-}
-public function setIsValid($value)
-{
-$this->_isValid=TPropertyValue::ensureBoolean($value);
-}
-}
-
-class TValidationSummary extends TWebControl
-{
-public function getHeaderText()
-{
-return $this->getViewState('HeaderText','');
-}
-public function setHeaderText($value)
-{
-$this->setViewState('HeaderText',$value,'');
-}
-public function getDisplayMode()
-{
-return $this->getViewState('DisplayMode','BulletList');
-}
-public function setDisplayMode($value)
-{
-$this->setViewState('DisplayMode',TPropertyValue::ensureEnum($value,'List','SingleParagraph','BulletList'),'BulletList');
-}
-public function getEnableClientScript()
-{
-return $this->getViewState('EnableClientScript',true);
-}
-public function setEnableClientScript($value)
-{
-$this->setViewState('EnableClientScript',TPropertyValue::ensureBoolean($value),true);
-}
-public function getShowMessageBox()
-{
-return $this->getViewState('ShowMessageBox',false);
-}
-public function setShowMessageBox($value)
-{
-$this->setViewState('ShowMessageBox',TPropertyValue::ensureBoolean($value),false);
-}
-public function getShowSummary()
-{
-return $this->getViewState('ShowSummary',true);
-}
-public function setShowSummary($value)
-{
-$this->setViewState('ShowSummary',TPropertyValue::ensureBoolean($value),true);
-}
-public function getShowAnchor()
-{
-return $this->getViewState('ShowAnchor',false);
-}
-public function setShowAnchor($value)
-{
-$this->setViewState('ShowAnchor',TPropertyValue::ensureBoolean($value),false);
-}
-public function getAutoUpdate()
-{
-return $this->getViewState('AutoUpdate', true);
-}
-public function setAutoUpdate($value)
-{
-$this->setViewState('AutoUpdate', TPropertyValue::ensureBoolean($value), true);
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-}
-protected function addAttributesToRender($writer)
-{
-$writer->addAttribute('id',$this->getClientID());
-parent::addAttributesToRender($writer);
-}
-protected function renderJsSummary()
-{
-if(!$this->getEnabled(true) || !$this->getEnableClientScript())
-return;
-$serializer = new TJavascriptSerializer($this->getClientScriptOptions());
-$options = $serializer->toJavascript();
-$script = "new Prado.Validation.Summary({$options});";
-$this->getPage()->getClientScript()->registerEndScript($this->getClientID(), $script);
-}
-protected function getClientScriptOptions()
-{
-$options['id'] = $this->ClientID;
-$options['form'] = $this->Page->Form->ClientID;
-if($this->getShowMessageBox())
-$options['showmessagebox']='True';
-if(!$this->getShowSummary())
-$options['showsummary']='False';
-$options['headertext']=$this->getHeaderText();
-$options['displaymode']=$this->getDisplayMode();
-$options['refresh'] = $this->getAutoUpdate();
-$options['validationgroup'] = $this->getValidationGroup();
-return $options;
-}
-protected function getErrorMessages()
-{
-$validators=$this->getPage()->getValidators($this->getValidationGroup());
-$messages = array();
-foreach($validators as $validator)
-{
-if(!$validator->getIsValid() && ($msg=$validator->getErrorMessage())!=='')
-$messages[] = $msg;
-}
-return $messages;
-}
-protected function renderContents($writer)
-{
-$this->renderJsSummary();
-if($this->getShowSummary())
-{
-switch($this->getDisplayMode())
-{
-case 'List':
-$content = $this->renderList($writer);
-break;
-case 'SingleParagraph':
-$content = $this->renderSingleParagraph($writer);
-break;
-case 'BulletList':
-default:
-$content = $this->renderBulletList($writer);
-}
-}
-}
-protected function renderList($writer)
-{
-$header=$this->getHeaderText();
-$messages=$this->getErrorMessages();
-$content = '';
-if(strlen($header))
-$content.= $header."<br/>\n";
-foreach($messages as $message)
-$content.="$message<br/>\n";
-$writer->write($content);
-}
-protected function renderSingleParagraph($writer)
-{
-$header=$this->getHeaderText();
-$messages=$this->getErrorMessages();
-$content = $header;
-foreach($messages as $message)
-$content.= ' '.$message;
-$writer->write($content);
-}
-protected function renderBulletList($writer)
-{
-$header=$this->getHeaderText();
-$messages=$this->getErrorMessages();
-$content = $header;
-if(count($messages)>0)
-{
-$content .= "<ul>\n";
-foreach($messages as $message)
-$content.= '<li>'.$message."</li>\n";
-$content .= "</ul>\n";
-}
-$writer->write($content);
-}
-}
-
-interface IRepeatInfoUser
-{
-public function getHasFooter();
-public function getHasHeader();
-public function getHasSeparators();
-public function getItemCount();
-public function generateItemStyle($itemType,$index);
-public function renderItem($writer,$repeatInfo,$itemType,$index);
-}
-class TRepeatInfo extends TComponent
-{
-private $_caption='';
-private $_captionAlign='NotSet';
-private $_repeatColumns=0;
-private $_repeatDirection='Vertical';
-private $_repeatLayout='Table';
-public function getCaption()
-{
-return $this->_caption;
-}
-public function setCaption($value)
-{
-$this->_caption=$value;
-}
-public function getCaptionAlign()
-{
-return $this->_captionAlign;
-}
-public function setCaptionAlign($value)
-{
-$this->_captionAlign=TPropertyValue::ensureEnum($value,array('NotSet','Top','Bottom','Left','Right'));
-}
-public function getRepeatColumns()
-{
-return $this->_repeatColumns;
-}
-public function setRepeatColumns($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-throw new TInvalidDataValueException('repeatinfo_repeatcolumns_invalid');
-$this->_repeatColumns=$value;
-}
-public function getRepeatDirection()
-{
-return $this->_repeatDirection;
-}
-public function setRepeatDirection($value)
-{
-$this->_repeatDirection=TPropertyValue::ensureEnum($value,array('Horizontal','Vertical'));
-}
-public function getRepeatLayout()
-{
-return $this->_repeatLayout;
-}
-public function setRepeatLayout($value)
-{
-$this->_repeatLayout=TPropertyValue::ensureEnum($value,array('Table','Flow'));
-}
-public function renderRepeater($writer, IRepeatInfoUser $user)
-{
-if($this->_repeatLayout==='Table')
-{
-$control=new TTable;
-if($this->_caption!=='')
-{
-$control->setCaption($this->_caption);
-$control->setCaptionAlign($this->_captionAlign);
-}
-}
-else
-$control=new TWebControl;
-$control->setID($user->getClientID());
-$control->copyBaseAttributes($user);
-if($user->getHasStyle())
-$control->getStyle()->copyFrom($user->getStyle());
-$control->renderBeginTag($writer);
-$writer->writeLine();
-if($this->_repeatDirection==='Vertical')
-$this->renderVerticalContents($writer,$user);
-else
-$this->renderHorizontalContents($writer,$user);
-$control->renderEndTag($writer);
-}
-protected function renderHorizontalContents($writer,$user)
-{
-$tableLayout=($this->_repeatLayout==='Table');
-$hasSeparators=$user->getHasSeparators();
-$itemCount=$user->getItemCount();
-$columns=$this->_repeatColumns===0?$itemCount:$this->_repeatColumns;
-$totalColumns=$hasSeparators?$columns+$columns:$columns;
-$needBreak=$columns<$itemCount;
-if($user->getHasHeader())
-$this->renderHeader($writer,$user,$tableLayout,$totalColumns,$needBreak);
-if($tableLayout)
-{
-$column=0;
-for($i=0;$i<$itemCount;++$i)
-{
-if($column==0)
-$writer->renderBeginTag('tr');
-if(($style=$user->generateItemStyle('Item',$i))!==null)
-$style->addAttributesToRender($writer);
-$writer->renderBeginTag('td');
-$user->renderItem($writer,$this,'Item',$i);
-$writer->renderEndTag();
-$writer->writeLine();
-if($hasSeparators && $i!=$itemCount-1)
-{
-if(($style=$user->generateItemStyle('Separator',$i))!==null)
-$style->addAttributesToRender($writer);
-$writer->renderBeginTag('td');
-$user->renderItem($writer,$this,'Separator',$i);
-$writer->renderEndTag();
-$writer->writeLine();
-}
-$column++;
-if($i==$itemCount-1)
-{
-$restColumns=$columns-$column;
-if($hasSeparators)
-$restColumns=$restColumns?$restColumns+$restColumns+1:1;
-for($j=0;$j<$restColumns;++$j)
-$writer->write("<td></td>\n");
-}
-if($column==$columns || $i==$itemCount-1)
-{
-$writer->renderEndTag();
-$writer->writeLine();
-$column=0;
-}
-}
-}
-else
-{
-$column=0;
-for($i=0;$i<$itemCount;++$i)
-{
-$user->renderItem($writer,$this,'Item',$i);
-if($hasSeparators && $i!=$itemCount-1)
-$user->renderItem($writer,$this,'Separator',$i);
-$column++;
-if($column==$columns || $i==$itemCount-1)
-{
-if($needBreak)
-$writer->writeBreak();
-$column=0;
-}
-$writer->writeLine();
-}
-}
-if($user->getHasFooter())
-$this->renderFooter($writer,$user,$tableLayout,$totalColumns,$needBreak);
-}
-protected function renderVerticalContents($writer,$user)
-{
-$tableLayout=($this->_repeatLayout==='Table');
-$hasSeparators=$user->getHasSeparators();
-$itemCount=$user->getItemCount();
-if($this->_repeatColumns<=1)
-{
-$rows=$itemCount;
-$columns=1;
-$lastColumns=1;
-}
-else
-{
-$columns=$this->_repeatColumns;
-$rows=(int)(($itemCount+$columns-1)/$columns);
-if($rows==0 && $itemCount>0)
-$rows=1;
-if(($lastColumns=$itemCount%$columns)==0)
-$lastColumns=$columns;
-}
-$totalColumns=$hasSeparators?$columns+$columns:$columns;
-if($user->getHasHeader())
-$this->renderHeader($writer,$user,$tableLayout,$totalColumns,false);
-if($tableLayout)
-{
-$renderedItems=0;
-for($row=0;$row<$rows;++$row)
-{
-$index=$row;
-$writer->renderBeginTag('tr');
-for($col=0;$col<$columns;++$col)
-{
-if($renderedItems>=$itemCount)
-break;
-if($col>0)
-{
-$index+=$rows;
-if($col-1>=$lastColumns)
-$index--;
-}
-if($index>=$itemCount)
-continue;
-$renderedItems++;
-if(($style=$user->generateItemStyle('Item',$index))!==null)
-$style->addAttributesToRender($writer);
-$writer->renderBeginTag('td');
-$user->renderItem($writer,$this,'Item',$index);
-$writer->renderEndTag();
-$writer->writeLine();
-if(!$hasSeparators)
-continue;
-if($renderedItems<$itemCount-1)
-{
-if($columns==1)
-{
-$writer->renderEndTag();
-$writer->renderBeginTag('tr');
-}
-if(($style=$user->generateItemStyle('Separator',$index))!==null)
-$style->addAttributesToRender($writer);
-$writer->renderBeginTag('td');
-$user->renderItem($writer,$this,'Separator',$index);
-$writer->renderEndTag();
-$writer->writeLine();
-}
-else if($columns>1)
-$writer->write("<td></td>\n");
-}
-if($row==$rows-1)
-{
-$restColumns=$columns-$lastColumns;
-if($hasSeparators)
-$restColumns+=$restColumns;
-for($col=0;$col<$restColumns;++$col)
-$writer->write("<td></td>\n");
-}
-$writer->renderEndTag();
-$writer->writeLine();
-}
-}
-else
-{
-$renderedItems=0;
-for($row=0;$row<$rows;++$row)
-{
-$index=$row;
-for($col=0;$col<$columns;++$col)
-{
-if($renderedItems>=$itemCount)
-break;
-if($col>0)
-{
-$index+=$rows;
-if($col-1>=$lastColumns)
-$index--;
-}
-if($index>=$itemCount)
-continue;
-$renderedItems++;
-$user->renderItem($writer,$this,'Item',$index);
-$writer->writeLine();
-if(!$hasSeparators)
-continue;
-if($renderedItems<$itemCount-1)
-{
-if($columns==1)
-$writer->writeBreak();
-$user->renderItem($writer,$this,'Separator',$index);
-}
-$writer->writeLine();
-}
-if($row<$rows-1 || $user->getHasFooter())
-$writer->writeBreak();
-}
-}
-if($user->getHasFooter())
-$this->renderFooter($writer,$user,$tableLayout,$totalColumns,false);
-}
-protected function renderHeader($writer,$user,$tableLayout,$columns,$needBreak)
-{
-if($tableLayout)
-{
-$writer->renderBeginTag('tr');
-if($columns>1)
-$writer->addAttribute('colspan',"$columns");
-$writer->addAttribute('scope','col');
-if(($style=$user->generateItemStyle('Header',-1))!==null)
-$style->addAttributesToRender($writer);
-$writer->renderBeginTag('th');
-$user->renderItem($writer,$this,'Header',-1);
-$writer->renderEndTag();
-$writer->renderEndTag();
-}
-else
-{
-$user->renderItem($writer,$this,'Header',-1);
-if($needBreak)
-$writer->writeBreak();
-}
-$writer->writeLine();
-}
-protected function renderFooter($writer,$user,$tableLayout,$columns)
-{
-if($tableLayout)
-{
-$writer->renderBeginTag('tr');
-if($columns>1)
-$writer->addAttribute('colspan',"$columns");
-if(($style=$user->generateItemStyle('Footer',-1))!==null)
-$style->addAttributesToRender($writer);
-$writer->renderBeginTag('td');
-$user->renderItem($writer,$this,'Footer',-1);
-$writer->renderEndTag();
-$writer->renderEndTag();
-}
-else
-$user->renderItem($writer,$this,'Footer',-1);
-$writer->writeLine();
-}
-}
-
-class TRepeater extends TDataBoundControl implements INamingContainer
-{
-private $_itemTemplate=null;
-private $_alternatingItemTemplate=null;
-private $_headerTemplate=null;
-private $_footerTemplate=null;
-private $_separatorTemplate=null;
-private $_items=null;
-private $_header=null;
-private $_footer=null;
-public function addParsedObject($object)
-{
-}
-public function getItemTemplate()
-{
-return $this->_itemTemplate;
-}
-public function setItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_itemTemplate=$value;
-else
-throw new TInvalidDataTypeException('repeater_template_required','ItemTemplate');
-}
-public function getAlternatingItemTemplate()
-{
-return $this->_alternatingItemTemplate;
-}
-public function setAlternatingItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_alternatingItemTemplate=$value;
-else
-throw new TInvalidDataTypeException('repeater_template_required','AlternatingItemTemplate');
-}
-public function getHeaderTemplate()
-{
-return $this->_headerTemplate;
-}
-public function setHeaderTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_headerTemplate=$value;
-else
-throw new TInvalidDataTypeException('repeater_template_required','HeaderTemplate');
-}
-public function getFooterTemplate()
-{
-return $this->_footerTemplate;
-}
-public function setFooterTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_footerTemplate=$value;
-else
-throw new TInvalidDataTypeException('repeater_template_required','FooterTemplate');
-}
-public function getSeparatorTemplate()
-{
-return $this->_separatorTemplate;
-}
-public function setSeparatorTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_separatorTemplate=$value;
-else
-throw new TInvalidDataTypeException('repeater_template_required','SeparatorTemplate');
-}
-public function getHeader()
-{
-return $this->_header;
-}
-public function getFooter()
-{
-return $this->_footer;
-}
-public function getItems()
-{
-if(!$this->_items)
-$this->_items=new TRepeaterItemCollection;
-return $this->_items;
-}
-protected function createItem($itemIndex,$itemType)
-{
-return new TRepeaterItem($itemIndex,$itemType);
-}
-private function createItemInternal($itemIndex,$itemType,$dataBind,$dataItem)
-{
-$item=$this->createItem($itemIndex,$itemType);
-$this->initializeItem($item);
-$param=new TRepeaterItemEventParameter($item);
-if($dataBind)
-{
-$item->setDataItem($dataItem);
-$this->onItemCreated($param);
-$this->getControls()->add($item);
-$item->dataBind();
-$this->onItemDataBound($param);
-$item->setDataItem(null);
-}
-else
-{
-$this->onItemCreated($param);
-$this->getControls()->add($item);
-}
-return $item;
-}
-protected function initializeItem($item)
-{
-$template=null;
-switch($item->getItemType())
-{
-case 'Header': $template=$this->_headerTemplate; break;
-case 'Footer': $template=$this->_footerTemplate; break;
-case 'Item': $template=$this->_itemTemplate; break;
-case 'Separator': $template=$this->_separatorTemplate; break;
-case 'AlternatingItem': $template=$this->_alternatingItemTemplate===null ? $this->_itemTemplate : $this->_alternatingItemTemplate; break;
-case 'SelectedItem':
-case 'EditItem':
-default:
-break;
-}
-if($template!==null)
-$template->instantiateIn($item);
-}
-protected function render($writer)
-{
-$this->renderContents($writer);
-}
-public function saveState()
-{
-parent::saveState();
-if($this->_items)
-$this->setViewState('ItemCount',$this->_items->getCount(),0);
-else
-$this->clearViewState('ItemCount');
-}
-public function loadState()
-{
-parent::loadState();
-if(!$this->getIsDataBound())
-$this->restoreItemsFromViewState();
-$this->clearViewState('ItemCount');
-}
-public function reset()
-{
-$this->getControls()->clear();
-$this->getItems()->clear();
-$this->_header=null;
-$this->_footer=null;
-}
-protected function restoreItemsFromViewState()
-{
-$this->reset();
-if(($itemCount=$this->getViewState('ItemCount',0))>0)
-{
-$items=$this->getItems();
-$hasSeparator=$this->_separatorTemplate!==null;
-if($this->_headerTemplate!==null)
-$this->_header=$this->createItemInternal(-1,'Header',false,null);
-for($i=0;$i<$itemCount;++$i)
-{
-if($hasSeparator && $i>0)
-$this->createItemInternal($i-1,'Separator',false,null);
-$itemType=$i%2==0?'Item':'AlternatingItem';
-$items->add($this->createItemInternal($i,$itemType,false,null));
-}
-if($this->_footerTemplate!==null)
-$this->_footer=$this->createItemInternal(-1,'Footer',false,null);
-}
-$this->clearChildState();
-}
-protected function performDataBinding($data)
-{
-$this->reset();
-$itemIndex=0;
-$items=$this->getItems();
-$hasSeparator=$this->_separatorTemplate!==null;
-foreach($data as $dataItem)
-{
-if($itemIndex===0 && $this->_headerTemplate!==null)
-$this->_header=$this->createItemInternal(-1,'Header',true,null);
-if($hasSeparator && $itemIndex>0)
-$this->createItemInternal($itemIndex-1,'Separator',true,null);
-$itemType=$itemIndex%2==0?'Item':'AlternatingItem';
-$items->add($this->createItemInternal($itemIndex,$itemType,true,$dataItem));
-$itemIndex++;
-}
-if($itemIndex>0 && $this->_footerTemplate!==null)
-$this->_footer=$this->createItemInternal(-1,'Footer',true,null);
-$this->setViewState('ItemCount',$itemIndex,0);
-}
-public function onBubbleEvent($sender,$param)
-{
-if($param instanceof TRepeaterCommandEventParameter)
-{
-$this->onItemCommand($param);
-return true;
-}
-else
-return false;
-}
-public function onItemCreated($param)
-{
-$this->raiseEvent('OnItemCreated',$this,$param);
-}
-public function onItemDataBound($param)
-{
-$this->raiseEvent('OnItemDataBound',$this,$param);
-}
-public function onItemCommand($param)
-{
-$this->raiseEvent('OnItemCommand',$this,$param);
-}
-}
-class TRepeaterItemEventParameter extends TEventParameter
-{
-private $_item=null;
-public function __construct(TRepeaterItem $item)
-{
-$this->_item=$item;
-}
-public function getItem()
-{
-return $this->_item;
-}
-}
-class TRepeaterCommandEventParameter extends TCommandEventParameter
-{
-private $_item=null;
-private $_source=null;
-public function __construct($item,$source,TCommandEventParameter $param)
-{
-$this->_item=$item;
-$this->_source=$source;
-parent::__construct($param->getCommandName(),$param->getCommandParameter());
-}
-public function getItem()
-{
-return $this->_item;
-}
-public function getCommandSource()
-{
-return $this->_source;
-}
-}
-class TRepeaterItem extends TControl implements INamingContainer
-{
-private $_itemIndex='';
-private $_itemType='';
-private $_dataItem=null;
-public function __construct($itemIndex,$itemType)
-{
-$this->_itemIndex=$itemIndex;
-$this->_itemType=TPropertyValue::ensureEnum($itemType,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager');
-}
-public function getItemType()
-{
-return $this->_itemType;
-}
-public function getItemIndex()
-{
-return $this->_itemIndex;
-}
-public function getDataItem()
-{
-return $this->_dataItem;
-}
-public function setDataItem($value)
-{
-$this->_dataItem=$value;
-}
-public function onBubbleEvent($sender,$param)
-{
-if($param instanceof TCommandEventParameter)
-{
-$this->raiseBubbleEvent($this,new TRepeaterCommandEventParameter($this,$sender,$param));
-return true;
-}
-else
-return false;
-}
-}
-class TRepeaterItemCollection extends TList
-{
-public function insertAt($index,$item)
-{
-if($item instanceof TRepeaterItem)
-parent::insertAt($index,$item);
-else
-throw new TInvalidDataTypeException('repeateritemcollection_repeateritem_required');
-}
-}
-
-abstract class TBaseDataList extends TDataBoundControl
-{
-public function addParsedObject($object)
-{
-}
-protected function createStyle()
-{
-return new TTableStyle;
-}
-public function getCaption()
-{
-return $this->getViewState('Caption','');
-}
-public function setCaption($value)
-{
-$this->setViewState('Caption','');
-}
-public function getCaptionAlign()
-{
-return $this->getViewState('CaptionAlign','NotSet');
-}
-public function setCaptionAlign($value)
-{
-$this->setViewState('CaptionAlign',TPropertyValue::ensureEnum($value,'NotSet','Top','Bottom','Left','Right'),'NotSet');
-}
-public function getCellSpacing()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getCellSpacing();
-else
-return -1;
-}
-public function setCellSpacing($value)
-{
-$this->getStyle()->setCellSpacing($value);
-}
-public function getCellPadding()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getCellPadding();
-else
-return -1;
-}
-public function setCellPadding($value)
-{
-$this->getStyle()->setCellPadding($value);
-}
-public function getHorizontalAlign()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getHorizontalAlign();
-else
-return 'NotSet';
-}
-public function setHorizontalAlign($value)
-{
-$this->getStyle()->setHorizontalAlign($value);
-}
-public function getGridLines()
-{
-if($this->getHasStyle())
-return $this->getStyle()->getGridLines();
-else
-return 'None';
-}
-public function setGridLines($value)
-{
-$this->getStyle()->setGridLines($value);
-}
-public function getDataKeyField()
-{
-return $this->getViewState('DataKeyField','');
-}
-public function setDataKeyField($value)
-{
-$this->setViewState('DataKeyField',$value,'');
-}
-public function getDataKeys()
-{
-if(($dataKeys=$this->getViewState('DataKeys',null))===null)
-{
-$dataKeys=new TList;
-$this->setViewState('DataKeys',$dataKeys,null);
-}
-return $dataKeys;
-}
-protected function getDataFieldValue($data,$field)
-{
-if(is_array($data))
-return $data[$field];
-else if(($data instanceof TMap) || ($data instanceof TList))
-return $data->itemAt($field);
-else if(($data instanceof TComponent) && $data->canGetProperty($field))
-{
-$getter='get'.$field;
-return $data->$getter();
-}
-else
-throw new TInvalidDataValueException('basedatalist_datafield_invalid');
-}
-public function onSelectedIndexChanged($param)
-{
-$this->raiseEvent('OnSelectedIndexChanged',$this,$param);
-}
-}
-
-class TDataList extends TBaseDataList implements INamingContainer, IRepeatInfoUser
-{
-private $_items=null;
-private $_itemTemplate=null;
-private $_alternatingItemTemplate=null;
-private $_selectedItemTemplate=null;
-private $_editItemTemplate=null;
-private $_headerTemplate=null;
-private $_footerTemplate=null;
-private $_separatorTemplate=null;
-private $_header=null;
-private $_footer=null;
-public function getItems()
-{
-if(!$this->_items)
-$this->_items=new TDataListItemCollection;
-return $this->_items;
-}
-public function getItemCount()
-{
-return $this->_items?$this->_items->getCount():0;
-}
-public function getItemTemplate()
-{
-return $this->_itemTemplate;
-}
-public function setItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_itemTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','ItemTemplate');
-}
-public function getItemStyle()
-{
-if(($style=$this->getViewState('ItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('ItemStyle',$style,null);
-}
-return $style;
-}
-public function getAlternatingItemTemplate()
-{
-return $this->_alternatingItemTemplate;
-}
-public function setAlternatingItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_alternatingItemTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','AlternatingItemType');
-}
-public function getAlternatingItemStyle()
-{
-if(($style=$this->getViewState('AlternatingItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('AlternatingItemStyle',$style,null);
-}
-return $style;
-}
-public function getSelectedItemTemplate()
-{
-return $this->_selectedItemTemplate;
-}
-public function setSelectedItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_selectedItemTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','SelectedItemTemplate');
-}
-public function getSelectedItemStyle()
-{
-if(($style=$this->getViewState('SelectedItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('SelectedItemStyle',$style,null);
-}
-return $style;
-}
-public function getEditItemTemplate()
-{
-return $this->_editItemTemplate;
-}
-public function setEditItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_editItemTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','EditItemTemplate');
-}
-public function getEditItemStyle()
-{
-if(($style=$this->getViewState('EditItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('EditItemStyle',$style,null);
-}
-return $style;
-}
-public function getHeaderTemplate()
-{
-return $this->_headerTemplate;
-}
-public function setHeaderTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_headerTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','HeaderTemplate');
-}
-public function getHeaderStyle()
-{
-if(($style=$this->getViewState('HeaderStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('HeaderStyle',$style,null);
-}
-return $style;
-}
-public function getHeader()
-{
-return $this->_header;
-}
-public function getFooterTemplate()
-{
-return $this->_footerTemplate;
-}
-public function setFooterTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_footerTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','FooterTemplate');
-}
-public function getFooterStyle()
-{
-if(($style=$this->getViewState('FooterStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('FooterStyle',$style,null);
-}
-return $style;
-}
-public function getFooter()
-{
-return $this->_footer;
-}
-public function getSeparatorTemplate()
-{
-return $this->_separatorTemplate;
-}
-public function setSeparatorTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_separatorTemplate=$value;
-else
-throw new TInvalidDataTypeException('datalist_template_required','SeparatorTemplate');
-}
-public function getSeparatorStyle()
-{
-if(($style=$this->getViewState('SeparatorStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('SeparatorStyle',$style,null);
-}
-return $style;
-}
-public function getSelectedItemIndex()
-{
-return $this->getViewState('SelectedItemIndex',-1);
-}
-public function setSelectedItemIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=-1;
-if(($current=$this->getSelectedItemIndex())!==$value)
-{
-$this->setViewState('SelectedItemIndex',$value,-1);
-$items=$this->getItems();
-$itemCount=$items->getCount();
-if($current>=0 && $current<$itemCount)
-{
-$item=$items->itemAt($current);
-if($item->getItemType()!=='EditItem')
-$item->setItemType($current%2?'AlternatingItem':'Item');
-}
-if($value>=0 && $value<$itemCount)
-{
-$item=$items->itemAt($value);
-if($item->getItemType()!=='EditItem')
-$item->setItemType('SelectedItem');
-}
-}
-}
-public function getSelectedItem()
-{
-$index=$this->getSelectedItemIndex();
-$items=$this->getItems();
-if($index>=0 && $index<$items->getCount())
-return $items->itemAt($index);
-else
-return null;
-}
-public function getSelectedDataKey()
-{
-if($this->getDataKeyField()==='')
-throw new TInvalidOperationException('datalist_datakeyfield_required');
-$index=$this->getSelectedItemIndex();
-$dataKeys=$this->getDataKeys();
-if($index>=0 && $index<$dataKeys->getCount())
-return $dataKeys->itemAt($index);
-else
-return null;
-}
-public function getEditItemIndex()
-{
-return $this->getViewState('EditItemIndex',-1);
-}
-public function setEditItemIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=-1;
-if(($current=$this->getEditItemIndex())!==$value)
-{
-$this->setViewState('EditItemIndex',$value,-1);
-$items=$this->getItems();
-$itemCount=$items->getCount();
-if($current>=0 && $current<$itemCount)
-$items->itemAt($current)->setItemType($current%2?'AlternatingItem':'Item');
-if($value>=0 && $value<$itemCount)
-$items->itemAt($value)->setItemType('EditItem');
-}
-}
-public function getEditItem()
-{
-$index=$this->getEditItemIndex();
-$items=$this->getItems();
-if($index>=0 && $index<$items->getCount())
-return $items->itemAt($index);
-else
-return null;
-}
-public function getShowHeader()
-{
-return $this->getViewState('ShowHeader',true);
-}
-public function setShowHeader($value)
-{
-$this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true);
-}
-public function getShowFooter()
-{
-return $this->getViewState('ShowFooter',true);
-}
-public function setShowFooter($value)
-{
-$this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),true);
-}
-protected function getRepeatInfo()
-{
-if(($repeatInfo=$this->getViewState('RepeatInfo',null))===null)
-{
-$repeatInfo=new TRepeatInfo;
-$this->setViewState('RepeatInfo',$repeatInfo,null);
-}
-return $repeatInfo;
-}
-public function getCaption()
-{
-return $this->getRepeatInfo()->getCaption();
-}
-public function setCaption($value)
-{
-$this->getRepeatInfo()->setCaption($value);
-}
-public function getCaptionAlign()
-{
-return $this->getRepeatInfo()->getCaptionAlign();
-}
-public function setCaptionAlign($value)
-{
-$this->getRepeatInfo()->setCaptionAlign($value);
-}
-public function getRepeatColumns()
-{
-return $this->getRepeatInfo()->getRepeatColumns();
-}
-public function setRepeatColumns($value)
-{
-$this->getRepeatInfo()->setRepeatColumns($value);
-}
-public function getRepeatDirection()
-{
-return $this->getRepeatInfo()->getRepeatDirection();
-}
-public function setRepeatDirection($value)
-{
-$this->getRepeatInfo()->setRepeatDirection($value);
-}
-public function getRepeatLayout()
-{
-return $this->getRepeatInfo()->getRepeatLayout();
-}
-public function setRepeatLayout($value)
-{
-$this->getRepeatInfo()->setRepeatLayout($value);
-}
-public function onBubbleEvent($sender,$param)
-{
-if($param instanceof TDataListCommandEventParameter)
-{
-$this->onItemCommand($param);
-$command=$param->getCommandName();
-if(strcasecmp($command,'select')===0)
-{
-$this->setSelectedItemIndex($param->getItem()->getItemIndex());
-$this->onSelectedIndexChanged(null);
-return true;
-}
-else if(strcasecmp($command,'edit')===0)
-{
-$this->onEditCommand($param);
-return true;
-}
-else if(strcasecmp($command,'delete')===0)
-{
-$this->onDeleteCommand($param);
-return true;
-}
-else if(strcasecmp($command,'update')===0)
-{
-$this->onUpdateCommand($param);
-return true;
-}
-else if(strcasecmp($command,'cancel')===0)
-{
-$this->onCancelCommand($param);
-return true;
-}
-}
-return false;
-}
-public function onItemCreated($param)
-{
-$this->raiseEvent('OnItemCreated',$this,$param);
-}
-public function onItemDataBound($param)
-{
-$this->raiseEvent('OnItemDataBound',$this,$param);
-}
-public function onItemCommand($param)
-{
-$this->raiseEvent('OnItemCommand',$this,$param);
-}
-public function onEditCommand($param)
-{
-$this->raiseEvent('OnEditCommand',$this,$param);
-}
-public function onDeleteCommand($param)
-{
-$this->raiseEvent('OnDeleteCommand',$this,$param);
-}
-public function onUpdateCommand($param)
-{
-$this->raiseEvent('OnUpdateCommand',$this,$param);
-}
-public function onCancelCommand($param)
-{
-$this->raiseEvent('OnCancelCommand',$this,$param);
-}
-public function getHasHeader()
-{
-return ($this->getShowHeader() && $this->_headerTemplate!==null);
-}
-public function getHasFooter()
-{
-return ($this->getShowFooter() && $this->_footerTemplate!==null);
-}
-public function getHasSeparators()
-{
-return $this->_separatorTemplate!==null;
-}
-public function generateItemStyle($itemType,$index)
-{
-if(($item=$this->getItem($itemType,$index))!==null && $item->getHasStyle())
-return $item->getStyle();
-else
-return null;
-}
-public function renderItem($writer,$repeatInfo,$itemType,$index)
-{
-$item=$this->getItem($itemType,$index);
-if($repeatInfo->getRepeatLayout()==='Table')
-$item->renderContents($writer);
-else
-$item->renderControl($writer);
-}
-private function getItem($itemType,$index)
-{
-switch($itemType)
-{
-case 'Header': return $this->getControls()->itemAt(0);
-case 'Footer': return $this->getControls()->itemAt($this->getControls()->getCount()-1);
-case 'Item':
-case 'AlternatingItem':
-case 'SelectedItem':
-case 'EditItem':
-return $this->getItems()->itemAt($index);
-case 'Separator':
-$i=$index+$index+1;
-if($this->_headerTemplate!==null)
-$i++;
-return $this->getControls()->itemAt($i);
-}
-return null;
-}
-private function createItemInternal($itemIndex,$itemType,$dataBind,$dataItem)
-{
-$item=$this->createItem($itemIndex,$itemType);
-$this->initializeItem($item);
-$param=new TDataListItemEventParameter($item);
-if($dataBind)
-{
-$item->setDataItem($dataItem);
-$this->onItemCreated($param);
-$this->getControls()->add($item);
-$item->dataBind();
-$this->onItemDataBound($param);
-$item->setDataItem(null);
-}
-else
-{
-$this->onItemCreated($param);
-$this->getControls()->add($item);
-}
-return $item;
-}
-protected function createItem($itemIndex,$itemType)
-{
-return new TDataListItem($itemIndex,$itemType);
-}
-protected function applyItemStyles()
-{
-$itemStyle=$this->getViewState('ItemStyle',null);
-$alternatingItemStyle=new TTableItemStyle($itemStyle);
-if(($style=$this->getViewState('AlternatingItemStyle',null))!==null)
-$alternatingItemStyle->mergeWith($style);
-$selectedItemStyle=$this->getViewState('SelectedItemStyle',null);
-$editItemStyle=new TTableItemStyle($selectedItemStyle);
-if(($style=$this->getViewState('EditItemStyle',null))!==null)
-$editItemStyle->copyFrom($style);
-$headerStyle=$this->getViewState('HeaderStyle',null);
-$footerStyle=$this->getViewState('FooterStyle',null);
-$pagerStyle=$this->getViewState('PagerStyle',null);
-$separatorStyle=$this->getViewState('SeparatorStyle',null);
-foreach($this->getControls() as $index=>$item)
-{
-switch($item->getItemType())
-{
-case 'Header':
-if($headerStyle)
-$item->getStyle()->mergeWith($headerStyle);
-break;
-case 'Footer':
-if($footerStyle)
-$item->getStyle()->mergeWith($footerStyle);
-break;
-case 'Separator':
-if($separatorStyle)
-$item->getStyle()->mergeWith($separatorStyle);
-break;
-case 'Item':
-if($itemStyle)
-$item->getStyle()->mergeWith($itemStyle);
-break;
-case 'AlternatingItem':
-if($alternatingItemStyle)
-$item->getStyle()->mergeWith($alternatingItemStyle);
-break;
-case 'SelectedItem':
-if($index % 2==1)
-{
-if($itemStyle)
-$item->getStyle()->mergeWith($itemStyle);
-}
-else
-{
-if($alternatingItemStyle)
-$item->getStyle()->mergeWith($alternatingItemStyle);
-}
-if($selectedItemStyle)
-$item->getStyle()->mergeWith($selectedItemStyle);
-break;
-case 'EditItem':
-if($index % 2==1)
-{
-if($itemStyle)
-$item->getStyle()->mergeWith($itemStyle);
-}
-else
-{
-if($alternatingItemStyle)
-$item->getStyle()->mergeWith($alternatingItemStyle);
-}
-if($editItemStyle)
-$item->getStyle()->mergeWith($editItemStyle);
-break;
-default:
-break;
-}
-}
-}
-protected function initializeItem($item)
-{
-$template=null;
-switch($item->getItemType())
-{
-case 'Header':
-$template=$this->_headerTemplate;
-break;
-case 'Footer':
-$template=$this->_footerTemplate;
-break;
-case 'Item':
-$template=$this->_itemTemplate;
-break;
-case 'AlternatingItem':
-if(($template=$this->_alternatingItemTemplate)===null)
-$template=$this->_itemTemplate;
-break;
-case 'Separator':
-$template=$this->_separatorTemplate;
-break;
-case 'SelectedItem':
-if(($template=$this->_selectedItemTemplate)===null)
-{
-if(!($item->getItemIndex()%2) || ($template=$this->_alternatingItemTemplate)===null)
-$template=$this->_itemTemplate;
-}
-break;
-case 'EditItem':
-if(($template=$this->_editItemTemplate)===null)
-{
-if($item->getItemIndex()!==$this->getSelectedItemIndex() || ($template=$this->_selectedItemTemplate)===null)
-if(!($item->getItemIndex()%2) || ($template=$this->_alternatingItemTemplate)===null)
-$template=$this->_itemTemplate;
-}
-break;
-default:
-break;
-}
-if($template!==null)
-$template->instantiateIn($item);
-}
-public function saveState()
-{
-parent::saveState();
-if($this->_items)
-$this->setViewState('ItemCount',$this->_items->getCount(),0);
-else
-$this->clearViewState('ItemCount');
-}
-public function loadState()
-{
-parent::loadState();
-if(!$this->getIsDataBound())
-$this->restoreItemsFromViewState();
-$this->clearViewState('ItemCount');
-}
-public function reset()
-{
-$this->getControls()->clear();
-$this->getItems()->clear();
-$this->_header=null;
-$this->_footer=null;
-}
-protected function restoreItemsFromViewState()
-{
-$this->reset();
-if(($itemCount=$this->getViewState('ItemCount',0))>0)
-{
-$items=$this->getItems();
-$selectedIndex=$this->getSelectedItemIndex();
-$editIndex=$this->getEditItemIndex();
-if($this->_headerTemplate!==null)
-$this->_header=$this->createItemInternal(-1,'Header',false,null);
-$hasSeparator=$this->_separatorTemplate!==null;
-for($i=0;$i<$itemCount;++$i)
-{
-if($hasSeparator && $i>0)
-$this->createItemInternal($i-1,'Separator',false,null);
-if($i===$editIndex)
-$itemType='EditItem';
-else if($i===$selectedIndex)
-$itemType='SelectedItem';
-else
-$itemType=$i%2?'AlternatingItem':'Item';
-$items->add($this->createItemInternal($i,$itemType,false,null));
-}
-if($this->_footerTemplate!==null)
-$this->_footer=$this->createItemInternal(-1,'Footer',false,null);
-}
-$this->clearChildState();
-}
-protected function performDataBinding($data)
-{
-$this->reset();
-$keys=$this->getDataKeys();
-$keys->clear();
-$keyField=$this->getDataKeyField();
-$itemIndex=0;
-$items=$this->getItems();
-$hasSeparator=$this->_separatorTemplate!==null;
-$selectedIndex=$this->getSelectedItemIndex();
-$editIndex=$this->getEditItemIndex();
-foreach($data as $dataItem)
-{
-if($keyField!=='')
-$keys->add($this->getDataFieldValue($dataItem,$keyField));
-if($itemIndex===0 && $this->_headerTemplate!==null)
-$this->_header=$this->createItemInternal(-1,'Header',true,null);
-if($hasSeparator && $itemIndex>0)
-$this->createItemInternal($itemIndex-1,'Separator',true,null);
-if($itemIndex===$editIndex)
-$itemType='EditItem';
-else if($itemIndex===$selectedIndex)
-$itemType='SelectedItem';
-else
-$itemType=$itemIndex%2?'AlternatingItem':'Item';
-$items->add($this->createItemInternal($itemIndex,$itemType,true,$dataItem));
-$itemIndex++;
-}
-if($itemIndex>0 && $this->_footerTemplate!==null)
-$this->_footer=$this->createItemInternal(-1,'Footer',true,null);
-$this->setViewState('ItemCount',$itemIndex,0);
-}
-protected function render($writer)
-{
-if($this->getHasControls())
-{
-$this->applyItemStyles();
-$repeatInfo=$this->getRepeatInfo();
-$repeatInfo->renderRepeater($writer,$this);
-}
-}
-}
-class TDataListItemEventParameter extends TEventParameter
-{
-private $_item=null;
-public function __construct(TDataListItem $item)
-{
-$this->_item=$item;
-}
-public function getItem()
-{
-return $this->_item;
-}
-}
-class TDataListCommandEventParameter extends TCommandEventParameter
-{
-private $_item=null;
-private $_source=null;
-public function __construct($item,$source,TCommandEventParameter $param)
-{
-$this->_item=$item;
-$this->_source=$source;
-parent::__construct($param->getCommandName(),$param->getCommandParameter());
-}
-public function getItem()
-{
-return $this->_item;
-}
-public function getCommandSource()
-{
-return $this->_source;
-}
-}
-class TDataListItem extends TWebControl implements INamingContainer
-{
-private $_itemIndex='';
-private $_itemType='';
-private $_dataItem=null;
-public function __construct($itemIndex,$itemType)
-{
-$this->_itemIndex=$itemIndex;
-$this->setItemType($itemType);
-}
-protected function createStyle()
-{
-return new TTableItemStyle;
-}
-public function getItemType()
-{
-return $this->_itemType;
-}
-public function setItemType($value)
-{
-$this->_itemType=TPropertyValue::ensureEnum($value,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager');
-}
-public function getItemIndex()
-{
-return $this->_itemIndex;
-}
-public function getDataItem()
-{
-return $this->_dataItem;
-}
-public function setDataItem($value)
-{
-$this->_dataItem=$value;
-}
-public function onBubbleEvent($sender,$param)
-{
-if($param instanceof TCommandEventParameter)
-{
-$this->raiseBubbleEvent($this,new TDataListCommandEventParameter($this,$sender,$param));
-return true;
-}
-else
-return false;
-}
-}
-class TDataListItemCollection extends TList
-{
-public function insertAt($index,$item)
-{
-if($item instanceof TDataListItem)
-parent::insertAt($index,$item);
-else
-throw new TInvalidDataTypeException('datalistitemcollection_datalistitem_required');
-}
-}
-
-class TDataGrid extends TBaseDataList
-{
-private $_columns=null;
-private $_autoColumns=null;
-private $_items=null;
-private $_header=null;
-private $_footer=null;
-private $_pager=null;
-private $_pagedDataSource=null;
-protected function getTagName()
-{
-return 'table';
-}
-public function addParsedObject($object)
-{
-if($object instanceof TDataGridColumn)
-$this->getColumns()->add($object);
-}
-public function getColumns()
-{
-if(!$this->_columns)
-$this->_columns=new TDataGridColumnCollection;
-return $this->_columns;
-}
-public function getAutoColumns()
-{
-if(!$this->_autoColumns)
-$this->_autoColumns=new TDataGridColumnCollection;
-return $this->_autoColumns;
-}
-public function getItems()
-{
-if(!$this->_items)
-$this->_items=new TDataGridItemCollection;
-return $this->_items;
-}
-protected function createStyle()
-{
-$style=new TTableStyle;
-$style->setGridLines('Both');
-$style->setCellSpacing(0);
-return $style;
-}
-public function getBackImageUrl()
-{
-return $this->getStyle()->getBackImageUrl();
-}
-public function setBackImageUrl($value)
-{
-$this->getStyle()->setBackImageUrl($value);
-}
-public function getAlternatingItemStyle()
-{
-if(($style=$this->getViewState('AlternatingItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('AlternatingItemStyle',$style,null);
-}
-return $style;
-}
-public function getItemStyle()
-{
-if(($style=$this->getViewState('ItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('ItemStyle',$style,null);
-}
-return $style;
-}
-public function getSelectedItemStyle()
-{
-if(($style=$this->getViewState('SelectedItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('SelectedItemStyle',$style,null);
-}
-return $style;
-}
-public function getEditItemStyle()
-{
-if(($style=$this->getViewState('EditItemStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('EditItemStyle',$style,null);
-}
-return $style;
-}
-public function getHeaderStyle()
-{
-if(($style=$this->getViewState('HeaderStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('HeaderStyle',$style,null);
-}
-return $style;
-}
-public function getHeader()
-{
-return $this->_header;
-}
-public function getFooterStyle()
-{
-if(($style=$this->getViewState('FooterStyle',null))===null)
-{
-$style=new TTableItemStyle;
-$this->setViewState('FooterStyle',$style,null);
-}
-return $style;
-}
-public function getFooter()
-{
-return $this->_footer;
-}
-public function getPagerStyle()
-{
-if(($style=$this->getViewState('PagerStyle',null))===null)
-{
-$style=new TDataGridPagerStyle;
-$this->setViewState('PagerStyle',$style,null);
-}
-return $style;
-}
-public function getPager()
-{
-return $this->_pager;
-}
-public function getSelectedItem()
-{
-$index=$this->getSelectedItemIndex();
-$items=$this->getItems();
-if($index>=0 && $index<$items->getCount())
-return $items->itemAt($index);
-else
-return null;
-}
-public function getSelectedItemIndex()
-{
-return $this->getViewState('SelectedItemIndex',-1);
-}
-public function setSelectedItemIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=-1;
-if(($current=$this->getSelectedItemIndex())!==$value)
-{
-$this->setViewState('SelectedItemIndex',$value,-1);
-$items=$this->getItems();
-$itemCount=$items->getCount();
-if($current>=0 && $current<$itemCount)
-{
-$item=$items->itemAt($current);
-if($item->getItemType()!=='EditItem')
-$item->setItemType($current%2?'AlternatingItem':'Item');
-}
-if($value>=0 && $value<$itemCount)
-{
-$item=$items->itemAt($value);
-if($item->getItemType()!=='EditItem')
-$item->setItemType('SelectedItem');
-}
-}
-}
-public function getEditItem()
-{
-$index=$this->getEditItemIndex();
-$items=$this->getItems();
-if($index>=0 && $index<$items->getCount())
-return $items->itemAt($index);
-else
-return null;
-}
-public function getEditItemIndex()
-{
-return $this->getViewState('EditItemIndex',-1);
-}
-public function setEditItemIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-$value=-1;
-if(($current=$this->getEditItemIndex())!==$value)
-{
-$this->setViewState('EditItemIndex',$value,-1);
-$items=$this->getItems();
-$itemCount=$items->getCount();
-if($current>=0 && $current<$itemCount)
-$items->itemAt($current)->setItemType($current%2?'AlternatingItem':'Item');
-if($value>=0 && $value<$itemCount)
-$items->itemAt($value)->setItemType('EditItem');
-}
-}
-public function getAllowCustomPaging()
-{
-return $this->getViewState('AllowCustomPaging',false);
-}
-public function setAllowCustomPaging($value)
-{
-$this->setViewState('AllowCustomPaging',TPropertyValue::ensureBoolean($value),false);
-}
-public function getAllowPaging()
-{
-return $this->getViewState('AllowPaging',false);
-}
-public function setAllowPaging($value)
-{
-$this->setViewState('AllowPaging',TPropertyValue::ensureBoolean($value),false);
-}
-public function getAllowSorting()
-{
-return $this->getViewState('AllowSorting',false);
-}
-public function setAllowSorting($value)
-{
-$this->setViewState('AllowSorting',TPropertyValue::ensureBoolean($value),false);
-}
-public function getAutoGenerateColumns()
-{
-return $this->getViewState('AutoGenerateColumns',true);
-}
-public function setAutoGenerateColumns($value)
-{
-$this->setViewState('AutoGenerateColumns',TPropertyValue::ensureBoolean($value),true);
-}
-public function getCurrentPageIndex()
-{
-return $this->getViewState('CurrentPageIndex',0);
-}
-public function setCurrentPageIndex($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-throw new TInvalidDataValueException('datagrid_currentpageindex_invalid');
-$this->setViewState('CurrentPageIndex',$value,0);
-}
-public function getPageSize()
-{
-return $this->getViewState('PageSize',10);
-}
-public function setPageSize($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<1)
-throw new TInvalidDataValueException('datagrid_pagesize_invalid');
-$this->setViewState('PageSize',TPropertyValue::ensureInteger($value),10);
-}
-public function getPageCount()
-{
-if($this->_pagedDataSource)
-return $this->_pagedDataSource->getPageCount();
-return $this->getViewState('PageCount',0);
-}
-public function getVirtualCount()
-{
-return $this->getViewState('VirtualCount',0);
-}
-public function setVirtualCount($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<0)
-throw new TInvalidDataValueException('datagrid_virtualcount_invalid');
-$this->setViewState('VirtualCount',$value,0);
-}
-public function getShowHeader()
-{
-return $this->getViewState('ShowHeader',true);
-}
-public function setShowHeader($value)
-{
-$this->setViewState('ShowHeader',TPropertyValue::ensureBoolean($value),true);
-}
-public function getShowFooter()
-{
-return $this->getViewState('ShowFooter',false);
-}
-public function setShowFooter($value)
-{
-$this->setViewState('ShowFooter',TPropertyValue::ensureBoolean($value),false);
-}
-public function onBubbleEvent($sender,$param)
-{
-if($param instanceof TDataGridCommandEventParameter)
-{
-$this->onItemCommand($param);
-$command=$param->getCommandName();
-if(strcasecmp($command,'select')===0)
-{
-$this->setSelectedIndex($param->getItem()->getItemIndex());
-$this->onSelectedIndexChanged(null);
-return true;
-}
-else if(strcasecmp($command,'edit')===0)
-{
-$this->onEditCommand($param);
-return true;
-}
-else if(strcasecmp($command,'delete')===0)
-{
-$this->onDeleteCommand($param);
-return true;
-}
-else if(strcasecmp($command,'update')===0)
-{
-$this->onUpdateCommand($param);
-return true;
-}
-else if(strcasecmp($command,'cancel')===0)
-{
-$this->onCancelCommand($param);
-return true;
-}
-else if(strcasecmp($command,'sort')===0)
-{
-$this->onSortCommand(new TDataGridSortCommandEventParameter($sender,$param->getCommandParameter()));
-return true;
-}
-else if(strcasecmp($command,'page')===0)
-{
-$p=$param->getCommandParameter();
-if(strcasecmp($p,'next'))
-$pageIndex=$this->getCurrentPageIndex()+1;
-else if(strcasecmp($p,'prev'))
-$pageIndex=$this->getCurrentPageIndex()-1;
-else
-$pageIndex=TPropertyValue::ensureInteger($p)-1;
-$this->onPageIndexChanged(new TDataGridPageChangedEventParameter($sender,$pageIndex));
-return true;
-}
-}
-return false;
-}
-public function onCancelCommand($param)
-{
-$this->raiseEvent('OnCancelCommand',$this,$param);
-}
-public function onDeleteCommand($param)
-{
-$this->raiseEvent('OnDeleteCommand',$this,$param);
-}
-public function onEditCommand($param)
-{
-$this->raiseEvent('OnEditCommand',$this,$param);
-}
-public function onItemCommand($param)
-{
-$this->raiseEvent('OnItemCommand',$this,$param);
-}
-public function onSortCommand($param)
-{
-$this->raiseEvent('OnSortCommand',$this,$param);
-}
-public function onUpdateCommand($param)
-{
-$this->raiseEvent('OnUpdateCommand',$this,$param);
-}
-public function onItemCreated($param)
-{
-$this->raiseEvent('OnItemCreated',$this,$param);
-}
-public function onItemDataBound($param)
-{
-$this->raiseEvent('OnItemDataBound',$this,$param);
-}
-public function onPageIndexChanged($param)
-{
-$this->raiseEvent('OnPageIndexChanged',$this,$param);
-}
-public function saveState()
-{
-parent::saveState();
-if(!$this->getEnableViewState(true))
-return;
-if($this->_items)
-$this->setViewState('ItemCount',$this->_items->getCount(),0);
-else
-$this->clearViewState('ItemCount');
-if($this->_autoColumns)
-{
-$state=array();
-foreach($this->_autoColumns as $column)
-$state[]=$column->saveState();
-$this->setViewState('AutoColumns',$state,array());
-}
-else
-$this->clearViewState('AutoColumns');
-if($this->_columns)
-{
-$state=array();
-foreach($this->_columns as $column)
-$state[]=$column->saveState();
-$this->setViewState('Columns',$state,array());
-}
-else
-$this->clearViewState('Columns');
-}
-public function loadState()
-{
-parent::loadState();
-if(!$this->getEnableViewState(true))
-return;
-if(!$this->getIsDataBound())
-{
-$state=$this->getViewState('AutoColumns',array());
-if(!empty($state))
-{
-$this->_autoColumns=new TDataGridColumnCollection;
-foreach($state as $st)
-{
-$column=new TBoundColumn;
-$column->loadState($st);
-$this->_autoColumns->add($column);
-}
-}
-else
-$this->_autoColumns=null;
-$state=$this->getViewState('Columns',array());
-if($this->_columns)
-{
-$i=0;
-foreach($this->_columns as $column)
-{
-$column->loadState($state[$i]);
-$i++;
-}
-}
-$this->restoreGridFromViewState();
-}
-$this->clearViewState('ItemCount');
-}
-private function createPagedDataSource()
-{
-$ds=new TPagedDataSource;
-$ds->setCurrentPageIndex($this->getCurrentPageIndex());
-$ds->setPageSize($this->getPageSize());
-$ds->setAllowPaging($this->getAllowPaging());
-$ds->setAllowCustomPaging($this->getAllowCustomPaging());
-$ds->setVirtualCount($this->getVirtualCount());
-return $ds;
-}
-public function reset()
-{
-$this->getControls()->clear();
-$this->getItems()->clear();
-$this->_header=null;
-$this->_footer=null;
-}
-protected function restoreGridFromViewState()
-{
-$this->reset();
-if(($itemCount=$this->getViewState('ItemCount',0))<=0)
-return;
-$this->_pagedDataSource=$ds=$this->createPagedDataSource();
-$allowPaging=$ds->getAllowPaging();
-if($allowPaging)
-$ds->setDataSource(new TDummyDataSource($itemCount));
-else
-$ds->setDataSource(new TDummyDataSource($this->getViewState('DataSourceCount',0)));
-$columns=new TList($this->getColumns());
-$columns->mergeWith($this->_autoColumns);
-if($columns->getCount()>0)
-{
-foreach($columns as $column)
-$column->initialize();
-if($allowPaging)
-$this->createPager(-1,-1,$columnCount,$ds);
-$this->createItemInternal(-1,-1,'Header',false,null,$columns);
-$selectedIndex=$this->getSelectedItemIndex();
-$editIndex=$this->getEditItemIndex();
-$index=0;
-$dsIndex=$ds->getAllowPaging()?$ds->getFirstIndexInPage():0;
-foreach($ds as $data)
-{
-if($index===$editIndex)
-$itemType='EditItem';
-else if($index===$selectedIndex)
-$itemType='SelectedItem';
-else if($index % 2)
-$itemType='AlternatingItem';
-else
-$itemType='Item';
-$items->add($this->createItemInternal($index,$dsIndex,$itemType,false,null,$columns));
-$index++;
-$dsIndex++;
-}
-$this->createItemInternal(-1,-1,'Footer',false,null,$columns);
-if($allowPaging)
-$this->createPager(-1,-1,$columnCount,$ds);
-}
-$this->_pagedDataSource=null;
-}
-protected function performDataBinding($data)
-{
-$this->reset();
-$keys=$this->getDataKeys();
-$keys->clear();
-$keyField=$this->getDataKeyField();
-$this->_pagedDataSource=$ds=$this->createPagedDataSource();
-$ds->setDataSource($data);
-$allowPaging=$ds->getAllowPaging();
-if($allowPaging && $ds->getCurrentPageIndex()>=$ds->getPageCount())
-throw new TInvalidDataValueException('datagrid_currentpageindex_invalid');
-$columns=new TList($this->getColumns());
-if($this->getAutoGenerateColumns())
-{
-$autoColumns=$this->createAutoColumns($ds);
-$columns->mergeWith($autoColumns);
-}
-$items=$this->getItems();
-if(($columnCount=$columns->getCount())>0)
-{
-foreach($columns as $column)
-$column->initialize();
-$allowPaging=$ds->getAllowPaging();
-if($allowPaging)
-$this->createPager(-1,-1,$columnCount,$ds);
-$this->createItemInternal(-1,-1,'Header',true,null,$columns);
-$selectedIndex=$this->getSelectedItemIndex();
-$editIndex=$this->getEditItemIndex();
-$index=0;
-$dsIndex=$ds->getAllowPaging()?$ds->getFirstIndexInPage():0;
-foreach($ds as $data)
-{
-if($keyField!=='')
-$keys->add($this->getDataFieldValue($data,$keyField));
-if($index===$editIndex)
-$itemType='EditItem';
-else if($index===$selectedIndex)
-$itemType='SelectedItem';
-else if($index % 2)
-$itemType='AlternatingItem';
-else
-$itemType='Item';
-$items->add($this->createItemInternal($index,$dsIndex,$itemType,true,$data,$columns));
-$index++;
-$dsIndex++;
-}
-$this->createItemInternal(-1,-1,'Footer',true,null,$columns);
-if($allowPaging)
-$this->createPager(-1,-1,$columnCount,$ds);
-$this->setViewState('ItemCount',$index,0);
-$this->setViewState('PageCount',$ds->getPageCount(),0);
-$this->setViewState('DataSourceCount',$ds->getDataSourceCount(),0);
-}
-else
-{
-$this->clearViewState('ItemCount');
-$this->clearViewState('PageCount');
-$this->clearViewState('DataSourceCount');
-}
-$this->_pagedDataSource=null;
-}
-protected function createItem($itemIndex,$dataSourceIndex,$itemType)
-{
-return new TDataGridItem($itemIndex,$dataSourceIndex,$itemType);
-}
-private function createItemInternal($itemIndex,$dataSourceIndex,$itemType,$dataBind,$dataItem,$columns)
-{
-$item=$this->createItem($itemIndex,$dataSourceIndex,$itemType);
-$this->initializeItem($item,$columns);
-$param=new TDataGridItemEventParameter($item);
-if($dataBind)
-{
-$item->setDataItem($dataItem);
-$this->onItemCreated($param);
-$this->getControls()->add($item);
-$item->dataBind();
-$this->onItemDataBound($param);
-$item->setDataItem(null);
-}
-else
-{
-$this->onItemCreated($param);
-$this->getControls()->add($item);
-}
-return $item;
-}
-protected function initializeItem($item,$columns)
-{
-$cells=$item->getCells();
-$itemType=$item->getItemType();
-$index=0;
-foreach($columns as $column)
-{
-if($itemType==='Header')
-$cell=new TTableHeaderCell;
-else
-$cell=new TTableCell;
-$column->initializeCell($cell,$index,$itemType);
-$cells->add($cell);
-$index++;
-}
-}
-private function createPager($itemIndex,$dataSourceIndex,$columnSpan,$pagedDataSource)
-{
-$item=$this->createItem($itemIndex,$dataSourceIndex,'Pager');
-$this->initializePager($item,$columnSpan,$pagedDataSource);
-$this->onItemCreated(new TDataGridItemEventParameter($item));
-$this->getControls()->add($item);
-return $item;
-}
-protected function initializePager($pager,$columnSpan,$pagedDataSource)
-{
-$cell=new TTableCell;
-if($columnSpan>1)
-$cell->setColumnSpan($columnSpan);
-$this->buildPager($cell,$pagedDataSource);
-$pager->getCells()->add($cell);
-}
-protected function buildPager($cell,$dataSource)
-{
-switch($this->getPagerStyle()->getMode())
-{
-case 'NextPrev':
-$this->buildNextPrevPager($cell,$dataSource);
-break;
-case 'Numeric':
-$this->buildNumericPager($cell,$dataSource);
-break;
-}
-}
-protected function buildNextPrevPager($cell,$dataSource)
-{
-$style=$this->getPagerStyle();
-$controls=$cell->getControls();
-if($dataSource->getIsFirstPage())
-{
-$label=new TLabel;
-$label->setText($style->getPrevPageText());
-$controls->add($label);
-}
-else
-{
-$button=new TLinkButton;
-$button->setText($style->getPrevPageText());
-$button->setCommandName('page');
-$button->setCommandParameter('prev');
-$button->setCausesValidation(false);
-$controls->add($button);
-}
-$controls->add('&nbsp;');
-if($dataSource->getIsLastPage())
-{
-$label=new TLabel;
-$label->setText($style->getNextPageText());
-$controls->add($label);
-}
-else
-{
-$button=new TLinkButton;
-$button->setText($style->getNextPageText());
-$button->setCommandName('page');
-$button->setCommandParameter('next');
-$button->setCausesValidation(false);
-$controls->add($button);
-}
-}
-protected function buildNumericPager($cell,$dataSource)
-{
-$style=$this->getPagerStyle();
-$controls=$cell->getControls();
-$pageCount=$dataSource->getPageCount();
-$pageIndex=$dataSource->getCurrentPageIndex()+1;
-$maxButtonCount=$style->getPageButtonCount();
-$buttonCount=$maxButtonCount>$pageCount?$pageCount:$maxButtonCount;
-$startPageIndex=1;
-$endPageIndex=$buttonCount;
-if($pageIndex>$endPageIndex)
-{
-$startPageIndex=((int)($pageIndex/$maxButtonCount))*$maxButtonCount+1;
-if(($endPageIndex=$startPageIndex+$maxButtonCount-1)>$pageCount)
-$endPageIndex=$pageCount;
-if($endPageIndex-$startPageIndex+1<$maxButtonCount)
-{
-if(($startPageIndex=$endPageIndex-$maxButtonCount+1)<1)
-$startPageIndex=1;
-}
-}
-if($startPageIndex>1)
-{
-$button=new TLinkButton;
-$button->setText('...');
-$button->setCommandName('page');
-$button->setCommandParameter($startPageIndex-1);
-$button->setCausesValidation(false);
-$controls->add($button);
-$controls->add('&nbsp;');
-}
-for($i=$startPageIndex;$i<=$endPageIndex;++$i)
-{
-if($i===$pageIndex)
-{
-$label=new TLabel;
-$label->setText("$i");
-$controls->add($label);
-}
-else
-{
-$button=new TLinkButton;
-$button->setText("$i");
-$button->setCommandName('page');
-$button->setCommandParameter($i);
-$button->setCausesValidation(false);
-$controls->add($button);
-}
-if($i<$endPageIndex)
-$controls->add('&nbsp;');
-}
-if($pageCount>$endPageIndex)
-{
-$controls->add('&nbsp;');
-$button=new TLinkButton;
-$button->setText('...');
-$button->setCommandName('page');
-$button->setCommandParameter($endPageIndex+1);
-$button->setCausesValidation(false);
-$controls->add($button);
-}
-}
-protected function createAutoColumns($dataSource)
-{
-if(!$dataSource)
-return null;
-$autoColumns=$this->getAutoColumns();
-$autoColumns->clear();
-foreach($dataSource as $row)
-{
-foreach($row as $key=>$value)
-{
-$column=new TBoundColumn;
-if(is_string($key))
-{
-$column->setHeaderText($key);
-$column->setDataField($key);
-$column->setSortExpression($key);
-$column->setOwner($this);
-$autoColumns->add($column);
-}
-else
-{
-$column->setHeaderText('Item');
-$column->setDataField($key);
-$column->setSortExpression('Item');
-$column->setOwner($this);
-$autoColumns->add($column);
-}
-}
-break;
-}
-return $autoColumns;
-}
-protected function applyItemStyles()
-{
-$itemStyle=$this->getViewState('ItemStyle',null);
-$alternatingItemStyle=new TTableItemStyle($itemStyle);
-if(($style=$this->getViewState('AlternatingItemStyle',null))!==null)
-$alternatingItemStyle->mergeWith($style);
-$selectedItemStyle=$this->getViewState('SelectedItemStyle',null);
-$editItemStyle=new TTableItemStyle($selectedItemStyle);
-if(($style=$this->getViewState('EditItemStyle',null))!==null)
-$editItemStyle->copyFrom($style);
-$headerStyle=$this->getViewState('HeaderStyle',null);
-$footerStyle=$this->getViewState('FooterStyle',null);
-$pagerStyle=$this->getViewState('PagerStyle',null);
-$separatorStyle=$this->getViewState('SeparatorStyle',null);
-foreach($this->getControls() as $index=>$item)
-{
-$itemType=$item->getItemType();
-switch($itemType)
-{
-case 'Header':
-if($headerStyle)
-$item->getStyle()->mergeWith($headerStyle);
-if(!$this->getShowHeader())
-$item->setVisible(false);
-break;
-case 'Footer':
-if($footerStyle)
-$item->getStyle()->mergeWith($footerStyle);
-if(!$this->getShowFooter())
-$item->setVisible(false);
-break;
-case 'Separator':
-if($separatorStyle)
-$item->getStyle()->mergeWith($separatorStyle);
-break;
-case 'Item':
-if($itemStyle)
-$item->getStyle()->mergeWith($itemStyle);
-break;
-case 'AlternatingItem':
-if($alternatingItemStyle)
-$item->getStyle()->mergeWith($alternatingItemStyle);
-break;
-case 'SelectedItem':
-if($index % 2==1)
-{
-if($itemStyle)
-$item->getStyle()->mergeWith($itemStyle);
-}
-else
-{
-if($alternatingItemStyle)
-$item->getStyle()->mergeWith($alternatingItemStyle);
-}
-if($selectedItemStyle)
-$item->getStyle()->mergeWith($selectedItemStyle);
-break;
-case 'EditItem':
-if($index % 2==1)
-{
-if($itemStyle)
-$item->getStyle()->mergeWith($itemStyle);
-}
-else
-{
-if($alternatingItemStyle)
-$item->getStyle()->mergeWith($alternatingItemStyle);
-}
-if($editItemStyle)
-$item->getStyle()->mergeWith($editItemStyle);
-break;
-case 'Pager':
-if($pagerStyle)
-{
-$item->getStyle()->mergeWith($pagerStyle);
-$mode=$pagerStyle->getMode();
-if($index===0)
-{
-if($mode==='Bottom')
-$item->setVisible(false);
-}
-else
-{
-if($mode==='Top')
-$item->setVisible(false);
-}
-}
-break;
-default:
-break;
-}
-if($this->_columns && $itemType!=='Pager')
-{
-$n=$this->_columns->getCount();
-$cells=$item->getCells();
-for($i=0;$i<$n;++$i)
-{
-$cell=$cells->itemAt($i);
-$column=$this->_columns->itemAt($i);
-if(!$column->getVisible())
-$cell->setVisible(false);
-else
-{
-if($itemType==='Header')
-$style=$column->getHeaderStyle(false);
-else if($itemType==='Footer')
-$style=$column->getFooterStyle(false);
-else
-$style=$column->getItemStyle(false);
-if($style!==null)
-$cell->getStyle()->mergeWith($style);
-}
-}
-}
-}
-}
-protected function renderContents($writer)
-{
-if($this->getHasControls())
-{
-$this->applyItemStyles();
-parent::renderContents($writer);
-}
-}
-}
-class TDataGridItemEventParameter extends TEventParameter
-{
-private $_item=null;
-public function __construct(TDataGridItem $item)
-{
-$this->_item=$item;
-}
-public function getItem()
-{
-return $this->_item;
-}
-}
-class TDataGridCommandEventParameter extends TCommandEventParameter
-{
-private $_item=null;
-private $_source=null;
-public function __construct($item,$source,TCommandEventParameter $param)
-{
-$this->_item=$item;
-$this->_source=$source;
-parent::__construct($param->getCommandName(),$param->getCommandParameter());
-}
-public function getItem()
-{
-return $this->_item;
-}
-public function getCommandSource()
-{
-return $this->_source;
-}
-}
-class TDataGridSortCommandEventParameter extends TEventParameter
-{
-private $_sortExpression='';
-private $_source=null;
-public function __construct($source,TDataGridCommandEventParameter $param)
-{
-$this->_source=$source;
-$this->_sortExpression=$param->getCommandParameter();
-}
-public function getCommandSource()
-{
-return $this->_source;
-}
-public function getSortExpression()
-{
-return $this->_sortExpression;
-}
-}
-class TDataGridPageChangedEventParameter extends TEventParameter
-{
-private $_newIndex;
-private $_source=null;
-public function __construct($source,$newPageIndex)
-{
-$this->_source=$source;
-$this->_newIndex=$newPageIndex;
-}
-public function getCommandSource()
-{
-return $this->_source;
-}
-public function getNewPageIndex()
-{
-return $this->_newIndex;
-}
-}
-class TDataGridItem extends TTableRow implements INamingContainer
-{
-private $_itemIndex='';
-private $_dataSourceIndex=0;
-private $_itemType='';
-private $_dataItem=null;
-public function __construct($itemIndex,$dataSourceIndex,$itemType)
-{
-$this->_itemIndex=$itemIndex;
-$this->_dataSourceIndex=$dataSourceIndex;
-$this->setItemType($itemType);
-}
-public function getItemType()
-{
-return $this->_itemType;
-}
-public function setItemType($value)
-{
-$this->_itemType=TPropertyValue::ensureEnum($value,'Header','Footer','Item','AlternatingItem','SelectedItem','EditItem','Separator','Pager');
-}
-public function getItemIndex()
-{
-return $this->_itemIndex;
-}
-public function getDataSourceIndex()
-{
-return $this->_dataSourceIndex;
-}
-public function getDataItem()
-{
-return $this->_dataItem;
-}
-public function setDataItem($value)
-{
-$this->_dataItem=$value;
-}
-public function onBubbleEvent($sender,$param)
-{
-if($param instanceof TCommandEventParameter)
-{
-$this->raiseBubbleEvent($this,new TDataGridCommandEventParameter($this,$sender,$param));
-return true;
-}
-else
-return false;
-}
-}
-class TDataGridItemCollection extends TList
-{
-public function insertAt($index,$item)
-{
-if($item instanceof TDataGridItem)
-parent::insertAt($index,$item);
-else
-throw new TInvalidDataTypeException('datagriditemcollection_datagriditem_required');
-}
-}
-class TDataGridColumnCollection extends TList
-{
-public function insertAt($index,$item)
-{
-if($item instanceof TDataGridColumn)
-parent::insertAt($index,$item);
-else
-throw new TInvalidDataTypeException('datagridcolumncollection_datagridcolumn_required');
-}
-}
-class TDataGridPagerStyle extends TTableItemStyle
-{
-private $_mode=null;
-private $_nextText=null;
-private $_prevText=null;
-private $_buttonCount=null;
-private $_position=null;
-private $_visible=null;
-public function getMode()
-{
-return $this->_mode===null?'NextPrev':$this->_mode;
-}
-public function setMode($value)
-{
-$this->_mode=TPropertyValue::ensureEnum($value,'NextPrev','Numeric');
-}
-public function getNextPageText()
-{
-return $this->_nextText===null?'>':$this->_nextText;
-}
-public function setNextPageText($value)
-{
-$this->_nextText=$value;
-}
-public function getPrevPageText()
-{
-return $this->_prevText===null?'<':$this->_prevText;
-}
-public function setPrevPageText($value)
-{
-$this->_prevText=$value;
-}
-public function getPageButtonCount()
-{
-return $this->_buttonCount===null?10:$this->_buttonCount;
-}
-public function setPageButtonCount($value)
-{
-if(($value=TPropertyValue::ensureInteger($value))<1)
-throw new TInvalidDataValueException('datagridpagerstyle_pagebuttoncount_invalid');
-$this->_buttonCount=$value;
-}
-public function getPosition()
-{
-return $this->_position===null?'Bottom':$this->_position;
-}
-public function setPosition($value)
-{
-$this->_position=TPropertyValue::ensureEnum($value,'Bottom','Top','TopAndBottom');
-}
-public function getVisible()
-{
-return $this->_visible===null?true:$this->_visible;
-}
-public function setVisible($value)
-{
-$this->_visible=TPropertyValue::ensureBoolean($value);
-}
-public function reset()
-{
-parent::reset();
-$this->_visible=null;
-$this->_position=null;
-$this->_buttonCount=null;
-$this->_prevText=null;
-$this->_nextText=null;
-$this->_mode=null;
-}
-public function copyFrom($style)
-{
-parent::copyFrom($style);
-if($style instanceof TDataGridPagerStyle)
-{
-$this->_visible=$style->_visible;
-$this->_position=$style->_position;
-$this->_buttonCount=$style->_buttonCount;
-$this->_prevText=$style->_prevText;
-$this->_nextText=$style->_nextText;
-$this->_mode=$style->_mode;
-}
-}
-public function mergeWith($style)
-{
-parent::mergeWith($style);
-if($style instanceof TDataGridPagerStyle)
-{
-if($style->_visible!==null)
-$this->_visible=$style->_visible;
-if($style->_position!==null)
-$this->_position=$style->_position;
-if($style->_buttonCount!==null)
-$this->_buttonCount=$style->_buttonCount;
-if($style->_prevText!==null)
-$this->_prevText=$style->_prevText;
-if($style->_nextText!==null)
-$this->_nextText=$style->_nextText;
-if($style->_mode!==null)
-$this->_mode=$style->_mode;
-}
-}
-}
-
-abstract class TDataGridColumn extends TComponent
-{
-private $_owner=null;
-private $_viewState=array();
-public function getHeaderText()
-{
-return $this->getViewState('HeaderText','');
-}
-public function setHeaderText($value)
-{
-$this->setViewState('HeaderText',$value,'');
-$this->onColumnChanged();
-}
-public function getHeaderImageUrl()
-{
-return $this->getViewState('HeaderImageUrl','');
-}
-public function setHeaderImageUrl($value)
-{
-$this->setViewState('HeaderImageUrl',$value,'');
-$this->onColumnChanged();
-}
-public function getHeaderStyle($createStyle=true)
-{
-if(($style=$this->getViewState('HeaderStyle',null))===null && $createStyle)
-{
-$style=new TTableItemStyle;
-$this->setViewState('HeaderStyle',$style,null);
-}
-return $style;
-}
-public function getFooterText()
-{
-return $this->getViewState('FooterText','');
-}
-public function setFooterText($value)
-{
-$this->setViewState('FooterText',$value,'');
-$this->onColumnChanged();
-}
-public function getFooterStyle($createStyle=true)
-{
-if(($style=$this->getViewState('FooterStyle',null))===null && $createStyle)
-{
-$style=new TTableItemStyle;
-$this->setViewState('FooterStyle',$style,null);
-}
-return $style;
-}
-public function getItemStyle($createStyle=true)
-{
-if(($style=$this->getViewState('ItemStyle',null))===null && $createStyle)
-{
-$style=new TTableItemStyle;
-$this->setViewState('ItemStyle',$style,null);
-}
-return $style;
-}
-public function setSortExpression($value)
-{
-$this->setViewState('SortExpression',$value,'');
-$this->onColumnChanged();
-}
-public function getSortExpression()
-{
-return $this->getViewState('SortExpression','');
-}
-public function getVisible($checkParents=true)
-{
-return $this->getViewState('Visible',true);
-}
-public function setVisible($value)
-{
-$this->setViewState('Visible',TPropertyValue::ensureBoolean($value),true);
-$this->onColumnChanged();
-}
-protected function getViewState($key,$defaultValue=null)
-{
-return isset($this->_viewState[$key])?$this->_viewState[$key]:$defaultValue;
-}
-protected function setViewState($key,$value,$defaultValue=null)
-{
-if($value===$defaultValue)
-unset($this->_viewState[$key]);
-else
-$this->_viewState[$key]=$value;
-}
-public function loadState($state)
-{
-$this->_viewState=$state;
-}
-public function saveState()
-{
-return $this->_viewState;
-}
-public function getOwner()
-{
-return $this->_owner;
-}
-public function setOwner(TDataGrid $value)
-{
-$this->_owner=$value;
-}
-public function onColumnChanged()
-{
-if($this->_owner)
-$this->_owner->onColumnsChanged();
-}
-public function initialize()
-{
-}
-protected function getDataFieldValue($data,$field)
-{
-if(is_array($data))
-return $data[$field];
-else if($data instanceof TMap)
-return $data->itemAt($field);
-else if(($data instanceof TComponent) && $data->canGetProperty($field))
-{
-$getter='get'.$field;
-return $data->$getter();
-}
-else
-throw new TInvalidDataValueException('datagridcolumn_data_invalid');
-}
-public function initializeCell($cell,$columnIndex,$itemType)
-{
-switch($itemType)
-{
-case 'Header':
-$sortExpression=$this->getSortExpression();
-$allowSorting=$sortExpression!=='' && (!$this->_owner || $this->_owner->getAllowSorting());
-if($allowSorting)
-{
-if(($url=$this->getHeaderImageUrl())!=='')
-{
-$button=Prado::createComponent('System.Web.UI.WebControls.TImageButton');
-$button->setImageUrl($url);
-$button->setCommandName('Sort');
-$button->setCommandParameter($sortExpression);
-$button->setCausesValidation(false);
-$cell->getControls()->add($button);
-}
-else if(($text=$this->getHeaderText())!=='')
-{
-$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
-$button->setText($text);
-$button->setCommandName('Sort');
-$button->setCommandParameter($sortExpression);
-$button->setCausesValidation(false);
-$cell->getControls()->add($button);
-}
-else
-$cell->setText('&nbsp;');
-}
-else
-{
-if(($url=$this->getHeaderImageUrl())!=='')
-{
-$image=Prado::createComponent('System.Web.UI.WebControls.TImage');
-$image->setImageUrl($url);
-$cell->getControls()->add($image);
-}
-else
-{
-if(($text=$this->getHeaderText())==='')
-$text='&nbsp;';
-$cell->setText($text);
-}
-}
-break;
-case 'Footer':
-if(($text=$this->getFooterText())==='')
-$text='&nbsp;';
-$cell->setText($text);
-break;
-}
-}
-protected function formatDataValue($formatString,$value)
-{
-return $formatString===''?TPropertyValue::ensureString($value):sprintf($formatString,$value);
-}
-}
-
-class TBoundColumn extends TDataGridColumn
-{
-public function getDataField()
-{
-return $this->getViewState('DataField','');
-}
-public function setDataField($value)
-{
-$this->setViewState('DataField',$value,'');
-$this->onColumnChanged();
-}
-public function getDataFormatString()
-{
-return $this->getViewState('DataFormatString','');
-}
-public function setDataFormatString($value)
-{
-$this->setViewState('DataFormatString',$value,'');
-$this->onColumnChanged();
-}
-public function getReadOnly()
-{
-return $this->getViewState('ReadOnly',false);
-}
-public function setReadOnly($value)
-{
-$this->setViewState('ReadOnly',TPropertyValue::ensureBoolean($value),false);
-$this->onColumnChanged();
-}
-public function initializeCell($cell,$columnIndex,$itemType)
-{
-parent::initializeCell($cell,$columnIndex,$itemType);
-switch($itemType)
-{
-case 'EditItem':
-$control=$cell;
-if(!$this->getReadOnly())
-{
-$textBox=Prado::createComponent('System.Web.UI.WebControls.TTextBox');
-$cell->getControls()->add($textBox);
-$control=$textBox;
-}
-if(($dataField=$this->getDataField())!=='')
-$control->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
-break;
-case 'Item':
-case 'AlternatingItem':
-case 'SelectedItem':
-if(($dataField=$this->getDataField())!=='')
-$cell->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
-break;
-}
-}
-public function dataBindColumn($sender,$param)
-{
-$item=$sender->getNamingContainer();
-$data=$item->getDataItem();
-$formatString=$this->getDataFormatString();
-if(($field=$this->getDataField())!=='')
-$value=$this->formatDataValue($formatString,$this->getDataFieldValue($data,$field));
-else
-$value=$this->formatDataValue($formatString,$data);
-if(($sender instanceof TTableCell) || ($sender instanceof TTextBox))
-$sender->setText($value);
-}
-}
-
-class TButtonColumn extends TDataGridColumn
-{
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-$this->onColumnChanged();
-}
-public function getDataTextField()
-{
-return $this->getViewState('DataTextField','');
-}
-public function setDataTextField($value)
-{
-$this->setViewState('DataTextField',$value,'');
-$this->onColumnChanged();
-}
-public function getDataTextFormatString()
-{
-return $this->getViewState('DataTextFormatString','');
-}
-public function setDataTextFormatString($value)
-{
-$this->setViewState('DataTextFormatString',$value,'');
-$this->onColumnChanged();
-}
-public function getButtonType()
-{
-return $this->getViewState('ButtonType','LinkButton');
-}
-public function setButtonType($value)
-{
-$this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'LinkButton','PushButton'),'LinkButton');
-$this->onColumnChanged();
-}
-public function getCommandName()
-{
-return $this->getViewState('CommandName','');
-}
-public function setCommandName($value)
-{
-$this->setViewState('CommandName',$value,'');
-$this->onColumnChanged();
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-$this->onColumnChanged();
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-$this->onColumnChanged();
-}
-public function initializeCell($cell,$columnIndex,$itemType)
-{
-parent::initializeCell($cell,$columnIndex,$itemType);
-if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem' || $itemType==='EditItem')
-{
-if($this->getButtonType()==='LinkButton')
-$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
-else
-$button=Prado::createComponent('System.Web.UI.WebControls.TButton');
-$button->setText($this->getText());
-$button->setCommandName($this->getCommandName());
-$button->setCausesValidation($this->getCausesValidation());
-$button->setValidationGroup($this->getValidationGroup());
-if($this->getDataTextField()!=='')
-$button->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
-$cell->getControls()->add($button);
-}
-}
-public function dataBindColumn($sender,$param)
-{
-if(($field=$this->getDataTextField())!=='')
-{
-$item=$sender->getNamingContainer();
-$data=$item->getDataItem();
-$value=$this->getDataFieldValue($data,$field);
-$text=$this->formatDataValue($this->getDataTextFormatString(),$value);
-if(($sender instanceof TLinkButton) || ($sender instanceof TButton))
-$sender->setText($text);
-}
-}
-}
-
-class TEditCommandColumn extends TDataGridColumn
-{
-public function getButtonType()
-{
-return $this->getViewState('ButtonType','LinkButton');
-}
-public function setButtonType($value)
-{
-$this->setViewState('ButtonType',TPropertyValue::ensureEnum($value,'LinkButton','PushButton'),'LinkButton');
-$this->onColumnChanged();
-}
-public function getEditText()
-{
-return $this->getViewState('EditText','Edit');
-}
-public function setEditText($value)
-{
-$this->setViewState('EditText',$value,'Edit');
-$this->onColumnChanged();
-}
-public function getUpdateText()
-{
-return $this->getViewState('UpdateText','Update');
-}
-public function setUpdateText($value)
-{
-$this->setViewState('UpdateText',$value,'Update');
-$this->onColumnChanged();
-}
-public function getCancelText()
-{
-return $this->getViewState('CancelText','Cancel');
-}
-public function setCancelText($value)
-{
-$this->setViewState('CancelText',$value,'Cancel');
-$this->onColumnChanged();
-}
-public function getCausesValidation()
-{
-return $this->getViewState('CausesValidation',true);
-}
-public function setCausesValidation($value)
-{
-$this->setViewState('CausesValidation',TPropertyValue::ensureBoolean($value),true);
-$this->onColumnChanged();
-}
-public function getValidationGroup()
-{
-return $this->getViewState('ValidationGroup','');
-}
-public function setValidationGroup($value)
-{
-$this->setViewState('ValidationGroup',$value,'');
-$this->onColumnChanged();
-}
-public function initializeCell($cell,$columnIndex,$itemType)
-{
-parent::initializeCell($cell,$columnIndex,$itemType);
-$buttonType=$this->getButtonType()=='LinkButton'?'TLinkButton':'TButton';
-if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem')
-$this->addButtonToCell($cell,'Edit',$this->getUpdateText(),false,'');
-else if($itemType==='EditItem')
-{
-$this->addButtonToCell($cell,'Update',$this->getUpdateText(),$this->getCausesValidation(),$this->getValidationGroup());
-$cell->getControls()->add('&nbsp;');
-$this->addButtonToCell($cell,'Cancel',$this->getUpdateText(),false,'');
-}
-}
-private function addButtonToCell($cell,$commandName,$text,$causesValidation,$validationGroup)
-{
-if($this->getButtonType()==='LinkButton')
-$button=Prado::createComponent('System.Web.UI.WebControls.TLinkButton');
-else
-$button=Prado::createComponent('System.Web.UI.WebControls.TButton');
-$button->setText($text);
-$button->setCommandName($commandName);
-$button->setCausesValidation($causesValidation);
-$button->setValidationGroup($validationGroup);
-$cell->getControls()->add($button);
-}
-}
-
-class THyperLinkColumn extends TDataGridColumn
-{
-public function getText()
-{
-return $this->getViewState('Text','');
-}
-public function setText($value)
-{
-$this->setViewState('Text',$value,'');
-$this->onColumnChanged();
-}
-public function getDataTextField()
-{
-return $this->getViewState('DataTextField','');
-}
-public function setDataTextField($value)
-{
-$this->setViewState('DataTextField',$value,'');
-$this->onColumnChanged();
-}
-public function getDataTextFormatString()
-{
-return $this->getViewState('DataTextFormatString','');
-}
-public function setDataTextFormatString($value)
-{
-$this->setViewState('DataTextFormatString',$value,'');
-$this->onColumnChanged();
-}
-public function getNavigateUrl()
-{
-return $this->getViewState('NavigateUrl','');
-}
-public function setNavigateUrl($value)
-{
-$this->setViewState('NavigateUrl',$value,'');
-$this->onColumnChanged();
-}
-public function getDataNavigateUrlField()
-{
-return $this->getViewState('DataNavigateUrlField','');
-}
-public function setDataNavigateUrlField($value)
-{
-$this->setViewState('DataNavigateUrlField',$value,'');
-$this->onColumnChanged();
-}
-public function getDataNavigateUrlFormatString()
-{
-return $this->getViewState('DataNavigateUrlFormatString','');
-}
-public function setDataNavigateUrlFormatString($value)
-{
-$this->setViewState('DataNavigateUrlFormatString',$value,'');
-$this->onColumnChanged();
-}
-public function getTarget()
-{
-return $this->getViewState('Target','');
-}
-public function setTarget($value)
-{
-$this->setViewState('Target',$value,'');
-$this->onColumnChanged();
-}
-public function initializeCell($cell,$columnIndex,$itemType)
-{
-parent::initializeCell($cell,$columnIndex,$itemType);
-if($itemType==='Item' || $itemType==='AlternatingItem' || $itemType==='SelectedItem' || $itemType==='EditItem')
-{
-$link=Prado::createComponent('System.Web.UI.WebControls.THyperLink');
-$link->setText($this->getText());
-$link->setNavigateUrl($this->getNavigateUrl());
-$link->setTarget($this->getTarget());
-if($this->getDataTextField()!=='' || $this->getDataNavigateUrlField()!=='')
-$link->attachEventHandler('OnDataBinding',array($this,'dataBindColumn'));
-$cell->getControls()->add($link);
-}
-}
-public function dataBindColumn($sender,$param)
-{
-$item=$sender->getNamingContainer();
-$data=$item->getDataItem();
-if(($field=$this->getDataTextField())!=='')
-{
-$value=$this->getDataFieldValue($data,$field);
-$text=$this->formatDataValue($this->getDataTextFormatString(),$value);
-$sender->setText($text);
-}
-if(($field=$this->getDataNavigateUrlField())!=='')
-{
-$value=$this->getDataFieldValue($data,$field);
-$url=$this->formatDataValue($this->getDataNavigateUrlFormatString(),$value);
-$sender->setNavigateUrl($url);
-}
-}
-}
-
-class TTemplateColumn extends TDataGridColumn
-{
-private $_itemTemplate=null;
-private $_editItemTemplate=null;
-private $_headerTemplate=null;
-private $_footerTemplate=null;
-public function getEditItemTemplate()
-{
-return $this->_editItemTemplate;
-}
-public function setEditItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_editItemTemplate=$value;
-else
-throw new TInvalidDataTypeException('templatecolumn_template_required','EditItemTemplate');
-}
-public function getItemTemplate()
-{
-return $this->_itemTemplate;
-}
-public function setItemTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_itemTemplate=$value;
-else
-throw new TInvalidDataTypeException('templatecolumn_template_required','ItemTemplate');
-}
-public function getHeaderTemplate()
-{
-return $this->_headerTemplate;
-}
-public function setHeaderTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_headerTemplate=$value;
-else
-throw new TInvalidDataTypeException('templatecolumn_template_required','HeaderTemplate');
-}
-public function getFooterTemplate()
-{
-return $this->_footerTemplate;
-}
-public function setFooterTemplate($value)
-{
-if($value instanceof ITemplate || $value===null)
-$this->_footerTemplate=$value;
-else
-throw new TInvalidDataTypeException('templatecolumn_template_required','FooterTemplate');
-}
-public function initializeCell($cell,$columnIndex,$itemType)
-{
-parent::initializeCell($cell,$columnIndex,$itemType);
-$template=null;
-switch($itemType)
-{
-case 'Header':
-$template=$this->_headerTemplate;
-break;
-case 'Footer':
-$template=$this->_footerTemplate;
-break;
-case 'Item':
-case 'AlternatingItem':
-case 'SelectedItem':
-$template=$this->_itemTemplate;
-break;
-case 'EditItem':
-$template=$this->_editItemTemplate===null?$this->_itemTemplate:$this->_editItemTemplate;
-break;
-}
-if($template!==null)
-{
-$cell->setText('');
-$cell->getControls()->clear();
-$template->instantiateIn($cell);
-}
-else
-$cell->setText('&nbsp;');
-}
-}
?> \ No newline at end of file