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.

102 lines
4.2 KiB

13 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 OrderStatusHistory class. It uses the code-generated
  5. * OrderStatusHistoryMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a OrderStatusHistory 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_status_history_edit.php AND
  13. * order_status_history_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quasi
  16. * @subpackage Drafts
  17. */
  18. class OrderStatusHistoryEditPanel extends QPanel {
  19. // Local instance of the OrderStatusHistoryMetaControl
  20. protected $mctOrderStatusHistory;
  21. // Controls for OrderStatusHistory's Data Fields
  22. public $lblId;
  23. public $lstOrder;
  24. public $lblDate;
  25. public $txtNotes;
  26. public $lstStatus;
  27. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  28. // Other Controls
  29. public $btnSave;
  30. public $btnDelete;
  31. public $btnCancel;
  32. // Callback
  33. protected $strClosePanelMethod;
  34. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  35. // Call the Parent
  36. try {
  37. parent::__construct($objParentObject, $strControlId);
  38. } catch (QCallerException $objExc) {
  39. $objExc->IncrementOffset();
  40. throw $objExc;
  41. }
  42. // Setup Callback and Template
  43. $this->strTemplate = 'OrderStatusHistoryEditPanel.tpl.php';
  44. $this->strClosePanelMethod = $strClosePanelMethod;
  45. // Construct the OrderStatusHistoryMetaControl
  46. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  47. $this->mctOrderStatusHistory = OrderStatusHistoryMetaControl::Create($this, $intId);
  48. // Call MetaControl's methods to create qcontrols based on OrderStatusHistory's data fields
  49. $this->lblId = $this->mctOrderStatusHistory->lblId_Create();
  50. $this->lstOrder = $this->mctOrderStatusHistory->lstOrder_Create();
  51. $this->lblDate = $this->mctOrderStatusHistory->lblDate_Create();
  52. $this->txtNotes = $this->mctOrderStatusHistory->txtNotes_Create();
  53. $this->lstStatus = $this->mctOrderStatusHistory->lstStatus_Create();
  54. // Create Buttons and Actions on this Form
  55. $this->btnSave = new QButton($this);
  56. $this->btnSave->Text = QApplication::Translate('Save');
  57. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  58. $this->btnSave->CausesValidation = $this;
  59. $this->btnCancel = new QButton($this);
  60. $this->btnCancel->Text = QApplication::Translate('Cancel');
  61. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  62. $this->btnDelete = new QButton($this);
  63. $this->btnDelete->Text = QApplication::Translate('Delete');
  64. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('OrderStatusHistory') . '?'));
  65. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  66. $this->btnDelete->Visible = $this->mctOrderStatusHistory->EditMode;
  67. }
  68. // Control AjaxAction Event Handlers
  69. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  70. // Delegate "Save" processing to the OrderStatusHistoryMetaControl
  71. $this->mctOrderStatusHistory->SaveOrderStatusHistory();
  72. $this->CloseSelf(true);
  73. }
  74. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  75. // Delegate "Delete" processing to the OrderStatusHistoryMetaControl
  76. $this->mctOrderStatusHistory->DeleteOrderStatusHistory();
  77. $this->CloseSelf(true);
  78. }
  79. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  80. $this->CloseSelf(false);
  81. }
  82. // Close Myself and Call ClosePanelMethod Callback
  83. protected function CloseSelf($blnChangesMade) {
  84. $strMethod = $this->strClosePanelMethod;
  85. $this->objForm->$strMethod($blnChangesMade);
  86. }
  87. }
  88. ?>