Location.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. *
  4. * PHP Pro Bid $Id$ SUhXoGm9caoc5cGln1n2/z4mhL/KwPS7rrEcRfJPwVA=
  5. *
  6. * @link http://www.phpprobid.com
  7. * @copyright Copyright (c) 2014 Online Ventures Software LTD & CodeCube SRL
  8. * @license http://www.phpprobid.com/license Commercial License
  9. *
  10. * @version 7.0
  11. */
  12. /**
  13. * location page class - used by location navigation container
  14. */
  15. namespace Ppb\Navigation\Page;
  16. use Cube\Navigation\Page\AbstractPage;
  17. class Location extends AbstractPage
  18. {
  19. /**
  20. *
  21. * active location id
  22. *
  23. * @var integer
  24. */
  25. protected $_locationId;
  26. /**
  27. *
  28. * iso code field
  29. *
  30. * @var string
  31. */
  32. protected $_isoCode;
  33. /**
  34. *
  35. * get active location id
  36. *
  37. * @return integer
  38. */
  39. public function getLocationId()
  40. {
  41. return $this->_locationId;
  42. }
  43. /**
  44. *
  45. * set active location id
  46. *
  47. * @param integer $locationId
  48. * @return \Ppb\Navigation\Page\Location
  49. */
  50. public function setLocationId($locationId)
  51. {
  52. $this->_locationId = (int) $locationId;
  53. return $this;
  54. }
  55. /**
  56. *
  57. * get iso code field
  58. *
  59. * @return bool
  60. */
  61. public function getIsoCode()
  62. {
  63. return $this->_isoCode;
  64. }
  65. /**
  66. *
  67. * set iso code field
  68. *
  69. * @param int $isoCode
  70. * @return \Ppb\Navigation\Page\Location
  71. */
  72. public function setIsoCode($isoCode)
  73. {
  74. $this->_isoCode = (bool) $isoCode;
  75. return $this;
  76. }
  77. /**
  78. *
  79. * check if a page is active, based on the page id
  80. *
  81. * @param bool $recursive check in sub-pages as well, and if a sub-page is active, return the current page as active
  82. * @return bool returns active status
  83. */
  84. public function isActive($recursive = false)
  85. {
  86. if (!$this->_active) {
  87. if ($this->_id == $this->_locationId) {
  88. $this->_active = true;
  89. return true;
  90. }
  91. }
  92. return parent::isActive($recursive);
  93. }
  94. }