summaryrefslogtreecommitdiff
path: root/lib/prado/framework/Web/UI
diff options
context:
space:
mode:
Diffstat (limited to 'lib/prado/framework/Web/UI')
-rw-r--r--lib/prado/framework/Web/UI/ActiveControls/TActiveMultiView.php6
-rw-r--r--lib/prado/framework/Web/UI/TControl.php25
-rw-r--r--lib/prado/framework/Web/UI/WebControls/TDatePicker.php16
3 files changed, 36 insertions, 11 deletions
diff --git a/lib/prado/framework/Web/UI/ActiveControls/TActiveMultiView.php b/lib/prado/framework/Web/UI/ActiveControls/TActiveMultiView.php
index 45c137d..ca26554 100644
--- a/lib/prado/framework/Web/UI/ActiveControls/TActiveMultiView.php
+++ b/lib/prado/framework/Web/UI/ActiveControls/TActiveMultiView.php
@@ -92,9 +92,6 @@ class TActiveMultiView extends TMultiView implements IActiveControl
*/
public function setActiveViewIndex($value)
{
- if(parent::getActiveViewIndex() === $value)
- return;
-
parent::setActiveViewIndex($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter());
@@ -106,9 +103,6 @@ class TActiveMultiView extends TMultiView implements IActiveControl
*/
public function setActiveView($value)
{
- if(parent::getActiveView() === $value)
- return;
-
parent::setActiveView($value);
if($this->getActiveControl()->canUpdateClientSide())
$this->getPage()->getAdapter()->registerControlToRender($this,$this->getResponse()->createHtmlWriter());
diff --git a/lib/prado/framework/Web/UI/TControl.php b/lib/prado/framework/Web/UI/TControl.php
index be7b118..1b8a213 100644
--- a/lib/prado/framework/Web/UI/TControl.php
+++ b/lib/prado/framework/Web/UI/TControl.php
@@ -196,6 +196,31 @@ class TControl extends TApplicationComponent implements IRenderable, IBindable
}
/**
+ * Checks for the existance of a property value by name or a control by ID.
+ * This overrides the parent implementation by allowing checking for the
+ * existance of a control via its ID using the following syntax,
+ * <code>
+ * $menuBarExists = isset($this->menuBar);
+ * </code>
+ * Do not call this method. This is a PHP magic method that we override
+ * to allow using isset() to detect if a component property is set or not.
+ * Note, the control must be configured in the template
+ * with explicit ID. If the name matches both a property and a control ID,
+ * the control ID will take the precedence.
+ *
+ * @param string the property name or control ID
+ * @return bool wether the control or property exists
+ * @see __get
+ */
+ public function __isset($name) {
+ if(isset($this->_rf[self::RF_NAMED_OBJECTS][$name])) {
+ return true;
+ } else {
+ return parent::__isset($name);
+ }
+ }
+
+ /**
* @return boolean whether there is an adapter for this control
*/
public function getHasAdapter()
diff --git a/lib/prado/framework/Web/UI/WebControls/TDatePicker.php b/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
index 7a164dd..a773c69 100644
--- a/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
+++ b/lib/prado/framework/Web/UI/WebControls/TDatePicker.php
@@ -483,10 +483,19 @@ class TDatePicker extends TTextBox
{
$date = @getdate();
- if(isset($values[$key.'$day']))
+ $pattern = $this->getDateFormat();
+ $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
+ $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
+
+ $order = $formatter->getDayMonthYearOrdering();
+
+ if(isset($values[$key.'$day'])) {
$day = intval($values[$key.'$day']);
- else
+ } elseif(in_array('day', $order)) {
$day = $date['mday'];
+ } else {
+ $day = 1;
+ }
if(isset($values[$key.'$month']))
$month = intval($values[$key.'$month']) + 1;
@@ -502,9 +511,6 @@ class TDatePicker extends TTextBox
$date = $s->getTimeStamp(0, 0, 0, $month, $day, $year);
//$date = @mktime(0, 0, 0, $month, $day, $year);
- $pattern = $this->getDateFormat();
- $pattern = str_replace(array('MMMM', 'MMM'), array('MM','MM'), $pattern);
- $formatter = Prado::createComponent('System.Util.TSimpleDateFormatter', $pattern);
return $formatter->format($date);
}