protected function Form_Create() { parent::Form_Create(); // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroFileMetaControl constructor) // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctNarroFile = NarroFileMetaControl::CreateFromPathInfo($this); // Call MetaControl's methods to create qcontrols based on NarroFile's data fields $this->lblFileId = $this->mctNarroFile->lblFileId_Create(); $this->txtFileName = $this->mctNarroFile->txtFileName_Create(); $this->txtFilePath = $this->mctNarroFile->txtFilePath_Create(); $this->txtFileMd5 = $this->mctNarroFile->txtFileMd5_Create(); $this->lstParent = $this->mctNarroFile->lstParent_Create(); $this->lstType = $this->mctNarroFile->lstType_Create(); $this->lstProject = $this->mctNarroFile->lstProject_Create(); $this->chkActive = $this->mctNarroFile->chkActive_Create(); $this->calCreated = $this->mctNarroFile->calCreated_Create(); $this->calModified = $this->mctNarroFile->calModified_Create(); $this->txtHeader = $this->mctNarroFile->txtHeader_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('NarroFile')))); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->Visible = $this->mctNarroFile->EditMode; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this NarroFileMetaControl * @param QMetaControlCreateType $intCreateType rules governing NarroFile object creation - defaults to CreateOrEdit * @return NarroFileMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intFileId = QApplication::QueryString('intFileId'); return NarroFileMetaControl::Create($objParentObject, $intFileId, $intCreateType); }