123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <?php
- /**
- *
- * PHP Pro Bid $Id$ K9PfLDm6IYP5RLNLNc//Ik1uYkiidL77Wm6NaMualOA=
- *
- * @link http://www.phpprobid.com
- * @copyright Copyright (c) 2014 Online Ventures Software LTD & CodeCube SRL
- * @license http://www.phpprobid.com/license Commercial License
- *
- * @version 7.0
- */
- /**
- * category page class - used by category navigation container
- */
- namespace Ppb\Navigation\Page;
- use Cube\Navigation\Page\AbstractPage;
- class Category extends AbstractPage
- {
- /**
- *
- * active category id
- *
- * @var integer
- */
- protected $_categoryId;
- /**
- *
- * custom fees flag
- *
- * @var bool
- */
- protected $_customFees;
- /**
- *
- * sluggable value
- *
- * @var string
- */
- protected $_slug;
- /**
- *
- * get active category id
- *
- * @return integer
- */
- public function getCategoryId()
- {
- return $this->_categoryId;
- }
- /**
- *
- * set active category id
- *
- * @param integer $categoryId
- * @return \Ppb\Navigation\Page\Category
- */
- public function setCategoryId($categoryId)
- {
- $this->_categoryId = (int) $categoryId;
- return $this;
- }
- /**
- *
- * get custom fees flag
- *
- * @return bool
- */
- public function getCustomFees()
- {
- return $this->_customFees;
- }
- /**
- *
- * set custom fees flag
- *
- * @param int $customFees
- * @return \Ppb\Navigation\Page\Category
- */
- public function setCustomFees($customFees)
- {
- $this->_customFees = (bool) $customFees;
-
- return $this;
- }
- /**
- *
- * set slug
- *
- * @param string $slug
- *
- * @return $this
- */
- public function setSlug($slug)
- {
- $this->_slug = $slug;
- return $this;
- }
- /**
- *
- * get slug
- *
- * @return string
- */
- public function getSlug()
- {
- return $this->_slug;
- }
- /**
- *
- * override get method to use the slug if available for the url
- *
- * @param string $name
- * @return mixed|null|string
- */
- public function get($name)
- {
- if ($name == 'params' && !empty($this->_slug)) {
- return $this->getSlug();
- }
- return parent::get($name);
- }
- /**
- *
- * check if a page is active, based on the page id
- *
- * @param bool $recursive check in sub-pages as well, and if a sub-page is active, return the current page as active
- * @return bool returns active status
- */
- public function isActive($recursive = false)
- {
- if (!$this->_active) {
- if ($this->_id == $this->_categoryId) {
- $this->_active = true;
- return true;
- }
- }
- return parent::isActive($recursive);
- }
- }
|