calendar: removed some warnings, improved display for weekly style and
worked on css (still not perfect due to IE) git-svn-id: http://piwigo.org/svn/trunk@1069 68402e56-0260-453c-a942-63ccdbb3a9ee
This commit is contained in:
parent
1e7c9034de
commit
cba56c06ed
7 changed files with 62 additions and 40 deletions
|
|
@ -65,8 +65,11 @@ class CalendarBase
|
|||
for ($i=0; $i<count($this->date_components); $i++)
|
||||
{
|
||||
$res .= $conf['level_separator'];
|
||||
|
||||
$url .= $this->date_components[$i].'-';
|
||||
if ($i>0)
|
||||
{
|
||||
$url .= '-';
|
||||
}
|
||||
$url .= $this->date_components[$i];
|
||||
if ( isset($this->date_components[$i+1]) )
|
||||
{
|
||||
$res .=
|
||||
|
|
@ -96,7 +99,7 @@ class CalendarBase
|
|||
{
|
||||
$label = $this->calendar_levels[$level]['labels'][$date_component];
|
||||
}
|
||||
elseif ($date_component == 'any' )
|
||||
elseif ('any' === $date_component )
|
||||
{
|
||||
$label = l10n('calendar_any');
|
||||
}
|
||||
|
|
@ -112,14 +115,14 @@ class CalendarBase
|
|||
$res = '';
|
||||
for ($i=count($date_components)-1; $i>=0; $i--)
|
||||
{
|
||||
if ($date_components[$i]!='any')
|
||||
if ('any' !== $date_components[$i])
|
||||
{
|
||||
$label = $date_components[$i];
|
||||
if (isset($this->calendar_levels[$i]['labels'][$date_components[$i]]))
|
||||
$label = $this->get_date_component_label($i, $date_components[$i] );
|
||||
if ( $res!='' )
|
||||
{
|
||||
$label = $this->calendar_levels[$i]['labels'][$date_components[$i]];
|
||||
$res .= ' ';
|
||||
}
|
||||
$res .= $label.' ';
|
||||
$res .= $label;
|
||||
}
|
||||
}
|
||||
return $res;
|
||||
|
|
@ -192,7 +195,7 @@ class CalendarBase
|
|||
if ($conf['calendar_show_any'] and $show_any and count($items) > 1)
|
||||
{
|
||||
$label = l10n('calendar_any');
|
||||
if (isset($selected_item) and 'any' == $selected_item)
|
||||
if (isset($selected_item) and 'any' === $selected_item)
|
||||
{
|
||||
$nav_bar .= '<span class="'.$class_prefix.'Sel">';
|
||||
$nav_bar .= $label;
|
||||
|
|
@ -289,37 +292,41 @@ SELECT DISTINCT('.$this->calendar_levels[$level]['sql']
|
|||
$prev = $next =null;
|
||||
if ( empty($this->date_components) )
|
||||
return;
|
||||
|
||||
$current = '';
|
||||
$query = 'SELECT CONCAT_WS("-"';
|
||||
for ($i=0; $i<count($this->date_components); $i++)
|
||||
{
|
||||
if ( $this->date_components[$i] != 'any' )
|
||||
{
|
||||
$query .= ','.$this->calendar_levels[$i]['sql'];
|
||||
}
|
||||
else
|
||||
if ( 'any' === $this->date_components[$i] )
|
||||
{
|
||||
$query .= ','.'"any"';
|
||||
}
|
||||
$current .= '-' . $this->date_components[$i];
|
||||
else
|
||||
{
|
||||
$query .= ','.$this->calendar_levels[$i]['sql'];
|
||||
}
|
||||
}
|
||||
$current = substr($current, 1);
|
||||
$current = implode('-', $this->date_components );
|
||||
|
||||
$query.=') as period' . $this->inner_sql .'
|
||||
AND ' . $this->date_field . ' IS NOT NULL
|
||||
GROUP BY period';
|
||||
|
||||
$upper_items = array_from_query( $query, 'period');
|
||||
|
||||
usort($upper_items, 'version_compare');
|
||||
//echo ('<pre>'. var_export($upper_items, true) . '</pre>');
|
||||
$upper_items_rank = array_flip($upper_items);
|
||||
if ( !isset($upper_items_rank[$current]) )
|
||||
{
|
||||
array_push($upper_items, $current);// just in case (external link)
|
||||
usort($upper_items, 'version_compare');
|
||||
$upper_items_rank = array_flip($upper_items);
|
||||
}
|
||||
$current_rank = $upper_items_rank[$current];
|
||||
|
||||
if (!$this->has_nav_bar and
|
||||
($current_rank>0 or $current_rank < count($upper_items)-1 ) )
|
||||
{
|
||||
$template->assign_block_vars( 'calendar.navbar', array() );
|
||||
}
|
||||
|
||||
if ( $current_rank>0 )
|
||||
{ // has previous
|
||||
$prev = $upper_items[$current_rank-1];
|
||||
|
|
|
|||
|
|
@ -139,15 +139,15 @@ function get_date_where($max_levels=3)
|
|||
array_pop($date);
|
||||
}
|
||||
$res = '';
|
||||
if (isset($date[CYEAR]) and $date[CYEAR]!='any')
|
||||
if (isset($date[CYEAR]) and $date[CYEAR]!=='any')
|
||||
{
|
||||
$b = $date[CYEAR] . '-';
|
||||
$e = $date[CYEAR] . '-';
|
||||
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
|
||||
if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
|
||||
{
|
||||
$b .= $date[CMONTH] . '-';
|
||||
$e .= $date[CMONTH] . '-';
|
||||
if (isset($date[CDAY]) and $date[CDAY]!='any')
|
||||
if (isset($date[CDAY]) and $date[CDAY]!=='any')
|
||||
{
|
||||
$b .= $date[CDAY];
|
||||
$e .= $date[CDAY];
|
||||
|
|
@ -162,11 +162,11 @@ function get_date_where($max_levels=3)
|
|||
{
|
||||
$b .= '01-01';
|
||||
$e .= '12-31';
|
||||
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
|
||||
if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
|
||||
{
|
||||
$res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
|
||||
}
|
||||
if (isset($date[CDAY]) and $date[CDAY]!='any')
|
||||
if (isset($date[CDAY]) and $date[CDAY]!=='any')
|
||||
{
|
||||
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
|
||||
}
|
||||
|
|
@ -176,11 +176,11 @@ function get_date_where($max_levels=3)
|
|||
else
|
||||
{
|
||||
$res = ' AND '.$this->date_field.' IS NOT NULL';
|
||||
if (isset($date[CMONTH]) and $date[CMONTH]!='any')
|
||||
if (isset($date[CMONTH]) and $date[CMONTH]!=='any')
|
||||
{
|
||||
$res .= ' AND '.$this->calendar_levels[CMONTH]['sql'].'='.$date[CMONTH];
|
||||
}
|
||||
if (isset($date[CDAY]) and $date[CDAY]!='any')
|
||||
if (isset($date[CDAY]) and $date[CDAY]!=='any')
|
||||
{
|
||||
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
|
||||
}
|
||||
|
|
@ -224,7 +224,8 @@ function build_global_calendar()
|
|||
$query.= $this->inner_sql;
|
||||
$query.= $this->get_date_where();
|
||||
$query.= '
|
||||
GROUP BY period';
|
||||
GROUP BY period
|
||||
ORDER BY YEAR('.$this->date_field.') DESC';
|
||||
|
||||
$result = pwg_query($query);
|
||||
$items=array();
|
||||
|
|
@ -290,7 +291,6 @@ function build_year_calendar()
|
|||
$items[$m]['children'][$d] = $row['count'];
|
||||
$items[$m]['nb_images'] += $row['count'];
|
||||
}
|
||||
//echo ('<pre>'. var_export($items, true) . '</pre>');
|
||||
if (count($items)==1)
|
||||
{ // only one month exists so bail out to month view
|
||||
list($m) = array_keys($items);
|
||||
|
|
|
|||
|
|
@ -46,6 +46,13 @@ class Calendar extends CalendarBase
|
|||
{
|
||||
parent::initialize($date_field, $inner_sql, $date_components);
|
||||
global $lang;
|
||||
$week_no_labels=array();
|
||||
for ($i=1; $i<=53; $i++)
|
||||
{
|
||||
$week_no_labels[$i] = sprintf( l10n("Week %d"), $i);
|
||||
//$week_no_labels[$i] = $i;
|
||||
}
|
||||
|
||||
$this->calendar_levels = array(
|
||||
array(
|
||||
'sql'=> 'YEAR('.$this->date_field.')',
|
||||
|
|
@ -53,7 +60,7 @@ class Calendar extends CalendarBase
|
|||
),
|
||||
array(
|
||||
'sql'=> 'WEEK('.$this->date_field.')+1',
|
||||
'labels' => null
|
||||
'labels' => $week_no_labels,
|
||||
),
|
||||
array(
|
||||
'sql'=> 'DAYOFWEEK('.$this->date_field.')-1',
|
||||
|
|
@ -86,7 +93,7 @@ function generate_category_content($url_base, $view_type)
|
|||
}
|
||||
if ( count($this->date_components)==1 )
|
||||
{
|
||||
$this->build_nav_bar(CWEEK); // week nav bar 1-53
|
||||
$this->build_nav_bar(CWEEK, array()); // week nav bar 1-53
|
||||
}
|
||||
if ( count($this->date_components)==2 )
|
||||
{
|
||||
|
|
@ -111,17 +118,17 @@ function get_date_where($max_levels=3)
|
|||
array_pop($date);
|
||||
}
|
||||
$res = '';
|
||||
if (isset($date[CYEAR]) and $date[CYEAR]!='any')
|
||||
if (isset($date[CYEAR]) and $date[CYEAR]!=='any')
|
||||
{
|
||||
$y = $date[CYEAR];
|
||||
$res = " AND $this->date_field BETWEEN '$y-01-01' AND '$y-12-31 23:59:59'";
|
||||
}
|
||||
|
||||
if (isset($date[CWEEK]) and $date[CWEEK]!='any')
|
||||
if (isset($date[CWEEK]) and $date[CWEEK]!=='any')
|
||||
{
|
||||
$res .= ' AND '.$this->calendar_levels[CWEEK]['sql'].'='.$date[CWEEK];
|
||||
}
|
||||
if (isset($date[CDAY]) and $date[CDAY]!='any')
|
||||
if (isset($date[CDAY]) and $date[CDAY]!=='any')
|
||||
{
|
||||
$res .= ' AND '.$this->calendar_levels[CDAY]['sql'].'='.$date[CDAY];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -109,6 +109,7 @@ $lang['User comments'] = 'User comments';
|
|||
$lang['Username'] = 'Username';
|
||||
$lang['Visits'] = 'Visits';
|
||||
$lang['Webmaster'] = 'Webmaster';
|
||||
$lang['Week %d'] = 'Week %d';
|
||||
$lang['about_page_title'] = 'About PhpWebGallery';
|
||||
$lang['access_forbiden'] = 'You are not authorized to access the requested page';
|
||||
$lang['add to caddie'] = 'add to caddie';
|
||||
|
|
|
|||
|
|
@ -108,6 +108,7 @@ $lang['User comments'] = 'Commentaires utilisateur';
|
|||
$lang['Username'] = 'Nom d\'utilisateur';
|
||||
$lang['Visits'] = 'Visites';
|
||||
$lang['Webmaster'] = 'Webmestre';
|
||||
$lang['Week %d'] = 'Semaine %d';
|
||||
$lang['about_page_title'] = 'À propos de PhpWebGallery';
|
||||
$lang['access_forbiden'] = 'Vous n\'êtes pas autorisé sur la page demandée';
|
||||
$lang['add to caddie'] = 'ajouter au panier';
|
||||
|
|
@ -133,7 +134,7 @@ $lang['calendar_hint'] = 'affichage ann
|
|||
$lang['calendar_monthly_l'] = 'Liste mensuelle';
|
||||
$lang['calendar_monthly_c'] = 'Calendrier mensuel';
|
||||
$lang['calendar_picture_hint'] = 'affiche les images du ';
|
||||
$lang['calendar_view'] = 'View';
|
||||
$lang['calendar_view'] = 'Vue';
|
||||
$lang['calendar_weekly_l'] = 'Liste hebdomadaire';
|
||||
$lang['categories'] = 'Catégories';
|
||||
$lang['click_to_redirect'] = 'Cliquez ici si votre navigateur ne vous redirige pas.';
|
||||
|
|
|
|||
|
|
@ -17,10 +17,12 @@ BODY#theNotificationPage #content
|
|||
margin: 1em;
|
||||
}
|
||||
|
||||
#content H2, H3 {
|
||||
#content H3 {
|
||||
margin-bottom: 1ex;
|
||||
}
|
||||
|
||||
#content H2 { margin-bottom: 3px;} /*<- for IE otherwise calendar select is displaced to middle of page*/
|
||||
|
||||
#content H3 {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
@ -104,7 +106,7 @@ BODY#theNotificationPage #content
|
|||
|
||||
/* actions */
|
||||
UL.categoryActions {
|
||||
margin: 2px;
|
||||
margin: 0 2px;
|
||||
width: auto;
|
||||
padding: 0;
|
||||
text-indent: 0;
|
||||
|
|
@ -117,9 +119,12 @@ UL.categoryActions {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
#content DIV.titrePage {
|
||||
padding: 0 0 3px;
|
||||
}
|
||||
|
||||
#content UL.categoryActions LI {
|
||||
display: inline;
|
||||
|
||||
}
|
||||
|
||||
#content UL.categoryActions A IMG, UL.categoryActions A {
|
||||
|
|
@ -183,7 +188,7 @@ SPAN.filename:after {
|
|||
#content DIV.calendarViews {
|
||||
display: block;
|
||||
float: right;
|
||||
margin: 2px 2px;
|
||||
margin: 2px 0 0;
|
||||
}
|
||||
|
||||
#content DIV.calendarBar { margin: 8px 4px; }
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ H1 {
|
|||
|
||||
H2 {
|
||||
margin: 0;
|
||||
padding: 5px;
|
||||
padding: 0px 5px 4px;
|
||||
text-align: left;
|
||||
font-size: 120%;
|
||||
}
|
||||
|
|
@ -90,7 +90,7 @@ select.categoryList {
|
|||
/** go to an admin.css ? **/
|
||||
|
||||
.table2 {
|
||||
border: 1px solid black;
|
||||
border: 1px solid black;
|
||||
margin: 1em auto;
|
||||
padding: 0;
|
||||
}
|
||||
|
|
@ -228,7 +228,7 @@ FORM#categoryPermissions LI {
|
|||
padding: 0;
|
||||
}
|
||||
|
||||
BODY#theAdminPage #theHeader P {
|
||||
BODY#theAdminPage #theHeader P {
|
||||
display: none;
|
||||
}
|
||||
|
||||
|
|
@ -257,3 +257,4 @@ UL.actions A {
|
|||
border: none;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue