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.

114 lines
4.8 KiB

  1. <?php
  2. /**
  3. * This is a quick-and-dirty draft QPanel object to do Create, Edit, and Delete functionality
  4. * of the ContentCategory class. It uses the code-generated
  5. * ContentCategoryMetaControl class, which has meta-methods to help with
  6. * easily creating/defining controls to modify the fields of a ContentCategory 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 content_category_edit.php AND
  13. * content_category_edit.tpl.php out of this Form Drafts directory.
  14. *
  15. * @package Quinta
  16. * @subpackage AdminUI
  17. */
  18. class ContentCategoryEditPanel extends QPanel {
  19. // Local instance of the ContentCategoryMetaControl
  20. protected $mctContentCategory;
  21. // Controls for ContentCategory's Data Fields
  22. public $lblId;
  23. public $txtName;
  24. public $txtTitle;
  25. public $txtDescription;
  26. public $txtImageUri;
  27. public $lstParentContentCategory;
  28. public $lstPublicPermissions;
  29. public $lstUserPermissions;
  30. public $lstGroupPermissions;
  31. // Other ListBoxes (if applicable) via Unique ReverseReferences and ManyToMany References
  32. public $lstContentItems;
  33. public $lstPages;
  34. // Other Controls
  35. public $btnSave;
  36. public $btnDelete;
  37. public $btnCancel;
  38. // Callback
  39. protected $strClosePanelMethod;
  40. public function __construct($objParentObject, $strClosePanelMethod, $intId = null, $strControlId = null) {
  41. // Call the Parent
  42. try {
  43. parent::__construct($objParentObject, $strControlId);
  44. } catch (QCallerException $objExc) {
  45. $objExc->IncrementOffset();
  46. throw $objExc;
  47. }
  48. // Setup Callback and Template
  49. $this->strTemplate = 'ContentCategoryEditPanel.tpl.php';
  50. $this->strClosePanelMethod = $strClosePanelMethod;
  51. // Construct the ContentCategoryMetaControl
  52. // MAKE SURE we specify "$this" as the MetaControl's (and thus all subsequent controls') parent
  53. $this->mctContentCategory = ContentCategoryMetaControl::Create($this, $intId);
  54. // Call MetaControl's methods to create qcontrols based on ContentCategory's data fields
  55. $this->lblId = $this->mctContentCategory->lblId_Create();
  56. $this->txtName = $this->mctContentCategory->txtName_Create();
  57. $this->txtTitle = $this->mctContentCategory->txtTitle_Create();
  58. $this->txtDescription = $this->mctContentCategory->txtDescription_Create();
  59. $this->txtImageUri = $this->mctContentCategory->txtImageUri_Create();
  60. $this->lstParentContentCategory = $this->mctContentCategory->lstParentContentCategory_Create();
  61. $this->lstPublicPermissions = $this->mctContentCategory->lstPublicPermissions_Create();
  62. $this->lstUserPermissions = $this->mctContentCategory->lstUserPermissions_Create();
  63. $this->lstGroupPermissions = $this->mctContentCategory->lstGroupPermissions_Create();
  64. $this->lstContentItems = $this->mctContentCategory->lstContentItems_Create();
  65. $this->lstPages = $this->mctContentCategory->lstPages_Create();
  66. // Create Buttons and Actions on this Form
  67. $this->btnSave = new QButton($this);
  68. $this->btnSave->Text = QApplication::Translate('Save');
  69. $this->btnSave->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnSave_Click'));
  70. $this->btnSave->CausesValidation = $this;
  71. $this->btnCancel = new QButton($this);
  72. $this->btnCancel->Text = QApplication::Translate('Cancel');
  73. $this->btnCancel->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCancel_Click'));
  74. $this->btnDelete = new QButton($this);
  75. $this->btnDelete->Text = QApplication::Translate('Delete');
  76. $this->btnDelete->AddAction(new QClickEvent(), new QConfirmAction(QApplication::Translate('Are you SURE you want to DELETE this') . ' ' . QApplication::Translate('ContentCategory') . '?'));
  77. $this->btnDelete->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnDelete_Click'));
  78. $this->btnDelete->Visible = $this->mctContentCategory->EditMode;
  79. }
  80. // Control AjaxAction Event Handlers
  81. public function btnSave_Click($strFormId, $strControlId, $strParameter) {
  82. // Delegate "Save" processing to the ContentCategoryMetaControl
  83. $this->mctContentCategory->SaveContentCategory();
  84. $this->CloseSelf(true);
  85. }
  86. public function btnDelete_Click($strFormId, $strControlId, $strParameter) {
  87. // Delegate "Delete" processing to the ContentCategoryMetaControl
  88. $this->mctContentCategory->DeleteContentCategory();
  89. $this->CloseSelf(true);
  90. }
  91. public function btnCancel_Click($strFormId, $strControlId, $strParameter) {
  92. $this->CloseSelf(false);
  93. }
  94. // Close Myself and Call ClosePanelMethod Callback
  95. protected function CloseSelf($blnChangesMade) {
  96. $strMethod = $this->strClosePanelMethod;
  97. $this->objForm->$strMethod($blnChangesMade);
  98. }
  99. }
  100. ?>