| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* TActiveRatingList class file.
|
|
|
4 |
*
|
|
|
5 |
* @author Wei Zhuo <weizhuo[at]gamil[dot]com>
|
|
|
6 |
* @author Bradley Booms <bradley[dot]booms[at]gmail[dot]com>
|
|
|
7 |
* @link http://www.pradosoft.com/
|
|
|
8 |
* @copyright Copyright © 2005-2008 PradoSoft
|
|
|
9 |
* @license http://www.pradosoft.com/license/
|
|
|
10 |
* @version $Id$
|
|
|
11 |
* @package System.Web.UI.ActiveControls
|
|
|
12 |
*/
|
|
|
13 |
|
|
|
14 |
/**
|
|
|
15 |
* TActiveRatingList Class
|
|
|
16 |
*
|
|
|
17 |
* Displays clickable images that represent a TRadioButtonList
|
|
|
18 |
*
|
|
|
19 |
* @author Wei Zhuo <weizhuo[at]gmail[dot]com>
|
|
|
20 |
* @author Bradley Booms <bradley[dot]booms[at]gmail[dot]com>
|
|
|
21 |
* @version $Id$
|
|
|
22 |
* @package System.Web.UI.ActiveControls
|
|
|
23 |
* @since 3.1
|
|
|
24 |
*/
|
|
|
25 |
class TActiveRatingList extends TRatingList implements IActiveControl, ICallbackEventHandler
|
|
|
26 |
{
|
|
|
27 |
/**
|
|
|
28 |
* Creates a new callback control, sets the adapter to
|
|
|
29 |
* TActiveListControlAdapter. If you override this class, be sure to set the
|
|
|
30 |
* adapter appropriately by, for example, by calling this constructor.
|
|
|
31 |
*/
|
|
|
32 |
public function __construct()
|
|
|
33 |
{
|
|
|
34 |
$this->setAdapter(new TActiveListControlAdapter($this));
|
|
|
35 |
$this->setAutoPostBack(true);
|
|
|
36 |
parent::__construct();
|
|
|
37 |
}
|
|
|
38 |
|
|
|
39 |
/**
|
|
|
40 |
* @return TBaseActiveCallbackControl standard callback control options.
|
|
|
41 |
*/
|
|
|
42 |
public function getActiveControl()
|
|
|
43 |
{
|
|
|
44 |
return $this->getAdapter()->getBaseActiveControl();
|
|
|
45 |
}
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
* @return TCallbackClientSide client side request options.
|
|
|
49 |
*/
|
|
|
50 |
public function getClientSide()
|
|
|
51 |
{
|
|
|
52 |
return $this->getAdapter()->getBaseActiveControl()->getClientSide();
|
|
|
53 |
}
|
|
|
54 |
|
|
|
55 |
/**
|
|
|
56 |
* Raises the callback event. This method is required by {@link
|
|
|
57 |
* ICallbackEventHandler} interface.
|
|
|
58 |
* This method is mainly used by framework and control developers.
|
|
|
59 |
* @param TCallbackEventParameter the event parameter
|
|
|
60 |
*/
|
|
|
61 |
public function raiseCallbackEvent($param)
|
|
|
62 |
{
|
|
|
63 |
$this->onCallback($param);
|
|
|
64 |
}
|
|
|
65 |
|
|
|
66 |
/**
|
|
|
67 |
* This method is invoked when a callback is requested. The method raises
|
|
|
68 |
* 'OnCallback' event to fire up the event handlers. If you override this
|
|
|
69 |
* method, be sure to call the parent implementation so that the event
|
|
|
70 |
* handler can be invoked.
|
|
|
71 |
* @param TCallbackEventParameter event parameter to be passed to the event handlers
|
|
|
72 |
*/
|
|
|
73 |
public function onCallback($param)
|
|
|
74 |
{
|
|
|
75 |
$this->raiseEvent('OnCallback', $this, $param);
|
|
|
76 |
}
|
|
|
77 |
|
|
|
78 |
/**
|
|
|
79 |
* @param boolean whether the items in the column can be edited
|
|
|
80 |
*/
|
|
|
81 |
public function setReadOnly($value)
|
|
|
82 |
{
|
|
|
83 |
parent::setReadOnly($value);
|
|
|
84 |
$value = $this->getReadOnly();
|
|
|
85 |
$this->callClientFunction('setReadOnly',$value);
|
|
|
86 |
}
|
|
|
87 |
|
|
|
88 |
/**
|
|
|
89 |
* @param float rating value, also sets the selected Index
|
|
|
90 |
*/
|
|
|
91 |
public function setRating($value)
|
|
|
92 |
{
|
|
|
93 |
parent::setRating($value);
|
|
|
94 |
$value = $this->getRating();
|
|
|
95 |
$this->callClientFunction('setRating',$value);
|
|
|
96 |
}
|
|
|
97 |
|
|
|
98 |
/**
|
|
|
99 |
* Calls the client-side static method for this control class.
|
|
|
100 |
* @param string static method name
|
|
|
101 |
* @param mixed method parmaeter
|
|
|
102 |
*/
|
|
|
103 |
protected function callClientFunction($func,$value)
|
|
|
104 |
{
|
|
|
105 |
if($this->getActiveControl()->canUpdateClientSide())
|
|
|
106 |
{
|
|
|
107 |
$client = $this->getPage()->getCallbackClient();
|
|
|
108 |
$code = parent::getClientClassName().'.'.$func;
|
|
|
109 |
$client->callClientFunction($code,array($this,$value));
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
/**
|
|
|
114 |
* @param string caption text
|
|
|
115 |
*/
|
|
|
116 |
public function setCaption($value)
|
|
|
117 |
{
|
|
|
118 |
parent::setCaption($value);
|
|
|
119 |
// if it's an active control, this should not be needed.
|
|
|
120 |
$this->callClientFunction('setCaption',$value);
|
|
|
121 |
}
|
|
|
122 |
|
|
|
123 |
/**
|
|
|
124 |
* Gets the name of the javascript class responsible for performing postback for this control.
|
|
|
125 |
* This method overrides the parent implementation.
|
|
|
126 |
* @return string the javascript class name
|
|
|
127 |
*/
|
|
|
128 |
protected function getClientClassName()
|
|
|
129 |
{
|
|
|
130 |
return 'Prado.WebUI.TActiveRatingList';
|
|
|
131 |
}
|
|
|
132 |
}
|
|
|
133 |
|