protected function Form_Create() { parent::Form_Create(); // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroProjectMetaControl constructor) // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent $this->mctNarroProject = NarroProjectMetaControl::CreateFromPathInfo($this); // Call MetaControl's methods to create qcontrols based on NarroProject's data fields $this->lblProjectId = $this->mctNarroProject->lblProjectId_Create(); $this->lstProjectCategory = $this->mctNarroProject->lstProjectCategory_Create(); $this->txtProjectName = $this->mctNarroProject->txtProjectName_Create(); $this->lstProjectTypeObject = $this->mctNarroProject->lstProjectTypeObject_Create(); $this->txtProjectDescription = $this->mctNarroProject->txtProjectDescription_Create(); $this->txtData = $this->mctNarroProject->txtData_Create(); $this->txtActive = $this->mctNarroProject->txtActive_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('NarroProject')))); $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click')); $this->btnDelete->Visible = $this->mctNarroProject->EditMode; }
/** * Static Helper Method to Create using QueryString arguments * * @param mixed $objParentObject QForm or QPanel which will be using this NarroProjectMetaControl * @param QMetaControlCreateType $intCreateType rules governing NarroProject object creation - defaults to CreateOrEdit * @return NarroProjectMetaControl */ public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit) { $intProjectId = QApplication::QueryString('intProjectId'); return NarroProjectMetaControl::Create($objParentObject, $intProjectId, $intCreateType); }