/** * Create and setup QListBox lstPackageCategory * @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 lstPackageCategory_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstPackageCategory = new QListBox($this->objParentObject, $strControlId); $this->lstPackageCategory->Name = QApplication::Translate('Package Category'); $this->lstPackageCategory->Required = true; if (!$this->blnEditMode) { $this->lstPackageCategory->AddItem(QApplication::Translate('- Select One -'), null); } // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objPackageCategoryCursor = PackageCategory::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objPackageCategory = PackageCategory::InstantiateCursor($objPackageCategoryCursor)) { $objListItem = new QListItem($objPackageCategory->__toString(), $objPackageCategory->Id); if ($this->objPackage->PackageCategory && $this->objPackage->PackageCategory->Id == $objPackageCategory->Id) { $objListItem->Selected = true; } $this->lstPackageCategory->AddItem($objListItem); } // Return the QListBox return $this->lstPackageCategory; }