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.

124 lines
5.3 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 PaypalTransaction class. It uses the code-generated
  5. * PaypalTransactionMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a PaypalTransaction 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 paypal_transaction_edit.php AND
  13. * paypal_transaction_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quasi
  16. * @subpackage Drafts
  17. */
  18. class PaypalTransactionEditPanel extends QPanel {
  19. // Local instance of the PaypalTransactionMetaControl
  20. protected $mctPaypalTransaction;
  21. // Controls for PaypalTransaction's Data Fields
  22. public $lblId;
  23. public $lstOrder;
  24. public $txtCorrelationId;
  25. public $txtTransactionId;
  26. public $txtPpToken;
  27. public $txtPayerId;
  28. public $txtPayerStatus;
  29. public $txtPaymentStatus;
  30. public $txtAckReturned;
  31. public $txtApiAction;
  32. public $calTimeStamp;
  33. public $txtApiVersion;
  34. public $txtMessages;
  35. public $txtAmount;
  36. public $txtPpFee;
  37. public $lstPaymentMethod;
  38. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  39. // Other Controls
  40. public $btnSave;
  41. public $btnDelete;
  42. public $btnCancel;
  43. // Callback
  44. protected $strClosePanelMethod;
  45. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  46. // Call the Parent
  47. try {
  48. parent::__construct($objParentObject, $strControlId);
  49. } catch (QCallerException $objExc) {
  50. $objExc->IncrementOffset();
  51. throw $objExc;
  52. }
  53. // Setup Callback and Template
  54. $this->strTemplate = 'PaypalTransactionEditPanel.tpl.php';
  55. $this->strClosePanelMethod = $strClosePanelMethod;
  56. // Construct the PaypalTransactionMetaControl
  57. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  58. $this->mctPaypalTransaction = PaypalTransactionMetaControl::Create($this, $intId);
  59. // Call MetaControl's methods to create qcontrols based on PaypalTransaction's data fields
  60. $this->lblId = $this->mctPaypalTransaction->lblId_Create();
  61. $this->lstOrder = $this->mctPaypalTransaction->lstOrder_Create();
  62. $this->txtCorrelationId = $this->mctPaypalTransaction->txtCorrelationId_Create();
  63. $this->txtTransactionId = $this->mctPaypalTransaction->txtTransactionId_Create();
  64. $this->txtPpToken = $this->mctPaypalTransaction->txtPpToken_Create();
  65. $this->txtPayerId = $this->mctPaypalTransaction->txtPayerId_Create();
  66. $this->txtPayerStatus = $this->mctPaypalTransaction->txtPayerStatus_Create();
  67. $this->txtPaymentStatus = $this->mctPaypalTransaction->txtPaymentStatus_Create();
  68. $this->txtAckReturned = $this->mctPaypalTransaction->txtAckReturned_Create();
  69. $this->txtApiAction = $this->mctPaypalTransaction->txtApiAction_Create();
  70. $this->calTimeStamp = $this->mctPaypalTransaction->calTimeStamp_Create();
  71. $this->txtApiVersion = $this->mctPaypalTransaction->txtApiVersion_Create();
  72. $this->txtMessages = $this->mctPaypalTransaction->txtMessages_Create();
  73. $this->txtAmount = $this->mctPaypalTransaction->txtAmount_Create();
  74. $this->txtPpFee = $this->mctPaypalTransaction->txtPpFee_Create();
  75. $this->lstPaymentMethod = $this->mctPaypalTransaction->lstPaymentMethod_Create();
  76. // Create Buttons and Actions on this Form
  77. $this->btnSave = new QButton($this);
  78. $this->btnSave->Text = QApplication::Translate('Save');
  79. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  80. $this->btnSave->CausesValidation = $this;
  81. $this->btnCancel = new QButton($this);
  82. $this->btnCancel->Text = QApplication::Translate('Cancel');
  83. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  84. $this->btnDelete = new QButton($this);
  85. $this->btnDelete->Text = QApplication::Translate('Delete');
  86. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('PaypalTransaction') . '?'));
  87. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  88. $this->btnDelete->Visible = $this->mctPaypalTransaction->EditMode;
  89. }
  90. // Control AjaxAction Event Handlers
  91. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  92. // Delegate "Save" processing to the PaypalTransactionMetaControl
  93. $this->mctPaypalTransaction->SavePaypalTransaction();
  94. $this->CloseSelf(true);
  95. }
  96. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  97. // Delegate "Delete" processing to the PaypalTransactionMetaControl
  98. $this->mctPaypalTransaction->DeletePaypalTransaction();
  99. $this->CloseSelf(true);
  100. }
  101. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  102. $this->CloseSelf(false);
  103. }
  104. // Close Myself and Call ClosePanelMethod Callback
  105. protected function CloseSelf($blnChangesMade) {
  106. $strMethod = $this->strClosePanelMethod;
  107. $this->objForm->$strMethod($blnChangesMade);
  108. }
  109. }
  110. ?>