Ignore:
Timestamp:
Sep 8, 2011, 8:22:27 PM (13 years ago)
Author:
rvelices
Message:
  • reoptimize queries for MySql
  • week starts on monday/sunday applies also to weekly calendar
File:
1 edited

Legend:

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

    r8728 r12118  
    4141  {
    4242    parent::initialize($inner_sql);
    43     global $lang;
     43    global $lang, $conf;
    4444    $week_no_labels=array();
    4545    for ($i=1; $i<=53; $i++)
     
    6565    //Comment next lines for week starting on Sunday or if MySQL version<4.0.17
    6666    //WEEK(date,5) = "0-53 - Week 1=the first week with a Monday in this year"
    67     $this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
    68     $this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
    69     array_push( $this->calendar_levels[CDAY]['labels'],
    70                 array_shift( $this->calendar_levels[CDAY]['labels'] ) );
     67    if ('monday' == $conf['week_starts_on'])
     68    {
     69      $this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
     70      $this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
     71      array_push( $this->calendar_levels[CDAY]['labels'],
     72                  array_shift( $this->calendar_levels[CDAY]['labels'] ) );
     73    }
    7174  }
    7275
Note: See TracChangeset for help on using the changeset viewer.