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