| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 3 // $Id: station_archive.views.inc,v 1.1 2009/11/28 20:55:19 drewish Exp $ 4 5 /** 6 * Implementation of hook_views_data(). 7 */ 8 function station_archive_views_data() { 9 $data['station_archive_item']['table']['group'] = t('Station Archive'); 10 $data['station_archive_item']['table']['join'] = array( 11 'node' => array( 12 'left_field' => 'nid', 13 'field' => 'audio_nid' 14 ), 15 ); 16 17 $data['station_archive_item']['aired'] = array( 18 'title' => t('Air date'), 19 'help' => t('Date the audio was aired.'), 20 'field' => array( 21 'click sortable' => TRUE, 22 'handler' => 'views_handler_field_date', 23 ), 24 ); 25 $data['station_archive_item']['imported'] = array( 26 'title' => t('Import date'), 27 'help' => t('Date the audio was imported into the station archive.'), 28 'field' => array( 29 'sortable' => TRUE, 30 'handler' => 'views_handler_field_date', 31 'option' => 'string', 32 ), 33 ); 34 $data['station_archive_item']['permanent'] = array( 35 'title' => t('Is in permanent archive'), 36 'help' => t('Is this audio node part of the permanent archive?'), 37 'field' => array( 38 'handler' => 'views_handler_field_boolean', 39 'click sortable' => TRUE, 40 ), 41 'filter' => array( 42 'handler' => 'views_handler_filter_boolean_operator', 43 'label' => t('Is permanent'), 44 'type' => 'yes-no', 45 ), 46 ); 47 $data['station_archive_item']['program_nid'] = array( 48 'title' => t('Program Nid'), 49 'help' => t("The program node id that the audio is a recording of."), 50 'field' => array( 51 'handler' => 'views_handler_field_numeric', 52 'sortable' => TRUE, 53 ), 54 'argument' => array( 55 'handler' => 'views_handler_argument_numeric', 56 ), 57 'relationship' => array( 58 'title' => t('Program'), 59 'help' => t('Add a relationship to gain access to data about the program the audio is a recording of. Note: this relationship only works if the archive and schedule are on the same site.'), 60 'base' => 'node', 61 'base field' => 'nid', 62 'relationship table' => 'station_archive_item', 63 'relationship field' => 'program_nid', 64 'handler' => 'views_handler_relationship', 65 'label' => t("Archived audio's program"), 66 ), 67 ); 68 69 70 $data['station_archive_program']['table']['group'] = t('Station Archive'); 71 $data['station_archive_program']['table']['join'] = array( 72 'station_archive_item' => array( 73 'table' => 'station_archive_program', 74 'left_field' => 'program_nid', 75 'field' => 'program_nid', 76 ), 77 ); 78 $data['station_archive_program']['title'] = array( 79 'title' => t('Program title'), 80 'help' => t('The program that this audio is a recording of.'), 81 'field' => array( 82 'handler' => 'views_handler_field', 83 'sortable' => TRUE, 84 ), 85 ); 86 return $data; 87 } 88 89 /** 90 * Implementation of hook_views_handlers(). 91 */ 92 //function station_archive_views_handlers() { 93 // return array( 94 // 'info' => array( 95 // 'path' => drupal_get_path('module', 'station_archive') . '/views', 96 // ), 97 // 'handlers' => array( 98 // // Field handlers 99 // 'station_schedule_handler_field_streams' => array( 100 // 'parent' => 'views_handler_field', 101 // ), 102 // ), 103 // ); 104 //} 105 106 // TODO port this to a views2 field handler: 107 function station_archive_handler_audio_program_title_field($fieldinfo, $fielddata, $value, $data) { 108 $schedule = station_default_schedule(); 109 if ($fielddata['options'] == 'link' && isset($schedule['base_url']) && !empty($data->station_archive_program_program_nid)) { 110 return l($value, $schedule['base_url'] .'/node/'. $data->station_archive_program_program_nid); 111 } 112 return check_plain($value); 113 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Mar 24 11:18:33 2011 | Cross-referenced by PHPXref 0.7 |