1: <?php
2: 3: 4: 5: 6:
7:
8: 9: 10: 11: 12: 13:
14: abstract class QControlGrouping extends QBaseClass {
15: protected $strGroupingId;
16: protected $objControlArray = array();
17: protected $blnModified = false;
18:
19: public function __construct(QForm $objForm, $strGroupingId) {
20: if (strlen($strGroupingId) == 0)
21: $this->strGroupingId = $objForm->GenerateControlId();
22: else {
23:
24: $strMatches = array();
25: $strPattern = '/[A-Za-z0-9]*/';
26: preg_match($strPattern, $strGroupingId, $strMatches);
27: if (count($strMatches) && ($strMatches[0] == $strGroupingId))
28: $this->strGroupingId = $strGroupingId;
29: else
30: throw new QCallerException('GroupingIDs must be only alphanumeric chacters: ' . $strGroupingId);
31: }
32: try {
33: $objForm->AddGrouping($this);
34: } catch (QCallerException $objExc) {
35: $objExc->IncrementOffset();
36: throw $objExc;
37: }
38: }
39:
40: public function __get($strName) {
41: switch ($strName) {
42: case "GroupingId": return $this->strGroupingId;
43: case "Modified": return $this->blnModified;
44:
45: default:
46: try {
47: return parent::__get($strName);
48: } catch (QCallerException $objExc) {
49: $objExc->IncrementOffset();
50: throw $objExc;
51: }
52: }
53: }
54:
55: public function AddControl(QControl $objControl) {
56: $this->blnModified = true;
57: $strControlId = $objControl->ControlId;
58: $this->objControlArray[$strControlId] = $objControl;
59: }
60:
61: public function RemoveControl($strControlId) {
62: $this->blnModified = true;
63: if (array_key_exists($strControlId, $this->objControlArray)) {
64:
65: unset($this->objControlArray[$strControlId]);
66: }
67: }
68:
69: public function GetAllControls() {
70: return $this->objControlArray;
71: }
72:
73: abstract public function Render();
74: }