protected function Form_Create() { parent::Form_Create(); // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroContextMetaControl constructor) // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctNarroContext = NarroContextMetaControl::CreateFromPathInfo($this); // Call MetaControl's methods to create qcontrols based on NarroContext's data fields $this->lblContextId = $this->mctNarroContext->lblContextId_Create(); $this->lstText = $this->mctNarroContext->lstText_Create(); $this->txtTextAccessKey = $this->mctNarroContext->txtTextAccessKey_Create(); $this->txtTextCommandKey = $this->mctNarroContext->txtTextCommandKey_Create(); $this->lstProject = $this->mctNarroContext->lstProject_Create(); $this->txtContext = $this->mctNarroContext->txtContext_Create(); $this->txtContextMd5 = $this->mctNarroContext->txtContextMd5_Create(); $this->txtComment = $this->mctNarroContext->txtComment_Create(); $this->txtCommentMd5 = $this->mctNarroContext->txtCommentMd5_Create(); $this->lstFile = $this->mctNarroContext->lstFile_Create(); $this->calCreated = $this->mctNarroContext->calCreated_Create(); $this->calModified = $this->mctNarroContext->calModified_Create(); $this->chkActive = $this->mctNarroContext->chkActive_Create(); // Create Buttons and Actions on this Form $this->btnSave = new QButton($this); $this->btnSave->Text = QApplication::Translate('Save'); $this->btnSave->AddAction(new QClickEvent(), new QAjaxAction('btnSave_Click')); $this->btnSave->CausesValidation = true; $this->btnCancel = new QButton($this); $this->btnCancel->Text = QApplication::Translate('Cancel'); $this->btnCancel->AddAction(new QClickEvent(), new QAjaxAction('btnCancel_Click')); $this->btnDelete = new QButton($this); $this->btnDelete->Text = QApplication::Translate('Delete'); $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(sprintf(QApplication::Translate('Are you SURE you want to DELETE this %s?'), QApplication::Translate('NarroContext')))); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->Visible = $this->mctNarroContext->EditMode; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this NarroContextMetaControl * @param QMetaControlCreateType $intCreateType rules governing NarroContext object creation - defaults to CreateOrEdit * @return NarroContextMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intContextId = QApplication::QueryString('intContextId'); return NarroContextMetaControl::Create($objParentObject, $intContextId, $intCreateType); }