protected function Form_Create() { parent::Form_Create(); // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroLanguageMetaControl constructor) // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctNarroLanguage = NarroLanguageMetaControl::CreateFromPathInfo($this); // Call MetaControl's methods to create qcontrols based on NarroLanguage's data fields $this->lblLanguageId = $this->mctNarroLanguage->lblLanguageId_Create(); $this->txtLanguageName = $this->mctNarroLanguage->txtLanguageName_Create(); $this->txtLanguageCode = $this->mctNarroLanguage->txtLanguageCode_Create(); $this->txtCountryCode = $this->mctNarroLanguage->txtCountryCode_Create(); $this->txtDialectCode = $this->mctNarroLanguage->txtDialectCode_Create(); $this->txtEncoding = $this->mctNarroLanguage->txtEncoding_Create(); $this->txtTextDirection = $this->mctNarroLanguage->txtTextDirection_Create(); $this->txtSpecialCharacters = $this->mctNarroLanguage->txtSpecialCharacters_Create(); $this->txtPluralForm = $this->mctNarroLanguage->txtPluralForm_Create(); $this->chkActive = $this->mctNarroLanguage->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('NarroLanguage')))); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->Visible = $this->mctNarroLanguage->EditMode; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this NarroLanguageMetaControl * @param QMetaControlCreateType $intCreateType rules governing NarroLanguage object creation - defaults to CreateOrEdit * @return NarroLanguageMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intLanguageId = QApplication::QueryString('intLanguageId'); return NarroLanguageMetaControl::Create($objParentObject, $intLanguageId, $intCreateType); }