1: <?php
2: /**
3: * QProgressbar Base File
4: *
5: * The QProgressbarBase class defined here provides an interface between the generated
6: * QProgressbarGen class, and QCubed. This file is part of the core and will be overwritten
7: * when you update QCubed. To override, see the QProgressbar.class.php file in the controls
8: * folder.
9: *
10: */
11:
12: /**
13: * Implements a JQuery UI Progress Bar
14: *
15: * Use the inherited interface to control the progress bar.
16: *
17: * @link http://jqueryui.com/progressbar/
18: * @package Controls\Base
19: *
20: */
21: class QProgressbarBase extends QProgressbarGen {
22: /**
23: * The javascript for the control to be sent to the client.
24: * @return string The control's JS
25: */
26: public function GetEndScript() {
27: $strJS = parent::GetEndScript();
28: QApplication::ExecuteJsFunction('qcubed.progressbar', $this->GetJqControlId(), QJsPriority::High);
29: return $strJS;
30: }
31:
32: /**
33: * Returns the state data to restore later.
34: * @return mixed
35: */
36: protected function GetState() {
37: return ['value'=>$this->Value];
38: }
39:
40: /**
41: * Restore the state of the control.
42: * @param mixed $state
43: */
44: protected function PutState($state) {
45: if (isset($state['value'])) {
46: $this->Value = $state['value'];
47: }
48: }
49:
50:
51: /**
52: * PHP __set magic method
53: * @param string $strName Name of the property
54: * @param string $mixValue Value of the property
55: *
56: * @throws Exception|QCallerException
57: */
58: public function __set($strName, $mixValue) {
59: switch ($strName) {
60: case '_Value': // Internal Only. Used by JS above. Do Not Call.
61: try {
62: $this->Value = QType::Cast($mixValue, QType::Integer);
63: } catch (QCallerException $objExc) {
64: $objExc->IncrementOffset();
65: throw $objExc;
66: }
67: break;
68:
69: default:
70: try {
71: parent::__set($strName, $mixValue);
72: } catch (QCallerException $objExc) {
73: $objExc->IncrementOffset();
74: throw $objExc;
75: }
76: break;
77: }
78: }
79: }