A Qcodo based CMS/ecommerce framework
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

118 lines
4.9 KiB

12 years ago
  1. <?php
  2. /**
  3. * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
  4. * of the PaymentMethod class. It uses the code-generated
  5. * PaymentMethodMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a PaymentMethod columns.
  7. *
  8. * Any display customizations and presentation-tier logic can be implemented
  9. * here by overriding existing or implementing new methods, properties and variables.
  10. *
  11. * NOTE: This file is overwritten on any code regenerations. If you want to make
  12. * permanent changes, it is STRONGLY RECOMMENDED to move both payment_method_edit.php AND
  13. * payment_method_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quasi
  16. * @subpackage Drafts
  17. */
  18. class PaymentMethodEditPanel extends QPanel {
  19. // Local instance of the PaymentMethodMetaControl
  20. protected $mctPaymentMethod;
  21. // Controls for PaymentMethod's Data Fields
  22. public $lblId;
  23. public $txtTitle;
  24. public $txtServiceProvider;
  25. public $txtServiceType;
  26. public $txtActionClassName;
  27. public $txtDescription;
  28. public $txtImageUri;
  29. public $chkActive;
  30. public $chkRequiresCcNumber;
  31. public $chkSaveCcNumber;
  32. public $chkTestMode;
  33. public $txtSortOrder;
  34. public $lstPaymentType;
  35. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  36. // Other Controls
  37. public $btnSave;
  38. public $btnDelete;
  39. public $btnCancel;
  40. // Callback
  41. protected $strClosePanelMethod;
  42. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  43. // Call the Parent
  44. try {
  45. parent::__construct($objParentObject, $strControlId);
  46. } catch (QCallerException $objExc) {
  47. $objExc->IncrementOffset();
  48. throw $objExc;
  49. }
  50. // Setup Callback and Template
  51. $this->strTemplate = 'PaymentMethodEditPanel.tpl.php';
  52. $this->strClosePanelMethod = $strClosePanelMethod;
  53. // Construct the PaymentMethodMetaControl
  54. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  55. $this->mctPaymentMethod = PaymentMethodMetaControl::Create($this, $intId);
  56. // Call MetaControl's methods to create qcontrols based on PaymentMethod's data fields
  57. $this->lblId = $this->mctPaymentMethod->lblId_Create();
  58. $this->txtTitle = $this->mctPaymentMethod->txtTitle_Create();
  59. $this->txtServiceProvider = $this->mctPaymentMethod->txtServiceProvider_Create();
  60. $this->txtServiceType = $this->mctPaymentMethod->txtServiceType_Create();
  61. $this->txtActionClassName = $this->mctPaymentMethod->txtActionClassName_Create();
  62. $this->txtDescription = $this->mctPaymentMethod->txtDescription_Create();
  63. $this->txtImageUri = $this->mctPaymentMethod->txtImageUri_Create();
  64. $this->chkActive = $this->mctPaymentMethod->chkActive_Create();
  65. $this->chkRequiresCcNumber = $this->mctPaymentMethod->chkRequiresCcNumber_Create();
  66. $this->chkSaveCcNumber = $this->mctPaymentMethod->chkSaveCcNumber_Create();
  67. $this->chkTestMode = $this->mctPaymentMethod->chkTestMode_Create();
  68. $this->txtSortOrder = $this->mctPaymentMethod->txtSortOrder_Create();
  69. $this->lstPaymentType = $this->mctPaymentMethod->lstPaymentType_Create();
  70. // Create Buttons and Actions on this Form
  71. $this->btnSave = new QButton($this);
  72. $this->btnSave->Text = QApplication::Translate('Save');
  73. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  74. $this->btnSave->CausesValidation = $this;
  75. $this->btnCancel = new QButton($this);
  76. $this->btnCancel->Text = QApplication::Translate('Cancel');
  77. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  78. $this->btnDelete = new QButton($this);
  79. $this->btnDelete->Text = QApplication::Translate('Delete');
  80. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('PaymentMethod') . '?'));
  81. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  82. $this->btnDelete->Visible = $this->mctPaymentMethod->EditMode;
  83. }
  84. // Control AjaxAction Event Handlers
  85. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  86. // Delegate "Save" processing to the PaymentMethodMetaControl
  87. $this->mctPaymentMethod->SavePaymentMethod();
  88. $this->CloseSelf(true);
  89. }
  90. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  91. // Delegate "Delete" processing to the PaymentMethodMetaControl
  92. $this->mctPaymentMethod->DeletePaymentMethod();
  93. $this->CloseSelf(true);
  94. }
  95. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  96. $this->CloseSelf(false);
  97. }
  98. // Close Myself and Call ClosePanelMethod Callback
  99. protected function CloseSelf($blnChangesMade) {
  100. $strMethod = $this->strClosePanelMethod;
  101. $this->objForm->$strMethod($blnChangesMade);
  102. }
  103. }
  104. ?>