A QCodo powered CMS
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.

130 lines
5.3 KiB

  1. <?php
  2. /**
  3. * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
  4. * of the OrderAddress class. It uses the code-generated
  5. * OrderAddressMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a OrderAddress 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 order_address_edit.php AND
  13. * order_address_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quinta CMS
  16. * @subpackage AdminUI
  17. */
  18. class OrderAddressEditPanel extends QPanel {
  19. // Local instance of the OrderAddressMetaControl
  20. protected $mctOrderAddress;
  21. // Controls for OrderAddress's Data Fields
  22. public $lblId;
  23. public $lstOrder;
  24. public $txtNamePrefix;
  25. public $txtFirstName;
  26. public $txtMiddleName;
  27. public $txtLastName;
  28. public $txtNameSuffix;
  29. public $txtCompany;
  30. public $txtStreet1;
  31. public $txtStreet2;
  32. public $txtSuburb;
  33. public $txtCity;
  34. public $txtCounty;
  35. public $lstZone;
  36. public $lstCountry;
  37. public $txtPostalCode;
  38. public $lstType;
  39. public $lblCreationDate;
  40. public $lblLastModification;
  41. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  42. // Other Controls
  43. public $btnSave;
  44. public $btnDelete;
  45. public $btnCancel;
  46. // Callback
  47. protected $strClosePanelMethod;
  48. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  49. // Call the Parent
  50. try {
  51. parent::__construct($objParentObject, $strControlId);
  52. } catch (QCallerException $objExc) {
  53. $objExc->IncrementOffset();
  54. throw $objExc;
  55. }
  56. // Setup Callback and Template
  57. $this->strTemplate = 'OrderAddressEditPanel.tpl.php';
  58. $this->strClosePanelMethod = $strClosePanelMethod;
  59. // Construct the OrderAddressMetaControl
  60. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  61. $this->mctOrderAddress = OrderAddressMetaControl::Create($this, $intId);
  62. // Call MetaControl's methods to create qcontrols based on OrderAddress's data fields
  63. $this->lblId = $this->mctOrderAddress->lblId_Create();
  64. $this->lstOrder = $this->mctOrderAddress->lstOrder_Create();
  65. $this->txtNamePrefix = $this->mctOrderAddress->txtNamePrefix_Create();
  66. $this->txtFirstName = $this->mctOrderAddress->txtFirstName_Create();
  67. $this->txtMiddleName = $this->mctOrderAddress->txtMiddleName_Create();
  68. $this->txtLastName = $this->mctOrderAddress->txtLastName_Create();
  69. $this->txtNameSuffix = $this->mctOrderAddress->txtNameSuffix_Create();
  70. $this->txtCompany = $this->mctOrderAddress->txtCompany_Create();
  71. $this->txtStreet1 = $this->mctOrderAddress->txtStreet1_Create();
  72. $this->txtStreet2 = $this->mctOrderAddress->txtStreet2_Create();
  73. $this->txtSuburb = $this->mctOrderAddress->txtSuburb_Create();
  74. $this->txtCity = $this->mctOrderAddress->txtCity_Create();
  75. $this->txtCounty = $this->mctOrderAddress->txtCounty_Create();
  76. $this->lstZone = $this->mctOrderAddress->lstZone_Create();
  77. $this->lstCountry = $this->mctOrderAddress->lstCountry_Create();
  78. $this->txtPostalCode = $this->mctOrderAddress->txtPostalCode_Create();
  79. $this->lstType = $this->mctOrderAddress->lstType_Create();
  80. $this->lblCreationDate = $this->mctOrderAddress->lblCreationDate_Create();
  81. $this->lblLastModification = $this->mctOrderAddress->lblLastModification_Create();
  82. // Create Buttons and Actions on this Form
  83. $this->btnSave = new QButton($this);
  84. $this->btnSave->Text = QApplication::Translate('Save');
  85. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  86. $this->btnSave->CausesValidation = $this;
  87. $this->btnCancel = new QButton($this);
  88. $this->btnCancel->Text = QApplication::Translate('Cancel');
  89. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  90. $this->btnDelete = new QButton($this);
  91. $this->btnDelete->Text = QApplication::Translate('Delete');
  92. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('OrderAddress') . '?'));
  93. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  94. $this->btnDelete->Visible = $this->mctOrderAddress->EditMode;
  95. }
  96. // Control AjaxAction Event Handlers
  97. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  98. // Delegate "Save" processing to the OrderAddressMetaControl
  99. $this->mctOrderAddress->SaveOrderAddress();
  100. $this->CloseSelf(true);
  101. }
  102. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  103. // Delegate "Delete" processing to the OrderAddressMetaControl
  104. $this->mctOrderAddress->DeleteOrderAddress();
  105. $this->CloseSelf(true);
  106. }
  107. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  108. $this->CloseSelf(false);
  109. }
  110. // Close Myself and Call ClosePanelMethod Callback
  111. protected function CloseSelf($blnChangesMade) {
  112. $strMethod = $this->strClosePanelMethod;
  113. $this->objForm->$strMethod($blnChangesMade);
  114. }
  115. }
  116. ?>