| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TItemDataRenderer class file
|
|
|
4 |
*
|
|
|
5 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
6 |
* @link http://www.pradosoft.com/
|
|
|
7 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
8 |
* @license http://www.pradosoft.com/license/
|
|
|
9 |
* @version $Id: TItemDataRenderer.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
10 |
* @package System.Web.UI.WebControls
|
|
|
11 |
* @since 3.1.2
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
Prado::using('System.Web.UI.WebControls.TDataBoundControl');
|
|
|
15 |
Prado::using('System.Web.UI.WebControls.TDataRenderer');
|
|
|
16 |
|
|
|
17 |
/**
|
|
|
18 |
* TItemDataRenderer class
|
|
|
19 |
*
|
|
|
20 |
* TItemDataRenderer is the convient base class for template-based item data renderers.
|
|
|
21 |
* It implements the {@link IItemDataRenderer} interface, and because
|
|
|
22 |
* TItemDataRenderer extends from {@link TTemplateControl}, derived child
|
|
|
23 |
* classes can have templates to define their presentational layout.
|
|
|
24 |
*
|
|
|
25 |
* The following properties are provided by TItemDataRenderer:
|
|
|
26 |
* - {@link getItemIndex ItemIndex}: zero-based index of this renderer in the item list collection.
|
|
|
27 |
* - {@link getItemType ItemType}: item type of this renderer, such as TListItemType::AlternatingItem
|
|
|
28 |
* - {@link getData Data}: data associated with this renderer
|
|
|
29 |
|
|
|
30 |
* @author Qiang Xue <qiang.xue@gmail.com>
|
|
|
31 |
* @version $Id: TItemDataRenderer.php 2541 2008-10-21 15:05:13Z qiang.xue $
|
|
|
32 |
* @package System.Web.UI.WebControls
|
|
|
33 |
* @since 3.1.2
|
|
|
34 |
*/
|
|
|
35 |
abstract class TItemDataRenderer extends TDataRenderer implements IItemDataRenderer
|
|
|
36 |
{
|
|
|
37 |
/**
|
|
|
38 |
* index of the data item in the Items collection of repeater
|
|
|
39 |
*/
|
|
|
40 |
private $_itemIndex;
|
|
|
41 |
/**
|
|
|
42 |
* type of the TRepeaterItem
|
|
|
43 |
* @var TListItemType
|
|
|
44 |
*/
|
|
|
45 |
private $_itemType;
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* @return TListItemType item type
|
|
|
49 |
*/
|
|
|
50 |
public function getItemType()
|
|
|
51 |
{
|
|
|
52 |
return $this->_itemType;
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
/**
|
|
|
56 |
* @param TListItemType item type.
|
|
|
57 |
*/
|
|
|
58 |
public function setItemType($value)
|
|
|
59 |
{
|
|
|
60 |
$this->_itemType=TPropertyValue::ensureEnum($value,'TListItemType');
|
|
|
61 |
}
|
|
|
62 |
|
|
|
63 |
/**
|
|
|
64 |
* Returns a value indicating the zero-based index of the item in the corresponding data control's item collection.
|
|
|
65 |
* If the item is not in the collection (e.g. it is a header item), it returns -1.
|
|
|
66 |
* @return integer zero-based index of the item.
|
|
|
67 |
*/
|
|
|
68 |
public function getItemIndex()
|
|
|
69 |
{
|
|
|
70 |
return $this->_itemIndex;
|
|
|
71 |
}
|
|
|
72 |
|
|
|
73 |
/**
|
|
|
74 |
* Sets the zero-based index for the item.
|
|
|
75 |
* If the item is not in the item collection (e.g. it is a header item), -1 should be used.
|
|
|
76 |
* @param integer zero-based index of the item.
|
|
|
77 |
*/
|
|
|
78 |
public function setItemIndex($value)
|
|
|
79 |
{
|
|
|
80 |
$this->_itemIndex=TPropertyValue::ensureInteger($value);
|
|
|
81 |
}
|
|
|
82 |
}
|
|
|
83 |
|