<?php
/*****************************************************************************
 * AdminBar.php
 * Defines the AdminBar class.
 *
 * Kabuki CMS (C) 2013-2015, Aaron van Geffen
 *****************************************************************************/

class AdminBar extends SubTemplate
{
	private $extra_items = [];

	protected function html_content()
	{
		echo '
			<div id="admin_bar">
				<ul>
					<li><a href="', BASEURL, '/managealbums/">Albums</a></li>
					<li><a href="', BASEURL, '/managetags/">Tags</a></li>
					<li><a href="', BASEURL, '/manageusers/">Users</a></li>
					<li><a href="', BASEURL, '/manageerrors/">Errors [', ErrorLog::getCount(), ']</a></li>';

		foreach ($this->extra_items as $item)
			echo '
					<li><a href="', $item[0], '">', $item[1], '</a></li>';

		echo '
					<li><a href="', BASEURL, '/logout/">Log out [', Registry::get('user')->getFullName(), ']</a></li>
				</ul>
			</div>';
	}

	public function appendItem($url, $caption)
	{
		$this->extra_items[] = [$url, $caption];
	}
}