Changeset 4398 for trunk/include/calendar_monthly.class.php
- Timestamp:
- Nov 30, 2009, 9:41:11 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/calendar_monthly.class.php
r4367 r4398 44 44 $this->calendar_levels = array( 45 45 array( 46 'sql'=> 'YEAR('.$this->date_field.')',46 'sql'=> pwg_db_get_year($this->date_field), 47 47 'labels' => null 48 48 ), 49 49 array( 50 'sql'=> 'MONTH('.$this->date_field.')',51 50 'sql'=> pwg_db_get_month($this->date_field), 51 'labels' => $lang['month'] 52 52 ), 53 53 array( 54 'sql'=> 'DAYOFMONTH('.$this->date_field.')',54 'sql'=> pwg_db_get_dayofmonth($this->date_field), 55 55 'labels' => null 56 56 ), … … 135 135 { 136 136 global $page; 137 137 138 $date = $page['chronology_date']; 138 139 while (count($date)>$max_levels) … … 157 158 { 158 159 $b .= '01'; 159 $e .= '31';160 $e .= $this->get_all_days_in_month($date[CYEAR], $date[CMONTH]); 160 161 } 161 162 } … … 194 195 //--------------------------------------------------------- private members --- 195 196 196 // returns an array with all lthe days in a given month197 // returns an array with all the days in a given month 197 198 function get_all_days_in_month($year, $month) 198 199 { … … 221 222 { 222 223 global $page; 224 223 225 assert( count($page['chronology_date']) == 0 ); 224 $query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%Y%m")) as period, 225 COUNT( DISTINCT(id) ) as count'; 226 $query=' 227 SELECT '.pwg_db_get_date_YYYYMM($this->date_field).' as period,' 228 .pwg_db_get_year($this->date_field).' as year, ' 229 .pwg_db_get_month($this->date_field).' as month, 230 count(distinct id) as count'; 226 231 $query.= $this->inner_sql; 227 232 $query.= $this->get_date_where(); 228 233 $query.= ' 229 GROUP BY period 230 ORDER BY YEAR('.$this->date_field.') DESC, MONTH('.$this->date_field.')';234 GROUP BY period, year, month 235 ORDER BY year DESC, month ASC'; 231 236 232 237 $result = pwg_query($query); … … 274 279 { 275 280 global $page; 281 276 282 assert( count($page['chronology_date']) == 1 ); 277 $query='SELECT DISTINCT(DATE_FORMAT('.$this->date_field.',"%m%d"))as period,278 COUNT( DISTINCT(id)) as count';283 $query='SELECT '.pwg_db_get_date_MMDD($this->date_field).' as period, 284 COUNT(DISTINCT id) as count'; 279 285 $query.= $this->inner_sql; 280 286 $query.= $this->get_date_where(); 281 287 $query.= ' 282 GROUP BY period'; 288 GROUP BY period 289 ORDER BY period ASC'; 283 290 284 291 $result = pwg_query($query); … … 325 332 { 326 333 global $page; 327 $query='SELECT DISTINCT(DAYOFMONTH('.$this->date_field.')) as period, 328 COUNT( DISTINCT(id) ) as count'; 334 335 $query='SELECT '.pwg_db_get_dayofmonth($this->date_field).' as period, 336 COUNT(DISTINCT id) as count'; 329 337 $query.= $this->inner_sql; 330 338 $query.= $this->get_date_where(); 331 339 $query.= ' 332 GROUP BY period'; 340 GROUP BY period 341 ORDER BY period ASC'; 333 342 334 343 $items=array(); … … 344 353 $page['chronology_date'][CDAY]=$day; 345 354 $query = ' 346 SELECT id, file,tn_ext,path, width, height, DAYOFWEEK('.$this->date_field.')-1 as dow';355 SELECT id, file,tn_ext,path, width, height, '.pwg_db_get_dayofweek($this->date_field).'-1 as dow'; 347 356 $query.= $this->inner_sql; 348 357 $query.= $this->get_date_where();
Note: See TracChangeset
for help on using the changeset viewer.