Project:Station
Version:5.x-2.x-dev
Component:Schedule
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (won't fix)

Issue Summary

Would you be interested in a filter that show's what's on today?
I've been thinking of putting that on my site's front page instead of just what's on now.

Basically, in views.inc:

Add a start field (which ideally should be hidden from UI, if there's a way):

      'start' => array(
        'name' => t('Station: Start time'),
        'help' => t("Time the program is scheduled to begin."),
      ),

Add a filter:
      'todays_schedule' => array(
        'name' => t("Station: On today's schedule"),
        'cacheable' => FALSE,
        'operator' => array('IS' => t('on air today')),
        'value' => '',
        'handler' => 'station_handler_filter_todays_schedule',
        'help' => t("Filter whether the program is on air today."),
      ),

and a sort, which is useful anyway:
    'sorts' => array(
      'start' => array(
        'name' => t("Station: start time"),
        'help' => t("Sort by program start time on the schedule."),
      ),

The handler is where I'd need a hand -- I don't understand how the caching system works. There appears to be some sort of caching going on for the 'now playing' filter, and I assume the same sort of thing should be done for this.
Here's what I have so far:

function station_handler_filter_todays_schedule($op, $filterdata, $filterinfo, &$query) {
  switch ($op) {
  case 'handler':
    $query->ensure_table('node');
    $query->add_field('nid', 'node');
   
    $minute_now = station_minute_from_day_hour(date('w', $timestamp), date('G', $timestamp));
    $minute_start = floor( $minute_now / MINUTES_IN_DAY ) * MINUTES_IN_DAY;
    $minute_end   = $minute_start + MINUTES_IN_DAY;
       
    $query->add_where('{station_schedule}.start >= %d AND {station_schedule}.finish <= %d', $minute_start, $minute_end);
    break;
  }
  return;
}

Oh and I don't know how this works with multiple schedules... I couldn't see that my station 2.x's views stuff had anything for that either.

Comments

#1

yeah, that'd be cool. mind rolling a patch?

#2

Can we get that schedule trimming patch wrapped up and committed first? My CVS is getting to be a mess :)

#3

hehe, good call. how about you review all my patches and i'll review yours and we can get a 5.x-2x release out ;)

#4

did someone test it?
can it be used in 1.5?

#5

where is this at? I'm hoping to add similar functionality onto my site.

#6

Status:active» closed (won't fix)

i don't think i'm ever going to have time to get this going on d5. it should work well in d6 so please give that a try.

nobody click here