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.1 KiB

13 years ago
  1. <?php
  2. /**
  3. * This is the abstract Panel class for the List All functionality
  4. * of the MenuItem class. This code-generated class
  5. * contains a datagrid to display an HTML page that can
  6. * list a collection of MenuItem objects. It includes
  7. * functionality to perform pagination and sorting on columns.
  8. *
  9. * To take advantage of some (or all) of these control objects, you
  10. * must create a new QPanel which extends this MenuItemListPanelBase
  11. * class.
  12. *
  13. * Any and all changes to this file will be overwritten with any subsequent re-
  14. * code generation.
  15. *
  16. * @package Quasi
  17. * @subpackage Drafts
  18. *
  19. */
  20. class MenuItemListPanel extends QPanel {
  21. // Local instance of the Meta DataGrid to list MenuItems
  22. public $dtgMenuItems;
  23. // Other public QControls in this panel
  24. public $btnCreateNew;
  25. public $pxyEdit;
  26. // Callback Method Names
  27. protected $strSetEditPanelMethod;
  28. protected $strCloseEditPanelMethod;
  29. public function __construct($objParentObject, $strSetEditPanelMethod, $strCloseEditPanelMethod, $strControlId = null) {
  30. // Call the Parent
  31. try {
  32. parent::__construct($objParentObject, $strControlId);
  33. } catch (QCallerException $objExc) {
  34. $objExc->IncrementOffset();
  35. throw $objExc;
  36. }
  37. // Record Method Callbacks
  38. $this->strSetEditPanelMethod = $strSetEditPanelMethod;
  39. $this->strCloseEditPanelMethod = $strCloseEditPanelMethod;
  40. // Setup the Template
  41. $this->Template = 'MenuItemListPanel.tpl.php';
  42. // Instantiate the Meta DataGrid
  43. $this->dtgMenuItems = new MenuItemDataGrid($this);
  44. // Style the DataGrid (if desired)
  45. $this->dtgMenuItems->CssClass = 'datagrid';
  46. $this->dtgMenuItems->AlternateRowStyle->CssClass = 'alternate';
  47. // Add Pagination (if desired)
  48. $this->dtgMenuItems->Paginator = new QPaginator($this->dtgMenuItems);
  49. $this->dtgMenuItems->ItemsPerPage = 8;
  50. // Use the MetaDataGrid functionality to add Columns for this datagrid
  51. // Create an Edit Column
  52. $this->pxyEdit = new QControlProxy($this);
  53. $this->pxyEdit->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'pxyEdit_Click'));
  54. $this->dtgMenuItems->MetaAddEditProxyColumn($this->pxyEdit, 'Edit', 'Edit');
  55. // Create the Other Columns (note that you can use strings for menu_item's properties, or you
  56. // can traverse down QQN::menu_item() to display fields that are down the hierarchy)
  57. $this->dtgMenuItems->MetaAddColumn('Id');
  58. $this->dtgMenuItems->MetaAddColumn('Name');
  59. $this->dtgMenuItems->MetaAddColumn('CssClass');
  60. $this->dtgMenuItems->MetaAddColumn('Label');
  61. $this->dtgMenuItems->MetaAddColumn('Uri');
  62. $this->dtgMenuItems->MetaAddColumn('IsLocal');
  63. $this->dtgMenuItems->MetaAddColumn('IsSsl');
  64. $this->dtgMenuItems->MetaAddColumn('SortOrder');
  65. $this->dtgMenuItems->MetaAddTypeColumn('PublicPermissionsId', 'PermissionType');
  66. $this->dtgMenuItems->MetaAddTypeColumn('UserPermissionsId', 'PermissionType');
  67. $this->dtgMenuItems->MetaAddTypeColumn('GroupPermissionsId', 'PermissionType');
  68. $this->dtgMenuItems->MetaAddTypeColumn('StatusId', 'MenuStatusType');
  69. $this->dtgMenuItems->MetaAddTypeColumn('TypeId', 'MenuItemType');
  70. $this->dtgMenuItems->MetaAddColumn(QQN::MenuItem()->Page);
  71. // Setup the Create New button
  72. $this->btnCreateNew = new QButton($this);
  73. $this->btnCreateNew->Text = QApplication::Translate('Create a New') . ' ' . QApplication::Translate('MenuItem');
  74. $this->btnCreateNew->AddAction(new QClickEvent(), new QAjaxControlAction($this, 'btnCreateNew_Click'));
  75. }
  76. public function pxyEdit_Click($strFormId, $strControlId, $strParameter) {
  77. $strParameterArray = explode(',', $strParameter);
  78. $objEditPanel = new MenuItemEditPanel($this, $this->strCloseEditPanelMethod, $strParameterArray[0]);
  79. $strMethodName = $this->strSetEditPanelMethod;
  80. $this->objForm->$strMethodName($objEditPanel);
  81. }
  82. public function btnCreateNew_Click($strFormId, $strControlId, $strParameter) {
  83. $objEditPanel = new MenuItemEditPanel($this, $this->strCloseEditPanelMethod, null);
  84. $strMethodName = $this->strSetEditPanelMethod;
  85. $this->objForm->$strMethodName($objEditPanel);
  86. }
  87. }
  88. ?>