Source for file BaseView.php

Documentation is available at BaseView.php

  1. <?php
  2.  
  3. /**
  4. * MVCnPHP - BaseView.class.php
  5. *
  6. * This source file is subject to version 2.02 of the PHP license,
  7. * that is bundled with this package in the file LICENSE, and is
  8. * available at through the world-wide-web at
  9. * http://www.php.net/license/2_02.txt.
  10. * If you did not receive a copy of the PHP license and are unable to
  11. * obtain it through the world-wide-web, please send a note to
  12. * license@php.net so we can mail you a copy immediately.
  13. *
  14. * @author Tony Bibbs <tony@geeklog.net>
  15. * @copyright Tony Bibbs 2003
  16. * @package net.geeklog.mvc
  17. * @version $Id: BaseView.class.php,v 1.2 2003/08/28 01:31:22 tony Exp $
  18. *
  19. */
  20.  
  21. require_once 'ViewInterface.php';
  22.  
  23. /**
  24. * Interface class for views
  25. *
  26. * @author Tony Bibbs <tony@geeklog.net>
  27. * @package net.geeklog.mvc
  28. *
  29. */
  30. abstract class MVCnPHP_BaseView implements MVCnPHP_ViewInterface {
  31. /**
  32. * @access private
  33. * @var int
  34. */
  35. public $outputMethod = MVC_PRINT;
  36. /**
  37. * Returns if view should be printed
  38. *
  39. * View can be printed using echo or returned as a string.
  40. * This method is a tool used by the controller to determine
  41. * if it needs to return a string or not
  42. *
  43. * @author Tony Bibbs <tony@geeklog.net>
  44. * @access public
  45. * @return boolean True if view is printed, otherwise false
  46. *
  47. */
  48. public function printView()
  49. {
  50. if ($this->outputMethod == MVC_PRINT) {
  51. return true;
  52. } else {
  53. return false;
  54. }
  55. }
  56. /**
  57. * Sets views output method
  58. *
  59. * View can either be printed immediately using PHP's
  60. * echo command or the view can be returned as a string
  61. *
  62. * @author Tony Bibbs <tony@geeklog.net>
  63. * @access public
  64. * @param int $method One of two constanst, _PRINT or _STRING
  65. *
  66. */
  67. public function setOutputMethod($method)
  68. {
  69. if ($method == MVC_PRINT) {
  70. $this->outputMethod = MVC_PRINT;
  71. } else {
  72. $this->outputMethod = MVC_STRING;
  73. }
  74. }
  75. }
  76.  
  77. ?>

Documentation generated on Mon, 7 Mar 2005 22:36:20 -0600 by phpDocumentor 1.3.0RC3