Ejemplo n.º 1
0
    /**
     * output all breadcrumbs
     */
    public static function printBreadCrumbs()
    {
        $crumbs = Saf_Layout_Location::getCrumbs();
        if (count($crumbs) > 0) {
            ?>
		<ul class="breadcrumbs">
<?php 
            foreach ($crumbs as $label => $info) {
                $url = is_array($info) ? array_key_exists('url', $info) ? $info['url'] : '' : $info;
                $class = is_array($info) && array_key_exists('status', $info) ? " class=\"{$info['status']}\"" : '';
                if (is_array($info) && Saf_Array::keyExistsAndIsArray('options', $info)) {
                    $prefix = Saf_Array::keyExistsAndNotBlank('prefix', $info['options']) ? $info['options']['prefix'] : '';
                } else {
                    $prefix = '';
                }
                if ('' != $url) {
                    $baseUrl = Zend_Registry::get('baseUrl');
                    $url = str_replace('[[baseUrl]]', $baseUrl, $url);
                    ?>
		<li<?php 
                    print $class;
                    ?>
><?php 
                    print $prefix;
                    ?>
<a href="<?php 
                    print $url;
                    ?>
"><?php 
                    print $label;
                    ?>
</a></li>
<?php 
                } else {
                    ?>
		<li<?php 
                    print $class;
                    ?>
><?php 
                    print $prefix . $label;
                    ?>
</li>
<?php 
                }
            }
            ?>
		</ul>
<?php 
        }
    }
Ejemplo n.º 2
0
 public static function updateCrumb($label, $crumb = array('status' => 'current'), $newLabel = '')
 {
     if (array_key_exists($label, self::$_crumbs)) {
         if ($newLabel == '') {
             self::$_crumbs[$label] = $crumb;
         } else {
             $newCrumbs = array();
             foreach (self::$_crumbs as $oldLabel => $oldCrumb) {
                 if ($oldLabel == $label) {
                     $newCrumbs[$newLabel] = $crumb;
                 } else {
                     $newCrumbs[$oldLabel] = $oldCrumb;
                 }
             }
             self::$_crumbs = $newCrumbs;
         }
     } else {
         self::pushCrumb($newLabel !== '' ? $newLabel : $label, $crumb);
     }
 }