protected function Form_Create() { parent::Form_Create(); // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroTextCommentMetaControl constructor) // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctNarroTextComment = NarroTextCommentMetaControl::CreateFromPathInfo($this); // Call MetaControl's methods to create qcontrols based on NarroTextComment's data fields $this->lblTextCommentId = $this->mctNarroTextComment->lblTextCommentId_Create(); $this->lstText = $this->mctNarroTextComment->lstText_Create(); $this->lstUser = $this->mctNarroTextComment->lstUser_Create(); $this->lstLanguage = $this->mctNarroTextComment->lstLanguage_Create(); $this->calCreated = $this->mctNarroTextComment->calCreated_Create(); $this->calModified = $this->mctNarroTextComment->calModified_Create(); $this->txtCommentText = $this->mctNarroTextComment->txtCommentText_Create(); $this->txtCommentTextMd5 = $this->mctNarroTextComment->txtCommentTextMd5_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('NarroTextComment')))); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->Visible = $this->mctNarroTextComment->EditMode; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this NarroTextCommentMetaControl * @param QMetaControlCreateType $intCreateType rules governing NarroTextComment object creation - defaults to CreateOrEdit * @return NarroTextCommentMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intTextCommentId = QApplication::QueryString('intTextCommentId'); return NarroTextCommentMetaControl::Create($objParentObject, $intTextCommentId, $intCreateType); }