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
This commit is contained in:
plegall
2011-01-12 13:41:55 +00:00
parent 66458980f3
commit 0ef332fc0f
7 changed files with 70 additions and 4 deletions
+5
View File
@@ -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)
@@ -87,6 +87,15 @@
<input type="checkbox" name="email_admin_on_new_user" {if ($main.email_admin_on_new_user)}checked="checked"{/if}>
</label>
</li>
<li>
<label>
<span class="property">
{'Week starts on'|@translate}
{html_options name="week_starts_on" options=$main.week_starts_on_options selected=$main.week_starts_on_options_selected}
</span>
</label>
</li>
</ul>
</fieldset>
{/if}
+11 -4
View File
@@ -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'];
+1
View File
@@ -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');
+42
View File
@@ -0,0 +1,42 @@
<?php
// +-----------------------------------------------------------------------+
// | Piwigo - a PHP based picture gallery |
// +-----------------------------------------------------------------------+
// | Copyright(C) 2008-2010 Piwigo Team http://piwigo.org |
// | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net |
// | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick |
// +-----------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License as published by |
// | the Free Software Foundation |
// | |
// | This program is distributed in the hope that it will be useful, but |
// | WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
// | General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
// | USA. |
// +-----------------------------------------------------------------------+
if (!defined('PHPWG_ROOT_PATH'))
{
die('Hacking attempt!');
}
$upgrade_description = 'Monday may not be the first day of the week';
$query = '
INSERT INTO '.PREFIX_TABLE.'config (param,value,comment)
VALUES (\'week_starts_on\',\'monday\', \''.$upgrade_description.'\')
;';
pwg_query($query);
echo
"\n"
. $upgrade_description
."\n"
;
?>
+1
View File
@@ -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';
?>
+1
View File
@@ -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';
?>