Changeset 497


Ignore:
Timestamp:
Aug 27, 2004, 1:00:28 AM (20 years ago)
Author:
z0rglub
Message:

possibility to choose the date field you want to use for calendar category
(date_available or date_creation).

Location:
trunk/include
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/category_calendar.inc.php

    r480 r497  
    3434// years of image availability
    3535$query = '
    36 SELECT YEAR(date_available) AS year, COUNT(id) AS count
     36SELECT YEAR('.$conf['calendar_datefield'].') AS year, COUNT(id) AS count
    3737  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    3838  '.$page['where'].'
     
    8585  // the number of picture for this month : $calendar_months
    8686  $query = '
    87 SELECT DISTINCT(MONTH(date_available)) AS month, COUNT(id) AS count
    88   FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    89   '.$page['where'].'
    90     AND id = image_id
    91     AND YEAR(date_available) = '.$page['calendar_year'].'
    92   GROUP BY MONTH(date_available)
     87SELECT DISTINCT(MONTH('.$conf['calendar_datefield'].')) AS month
     88     , COUNT(id) AS count
     89  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
     90  '.$page['where'].'
     91    AND id = image_id
     92    AND YEAR('.$conf['calendar_datefield'].') = '.$page['calendar_year'].'
     93  GROUP BY MONTH('.$conf['calendar_datefield'].')
    9394;';
    9495  $result = mysql_query($query);
     
    156157  // the number of picture for this day : $calendar_days
    157158  $query = '
    158 SELECT DISTINCT(date_available) AS day, COUNT(id) AS count
    159   FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    160   '.$page['where'].'
    161     AND id = image_id
    162     AND YEAR(date_available) = '.$page['calendar_year'].'
    163     AND MONTH(date_available) = '.$page['calendar_month'].'
     159SELECT DISTINCT('.$conf['calendar_datefield'].') AS day, COUNT(id) AS count
     160  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
     161  '.$page['where'].'
     162    AND id = image_id
     163    AND YEAR('.$conf['calendar_datefield'].') = '.$page['calendar_year'].'
     164    AND MONTH('.$conf['calendar_datefield'].') = '.$page['calendar_month'].'
    164165  GROUP BY day
    165166;';
     
    184185  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    185186  '.$page['where'].'
    186     AND date_available = \''.$page['calendar_date'].'\'
     187    AND '.$conf['calendar_datefield'].' = \''.$page['calendar_date'].'\'
    187188    AND id = image_id
    188189  GROUP BY category_id
     
    219220  {
    220221    $query = '
    221 SELECT file,tn_ext,date_available,storage_category_id
    222   FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    223   '.$page['where'].'
    224     AND YEAR(date_available) = '.$calendar_year.'
     222SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
     223  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
     224  '.$page['where'].'
     225    AND YEAR('.$conf['calendar_datefield'].') = '.$calendar_year.'
    225226    AND id = image_id
    226227  ORDER BY RAND()
     
    277278  {
    278279    $query = '
    279 SELECT file,tn_ext,date_available,storage_category_id
    280   FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    281   '.$page['where'].'
    282     AND YEAR(date_available) = '.$page['calendar_year'].'
    283     AND MONTH(date_available) = '.$calendar_month.'
     280SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
     281  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
     282  '.$page['where'].'
     283    AND YEAR('.$conf['calendar_datefield'].') = '.$page['calendar_year'].'
     284    AND MONTH('.$conf['calendar_datefield'].') = '.$calendar_month.'
    284285    AND id = image_id
    285286  ORDER BY RAND()
     
    344345  {
    345346    $query = '
    346 SELECT file,tn_ext,date_available,storage_category_id
    347   FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    348   '.$page['where'].'
    349     AND date_available = \''.$calendar_day.'\'
     347SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
     348  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
     349  '.$page['where'].'
     350    AND '.$conf['calendar_datefield'].' = \''.$calendar_day.'\'
    350351    AND id = image_id
    351352  ORDER BY RAND()
     
    418419   
    419420    $query = '
    420 SELECT file,tn_ext,date_available,storage_category_id
    421   FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
    422   '.$page['where'].'
    423     AND date_available = \''.$page['calendar_date'].'\'';
     421SELECT file,tn_ext,'.$conf['calendar_datefield'].',storage_category_id
     422  FROM '.IMAGES_TABLE.', '.IMAGE_CATEGORY_TABLE.'
     423  '.$page['where'].'
     424    AND '.$conf['calendar_datefield'].' = \''.$page['calendar_date'].'\'';
    424425    if ($calendar_category != 0)
    425426    {
     
    452453
    453454    $url_link = PHPWG_ROOT_PATH.'category.php?cat=search';
    454     $url_link.= '&search=date_available:'.$_GET['day'];
     455    $url_link.= '&search='.$conf['calendar_datefield'].':'.$_GET['day'];
    455456    if ($calendar_category != 0)
    456457    {
  • trunk/include/config.inc.php

    r493 r497  
    8989// for PHP version newer than 4.1.2 :
    9090// $conf['show_exif_fields'] = array('CameraMake','CameraModel','DateTime');
     91
     92$conf['calendar_datefield'] = 'date_creation';
    9193?>
  • trunk/include/functions_category.inc.php

    r496 r497  
    687687          $page['title'] .= ')';
    688688        }
     689       
     690        $page['where'] = 'WHERE '.$conf['calendar_datefield'].' IS NOT NULL';
    689691        if (isset($forbidden))
    690692        {
    691           $page['where'] = 'WHERE '.$forbidden;
    692         }
    693         else
    694         {
    695           $page['where'] = 'WHERE 1=1';
     693          $page['where'].= ' AND '.$forbidden;
    696694        }
    697695      }
Note: See TracChangeset for help on using the changeset viewer.