public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null)
 {
     // Call the Parent
     try {
         parent::__construct($objParentObject, $strControlId);
     } catch (QCallerException $objExc) {
         $objExc->IncrementOffset();
         throw $objExc;
     }
     // Setup Callback and Template
     $this->strTemplate = __DOCROOT__ . __PANEL_DRAFTS__ . '/CategoryEditPanel.tpl.php';
     $this->strClosePanelMethod = $strClosePanelMethod;
     // Construct the CategoryMetaControl
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctCategory = CategoryMetaControl::Create($this, $intId);
     // Call MetaControl's methods to create qcontrols based on Category's data fields
     $this->lblId = $this->mctCategory->lblId_Create();
     $this->txtParentId = $this->mctCategory->txtParentId_Create();
     $this->txtName = $this->mctCategory->txtName_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 QAjaxControlAction($this, 'btnSave_Click'));
     $this->btnSave->CausesValidation = $this;
     $this->btnCancel = new QButton($this);
     $this->btnCancel->Text = QApplication::Translate('Cancel');
     $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
     $this->btnDelete = new QButton($this);
     $this->btnDelete->Text = QApplication::Translate('Delete');
     $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('Category') . '?'));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctCategory->EditMode;
 }
예제 #2
0
 protected function Form_Create()
 {
     // Use the CreateFromPathInfo shortcut (this can also be done manually using the CategoryMetaControl constructor)
     // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
     $this->mctCategory = CategoryMetaControl::CreateFromPathInfo($this);
     // Call MetaControl's methods to create qcontrols based on Category's data fields
     $this->lblId = $this->mctCategory->lblId_Create();
     $this->txtParentId = $this->mctCategory->txtParentId_Create();
     $this->txtName = $this->mctCategory->txtName_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(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('Category') . '?'));
     $this->btnDelete->AddAction(new QClickEvent(), new QAjaxAction('btnDelete_Click'));
     $this->btnDelete->Visible = $this->mctCategory->EditMode;
 }
 /**
  * Static Helper Method to Create using QueryString arguments
  *
  * @param mixed $objParentObject QForm or QPanel which will be using this CategoryMetaControl
  * @param QMetaControlCreateType $intCreateType rules governing Category object creation - defaults to CreateOrEdit
  * @return CategoryMetaControl
  */
 public static function CreateFromQueryString($objParentObject, $intCreateType = QMetaControlCreateType::CreateOrEdit)
 {
     $intCategoryId = QApplication::QueryString('intCategoryId');
     return CategoryMetaControl::Create($objParentObject, $intCategoryId, $intCreateType);
 }