blob: ead471ab7b8533854a8b79fe2ae2e96b4cf6068b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
<?php
/**
* IDataSource, TDataSourceControl, TReadOnlyDataSource class file
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @link http://www.pradosoft.com/
* @copyright Copyright © 2005-2014 PradoSoft
* @license http://www.pradosoft.com/license/
* @package System.Web.UI.WebControls
*/
/**
* TDataSourceControl class
*
* @author Qiang Xue <qiang.xue@gmail.com>
* @package System.Web.UI.WebControls
* @since 3.0
*/
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);
}
}
|