public function __construct(QForm $objForm, $strGroupingId) { if (strlen($strGroupingId) == 0) $this->strGroupingId = $objForm->GenerateControlId(); else { // Verify ControlId is only AlphaNumeric Characters $strMatches = array(); $strPattern = '/[A-Za-z0-9]*/'; preg_match($strPattern, $strGroupingId, $strMatches); if (count($strMatches) && ($strMatches[0] == $strGroupingId)) $this->strGroupingId = $strGroupingId; else throw new QCallerException('GroupingIDs must be only alphanumeric chacters: ' . $strGroupingId); } try { $objForm->AddGrouping($this); } catch (QCallerException $objExc) { $objExc->IncrementOffset(); throw $objExc; } }
/** * 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; } }