From 0ef332fc0f78e36e168d51c9cf17df65ef0ab186 Mon Sep 17 00:00:00 2001 From: plegall Date: Wed, 12 Jan 2011 13:41:55 +0000 Subject: [PATCH] feature 2103 added: week may start on sunday/monday in the monthly calendar git-svn-id: http://piwigo.org/svn/trunk@8626 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/configuration.php | 5 +++ .../themes/default/template/configuration.tpl | 9 ++++ include/calendar_monthly.class.php | 15 +++++-- install/config.sql | 1 + install/db/93-database.php | 42 +++++++++++++++++++ language/en_UK/admin.lang.php | 1 + language/fr_FR/admin.lang.php | 1 + 7 files changed, 70 insertions(+), 4 deletions(-) create mode 100644 install/db/93-database.php diff --git a/admin/configuration.php b/admin/configuration.php index 36a2901ae..0f2e8bd34 100644 --- a/admin/configuration.php +++ b/admin/configuration.php @@ -246,6 +246,11 @@ switch ($page['section']) 'CONF_GALLERY_TITLE' => htmlspecialchars($conf['gallery_title']), 'CONF_PAGE_BANNER' => htmlspecialchars($conf['page_banner']), 'CONF_GALLERY_URL' => $conf['gallery_url'], + 'week_starts_on_options' => array( + 'sunday' => $lang['day'][0], + 'monday' => $lang['day'][1], + ), + 'week_starts_on_options_selected' => $conf['week_starts_on'], )); foreach ($main_checkboxes as $checkbox) diff --git a/admin/themes/default/template/configuration.tpl b/admin/themes/default/template/configuration.tpl index 7a6583779..903255baf 100644 --- a/admin/themes/default/template/configuration.tpl +++ b/admin/themes/default/template/configuration.tpl @@ -87,6 +87,15 @@ + +
  • + +
  • {/if} diff --git a/include/calendar_monthly.class.php b/include/calendar_monthly.class.php index 1f7fdeee7..b3911ddb8 100644 --- a/include/calendar_monthly.class.php +++ b/include/calendar_monthly.class.php @@ -330,7 +330,7 @@ function build_year_calendar(&$tpl_var) function build_month_calendar(&$tpl_var) { - global $page; + global $page, $lang, $conf; $query='SELECT '.pwg_db_get_dayofmonth($this->date_field).' as period, COUNT(DISTINCT id) as count'; @@ -368,9 +368,12 @@ SELECT id, file,tn_ext,path, width, height, '.pwg_db_get_dayofweek($this->date_f $items[$day]['width'] = $row['width']; $items[$day]['height'] = $row['height']; $items[$day]['dow'] = $row['dow']; - } - global $lang, $conf; + if ('sunday' == $conf['week_starts_on']) + { + $items[$day]['dow']++; + } + } if ( !empty($items) and $conf['calendar_month_cell_width']>0 @@ -395,7 +398,11 @@ SELECT id, file,tn_ext,path, width, height, '.pwg_db_get_dayofweek($this->date_f { $first_day_dow -= 1; } - array_push( $wday_labels, array_shift($wday_labels) ); + + if ('monday' == $conf['week_starts_on']) + { + array_push( $wday_labels, array_shift($wday_labels) ); + } // END - pass now in week starting Monday $cell_width = $conf['calendar_month_cell_width']; diff --git a/install/config.sql b/install/config.sql index f54679352..02f6f71a1 100644 --- a/install/config.sql +++ b/install/config.sql @@ -51,3 +51,4 @@ INSERT INTO piwigo_config (param,value,comment) 'a:11:{s:6:"author";b:1;s:10:"created_on";b:1;s:9:"posted_on";b:1;s:10:"dimensions";b:1;s:4:"file";b:1;s:8:"filesize";b:1;s:4:"tags";b:1;s:10:"categories";b:1;s:6:"visits";b:1;s:12:"average_rate";b:1;s:13:"privacy_level";b:1;}', 'Information displayed on picture page' ); +INSERT INTO piwigo_config (param,value,comment) VALUES ('week_starts_on','monday','Monday may not be the first day of the week'); diff --git a/install/db/93-database.php b/install/db/93-database.php new file mode 100644 index 000000000..4d59aa17b --- /dev/null +++ b/install/db/93-database.php @@ -0,0 +1,42 @@ + diff --git a/language/en_UK/admin.lang.php b/language/en_UK/admin.lang.php index 6edb53994..47bf089ee 100644 --- a/language/en_UK/admin.lang.php +++ b/language/en_UK/admin.lang.php @@ -799,4 +799,5 @@ $lang['Type here the title'] = 'Type here the title'; $lang['remove creation date'] = 'remove creation date'; $lang['with no album'] = 'with no album'; $lang['with no tag'] = 'with no tag'; +$lang['Week starts on'] = 'Week starts on'; ?> diff --git a/language/fr_FR/admin.lang.php b/language/fr_FR/admin.lang.php index f6349e204..4e49136d6 100644 --- a/language/fr_FR/admin.lang.php +++ b/language/fr_FR/admin.lang.php @@ -803,4 +803,5 @@ $lang['Type here the title'] = 'Entrez ici le titre'; $lang['remove creation date'] = 'supprimer la date de création'; $lang['with no album'] = 'sans album'; $lang['with no tag'] = 'sans tag'; +$lang['Week starts on'] = 'La semaine commence le'; ?>