Beispiel #1
0
		             'my' => 'My',
		             'guitar' => 'Guitar');
	}
	
	public static function listData($action, $language)
	{
		return array(
			'one' => 'One',
			'two' => 'Two',
			'three' => 'Three',
			'four' => 'Four',
			'language' => $language
		);
	}
}
Menu::registerEntryProvider('MockMenuEntryProvider');

class MenuTest extends CoOrgModelTest
{
	const dataset = 'menu.dataset.xml';
	
	public function testCreateMenu()
	{
		$menu = new Menu();
		$menu->name = 'Navigation';
		$menu->save();
	}
	
	public function testCreateMenuNameExists()
	{
		$menu = new Menu();
Beispiel #2
0
			$pages = Page::pages($language);
			$menu = array();
			foreach ($pages->execute(0, 0) as $page)
			{
				$menu[$page->ID] = $page->title;
			}
			return $menu;
		}
		else
		{
			return null;
		}
	}
	
	public static function url($action, $language, $data)
	{
		if ($action == 'show')
		{
			return CoOrg::createURL(array('page', 'show', $data), $language);
		}
		else
		{
			return CoOrg::createURL(array('page', $action), $language);
		}
	}
}

Menu::registerEntryProvider('PageMenuEntryProvider');

?>
Beispiel #3
0
		else
		{
			return null;
		}
	}
	
	public static function url($action, $language, $data)
	{
		if ($action == 'show')
		{
			$dataArray = explode('/', $data, 2);
			$dateArray = explode('-', $dataArray[0]);
			return CoOrg::createURL(array('blog', 'show', $dateArray[0],
			                               $dateArray[1], $dateArray[2],
			                               $dataArray[1]), $language);
		}
		else if ($action == 'latest')
		{
			return CoOrg::createURL(array('blog'), $language);
		}
		else
		{
			return CoOrg::createURL(array('blog', $action), $language);
		}
	}
}

Menu::registerEntryProvider('BlogMenuEntryProvider');

?>
Beispiel #4
0
	}
}

class HomeMenuEntryProvider implements IMenuEntryProvider
{
	public static function name()
	{
		return t('Home');
	}

	public static function listActions()
	{
		return array('home' => t('Home'));
	}
	
	public static function listData($action, $language)
	{
		return null;
	}

	public static function url($action, $data, $language)
	{
		return CoOrg::createURL(array(), $language);
	}
}

Menu::registerEntryProvider('URLMenuEntryProvider');
Menu::registerEntryProvider('HomeMenuEntryProvider');

?>