Proper translation rendering for main menu

This commit is contained in:
Lucas Bickel 2017-03-23 23:41:47 +01:00
parent caaa0c0e2a
commit 314c105508
2 changed files with 57 additions and 46 deletions

View File

@ -1,40 +1,48 @@
<?php <?php
/**
/* * Navigation container (config/array)
* Navigation container (config/array) *
* Each element in the array will be passed to
* Each element in the array will be passed to * Zend_Navigation_Page::factory() when constructing
* Zend_Navigation_Page::factory() when constructing * the navigation container below.
* the navigation container below. *
*/ * The class field is used to contain the icon rendered
* before the nav entry for i18n purposes. When this
* gets parsed the language is not yet set and the
* strings stay plain en for now. They get retranslated
* in the menu.phtml script when they are output.
*/
$pages = array(); $pages = array();
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-music icon-white'></i>"._('My Podcast'), 'label' => _('My Podcast'),
'module' => 'default', 'module' => 'default',
'controller' => 'podcast', 'controller' => 'podcast',
'action' => 'station', 'action' => 'station',
'resource' => 'podcast' 'resource' => 'podcast',
'class' => '<i class="icon-music icon-white"></i>'
); );
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-globe icon-white'></i>"._('Radio Page'), 'label' => _('Radio Page'),
'uri' => '/', 'uri' => '/',
'resource' => '', 'resource' => '',
'pages' => array( 'class' => '<i class="icon-globe icon-white"></i>',
) 'pages' => array()
); );
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-calendar icon-white'></i>"._('Calendar'), 'label' => _('Calendar'),
'module' => 'default', 'module' => 'default',
'controller' => 'schedule', 'controller' => 'schedule',
'action' => 'index', 'action' => 'index',
'resource' => 'schedule' 'resource' => 'schedule',
'class' => '<i class="icon-calendar icon-white"></i>'
); );
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-wrench icon-white'></i>"._('Widgets'), 'label' => _('Widgets'),
'module' => 'default', 'module' => 'default',
'controller' => 'embeddablewidgets', 'controller' => 'embeddablewidgets',
'action' => 'player', 'action' => 'player',
'resource' => 'embeddablewidgets', 'resource' => 'embeddablewidgets',
'class' => '<i class="icon-wrench icon-white"></i>',
'title' => 'Widgets', 'title' => 'Widgets',
'pages' => array( 'pages' => array(
array( array(
@ -58,11 +66,12 @@ $pages[] = array(
) )
); );
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-cog icon-white'></i>"._("Settings"), 'label' => _("Settings"),
'resource' => 'preference', 'resource' => 'preference',
'action' => 'index', 'action' => 'index',
'module' => 'default', 'module' => 'default',
'controller' => 'preference', 'controller' => 'preference',
'class' => '<i class="icon-cog icon-white"></i>',
'title' => 'Settings', 'title' => 'Settings',
'pages' => array( 'pages' => array(
array( array(
@ -99,11 +108,12 @@ $pages[] = array(
) )
); );
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-signal icon-white'></i>"._("Analytics"), 'label' => _("Analytics"),
'module' => 'default', 'module' => 'default',
'controller' => 'playouthistory', 'controller' => 'playouthistory',
'action' => 'index', 'action' => 'index',
'resource' => 'playouthistory', 'resource' => 'playouthistory',
'class' => '<i class="icon-signal icon-white"></i>',
'title' => 'Analytics', 'title' => 'Analytics',
'pages' => array( 'pages' => array(
array( array(
@ -162,11 +172,12 @@ if (LIBRETIME_ENABLE_BILLING === true) {
); );
} }
$pages[] = array( $pages[] = array(
'label' => "<i class='icon-question-sign icon-white'></i>"._('Help'), 'label' => _('Help'),
'controller' => 'dashboard', 'controller' => 'dashboard',
'action' => 'help', 'action' => 'help',
'resource' => 'dashboard', 'resource' => 'dashboard',
'title' => 'Help', 'class' => '<i class="icon-question-sign icon-white"></i>',
'title' => 'Help',
'pages' => array( 'pages' => array(
array( array(
'label' => _('Getting Started'), 'label' => _('Getting Started'),

View File

@ -1,32 +1,32 @@
<ol id="navlist"> <ol id="navlist">
<?php foreach ($this->container as $page) : ?> <?php foreach ($this->container as $page) : ?>
<?php if($this->navigation()->accept($page)) : ?> <?php if($this->navigation()->accept($page)) : ?>
<li class="top <?php if($page->isActive(true)){echo 'active';} ?>"> <li class="top <?php if($page->isActive(true)){echo 'active';} ?>">
<?php if($page->hasPages()) : ?> <?php if($page->hasPages()) : ?>
<a class="top_link" href="<?php echo $page->getHref(); ?>"> <a class="top_link" href="<?php echo $page->getHref(); ?>">
<span class="down"><?php echo _($page->getLabel()); ?></span> <span class="down"><?php echo $page->getClass(); echo _($page->getLabel()); ?></span>
</a> </a>
<ul class="sub"> <ul class="sub">
<?php foreach ($page->getPages() as $sub) : <?php foreach ($page->getPages() as $sub) :
if($sub->getId() == "manage_folder"){ if($sub->getId() == "manage_folder"){
continue; continue;
} ?> } ?>
<?php if($this->navigation()->accept($sub)) : ?> <?php if($this->navigation()->accept($sub)) : ?>
<li> <li>
<a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo _($sub->getLabel()); ?></a> <a href="<?php echo $sub->getHref(); ?>" <?php echo ($sub->getTarget() != "")?"target=\"".$sub->getTarget()."\"":""; ?>><?php echo $page->getClass(); echo _($sub->getLabel()); ?></a>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php else: ?> <?php else: ?>
<a class="top_link" href="<?php echo $page->getHref(); ?>"> <a class="top_link" href="<?php echo $page->getHref(); ?>">
<span><?php echo _($page->getLabel()); ?></span> <span><?php echo $page->getClass(); echo _($page->getLabel()); ?></span>
</a> </a>
<?php endif; ?> <?php endif; ?>
</li> </li>
<?php endif; ?> <?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</ol> </ol>