From 26c3775697fc94086269d54099576679137e5eda Mon Sep 17 00:00:00 2001 From: wei <> Date: Fri, 14 Jul 2006 05:27:35 +0000 Subject: Fixed #284 --- .../tickets/protected/pages/Ticket284.page | 14 ++++ .../tickets/protected/pages/Ticket284.php | 11 +++ .../tickets/protected/pages/Ticket284Component.php | 94 ++++++++++++++++++++++ .../tickets/protected/pages/Ticket284Component.tpl | 94 ++++++++++++++++++++++ 4 files changed, 213 insertions(+) create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket284.page create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket284.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket284Component.php create mode 100644 tests/FunctionalTests/tickets/protected/pages/Ticket284Component.tpl (limited to 'tests/FunctionalTests/tickets/protected') diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket284.page b/tests/FunctionalTests/tickets/protected/pages/Ticket284.page new file mode 100644 index 00000000..ff25e3fb --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket284.page @@ -0,0 +1,14 @@ + + + + + + + + + diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket284.php b/tests/FunctionalTests/tickets/protected/pages/Ticket284.php new file mode 100644 index 00000000..332789ff --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket284.php @@ -0,0 +1,11 @@ + \ No newline at end of file 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 @@ +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 diff --git a/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.tpl b/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.tpl new file mode 100644 index 00000000..ed787287 --- /dev/null +++ b/tests/FunctionalTests/tickets/protected/pages/Ticket284Component.tpl @@ -0,0 +1,94 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3