/** * Create and setup QListBox lstSuggestion * @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 lstSuggestion_Create($strControlId = null, QQCondition $objCondition = null, $objOptionalClauses = null) { $this->lstSuggestion = new QListBox($this->objParentObject, $strControlId); $this->lstSuggestion->Name = QApplication::Translate('Suggestion'); $this->lstSuggestion->Required = true; if (!$this->blnEditMode) { $this->lstSuggestion->AddItem(QApplication::Translate('- Select One -'), null); } // Setup and perform the Query if (is_null($objCondition)) { $objCondition = QQ::All(); } $objSuggestionCursor = NarroSuggestion::QueryCursor($objCondition, $objOptionalClauses); // Iterate through the Cursor while ($objSuggestion = NarroSuggestion::InstantiateCursor($objSuggestionCursor)) { $objListItem = new QListItem($objSuggestion->__toString(), $objSuggestion->SuggestionId); if ($this->objNarroSuggestionVote->Suggestion && $this->objNarroSuggestionVote->Suggestion->SuggestionId == $objSuggestion->SuggestionId) { $objListItem->Selected = true; } $this->lstSuggestion->AddItem($objListItem); } // Return the QListBox return $this->lstSuggestion; }