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