<?php
// use_helper('I18N');
if (Catalyz::getLoginHandler()->hasAccessToToolbar() && CatalyzToolbar::instance()->enabled()) {
    use_stylesheet('catalyz/catalyz', 'last');
    $oldCulture = $sf_user->getCulture();
    $sf_user->setCulture(sfConfig::get('app_catalyz_language'));
    use_stylesheet('catalyz/smoothness/jquery-ui-1.7.custom.css');
    use_javascript('catalyz/jquery-1.3.2.min.js');
    use_javascript('catalyz/jquery-ui-1.7.custom.min.js');

    if (sfConfig::get('app_catalyz_customize_css')) {
        use_stylesheet('catalyz-content.css', 'last');
    }

    ?>


<div id="catalyz-toolbar" class="ui-corner-all noprint">
<?php
    $url_support = sfConfig::get('app_catalyz_url_support', null);
    if ($url_support):
        ?>
<div id="catalyz-toolbar-help">
	<a href="<?php echo $url_support; ?>" title="Support" target="_blank"><img src="/images/catalyz/help.png" width="16" height="16" alt="" border="0" align="top" /></a>
	<a href="<?php echo $url_support; ?>" title="Support" target="_blank"><?php echo __('Help', null, 'catalyz'); ?></a>
</div>
<?php
    endif;

    ?>
<div id="catalyz-toolbar-logo">
	<a href="<?php echo sfConfig::get('app_catalyz_url_home'); ?>" title="About" target="_blank"><?php echo image_tag(sfConfig::get('app_catalyz_logo_small', '/images/catalyz/logo.png')); ?></a>
</div>
<div id="catalyz-toolbar-actions">
	<?php
    $prefix = '&nbsp;-';
    foreach(CatalyzToolbar::instance()->getToolbarActions($page) as $action) {
        $options = '';
        if (isset($action['target'])) {
            $options .= sprintf(' target="%s"', $action['target']);
        }
		$icon = sprintf('/images/catalyz/%s.png', $action['key']);
		if (!empty($action['icon']) && is_file(sfConfig::get('sf_web_dir') . $action['icon'])) {
			$icon = $action['icon'];
		}
        echo $prefix;
        printf('&nbsp;<a href="%s"%s><img src="%s" border="0" align="top" alt="%s" title="%s" /></a>', $action['url'], $options, $icon, $action['caption'], $action['caption']);
        printf('&nbsp;<a href="%s"%s>%s</a>', $action['url'], $options, $action['caption']);
        $prefix = '&nbsp;-';
    }

    ?>
</div>
</div>

<?php
    $sf_user->setCulture($oldCulture);
}

?>