' . $vars['content_misc'] . '
TV

' . $vars['title'] . '
';
$vars['sidebar_right'] = FALSE;
$vars['title'] = NULL;
$vars['content'] = _phptemplate_callback('2_col_header', $vars);
if (arg(3) == 'results') $vars['title_element'] = 'TV guide search results';
if (arg(2) == 'tonight') $vars['title_element'] = 'Tonight\'s TV';
if (arg(2) == 'now') $vars['title_element'] = ' What\'s On TV right now';
$vars['meta_description'] = 'Comprehensive Brisbane TV Guide for all free-to-air and pay channels.';
/**********************************************
* News list
**********************************************/
} elseif (arg(2) == 'news' && arg(3) == '') {
$vars['title_element'] = 'TV news and celebrity gossip';
$vars['meta_keywords'] = 'TV,television,abc,sbs,seven,nine,ten,bris31,guide,programs,programmes,shows,gossip,hollywood,celebrity';
$vars['meta_description'] = 'A roundup of the best and worst in TV and entertainment news and gossip from Australia and around the world.';
/**********************************************
* News detail
**********************************************/
} elseif ($node->type == 'movietv_news') {
$vars['movie_image'] = ob_get_movie_image($node->field_media_filename[0]['value'], '', '300x100_tv_generic.jpg');
$vars['title_element'] = 'TV news and celebrity gossip: ' . $node->title;
$vars['content'] = _phptemplate_callback('detail_news', $vars);
/**********************************************
* Highlight detail
**********************************************/
} elseif ($node->field_highlight[0]['value'] == 1) {
$vars['movie_image'] = ob_get_movie_image($node->field_media_filename[0]['value'], '', '300x100_tv_generic.jpg');
$vars['title_element'] = 'TV highlights: ' . $node->title;
$vars['content'] = _phptemplate_callback('detail_news', $vars);
/**********************************************
* All other
**********************************************/
} else {
$vars['content'] = _phptemplate_callback('2_col_content', $vars);
}
}
if ((arg(1) == 'events' || strpos($vars[node]->path, 'whats-on/events') !== false)) {
$vars['ob_custom_header'] = '
EVENTS

';
$vars['title_element'] = 'Events date and information';
$vars['meta_keywords'] = 'Events';
$vars['meta_description'] = 'Dates and information for all Brisbane events.';
/**********************************************
* Event list
**********************************************/
if ($node->path == 'whats-on/events/titles/all') {
$vars['title_element'] = 'Events - events happening around Brisbane';
$vars['meta_description'] = 'Information and dates for events happening across Brisbane right now.';
}
/**********************************************
* Event detail
**********************************************/
if ($node->type == 'event') {
$vars = array_merge($vars, prepare_event($node, 'page'));
$vars['content'] = _phptemplate_callback('detail_event', $vars);
}
/**********************************************
* All other
**********************************************/
else {
$vars['content'] = _phptemplate_callback('2_col_content_events', $vars);
}
}
// Page code has finished, last calls
$vars['ob_inline_css'] = ob_prepare_inline_css(ob_set_inline_css());
break;
case 'node':
switch ($node->type) {
case 'movietv_news':
$vars = array(
'description' => $node->content['body']['#value']
);
break;
case 'movie':
$vars = prepare_movie($node, 'node');
break;
case 'tv':
$vars = prepare_tv($node, 'node');
break;
case 'event':
$vars = prepare_event($node, 'node');
break;
}
break;
}
return $vars;
//}
function ob_get_movie_image($image, $size = '', $alt) {
if ($image == '') {
//if ($size == 'thumb') $image_path = path_to_theme() . '/images/' . $alt;
//else $image_path = path_to_theme() . '/images/350x100_movie_generic.jpg';
} elseif ($size == 'thumb') {
$image_path = TVMOVIES_IMAGE_THUMB_DIRECTORY . $image;
} else {
$image_path = TVMOVIES_IMAGE_MEDIUM_DIRECTORY . $image;
}
if (!file_exists($image_path)) $image_path = path_to_theme() . '/images/' . $alt;
return $image_path;
}
/**
* Set inline CSS
*
* Gathers inline CSS during page
* creation in a static variable
*
* @param $data
* A new snippet of CSS to be included in the
* individual page
* @return
* All gathered CSS or FALSE
*/
function ob_set_inline_css($data = NULL) {
static $ob_stored_inline_css;
if (!is_null($data)) {
$ob_stored_inline_css .= $data ."\n";
}
return $ob_stored_inline_css;
}
/**
* Prepare inline CSS
*
* Wraps the custom ob CSS into style sheet
* and CDATA tags for embedding in the page
*
* @param $css
* The CSS gathered across the page cycle
* @return
* The complete style block or FALSE
*/
function ob_prepare_inline_css($css = FALSE) {
$output = '';
if ($css) {
$output .= ''."\n";
return $output;
}
else return false;
}
/**
* Prepare movie detail data
*
* @param $node
* The movie node object
* @param $op
* The operation required (page or node)
* @return
* The template vars
*/
function prepare_movie($node, $op) {
switch ($op) {
case 'node':
$tax_terms = taxonomy_node_get_terms($node->nid);
$tax_list = '';
if (count($tax_terms) > 0) {
$tax_list .= "
\n";
foreach($tax_terms as $v) $tax_list .= '- ' . $v->name . '
';
$tax_list .= "
\n";
}
$vars = array(
'description' => $node->field_short_description[0]['value'],
'tax_terms' => $tax_list,
'release_date' => mysql_date_to_timestamp($node->field_movie_release_date[0]['value']),
'title_id' => $node->field_title_id[0]['value'],
);
unset($tax_list);
break;
case 'page':
$vars = array(
'movie_image' => ob_get_movie_image($node->field_media_filename[0]['value'], '', '300x100_movie_generic.jpg'),
'title_element' => 'Movie review: ' . $node->title,
'meta_keywords' => 'Movies,cinema,theatre,' . $node->title . ',' .
$node->field_main_cast[0]['value'] .
',' . $node->field_director[0]['value'] . ',review,release',
'meta_description' => 'Information and review of the movie \'' . $node->title . '\' playing at cinemas in Brisbane right now.',
'director' => $node->field_director[0]['value'],
'main_cast' => $node->field_main_cast[0]['value'],
'duration' => $node->field_duration[0]['value'],
'imdb_id' => $node->field_imdb_id[0]['value'],
'description' => $node->field_short_description[0]['value'],
'tax_terms' => $tax_list,
'release_date' => mysql_date_to_timestamp($node->field_movie_release_date[0]['value']),
'title_id' => $node->field_title_id[0]['value'],
);
$vars['official_site'] = ($node->field_url_0[0]['value']) ? l('Link', $node->field_url_0[0]['value']) : FALSE;
break;
}
return $vars;
}
/**
* Prepare TV detail data
*
* @param $node
* The tv node object
* @param $op
* The operation required (page or node)
* @return
* The template vars
*/
function prepare_tv($node, $op) {
switch ($op) {
case 'node':
$vars = array(
'channel' => $node->field_channel_abbrev[0]['value'],
'title' => $node->title,
'episode_name' => $node->field_episode_name[0]['value'],
'tax_terms' => taxonomy_node_get_terms($node->nid),
'tax_links' => taxonomy_link('taxonomy terms', $node),
'year_released' => $node->field_year_released[0]['value'],
'consumer_advice' => $node->field_consumer_advice[0]['value'],
'duration' => t("!time minutes", array('!time' => $node->field_duration[0]['value'])),
'director' => $node->field_director[0]['value'],
'description' => strip_tags($node->content['body']['#value']),
'cast' => $node->field_main_cast[0]['value'],
);
$vars['start_timestamp'] = mysql_date_to_timestamp($node->field_program_date[0]['value'] ."T". $node->field_program_time[0]['value'].":00");
// $vars['start_timestamp'] = $node->field_program_datetime[0]['value'];
// $vars['end_timestamp'] = (int) $node->field_duration[0]['value'] * 60 + $vars['start_timestamp'];
$vars['start_date'] = format_date($vars['start_timestamp'], 'large');
// $vars['start_time'] = date("g:i a", $vars['start_timestamp']);
// $vars['end_date'] = date("l, j F, Y", $vars['end_timestamp']);
// $vars['end_time'] = date("g:i a", $vars['end_timestamp']);
$tmp = array();
if ($node->field_country[0]['value']) {
$tmp[] = $node->field_country[0]['value'];
}
if ($node->field_language[0]['value']) {
$tmp[] = $node->field_language[0]['value'];
}
if (count($tmp > 0)) {
$vars['country'] = implode("/", $tmp);
}
unset($tmp);
foreach ($vars['tax_terms'] as $v) $tmp[] = $v->name;
$vars['tax_terms'] = implode(", ", $tmp);
unset($tmp);
foreach ($vars['tax_links'] as $v) $tmp[] = l($v['title'], $v['href']);
$vars['tax_links'] = implode(", ", $tmp);
unset($tmp);
// Set these vars if called using ajax (i.e. jTip)
if (stristr(arg(2), "xml")) {
$vars['xml'] = 1;
$vars['page'] = 1;
$vars['description'] = $node->body;
}
break;
case 'page':
// Not implemented
break;
}
return $vars;
}
/**
* Prepare event detail data
*
* @param $node
* The event node object
* @param $op
* The operation required (page or node)
* @return
* The template vars
*/
function prepare_event($node, $op) {
switch ($op) {
case 'node':
$tax_terms = taxonomy_node_get_terms($node->nid);
$tax_list = '';
if (count($tax_terms) > 0) {
$tax_list .= "
\n";
foreach($tax_terms as $v) $tax_list .= '- ' . $v->name . '
';
$tax_list .= "
\n";
}
$vars = array(
'tax_terms' => $tax_list,
/*'release_date' => $node->field_release_date[0]['value'],
'title_id' => $node->field_title_id[0]['value'],*/
);
unset($tax_list);
break;
case 'page':
$vars = array(
/*'movie_image' => ob_get_movie_image($node->field_media_filename[0]['value'], '', '300x100_movie_generic.jpg'),
'title_element' => 'Movie review: ' . $node->title,
'meta_keywords' => 'Movies,cinema,theatre,' . $node->title . ',' .
$node->field_main_cast[0]['value'] .
',' . $node->field_director[0]['value'] . ',review,release',
'meta_description' => 'Information and review of the movie \'' . $node->title . '\' playing at cinemas in Brisbane right now.',
'director' => $node->field_director[0]['value'],
'main_cast' => $node->field_main_cast[0]['value'],
'duration' => $node->field_duration[0]['value'],
'imdb_id' => $node->field_imdb_id[0]['value'],
'description' => $node->field_short_description[0]['value'],*/
'tax_terms' => $tax_list,
/*'release_date' => $node->field_release_date[0]['value'],
'title_id' => $node->field_title_id[0]['value'],*/
);
/*$vars['official_site'] = ($node->field_url_0[0]['value']) ? l('Link', $node->field_url_0[0]['value']) : FALSE;*/
break;
}
return $vars;
}
/**
* Gets the ID of a menu by supplying the name
* @param menu name
* @return menu id
*/
function get_menu_id($menu_name) {
$menus = menu_get_root_menus();
foreach ($menus as $id => $name) {
if (strtolower($name) == strtolower($menu_name)): return $id; endif;
}
}
/**
* Reset the css file array
*/
function ob_reset_css($css) {
$new_css = array();
$theme_css = $css['all']['theme'];
$new_css['all']['theme'] = $theme_css;
return $new_css;
}
function mysql_date_to_timestamp($mysql) {
$datear1 = explode('T', $mysql);
$datear2 = explode('-', $datear1[0]);
$datear3 = explode(':', $datear1[1]);
$stamp = mktime($datear3[0], $datear3[1], $datear3[2], $datear2[1], $datear2[2], $datear2[0]);
return $stamp;
}
/**********************************************
* Override theme functions
**********************************************/
/**
* Formats a list of standard OB teasers
* @param teasers An array of teaser objects
* @return output A XHTML definition list
*/
function theme_ob_teasers($teasers, $date_prefix = '') {
$output = '
';
foreach ($teasers as $teaser) {
$url = url('node/' . $teaser->nid);
$output .= ' - ';
if ($path = ob_get_movie_image($teaser->image, 'thumb', $teaser->image_alt)) {
$output .= theme('image', $path, 'Thumbnail for '. $teaser->title);
}
$output .= ''. $teaser->title .'
';
$output .= '- ';
if ($teaser->program_datetime) {
if (strrpos($teaser->program_datetime, "T") === FALSE || strrpos($teaser->program_datetime, "T00:00:00") == TRUE) {
$output .= '
'. $date_prefix . format_date(mysql_date_to_timestamp($teaser->program_datetime), 'custom', 'l, F j, Y') .'
';
}
else {
$output .= ''. $date_prefix . format_date(mysql_date_to_timestamp($teaser->program_datetime), 'large') .'
';
}
}
$output .= $teaser->description .' ';
}
$output .= '
';
return $output;
}
function theme_ob_teaser_slider($teasers) {
drupal_add_js(path_to_theme() . '/js/jquery.accessible-news-slider.js',1);
drupal_add_js('$(function() {$(".top_stories").slideNews();});','inline');
$output = '
Please Note: You may have disabled JavaScript and/or CSS. Although this news content will be accessible, certain functionality is unavailable.
Skip to news content.
';
foreach ($teasers as $teaser) {
$url = url('node/' . $teaser->nid);
$output .= '
';
}
$output .= '
';
return $output;
}