Ignore:
Timestamp:
Mar 8, 2006, 4:22:25 AM (18 years ago)
Author:
rvelices
Message:

calendar: removed some warnings, improved display for weekly style and
worked on css (still not perfect due to IE)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/calendar_base.class.php

    r1062 r1069  
    6666    {
    6767      $res .= $conf['level_separator'];
    68 
    69       $url .= $this->date_components[$i].'-';
     68      if ($i>0)
     69      {
     70        $url .= '-';
     71      }
     72      $url .= $this->date_components[$i];
    7073      if ( isset($this->date_components[$i+1]) )
    7174      {
     
    97100      $label = $this->calendar_levels[$level]['labels'][$date_component];
    98101    }
    99     elseif ($date_component == 'any' )
     102    elseif ('any' === $date_component )
    100103    {
    101104      $label = l10n('calendar_any');
     
    113116    for ($i=count($date_components)-1; $i>=0; $i--)
    114117    {
    115       if ($date_components[$i]!='any')
    116       {
    117         $label = $date_components[$i];
    118         if (isset($this->calendar_levels[$i]['labels'][$date_components[$i]]))
     118      if ('any' !== $date_components[$i])
     119      {
     120        $label = $this->get_date_component_label($i, $date_components[$i] );
     121        if ( $res!='' )
    119122        {
    120           $label = $this->calendar_levels[$i]['labels'][$date_components[$i]];
     123          $res .= ' ';
    121124        }
    122         $res .= $label.' ';
     125        $res .= $label;
    123126      }
    124127    }
     
    193196    {
    194197      $label = l10n('calendar_any');
    195       if (isset($selected_item) and 'any' == $selected_item)
     198      if (isset($selected_item) and 'any' === $selected_item)
    196199      {
    197200        $nav_bar .= '<span class="'.$class_prefix.'Sel">';
     
    290293    if ( empty($this->date_components) )
    291294      return;
    292 
    293     $current = '';
    294295    $query = 'SELECT CONCAT_WS("-"';
    295296    for ($i=0; $i<count($this->date_components); $i++)
    296297    {
    297       if ( $this->date_components[$i] != 'any' )
     298      if ( 'any' === $this->date_components[$i] )
     299      {
     300        $query .= ','.'"any"';
     301      }
     302      else
    298303      {
    299304        $query .= ','.$this->calendar_levels[$i]['sql'];
    300305      }
    301       else
    302       {
    303         $query .= ','.'"any"';
    304       }
    305       $current .= '-' . $this->date_components[$i];
    306     }
    307     $current = substr($current, 1);
     306    }
     307    $current = implode('-', $this->date_components );
    308308
    309309    $query.=') as period' . $this->inner_sql .'
    310310AND ' . $this->date_field . ' IS NOT NULL
    311311GROUP BY period';
     312
    312313    $upper_items = array_from_query( $query, 'period');
     314
    313315    usort($upper_items, 'version_compare');
    314     //echo ('<pre>'. var_export($upper_items, true) . '</pre>');
    315316    $upper_items_rank = array_flip($upper_items);
     317    if ( !isset($upper_items_rank[$current]) )
     318    {
     319      array_push($upper_items, $current);// just in case (external link)
     320      usort($upper_items, 'version_compare');
     321      $upper_items_rank = array_flip($upper_items);
     322    }
    316323    $current_rank = $upper_items_rank[$current];
     324
    317325    if (!$this->has_nav_bar and
    318326        ($current_rank>0 or $current_rank < count($upper_items)-1 ) )
     
    320328      $template->assign_block_vars( 'calendar.navbar', array() );
    321329    }
    322 
    323330    if ( $current_rank>0 )
    324331    { // has previous
Note: See TracChangeset for help on using the changeset viewer.