Source for file HtmlPage.php

Documentation is available at HtmlPage.php

  1. <?php
  2. /*
  3. * This file is part of Sylar.
  4. *
  5. * Sylar is free software: you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License as published by
  7. * the Free Software Foundation, either version 3 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * Sylar is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU Lesser General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Lesser General Public License
  16. * along with Sylar. If not, see <http://www.gnu.org/licenses/>.
  17. *
  18. * @copyright Copyright Sylar Development Team
  19. * @license http://www.gnu.org/licenses/ GNU Public License V2.0
  20. * @see https://launchpad.net/sylar/
  21. * @see http://www.giano-solutions.com
  22. */
  23.  
  24. import('sylar.presentation.Format');
  25. import('sylar.presentation.html.Html');
  26. import('sylar.presentation.html.HtmlHead');
  27. import('sylar.presentation.html.HtmlBody');
  28.  
  29.  
  30. /**
  31. * Html Page Format
  32. *
  33. * Desc File
  34. *
  35. * @see Sylar_HtmlHead
  36. * @see Sylar_HtmlBody
  37. *
  38. * @package Sylar
  39. * @version 1.0
  40. * @since 31/mar/08
  41. * @author Gianluca Giusti [brdp] <g.giusti@giano-solutions.com>
  42. * @copyright Sylar Development Team
  43. */
  44. class Sylar_HtmlPage extends Sylar_Html{
  45. private $oPageHead;
  46. private $oPageBody;
  47. private $sPage;
  48. function __construct(){
  49. // nothing to do at the moment
  50. }
  51. function __destruct(){
  52. // nothing to do at the moment
  53. }
  54.  
  55. // Setter and Getter
  56. //__________________________________________________________________________
  57. public function setPageHead(Sylar_HtmlHead $oPgHead){
  58. $this->oPageHead = $oPgHead;
  59. }
  60. public function getPageHead(){
  61. return $this->oPageHead;
  62. }
  63. public function setPageBody(Sylar_HtmlBody $oPgBody){
  64. $this->oPageBody = $oPgBody;
  65. }
  66. public function getPageBody(){
  67. return $this->oPageBody;
  68. }
  69. // Public Methods
  70. //__________________________________________________________________________
  71.  
  72.  
  73. /**
  74. * return the Html source
  75. * it return html code of entire page
  76. *
  77. * @return string
  78. */
  79. public function getHtmlSource(){
  80. return $this->render();
  81. }
  82. /**
  83. * Display the page
  84. * it prints the page on screen
  85. *
  86. * @return void
  87. */
  88. public function show(){
  89. echo $this->render();
  90. }
  91. // Protected Methods
  92. //__________________________________________________________________________
  93. /**
  94. * Render Html <HTML> tag
  95. * it push <body> and <head> tag in the page and prepare the html code of entire web page
  96. *
  97. * @return string
  98. */
  99. protected function render(){
  100. $sTagHtml = "<html>";
  101. if( is_object($this->getPageHead()) ){
  102. $sTagHtml .= $this->getPageHead()->getHtmlSource();
  103. }
  104. if( is_object($this->getPageBody()) ){
  105. $sTagHtml .= $this->getPageBody()->getHtmlSource();
  106. }
  107. $sTagHtml .= "\n</html>";
  108. return $sTagHtml;
  109. }
  110. }
  111. ?>

Documentation generated on Thu, 24 Apr 2008 16:14:15 +0200 by phpDocumentor 1.3.0RC3