Project:Station
Version:6.x-2.x-dev
Component:Schedule
Category:feature request
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

It would be great to be able to show all todays scheduled programs in a block on the front page. Could this be done?

Kind Regards

Niall

Comments

#1

Can anyone help with with this one? Pretty please :P

#2

Version:6.x-2.0-unstable3» 6.x-2.x-dev

I'll need to flush out the filter a bit more to add a today mode.

#3

Status:active» needs review

Okay, apply this patch and then try out this view:

<?php
$view
= new view;
$view->name = 'station_schedule_today';
$view->description = 'Today\'s programs';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'station_schedule_item';
$view->is_cacheable = FALSE;
$view->api_version = 2;
$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
$handler = $view->new_display('default', 'Defaults', 'default');
$handler->override_option('relationships', array(
 
'program_nid' => array(
   
'label' => 'Program',
   
'required' => 0,
   
'id' => 'program_nid',
   
'table' => 'station_schedule_item',
   
'field' => 'program_nid',
   
'override' => array(
     
'button' => 'Override',
    ),
   
'relationship' => 'none',
  ),
));
$handler->override_option('fields', array(
 
'title' => array(
   
'label' => '',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'link_to_node' => 1,
   
'exclude' => 0,
   
'id' => 'title',
   
'table' => 'node',
   
'field' => 'title',
   
'relationship' => 'program_nid',
   
'override' => array(
     
'button' => 'Override',
    ),
  ),
 
'start' => array(
   
'label' => 'Start',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'style' => 'station_dayhour',
   
'exclude' => 0,
   
'id' => 'start',
   
'table' => 'station_schedule_item',
   
'field' => 'start',
   
'override' => array(
     
'button' => 'Override',
    ),
   
'relationship' => 'none',
  ),
 
'finish' => array(
   
'label' => 'Finish',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'style' => 'station_hour',
   
'exclude' => 0,
   
'id' => 'finish',
   
'table' => 'station_schedule_item',
   
'field' => 'finish',
   
'override' => array(
     
'button' => 'Override',
    ),
   
'relationship' => 'none',
  ),
 
'time' => array(
   
'label' => 'Duration',
   
'alter' => array(
     
'alter_text' => 0,
     
'text' => '',
     
'make_link' => 0,
     
'path' => '',
     
'alt' => '',
     
'prefix' => '',
     
'suffix' => '',
     
'help' => '',
     
'trim' => 0,
     
'max_length' => '',
     
'word_boundary' => 1,
     
'ellipsis' => 1,
     
'strip_tags' => 0,
     
'html' => 0,
    ),
   
'style' => 'station_hour_duration',
   
'exclude' => 0,
   
'id' => 'time',
   
'table' => 'station_schedule_item',
   
'field' => 'time',
   
'override' => array(
     
'button' => 'Override',
    ),
   
'relationship' => 'none',
  ),
));
$handler->override_option('filters', array(
 
'start' => array(
   
'operator' => '>=',
   
'value' => array(
     
'mode' => 'today',
     
'value' => 0,
     
'min' => '',
     
'max' => '',
     
'offset' => '',
    ),
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => 'start_op',
     
'label' => 'Station schedule item: Start',
     
'use_operator' => FALSE,
     
'identifier' => 'start',
     
'remember' => FALSE,
     
'single' => TRUE,
     
'optional' => TRUE,
    ),
   
'id' => 'start',
   
'table' => 'station_schedule_item',
   
'field' => 'start',
   
'relationship' => 'none',
   
'override' => array(
     
'button' => 'Override',
    ),
  ),
 
'start_1' => array(
   
'operator' => '<',
   
'value' => array(
     
'mode' => 'today',
     
'value' => 0,
     
'min' => '',
     
'max' => '',
     
'offset' => '1440',
    ),
   
'group' => '0',
   
'exposed' => FALSE,
   
'expose' => array(
     
'operator' => FALSE,
     
'label' => '',
    ),
   
'id' => 'start_1',
   
'table' => 'station_schedule_item',
   
'field' => 'start',
   
'relationship' => 'none',
  ),
));
$handler->override_option('access', array(
 
'type' => 'perm',
 
'perm' => 'view station schedule content',
));
$handler->override_option('cache', array(
 
'type' => 'none',
));
$handler->override_option('title', 'Today programs');
$handler->override_option('empty', 'Nothing is scheduled.');
$handler->override_option('empty_format', '1');
$handler = $view->new_display('block', 'Block', 'block_1');
$handler->override_option('block_description', 'Station Schedule Upcoming Programs');
$handler->override_option('block_caching', -1);
?>
AttachmentSize
station_views_505538.patch 6.32 KB

#4

Status:needs review» fixed

committed the patch but leaving the view as an exercise to the admin ;)

#5

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here