Exemplo n.º 1
0
 protected function Form_Create()
 {
     parent::Form_Create();
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the NarroTextMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctNarroText = NarroTextMetaControl::CreateFromPathInfo($this);
     // Call MetaControl's methods to create qcontrols based on NarroText's data fields
     $this->lblTextId = $this->mctNarroText->lblTextId_Create();
     $this->txtTextValue = $this->mctNarroText->txtTextValue_Create();
     $this->txtTextValueMd5 = $this->mctNarroText->txtTextValueMd5_Create();
     $this->txtTextCharCount = $this->mctNarroText->txtTextCharCount_Create();
     $this->txtTextWordCount = $this->mctNarroText->txtTextWordCount_Create();
     $this->chkHasComments = $this->mctNarroText->chkHasComments_Create();
     $this->calCreated = $this->mctNarroText->calCreated_Create();
     $this->calModified = $this->mctNarroText->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('NarroText'))));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctNarroText->EditMode;
 }
 /**
  * Static Helper Method to Create using QueryString arguments
  *
  * @param mixed $objParentObject QForm or QPanel which will be using this NarroTextMetaControl
  * @param QMetaControlCreateType $intCreateType rules governing NarroText object creation - defaults to CreateOrEdit
  * @return NarroTextMetaControl
  */
 public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     $intTextId = QApplication::QueryString('intTextId');
     return NarroTextMetaControl::Create($objParentObject, $intTextId, $intCreateType);
 }