Ignore:
Timestamp:
Feb 28, 2006, 5:28:06 AM (19 years ago)
Author:
rvelices
Message:

calendar improvements: week on weekly list starts on Monday,
ability to show grayed months/weeks/days (without any picture in it),
added icons for created/posted fields
language uniformization

calendar fixes: correct number of pictures in calendar view,
code simplification (I hope so)

File:
1 edited

Legend:

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

    r1057 r1059  
    5353//------------------ initialize the condition on items to take into account ---
    5454  $inner_sql = ' FROM ' . IMAGES_TABLE;
    55  
     55
    5656  if (!isset($page['cat']) or is_numeric($page['cat']))
    5757  { // we will regenerate the items by including subcats elements
     
    6060    $inner_sql .= '
    6161INNER JOIN '.IMAGE_CATEGORY_TABLE.' ON id = image_id';
    62    
     62
    6363    if (isset($page['cat']) and is_numeric($page['cat']))
    6464    {
     
    6767        explode(',', $user['forbidden_categories'])
    6868        );
    69      
     69
    7070      if (empty($sub_ids))
    7171      {
     
    102102    // Created
    103103    'created' => array(
    104        // TODO change next line when calendar_datefield disapears
    105       'default_link'   => ( $conf['calendar_datefield']=='date_creation' ? '' : 'created-' ),
     104      'default_link'   => 'created-',
    106105      'label'          => l10n('Creation date'),
    107106      'db_field'       => 'date_creation',
     
    109108    // Posted
    110109    'posted' => array(
    111       // TODO change next line when calendar_datefield disapears
    112       'default_link'   => ( $conf['calendar_datefield']=='date_available' ? '' : 'posted-' ),
    113       'label'          => l10n('Availability date'),
     110      'default_link'   => 'posted-',
     111      'label'          => l10n('Post date'),
    114112      'db_field'       => 'date_available',
    115113      ),
     
    120118    'monthly' => array(
    121119      'default_link'   => '',
    122       'label'           => l10n('Monthly'),
    123120      'include'        => 'calendar_monthly.class.php',
    124121      'view_calendar'  => true,
    125122      ),
    126     // Weekly style   
     123    // Weekly style
    127124    'weekly' => array(
    128125      'default_link'   => 'weekly-',
    129       'label'           => l10n('Weekly'),
    130126      'include'        => 'calendar_weekly.class.php',
    131127      'view_calendar'  => false,
     
    137133    CAL_VIEW_LIST => array(
    138134      'default_link'   => '',
    139       'label' => l10n('List')
    140135      ),
    141136    // calendar view
    142137    CAL_VIEW_CALENDAR => array(
    143138      'default_link'   => CAL_VIEW_CALENDAR.'-',
    144       'label' => l10n('calendar')
    145139      ),
    146140    );
    147141
    148142  $requested = explode('-', $_GET['calendar']);
    149  
     143
    150144  // Retrieve calendar field
    151145  $cal_field = get_calendar_parameter($fields, $requested);
    152  
     146
    153147  // Retrieve style
    154148  $cal_style = get_calendar_parameter($styles, $requested);
     
    191185      }
    192186    }
     187    else
     188    {
     189      $requested[$i] = (int)$requested[$i];
     190    }
    193191  }
    194192  if ($any_count == 3)
     
    196194    array_pop($requested);
    197195  }
    198  
     196
    199197  $calendar->initialize($fields[$cal_field]['db_field'], $inner_sql, $requested);
    200  
    201   //echo ('<pre>'. var_export($fields, true) . '</pre>');
    202 
     198
     199  //echo ('<pre>'. var_export($calendar, true) . '</pre>');
     200
     201  $url_base = get_query_string_diff(array('start', 'calendar'));
    203202  $url_base =
    204203    PHPWG_ROOT_PATH.'category.php'
    205     .get_query_string_diff(array('start', 'calendar'))
     204    .$url_base
    206205    .(empty($url_base) ? '?' : '&')
    207206    .'calendar='.$cal_field.'-'
    208207    ;
    209 
    210208  $must_show_list = true; // true until calendar generates its own display
    211209  if (basename($_SERVER["PHP_SELF"]) == 'category.php')
     
    224222        $page['cat_nb_images']
    225223        );
    226      
     224
    227225      $must_show_list = false;
    228226    }
    229    
     227
    230228    $template->assign_block_vars( 'calendar.views', array() );
    231229    foreach ($styles as $style => $style_data)
     
    256254            array(
    257255              'VALUE' => $url,
    258               'CONTENT' => $style_data['label'].' ('.$view_data['label'].')',
     256              'CONTENT' => l10n('calendar_'.$style.'_'.$view),
    259257              'SELECTED' => $selected,
    260258              )
     
    265263  } // end category calling
    266264
    267   $calendar_title = 
     265  $calendar_title =
    268266      '<a href="'.$url_base.$cal_style.'-'.$cal_view.'">'
    269267      .$fields[$cal_field]['label'].'</a>';
     
    272270    'calendar',
    273271    array(
    274       'TITLE' => $calendar_title,
     272      'TITLE' => '<br/>'.$calendar_title,
    275273      )
    276274    );
    277  
     275
    278276  if ($must_show_list)
    279277  {
     
    290288      $order_by = str_replace(
    291289        'ORDER BY ',
    292         'ORDER BY '.$calendar->date_field.',', $conf['order_by']
     290        'ORDER BY '.$calendar->date_field.' DESC,', $conf['order_by']
    293291        );
    294292      $query .= $order_by;
Note: See TracChangeset for help on using the changeset viewer.