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.

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