GetAttributes(); // Pull any styles if ($strStyle = $this->GetStyleAttributes()) $strStyle = 'style="' . $strStyle . '"'; // Return the HTML. return sprintf('Sample Control: %s - %s', $this->strControlId, $strAttributes, $strStyle, $this->intExample, $this->strFoo); } /** * Constructor for this control * @param mixed $objParentObject Parent QForm or QControl that is responsible for rendering this control * @param string $strControlId optional control ID */ public function __construct($objParentObject, $strControlId = null) { try { parent::__construct($objParentObject, $strControlId); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } // Setup Control-specific CSS and JS files to be loaded // Paths are relative to the __CSS_ASSETS__ and __JS_ASSETS__ directories // Multiple files can be specified, as well, by separating with a comma // $this->strJavaScripts = 'custom.js, ../path/to/prototype.js, etc.js'; // $this->strStyleSheets = 'custom.css'; // Additional Setup Performed here $this->intExample = 28; $this->strFoo = 'Hello!'; } // For any JavaScript calls that need to be made whenever this control is rendered or re-rendered // public function GetEndScript() { // $strToReturn = parent::GetEndScript(); // return $strToReturn; // } // For any HTML code that needs to be rendered at the END of the QForm when this control is INITIALLY rendered. // public function GetEndHtml() { // $strToReturn = parent::GetEndHtml(); // return $strToReturn; // } ///////////////////////// // Public Properties: GET ///////////////////////// public function __get($strName) { switch ($strName) { case 'Example': return $this->intExample; case 'Foo': return $this->strFoo; default: try { return parent::__get($strName); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } } ///////////////////////// // Public Properties: SET ///////////////////////// public function __set($strName, $mixValue) { $this->blnModified = true; switch ($strName) { case 'Example': try { return ($this->intExample = QType::Cast($mixValue, QType::Integer)); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } case 'Foo': try { return ($this->strFoo = QType::Cast($mixValue, QType::String)); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } default: try { return (parent::__set($strName, $mixValue)); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } } } } ?>