protected function Form_Create() { parent::Form_Create(); // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroSuggestionMetaControl constructor) // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctNarroSuggestion = NarroSuggestionMetaControl::CreateFromPathInfo($this); // Call MetaControl's methods to create qcontrols based on NarroSuggestion's data fields $this->lblSuggestionId = $this->mctNarroSuggestion->lblSuggestionId_Create(); $this->lstUser = $this->mctNarroSuggestion->lstUser_Create(); $this->lstText = $this->mctNarroSuggestion->lstText_Create(); $this->lstLanguage = $this->mctNarroSuggestion->lstLanguage_Create(); $this->txtSuggestionValue = $this->mctNarroSuggestion->txtSuggestionValue_Create(); $this->txtSuggestionValueMd5 = $this->mctNarroSuggestion->txtSuggestionValueMd5_Create(); $this->txtSuggestionCharCount = $this->mctNarroSuggestion->txtSuggestionCharCount_Create(); $this->txtSuggestionWordCount = $this->mctNarroSuggestion->txtSuggestionWordCount_Create(); $this->chkHasComments = $this->mctNarroSuggestion->chkHasComments_Create(); $this->chkIsImported = $this->mctNarroSuggestion->chkIsImported_Create(); $this->calCreated = $this->mctNarroSuggestion->calCreated_Create(); $this->calModified = $this->mctNarroSuggestion->calModified_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('NarroSuggestion')))); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->Visible = $this->mctNarroSuggestion->EditMode; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this NarroSuggestionMetaControl * @param QMetaControlCreateType $intCreateType rules governing NarroSuggestion object creation - defaults to CreateOrEdit * @return NarroSuggestionMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intSuggestionId = QApplication::QueryString('intSuggestionId'); return NarroSuggestionMetaControl::Create($objParentObject, $intSuggestionId, $intCreateType); }