- reoptimize queries for MySql

- week starts on monday/sunday applies also to weekly calendar

git-svn-id: http://piwigo.org/svn/trunk@12118 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
rvelices
2011-09-08 18:22:27 +00:00
parent dbb3fd5a44
commit 1d3fc9005f
5 changed files with 30 additions and 67 deletions
+8 -5
View File
@@ -40,7 +40,7 @@ class Calendar extends CalendarBase
function initialize($inner_sql)
{
parent::initialize($inner_sql);
global $lang;
global $lang, $conf;
$week_no_labels=array();
for ($i=1; $i<=53; $i++)
{
@@ -64,10 +64,13 @@ class Calendar extends CalendarBase
);
//Comment next lines for week starting on Sunday or if MySQL version<4.0.17
//WEEK(date,5) = "0-53 - Week 1=the first week with a Monday in this year"
$this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
$this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
array_push( $this->calendar_levels[CDAY]['labels'],
array_shift( $this->calendar_levels[CDAY]['labels'] ) );
if ('monday' == $conf['week_starts_on'])
{
$this->calendar_levels[CWEEK]['sql'] = pwg_db_get_week($this->date_field, 5).'+1';
$this->calendar_levels[CDAY]['sql'] = pwg_db_get_weekday($this->date_field);
array_push( $this->calendar_levels[CDAY]['labels'],
array_shift( $this->calendar_levels[CDAY]['labels'] ) );
}
}
/**