aboutsummaryrefslogtreecommitdiffstats
path: root/include/calendar_weekly.class.php
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2011-09-08 18:22:27 +0000
committerrvelices <rv-github@modusoptimus.com>2011-09-08 18:22:27 +0000
commit1d3fc9005f00927c19c291f33b5bfffdd81cad6e (patch)
tree549aa6fa5a11b0ab895e74e7fb97e468bcff4074 /include/calendar_weekly.class.php
parentdbb3fd5a444a542ddcd730882138daca602c0923 (diff)
- 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
Diffstat (limited to '')
-rw-r--r--include/calendar_weekly.class.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/include/calendar_weekly.class.php b/include/calendar_weekly.class.php
index 8ebcf0174..146bb1788 100644
--- a/include/calendar_weekly.class.php
+++ b/include/calendar_weekly.class.php
@@ -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'] ) );
+ }
}
/**