protected function ValidateControlAndChildren(QControl $objControl) { // Initially Assume Validation is True $blnToReturn = true; // Check the Control Itself if (!$objControl->Validate()) { $objControl->MarkAsModified(); $blnToReturn = false; } // Recursive call on Child Controls foreach ($objControl->GetChildControls() as $objChildControl) { // Only Enabled and Visible and Rendered controls should be validated if ($objChildControl->Visible && $objChildControl->Enabled && $objChildControl->RenderMethod && $objChildControl->OnPage) { if (!$this->ValidateControlAndChildren($objChildControl)) { $blnToReturn = false; } } } return $blnToReturn; }
/** * Add a QControl to the current QForm. * @param QControl|QControlBase $objControl * * @throws QCallerException */ public function AddControl(QControl $objControl) { $strControlId = $objControl->ControlId; $objControl->MarkAsModified(); // make sure new controls get drawn if (array_key_exists($strControlId, $this->objControlArray)) { throw new QCallerException(sprintf('A control already exists in the form with the ID: %s', $strControlId)); } if (array_key_exists($strControlId, $this->objGroupingArray)) { throw new QCallerException(sprintf('A Grouping already exists in the form with the ID: %s', $strControlId)); } $this->objControlArray[$strControlId] = $objControl; }