Skip to content

Instantly share code, notes, and snippets.

@raytiley
Created October 1, 2010 20:26
Show Gist options
  • Save raytiley/606801 to your computer and use it in GitHub Desktop.
Save raytiley/606801 to your computer and use it in GitHub Desktop.
$view = new view;
$view->name = 'Schedule';
$view->description = 'Schedule';
$view->tag = '';
$view->view_php = '';
$view->base_table = 'node';
$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('fields', array(
'cablecast_show_nid' => array(
'label' => 'Cablecast Show NID ',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => '',
'prefix' => '',
'suffix' => '',
'exclude' => 1,
'id' => 'cablecast_show_nid',
'table' => 'cablecast_schedule_event',
'field' => 'cablecast_show_nid',
'override' => array(
'button' => 'Override',
),
'relationship' => 'none',
),
'start_time' => array(
'label' => 'Time',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => '',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'date_format' => 'custom',
'custom_date_format' => 'g:i a',
'exclude' => 0,
'id' => 'start_time',
'table' => 'cablecast_schedule_event',
'field' => 'start_time',
'relationship' => 'none',
),
'showID' => array(
'label' => '',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 0,
'path' => 'show\\[showID]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'set_precision' => FALSE,
'precision' => 0,
'decimal' => '.',
'separator' => '',
'prefix' => '',
'suffix' => '',
'exclude' => 1,
'id' => 'showID',
'table' => 'cablecast_schedule_event',
'field' => 'showID',
'relationship' => 'none',
),
'title' => array(
'label' => 'Title',
'alter' => array(
'alter_text' => 0,
'text' => '',
'make_link' => 1,
'path' => 'node/[cablecast_show_nid]',
'link_class' => '',
'alt' => '',
'prefix' => '',
'suffix' => '',
'target' => '',
'help' => '',
'trim' => 0,
'max_length' => '',
'word_boundary' => 1,
'ellipsis' => 1,
'html' => 0,
'strip_tags' => 0,
),
'empty' => '',
'hide_empty' => 0,
'empty_zero' => 0,
'link_to_node' => 0,
'exclude' => 0,
'id' => 'title',
'table' => 'node',
'field' => 'title',
'relationship' => 'none',
'override' => array(
'button' => 'Override',
),
),
));
$handler->override_option('sorts', array(
'start_time' => array(
'order' => 'ASC',
'id' => 'start_time',
'table' => 'cablecast_schedule_event',
'field' => 'start_time',
'relationship' => 'none',
),
));
$handler->override_option('arguments', array(
'name' => array(
'default_action' => 'ignore',
'style_plugin' => 'default_summary',
'style_options' => array(),
'wildcard' => 'all',
'wildcard_substitution' => 'All',
'title' => '',
'breadcrumb' => '',
'default_argument_type' => 'fixed',
'default_argument' => '',
'validate_type' => 'none',
'validate_fail' => 'not found',
'glossary' => 0,
'limit' => '0',
'case' => 'none',
'path_case' => 'lower',
'transform_dash' => 1,
'add_table' => 0,
'require_value' => 0,
'id' => 'name',
'table' => 'term_data',
'field' => 'name',
'validate_user_argument_type' => 'uid',
'validate_user_roles' => array(
'2' => 0,
'4' => 0,
'3' => 0,
'5' => 0,
),
'relationship' => 'none',
'default_options_div_prefix' => '',
'default_argument_fixed' => '',
'default_argument_user' => 0,
'default_argument_php' => '',
'validate_argument_node_type' => array(
'webform' => 0,
'blog' => 0,
'cablecast_show' => 0,
'cablecast_schedule_event' => 0,
'product' => 0,
'class' => 0,
'community_calendar_event' => 0,
'image' => 0,
'page' => 0,
'profile' => 0,
'story' => 0,
),
'validate_argument_node_access' => 0,
'validate_argument_nid_type' => 'nid',
'validate_argument_vocabulary' => array(
'13' => 0,
'1' => 0,
),
'validate_argument_type' => 'tid',
'validate_argument_transform' => 0,
'validate_user_restrict_roles' => 0,
'validate_argument_php' => '',
),
));
$handler->override_option('filters', array(
'status' => array(
'operator' => '=',
'value' => '1',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'status',
'table' => 'node',
'field' => 'status',
'relationship' => 'none',
),
'type' => array(
'operator' => 'in',
'value' => array(
'cablecast_schedule_event' => 'cablecast_schedule_event',
),
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'id' => 'type',
'table' => 'node',
'field' => 'type',
'relationship' => 'none',
),
'nid_php' => array(
'operator' => 'OR',
'value' => '$nids = array();
if($_GET["schedule_date"]) {
$date = strtotime($_GET["schedule_date"]);
}
else {
$date = time();
}
$schedule_start = strtotime(date("Y-m-d\\T00:00:00", $date));
$schedule_end = strtotime(date("Y-m-d\\T23:59:59", $date));
$schedule_result = db_query("SELECT nid FROM cablecast_schedule_event WHERE (start_time >= %d) AND (start_time < %d)", $schedule_start, $schedule_end);
while($schedule_row = db_fetch_array($schedule_result)) {
$nids[] = $schedule_row[\'nid\'];
}
return $nids;',
'group' => '0',
'exposed' => FALSE,
'expose' => array(
'operator' => FALSE,
'label' => '',
),
'handler' => 'php',
'id' => 'nid_php',
'table' => 'node',
'field' => 'nid_php',
'relationship' => 'none',
),
));
$handler->override_option('access', array(
'type' => 'none',
));
$handler->override_option('cache', array(
'type' => 'none',
));
$handler->override_option('header', '<?php
$date = $_GET["schedule_date"] ? strtotime($_GET["schedule_date"]) : time();
echo "<h1>".date(\'l jS \\of F Y \', $date)."</h1>";
?>');
$handler->override_option('header_format', '5');
$handler->override_option('header_empty', 0);
$handler->override_option('items_per_page', 0);
$handler->override_option('style_plugin', 'table');
$handler = $view->new_display('page', 'Page', 'page_1');
$handler->override_option('path', 'schedule/%');
$handler->override_option('menu', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
$handler->override_option('tab_options', array(
'type' => 'none',
'title' => '',
'description' => '',
'weight' => 0,
'name' => 'navigation',
));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment