Development

Changeset 20512

You must first sign up to be able to contribute.

Changeset 20512

Show
Ignore:
Timestamp:
07/27/09 08:21:48 (4 years ago)
Author:
henrik
Message:

Added a priority setting, if there is multiple matches with the same score :) and the matches if no action if specified, i dosent default to index

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • plugins/sfTabMenuPeytzPlugin/lib/sfTabMenuPeytz.class.php

    r20510 r20512  
    4848        ), 
    4949        'matches' => array(), 
     50        'priority' => 0, 
    5051    ); 
    5152     
     
    180181            $parseArray['module'] = $moduleAction[0]; 
    181182             
    182             $parseArray['action'] = 'index'; 
    183183            if (isset($moduleAction[1])) { 
    184184                $parseArray['action'] = $moduleAction[1]; 
     
    213213            foreach ($matches as $match) { 
    214214                $score = 0; 
    215                 $match = $this->parseMatch($match);; 
     215                $match = $this->parseMatch($match); 
    216216                 
    217217                if ($module == $match['module']) { 
     
    247247         
    248248        if ($scores[$index] > 0) { 
    249             $this->_ActiveTabIndex = $index; 
     249            $priorities = array(); 
     250            foreach ($scores as $key => $score) { 
     251                if ($score != $scores[$index]) { 
     252                    continue; 
     253                } 
     254                 
     255                $tab = self::merge($this->_DefaultTabConfig, $this->config['tabs'][$key]); 
     256                if ($tab['priority']) { 
     257                    $priorities[$key] = $tab['priority']; 
     258                } 
     259            } 
     260             
     261            if (count($priorities)) { 
     262                asort($priorities); 
     263                $priorityKeys = array_keys($priorities); 
     264                $this->_ActiveTabIndex = end($priorityKeys); 
     265            } else { 
     266                $this->_ActiveTabIndex = $index; 
     267            } 
    250268        } 
    251269    }