summaryrefslogtreecommitdiff
path: root/framework/Web/UI/WebControls/TDataSourceView.php
blob: e64ecabf03ffbe3ecf528357311e5834cd625a1b (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
 * TDataSourceSelectParameters, TDataSourceView, TReadOnlyDataSourceView class file
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @link http://www.pradosoft.com/
 * @copyright Copyright &copy; 2005-2014 PradoSoft
 * @license http://www.pradosoft.com/license/
 * @package Prado\Web\UI\WebControls
 */

namespace Prado\Web\UI\WebControls;

/**
 * TDataSourceView class
 *
 * @author Qiang Xue <qiang.xue@gmail.com>
 * @package Prado\Web\UI\WebControls
 * @since 3.0
 */
abstract class TDataSourceView extends TComponent
{
	private $_owner;
	private $_name;

	public function __construct(IDataSource $owner,$viewName)
	{
		$this->_owner=$owner;
		$this->_name=$viewName;
	}

	/**
	 * Performs DB selection based on specified parameters.
	 * @param ???
	 * @return Traversable
	 */
	abstract public function select($parameters);

	/**
	 * Inserts a DB record.
	 * @param array|TMap
	 * @return integer affected rows
	 */
	public function insertAt($values)
	{
		throw new TNotSupportedException('datasourceview_insert_unsupported');
	}

	/**
	 * Updates DB record(s) with the specified keys and new values
	 * @param array|TMap keys for specifying the records to be updated
	 * @param array|TMap new values
	 * @return integer affected rows
	 */
	public function update($keys,$values)
	{
		throw new TNotSupportedException('datasourceview_update_unsupported');
	}

	/**
	 * Deletes DB row(s) with the specified keys.
	 * @param array|TMap keys for specifying the rows to be deleted
	 * @return integer affected rows
	 */
	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);
	}
}