public function __set($strName, $mixValue) { switch ($strName) { case 'MaxDate': case 'Maximum': try { if (is_string($mixValue)) { $mixValue = new QDateTime($mixValue); } parent::__set('MaxDate', QType::Cast($mixValue, QType::DateTime)); } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; case 'MinDate': case 'Minimum': try { if (is_string($mixValue)) { $mixValue = new QDateTime($mixValue); } parent::__set('MinDate', QType::Cast($mixValue, QType::DateTime)); } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; case 'DateTime': try { $this->dttDateTime = QType::Cast($mixValue, QType::DateTime); if ($this->dttDateTime && $this->dttDateTime->IsNull()) { $this->dttDateTime = null; $this->blnModified = true; } if (!$this->dttDateTime || !$this->strDateTimeFormat) { parent::__set('Text', ''); } else { parent::__set('Text', $this->dttDateTime->qFormat($this->strDateTimeFormat)); } } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; case 'JqDateFormat': try { parent::__set($strName, $mixValue); $this->strDateTimeFormat = QCalendar::qcFrmt($this->JqDateFormat); // trigger an update to reformat the text with the new format $this->DateTime = $this->dttDateTime; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; case 'DateTimeFormat': case 'DateFormat': try { $this->strDateTimeFormat = QType::Cast($mixValue, QType::String); parent::__set('JqDateFormat', QCalendar::jqFrmt($this->strDateTimeFormat)); // trigger an update to reformat the text with the new format $this->DateTime = $this->dttDateTime; } catch (QInvalidCastException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; case 'Text': parent::__set($strName, $mixValue); $this->dttDateTime = new QDateTime($this->strText); break; default: try { parent::__set($strName, $mixValue); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } break; } }
/** * @return QModelConnectorParam[] */ public static function GetModelConnectorParams() { return array_merge(parent::GetModelConnectorParams(), array(new QModelConnectorParam(get_called_class(), 'DateFormat', 'How to format the date. Default: MM/DD/YY', QType::String))); }