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.

126 lines
4.0 KiB

12 years ago
  1. <?php
  2. if(!defined('QUASICMS') ) die("No quasi.");
  3. if (!defined("someMODULE.CLASS.PHP")){
  4. define("someMODULE.CLASS.PHP",1);
  5. /**
  6. * Class SomeModule - provides modifiable display of data
  7. *@author Erik Winn <erikwinnmail@yahoo.com>
  8. *
  9. *
  10. * $Id: Module-template.class.php 290 2008-10-12 02:22:54Z erikwinn $
  11. *@version 0.1
  12. *
  13. *@copyright (C) 2008 by Erik Winn
  14. *@license GPL v.2
  15. This program is free software; you can redistribute it and/or modify
  16. it under the terms of the GNU General Public License as published by
  17. the Free Software Foundation; either version 2 of the License, or
  18. (at your option) any later version.
  19. This program is distributed in the hope that it will be useful,
  20. but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. GNU General Public License for more details.
  23. You should have received a copy of the GNU General Public License
  24. along with this program; if not, write to the Free Software
  25. Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
  26. *
  27. *@package Quasi
  28. * @subpackage Modules
  29. */
  30. class SomeModule extends QPanel
  31. {
  32. /**
  33. * @var ContentBlockView objContentBlock - the content block to which this module is assigned
  34. */
  35. protected $objContentBlock;
  36. /**
  37. * @var SomeClass objSomeClass - local reference or instance of some relevant object ..
  38. */
  39. protected $objSomeClass;
  40. /**
  41. * Module constructor
  42. * NOTE: When loaded as a module registered in the database, the parameters will be
  43. * a reference to the Module ORM object.
  44. *@param ContentBlock - parent controller object.
  45. *@param mixed - extra parameters for the displayed module
  46. */
  47. public function __construct( ContentBlockView $objContentBlock, $mixParameters=null)
  48. {
  49. //Parent should always be a ContentBlockView
  50. $this->objContentBlock =& $objContentBlock;
  51. try {
  52. parent::__construct($this->objContentBlock);
  53. } catch (QCallerException $objExc) {
  54. $objExc->IncrementOffset();
  55. throw $objExc;
  56. }
  57. $this->strTemplate = __QUASI_CORE_TEMPLATES__ . '/SomeModule.tpl.php';
  58. }
  59. /**
  60. * This Function is called when any input is sent - on failure the
  61. * fields are redrawn with optional error messages.
  62. */
  63. public function Validate()
  64. {
  65. $blnToReturn = true;
  66. // validate input here
  67. return $blnToReturn;
  68. }
  69. /**
  70. * Event Handling
  71. */
  72. public function btnDoSomething_Click($strFormId, $strControlId, $strParameter)
  73. {
  74. Quasi::Redirect(__QUASI_SUBDIRECTORY__ . '/index.php/Home');
  75. }
  76. public function __get($strName)
  77. {
  78. switch ($strName)
  79. {
  80. case 'SomeClass':
  81. return $this->objSomeClass ;
  82. default:
  83. try {
  84. return parent::__get($strName);
  85. } catch (QCallerException $objExc) {
  86. $objExc->IncrementOffset();
  87. throw $objExc;
  88. }
  89. }
  90. }
  91. public function __set($strName, $mixValue)
  92. {
  93. switch ($strName)
  94. {
  95. case 'SomeClass':
  96. try {
  97. return ($this->objSomeClass = QType::Cast($mixValue, 'SomeClass' ));
  98. } catch (QInvalidCastException $objExc) {
  99. $objExc->IncrementOffset();
  100. throw $objExc;
  101. }
  102. default:
  103. try {
  104. return (parent::__set($strName, $mixValue));
  105. } catch (QCallerException $objExc) {
  106. $objExc->IncrementOffset();
  107. throw $objExc;
  108. }
  109. }
  110. }
  111. }//end class
  112. }//end define
  113. ?>