/** * Creates a QControlBase object * This constructor will generally not be used to create a QControlBase object. Instead it is used by the * classes which extend the class. Only the parent object parameter is required. If the option strControlId * parameter is not used, QCubed will generate the id. * * @param QControl|QForm|QControlBase $objParentObject * @param string $strControlId * optional id of this Control. In html, this will be set as the value of the id attribute. The id can only * contain alphanumeric characters. If this parameter is not passed, QCubed will generate the id * * @throws Exception|QCallerException */ public function __construct($objParentObject, $strControlId = null) { if ($objParentObject instanceof QForm) { $this->objForm = $objParentObject; } else { if ($objParentObject instanceof QControl) { $this->objParentControl = $objParentObject; // $this->objParentControl->blnModified = true; $this->objForm = $objParentObject->Form; } else { throw new QCallerException('ParentObject must be either a QForm or QControl object'); } } if (strlen($strControlId) == 0) { $this->strControlId = $this->objForm->GenerateControlId(); } else { // Verify ControlId is only AlphaNumeric Characters if (ctype_alnum($strControlId)) { $this->strControlId = $strControlId; } else { throw new QCallerException('ControlIDs must be only alphanumeric chacters: ' . $strControlId); } } try { $this->objForm->AddControl($this); if ($this->objParentControl) { $this->objParentControl->AddChildControl($this); } } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }