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.

169 lines
5.5 KiB

12 years ago
  1. <?php
  2. if(!defined('QUASICMS') ) die("No quasi.");
  3. if (!defined("LISTMODULEBASE.CLASS.PHP")){
  4. define("LISTMODULEBASE.CLASS.PHP",1);
  5. /**
  6. * Class ListModuleBase - List and Item view panel manager
  7. *@author Erik Winn <erikwinnmail@yahoo.com>
  8. *
  9. * This module provides the base class for modules that display list and item
  10. * views of objects. Based on the Dashboard, it provides two panels with callbacks
  11. * for switching between panels, one panel is for displaying lists and one is for
  12. * individual items which may have been selected from the list.
  13. *
  14. * The callback methods here only show or close the view panel - the list panel
  15. * is shown by default if there are no page parameters in the URL. When the
  16. * view panel is closed, the list panel is displayed after ensuring that it is populated
  17. * with a list.
  18. *
  19. * A reference to the Account object is also kept here to facilitate permissions
  20. * checking on display of items.
  21. *
  22. * . New List modules can be created by extending this class and populating
  23. * the relevant panels.
  24. *
  25. *
  26. * $Id: ListModuleBase.class.php 2 2008-07-31 18:55:50Z erikwinn $
  27. *@version 0.1
  28. *
  29. *@copyright (C) 2008 by Erik Winn
  30. *@license GPL v.2
  31. This program is free software; you can redistribute it and/or modify
  32. it under the terms of the GNU General Public License as published by
  33. the Free Software Foundation; either version 2 of the License, or
  34. (at your option) any later version.
  35. *
  36. This program is distributed in the hope that it will be useful,
  37. but WITHOUT ANY WARRANTY; without even the implied warranty of
  38. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  39. GNU General Public License for more details.
  40. You should have received a copy of the GNU General Public License
  41. along with this program; if not, write to the Free Software
  42. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
  43. *
  44. *@package Quasi
  45. * @subpackage Modules
  46. */
  47. abstract class ListModuleBase extends QPanel
  48. {
  49. /**
  50. *@var ContentBlockView - the controlling block for the module
  51. */
  52. protected $objParentObject;
  53. //Local reference to the Account
  54. protected $objAccount;
  55. //Display panels
  56. public $pnlListView;
  57. public $pnlItemView;
  58. public $objDefaultWaitIcon;
  59. /**
  60. * Module constructor
  61. * NOTE: This module ignores the required extra parameters ..
  62. *@param ContentBlockView - parent controller object.
  63. *@param mixed - extra parameters, ignored
  64. */
  65. public function __construct($objParentObject)
  66. {
  67. $this->objParentObject =& $objParentObject;
  68. try {
  69. parent::__construct($this->objParentObject);
  70. } catch (QCallerException $objExc) {
  71. $objExc->IncrementOffset();
  72. throw $objExc;
  73. }
  74. $this->objAccount =& IndexPage::$objAccount;
  75. $this->pnlListView = new QPanel($this, 'pnlListView');
  76. $this->pnlListView->AutoRenderChildren = true;
  77. $this->pnlItemView = new QPanel($this, 'pnlItemView');
  78. $this->pnlItemView->AutoRenderChildren = true;
  79. $this->pnlItemView->Visible = false;
  80. $this->objDefaultWaitIcon = new QWaitIcon($this);
  81. }
  82. public function Validate()
  83. {
  84. $blnToReturn = true;
  85. return $blnToReturn;
  86. }
  87. /* public function SetListPane(QPanel $objPanel) {
  88. $this->pnlListView->RemoveChildControls(true);
  89. $objPanel->SetParentControl($this->pnlListView);
  90. }*/
  91. public function CloseItemPanel($blnUpdatesMade)
  92. {
  93. $this->pnlItemView->RemoveChildControls(true);
  94. $this->pnlItemView->Visible = false;
  95. if ($blnUpdatesMade)
  96. $this->pnlListView->Refresh();
  97. $this->pnlListView->Visible = true;
  98. }
  99. public function ShowItemPanel(QPanel $objPanel = null)
  100. {
  101. $this->pnlListView->Visible = false;
  102. $this->pnlItemView->RemoveChildControls(true);
  103. if ($objPanel) {
  104. $objPanel->SetParentControl($this->pnlItemView);
  105. $this->pnlItemView->Visible = true;
  106. } else {
  107. $this->pnlItemView->Visible = false;
  108. }
  109. }
  110. public function __get($strName)
  111. {
  112. switch ($strName)
  113. {
  114. case 'Account':
  115. return $this->objAccount ;
  116. default:
  117. try {
  118. return parent::__get($strName);
  119. } catch (QCallerException $objExc) {
  120. $objExc->IncrementOffset();
  121. throw $objExc;
  122. }
  123. }
  124. }
  125. public function __set($strName, $mixValue)
  126. {
  127. switch ($strName)
  128. {
  129. case 'Account':
  130. try {
  131. return ($this->objAccount = QType::Cast($mixValue, 'Account' ));
  132. } catch (QInvalidCastException $objExc) {
  133. $objExc->IncrementOffset();
  134. throw $objExc;
  135. }
  136. default:
  137. try {
  138. return (parent::__set($strName, $mixValue));
  139. } catch (QCallerException $objExc) {
  140. $objExc->IncrementOffset();
  141. throw $objExc;
  142. }
  143. }
  144. }
  145. }//end class
  146. }//end define
  147. ?>