File phpboost/menu/links/LinksMenuLink.class.php
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55:
<?php
/**
* A Simple menu link
* @package PHPBoost
* @subpackage Menu\links
* @copyright © 2005-2019 PHPBoost
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU/GPL-3.0
* @author Regis VIARRE <crowkait@phpboost.com>
* @version PHPBoost 5.2 - last update: 2016 10 24
* @since PHPBoost 2.0 - 2008 07 08
* @contributor Loic ROUCHON <horn@phpboost.com>
* @contributor Julien BRISWALTER <j1.seth@phpboost.com>
* @contributor Arnaud GENET <elenwii@phpboost.com>
*/
class LinksMenuLink extends LinksMenuElement
{
const LINKS_MENU_LINK__CLASS = 'LinksMenuLink';
/**
* Constructor
* @param string $title Menu title
* @param string $url Destination url
* @param string $image Menu's image url relative to the website root or absolute
* @param int $id The Menu's id in the database
*/
public function __construct($title, $url, $image = '')
{
parent::__construct($title, $url, $image);
}
/**
* Display the menu
* @param Template $template the template to use
* @return string the menu parsed in xHTML
*/
public function display($template = false, $mode = LinksMenuElement::LINKS_MENU_ELEMENT__CLASSIC_DISPLAYING)
{
// Stop if the user isn't authorised
if (!$this->check_auth())
{
return '';
}
parent::_assign($template, $mode);
$template->put_all(array(
'C_DISPLAY_AUTH' => AppContext::get_current_user()->check_auth($this->get_auth(), Menu::MENU_AUTH_BIT),
'C_LINK' => true
));
return $template->render();
}
}
?>