/** * Create and setup QListBox lstGrowthGroups * @param string $strControlId optional ControlId to use * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return QListBox */ public function lstGrowthGroups_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstGrowthGroups = new QListBox($this->objParentObject, $strControlId); $this->lstGrowthGroups->Name = QApplication::Translate('Growth Groups'); $this->lstGrowthGroups->SelectionMode = QSelectionMode::Multiple; // We need to know which items to "Pre-Select" $objAssociatedArray = $this->objGrowthGroupStructure->GetGrowthGroupArray(); // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objGrowthGroupCursor = GrowthGroup::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objGrowthGroup = GrowthGroup::InstantiateCursor($objGrowthGroupCursor)) { $objListItem = new QListItem($objGrowthGroup->__toString(), $objGrowthGroup->GroupId); foreach ($objAssociatedArray as $objAssociated) { if ($objAssociated->GroupId == $objGrowthGroup->GroupId) { $objListItem->Selected = true; } } $this->lstGrowthGroups->AddItem($objListItem); } // Return the QListControl return $this->lstGrowthGroups; }
/** * Create and setup QListBox lstGrowthGroup * @param string $strControlId optional ControlId to use * @param QQCondition $objConditions override the default condition of QQ::All() to the query, itself * @param QQClause[] $objOptionalClauses additional optional QQClause object or array of QQClause objects for the query * @return QListBox */ public function lstGrowthGroup_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstGrowthGroup = new QListBox($this->objParentObject, $strControlId); $this->lstGrowthGroup->Name = QApplication::Translate('Growth Group'); $this->lstGrowthGroup->AddItem(QApplication::Translate('- Select One -'), null); // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objGrowthGroupCursor = GrowthGroup::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objGrowthGroup = GrowthGroup::InstantiateCursor($objGrowthGroupCursor)) { $objListItem = new QListItem($objGrowthGroup->__toString(), $objGrowthGroup->GroupId); if ($objGrowthGroup->GroupId == $this->objGroup->Id) { $objListItem->Selected = true; } $this->lstGrowthGroup->AddItem($objListItem); } // Because GrowthGroup's GrowthGroup is not null, if a value is already selected, it cannot be changed. if ($this->lstGrowthGroup->SelectedValue) { $this->lstGrowthGroup->Enabled = false; } // Return the QListBox return $this->lstGrowthGroup; }