Edit via SFTP
  1. <?php namespace greenmine;
  2. /*
  3.   PURPOSE: page type for Greenmine (probably won't have any others)
  4.   HISTORY:
  5.   2016-06-13 started
  6.   2017-01-24 gutted; rewriting
  7.   2020-12-03 added "namespace greenmine"
  8. */
  9.  
  10. class cPage extends \fcPage_login {
  11.  
  12. // ++ EVENTS ++ //
  13.  
  14. // CEMENT
  15. protected function OnRunCalculations() : void {
  16. // 2017-01-25 These may create nodes -- shouldn't they be in OnCreateElements()?
  17. $this->UseStyleSheet('basic');
  18. $sSite = \fcApp::Globals()->GetText_SiteName_short();
  19. $this->SetPageTitle($sSite.' Control Panel'); // default page title
  20.  
  21. $oKiosk = \fcApp::Me()->GetKioskObject();
  22. $oReq = $oKiosk->GetInputObject();
  23. }
  24. // -- EVENTS -- //
  25. // ++ CLASSES ++ //
  26.  
  27. protected function Class_forTagHTML() : string { return cTag_html::class; }
  28.  
  29. // -- CLASSES -- //
  30. // ++ ELEMENTS ++ //
  31.  
  32. public function GetElement_PageHeader() { return $this->GetTagNode_body()->GetElement_PageHeader(); }
  33.  
  34. // -- ELEMENTS -- //
  35.  
  36. }
  37. class cTag_html extends \fcTag_html_standard {
  38.  
  39. // ++ CEMENTING ++ //
  40.  
  41. protected function Class_forTag_body() : string { return gcTag_body::class; }
  42.  
  43. // -- CEMENTING -- //
  44. }
  45. class gcTag_body extends \fcTag_body_login {
  46. use \ftLoginContainer;
  47.  
  48. // ++ EVENTS ++ //
  49.  
  50. // OVERRIDE: Navbar needs to render before header and content.
  51. protected function OnCreateElements() : void {
  52. $this->GetElement_PageNavigation();
  53. $this->GetElement_PageHeader();
  54. $this->GetElement_LoginWidget();
  55. $this->GetElement_PageContent();
  56. }
  57. protected function OnRunCalculations() : void {}
  58.  
  59. // -- EVENTS -- //
  60. // ++ CLASSES ++ //
  61.  
  62. // CEMENT
  63. protected function Class_forPageHeader() : string { return cPageHeader::class; }
  64. // CEMENT
  65. protected function Class_forPageNavigation() : string { return cNavbar::class; }
  66. // CEMENT
  67. protected function Class_forPageContent() : string { return cPageContent::class; }
  68. // OVERRIDE
  69. protected function Class_forLoginWidget() : string { return 'fcpeLoginWidget_block'; }
  70.  
  71. // -- CLASSES -- //
  72.  
  73. }
  74. class cPageHeader extends \fcContentHeader_login {}
  75. class cNavbar extends \fcMenuFolder {
  76.  
  77. // ++ CEMENTING ++ //
  78.  
  79. protected function OnCreateElements() : void {
  80. $fpDropins = \greenmine\cApp::Globals()->GetFilePath_forDropins();
  81. \ferret\ctDropInManager::ScanDropins($fpDropins,$this); // add all the dropins as subnodes
  82. }
  83. protected function RenderSelf() : string { return ''; }
  84. protected function RenderNodesBlock() : string {
  85. return "\n<ul class=dropin-menu>"
  86. .$this->RenderNodes()
  87. ."\n</ul>"
  88. ;
  89. }
  90.  
  91. // -- CEMENTING -- //
  92.  
  93. }
  94. class cPageContent extends \fcPageContent {
  95. use \ftContentMessages;
  96.  
  97. // ++ EVENTS ++ //
  98.  
  99. // ACTION: add any elements that can be defined at construction time
  100. protected function OnCreateElements() : void {} // Nothing to do here; <body> creates header and navbar
  101. protected function OnRunCalculations() : void {} // Nothing to do here; Page object does some calcs, menu executes requests
  102.  
  103. // -- EVENTS -- //
  104. // ++ FRAMEWORK ++ //
  105.  
  106. protected function GetDatabase() { return fcApp::Me()->GetDatabase(); }
  107.  
  108. // -- FRAMEWORK -- //
  109. // ++ NEW PAGE ELEMENTS ++ //
  110.  
  111. }
  112. class cpeMessage_error extends \fcpeSimple {
  113. public function Render() : string {
  114. $s = $this->GetValue();
  115. return '<center>'
  116. .'<table class="error-message">'
  117. .'<tr><td valign=middle><img src="'.KWP_ICON_ALERT.'" alt="icon: error" /></td>'
  118. ."<td valign=middle>$s</td>"
  119. .'</tr></table>'
  120. .'</center>'
  121. ;
  122. }
  123. }
  124. class cpeMessage_warning extends \fcpeSimple {
  125. public function Render() : string {
  126. $s = $this->GetValue();
  127. return '<center>'
  128. .'<table class="warning-message">'
  129. .'<tr><td valign=middle><img src="'.KWP_ICON_WARN.'" alt="icon: warning" /></td>'
  130. ."<td valign=middle>$s</td>"
  131. .'</tr></table>'
  132. .'</center>'
  133. ;
  134. }
  135. }
  136. class cpeMessage_success extends \fcpeSimple {
  137. public function Render() : string {
  138. $s = $this->GetValue();
  139. return '<center>'
  140. .'<table style="border: 1px solid green; background: #eeffee;">'
  141. .'<tr><td valign=middle><img src="'.KWP_ICON_OKAY.'" alt="icon: okay" /></td>'
  142. ."<td valign=middle>$s</td>"
  143. .'</tr></table>'
  144. .'</center>';
  145. }
  146. }
  147.