/** * Create and setup QListBox lstInventoryModel * @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 lstInventoryModel_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstInventoryModel = new QListBox($this->objParentObject, $strControlId); $this->lstInventoryModel->Name = QApplication::Translate('Inventory Model'); $this->lstInventoryModel->Required = true; if (!$this->blnEditMode) { $this->lstInventoryModel->AddItem(QApplication::Translate('- Select One -'), null); } // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objInventoryModelCursor = InventoryModel::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objInventoryModel = InventoryModel::InstantiateCursor($objInventoryModelCursor)) { $objListItem = new QListItem($objInventoryModel->__toString(), $objInventoryModel->InventoryModelId); if ($this->objInventoryModelCustomFieldHelper->InventoryModel && $this->objInventoryModelCustomFieldHelper->InventoryModel->InventoryModelId == $objInventoryModel->InventoryModelId) { $objListItem->Selected = true; } $this->lstInventoryModel->AddItem($objListItem); } // Return the QListBox return $this->lstInventoryModel; }