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