Changeset 1069 for trunk/include/calendar_base.class.php
- Timestamp:
- Mar 8, 2006, 4:22:25 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_base.class.php
r1062 r1069 66 66 { 67 67 $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]; 70 73 if ( isset($this->date_components[$i+1]) ) 71 74 { … … 97 100 $label = $this->calendar_levels[$level]['labels'][$date_component]; 98 101 } 99 elseif ( $date_component == 'any')102 elseif ('any' === $date_component ) 100 103 { 101 104 $label = l10n('calendar_any'); … … 113 116 for ($i=count($date_components)-1; $i>=0; $i--) 114 117 { 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!='' ) 119 122 { 120 $ label = $this->calendar_levels[$i]['labels'][$date_components[$i]];123 $res .= ' '; 121 124 } 122 $res .= $label .' ';125 $res .= $label; 123 126 } 124 127 } … … 193 196 { 194 197 $label = l10n('calendar_any'); 195 if (isset($selected_item) and 'any' == $selected_item)198 if (isset($selected_item) and 'any' === $selected_item) 196 199 { 197 200 $nav_bar .= '<span class="'.$class_prefix.'Sel">'; … … 290 293 if ( empty($this->date_components) ) 291 294 return; 292 293 $current = '';294 295 $query = 'SELECT CONCAT_WS("-"'; 295 296 for ($i=0; $i<count($this->date_components); $i++) 296 297 { 297 if ( $this->date_components[$i] != 'any' ) 298 if ( 'any' === $this->date_components[$i] ) 299 { 300 $query .= ','.'"any"'; 301 } 302 else 298 303 { 299 304 $query .= ','.$this->calendar_levels[$i]['sql']; 300 305 } 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 ); 308 308 309 309 $query.=') as period' . $this->inner_sql .' 310 310 AND ' . $this->date_field . ' IS NOT NULL 311 311 GROUP BY period'; 312 312 313 $upper_items = array_from_query( $query, 'period'); 314 313 315 usort($upper_items, 'version_compare'); 314 //echo ('<pre>'. var_export($upper_items, true) . '</pre>');315 316 $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 } 316 323 $current_rank = $upper_items_rank[$current]; 324 317 325 if (!$this->has_nav_bar and 318 326 ($current_rank>0 or $current_rank < count($upper_items)-1 ) ) … … 320 328 $template->assign_block_vars( 'calendar.navbar', array() ); 321 329 } 322 323 330 if ( $current_rank>0 ) 324 331 { // has previous
Note: See TracChangeset
for help on using the changeset viewer.