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.

95 lines
2.5 KiB

  1. <?php
  2. if(!defined('QUINTACMS') ) die("No quinta.");
  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 <sidewalksoftware@gmail.com>
  8. *
  9. *@version 0.3
  10. *
  11. *@package Quinta
  12. * @subpackage Modules
  13. */
  14. class SomeModule extends QPanel{
  15. /**
  16. * @var ContentBlockController objContentBlock - the content block to which this module is assigned
  17. */
  18. protected $objContentBlock;
  19. /**
  20. * @var SomeClass objSomeClass - local reference or instance of some relevant object ..
  21. */
  22. protected $objSomeClass;
  23. /**
  24. * Module constructor
  25. * NOTE: When loaded as a module registered in the database, the parameters will be
  26. * a reference to the Module ORM object.
  27. *@param ContentBlock - parent controller object.
  28. *@param mixed - extra parameters for the displayed module
  29. */
  30. public function __construct( ContentBlockController $objContentBlock, $mixParameters=null){
  31. //Parent should always be a ContentBlockController
  32. $this->objContentBlock =& $objContentBlock;
  33. try {
  34. parent::__construct($this->objContentBlock);
  35. } catch (QCallerException $objExc) {
  36. $objExc->IncrementOffset();
  37. throw $objExc;
  38. }
  39. $this->strTemplate = __QUINTA_CORE_VIEWS__ . '/SomeModule.tpl.php';
  40. }
  41. /**
  42. * This Function is called when any input is sent - on failure the
  43. * fields are redrawn with optional error messages.
  44. */
  45. public function Validate(){
  46. $blnToReturn = true;
  47. // validate input here
  48. return $blnToReturn;
  49. }
  50. /**
  51. * Event Handling
  52. */
  53. public function btnDoSomething_Click($strFormId, $strControlId, $strParameter){
  54. Quinta::Redirect(__QUINTA_SUBDIRECTORY__ . '/index.php/Home');
  55. }
  56. public function __get($strName){
  57. switch ($strName){
  58. case 'SomeClass':
  59. return $this->objSomeClass ;
  60. default:
  61. try {
  62. return parent::__get($strName);
  63. } catch (QCallerException $objExc) {
  64. $objExc->IncrementOffset();
  65. throw $objExc;
  66. }
  67. }
  68. }
  69. public function __set($strName, $mixValue){
  70. switch ($strName){
  71. case 'SomeClass':
  72. try {
  73. return ($this->objSomeClass = QType::Cast($mixValue, 'SomeClass' ));
  74. } catch (QInvalidCastException $objExc) {
  75. $objExc->IncrementOffset();
  76. throw $objExc;
  77. }
  78. default:
  79. try {
  80. return (parent::__set($strName, $mixValue));
  81. } catch (QCallerException $objExc) {
  82. $objExc->IncrementOffset();
  83. throw $objExc;
  84. }
  85. }
  86. }
  87. }//end class
  88. }//end define
  89. ?>