summaryrefslogtreecommitdiff
path: root/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
diff options
context:
space:
mode:
authorxue <>2006-07-16 01:50:23 +0000
committerxue <>2006-07-16 01:50:23 +0000
commitaf68030fcf0c266300feb2c100149ecadef7d364 (patch)
tree76b7c8ad5d8227870b9ef10c3e7b92a36336b320 /tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
parent4b78404c20490a615459267426ce9e6737bf4485 (diff)
Merge from 3.0 branch till 1264.
Diffstat (limited to 'tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php')
-rw-r--r--tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php94
1 files changed, 94 insertions, 0 deletions
diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php b/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
new file mode 100644
index 00000000..892bdc87
--- /dev/null
+++ b/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php
@@ -0,0 +1,94 @@
+<?php
+
+class Ticket284Component extends TTemplateControl implements IValidatable
+{
+ public function onPreRender($param)
+ {
+ if (!$this->ShowHours && $this->ShowMinutes)
+ {
+ throw new TConfigurationException(
+ 'Invalid OPSDatePicker Config: You cannot specify ShowMinutes="true" while ShowHours="false"'
+ );
+ }
+ }
+
+ public function getDatePicker()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('datePicker');
+ }
+
+ public function getHourPicker()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('hourPicker');
+ }
+
+ public function getMinutePicker()
+ {
+ $this->ensureChildControls();
+ return $this->getRegisteredObject('minutePicker');
+ }
+
+ public function getShowHours()
+ {
+ return $this->HourPicker->Visible;
+ }
+
+ public function setShowHours($value)
+ {
+ $this->HourPicker->Visible = TPropertyValue::ensureBoolean($value);
+ }
+
+ public function getShowMinutes()
+ {
+ return $this->MinutePicker->Visible;
+ }
+
+ public function setShowMinutes($value)
+ {
+ $this->MinutePicker->Visible = TPropertyValue::ensureBoolean($value);
+ }
+
+ public function getTimeStamp()
+ {
+ return strtotime($this->Date);
+ }
+
+ public function setTimeStamp($value)
+ {
+ $ts = TPropertyValue::ensureInteger($value);
+ $this->DatePicker->TimeStamp = $ts;
+ $this->HourPicker->SelectedValue = date('H', $ts);
+ $this->MinutePicker->SelectedValue = date('i', $ts);
+ }
+
+ public function getDate()
+ {
+ $dateStr = $this->DatePicker->Date;
+ if ($this->ShowHours){
+ $dateStr .= ' '.$this->HourPicker->SelectedValue;
+ }
+ if ($this->ShowMinutes){
+ $dateStr .= ':'.$this->MinutePicker->SelectedValue;
+ }
+ return $dateStr;
+ }
+
+ public function setDate($value)
+ {
+ $dateStr = TPropertyValue::ensureString($value);
+ $this->TimeStamp = strtotime($dateStr);
+ }
+
+ public function getValidationPropertyValue()
+ {
+ if ($this->DatePicker->Date === ''){
+ return '';
+ }
+ else{
+ return $this->TimeStamp;
+ }
+ }
+}
+?> \ No newline at end of file