<?php
/*
 * Copyright (c) 2013, webvariants GbR, http://www.webvariants.de
 *
 * This file is released under the terms of the MIT license. You can find the
 * complete text in the attached LICENSE file or online at:
 *
 * http://www.opensource.org/licenses/mit-license.php
 */

abstract class WV8_Navigation {
	public static function getNavElements() {
		static $elements = null;

		if ($elements === null) {
			$elements = array(array('page' => 'globalsettings', 'title' => ht('wv8_overview')));
			$pages    = array();

			// translate all pages and give them unique keys
			foreach (WV8_Settings::getPages() as $page) {
				$key         = WV8_Settings::hash($page);
				$pages[$key] = $page;
			}

			// now it makes sense to translate & sort the pages
			$pages = WV8_Settings::translateList($pages);

			// add all pages to the element lists
			foreach ($pages as $settingID => $pagename) {
				$elements[] = array('page' => 'globalsettings_settings', 'title' => $pagename, 'id' => $settingID);
			}
		}

		return $elements;
	}
}
