| 1 |
<?php |
<?php |
| 2 |
// $Id: station_schedule.views.inc,v 1.8 2009/09/21 17:43:32 drewish Exp $ |
// $Id: station_schedule.views.inc,v 1.9 2009/09/21 21:36:20 drewish Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* Implementation of hook_views_handlers(). |
* Implementation of hook_views_handlers(). |
| 44 |
'station_schedule_handler_filter_time' => array( |
'station_schedule_handler_filter_time' => array( |
| 45 |
'parent' => 'views_handler_filter_numeric', |
'parent' => 'views_handler_filter_numeric', |
| 46 |
), |
), |
| 47 |
|
'station_schedule_handler_filter_schedule_item' => array( |
| 48 |
|
'parent' => 'views_handler_filter_boolean_operator', |
| 49 |
|
), |
| 50 |
), |
), |
| 51 |
); |
); |
| 52 |
} |
} |
| 144 |
'help' => t("Items on the station's schedules."), |
'help' => t("Items on the station's schedules."), |
| 145 |
); |
); |
| 146 |
|
|
|
// For other base tables, explain how we join |
|
|
$data['station_schedule_item']['table']['join'] = array( |
|
|
'node' => array( |
|
|
'left_field' => 'nid', |
|
|
'field' => 'program_nid', |
|
|
), |
|
|
); |
|
|
|
|
| 147 |
// ---------------------------------------------------------------- |
// ---------------------------------------------------------------- |
| 148 |
// Fields |
// Fields |
| 149 |
$data['station_schedule_item']['iid'] = array( |
$data['station_schedule_item']['iid'] = array( |
| 260 |
); |
); |
| 261 |
|
|
| 262 |
return $data; |
return $data; |
| 263 |
|
} |
| 264 |
|
|
| 265 |
|
/** |
| 266 |
|
* Use views_data_alter to add relations from {node} to {schedule_items}. |
| 267 |
|
*/ |
| 268 |
|
function station_schedule_views_data_alter(&$data) { |
| 269 |
|
$data['node']['station_schedule_iid'] = array( |
| 270 |
|
'group' => t('Station Schedule'), |
| 271 |
|
'title' => t('Scheduled Programs'), |
| 272 |
|
'help' => t('All programs on this schedule.'), |
| 273 |
|
'real field' => 'nid', |
| 274 |
|
// 'field' => array( |
| 275 |
|
// 'handler' => 'views_handler_field_upload_fid', |
| 276 |
|
// ), |
| 277 |
|
'filter' => array( |
| 278 |
|
'handler' => 'station_schedule_handler_filter_schedule_item', |
| 279 |
|
'title' => t('Has scheduled programs'), |
| 280 |
|
'type' => 'yes-no', |
| 281 |
|
'label' => t('Has scheduled programs'), |
| 282 |
|
'help' => t('Only display schedules with programs. This can cause duplicates if there are multiple programs scheduled.'), |
| 283 |
|
), |
| 284 |
|
'relationship' => array( |
| 285 |
|
'title' => t('Scheduled Programs'), |
| 286 |
|
'help' => t('Add a relationship to gain access to data about the programs on a schedule. Note that this relationship will cause duplicate schedule nodes if there are multiple programs on the schedule.'), |
| 287 |
|
'relationship table' => 'node', |
| 288 |
|
'relationship field' => 'nid', |
| 289 |
|
'base' => 'station_schedule_item', |
| 290 |
|
'base field' => 'schedule_nid', |
| 291 |
|
'handler' => 'views_handler_relationship', |
| 292 |
|
'label' => t('Scheduled Programs'), |
| 293 |
|
), |
| 294 |
|
); |
| 295 |
|
$data['node']['station_program_iid'] = array( |
| 296 |
|
'group' => t('Station Program'), |
| 297 |
|
'title' => t('Program Schedule Times'), |
| 298 |
|
'help' => t('All the times this program is scheduled.'), |
| 299 |
|
'real field' => 'nid', |
| 300 |
|
// 'field' => array( |
| 301 |
|
// 'handler' => 'views_handler_field_upload_fid', |
| 302 |
|
// ), |
| 303 |
|
'filter' => array( |
| 304 |
|
'handler' => 'station_schedule_handler_filter_schedule_item', |
| 305 |
|
'title' => t('Is scheduled'), |
| 306 |
|
'type' => 'yes-no', |
| 307 |
|
'label' => t('Program is scheduled'), |
| 308 |
|
'help' => t('Only display programs that are on a schedule. This can cause duplicates if the schedule is on multiple schedules.'), |
| 309 |
|
), |
| 310 |
|
'relationship' => array( |
| 311 |
|
'title' => t('Program Scheduling'), |
| 312 |
|
'help' => t('Add a relationship to gain access to data about the times a program is scheduled. Note that this relationship will cause duplicate schedule nodes if the program is multiple slots or on multiple schedules.'), |
| 313 |
|
'relationship table' => 'node', |
| 314 |
|
'relationship field' => 'nid', |
| 315 |
|
'base' => 'station_schedule_item', |
| 316 |
|
'base field' => 'program_nid', |
| 317 |
|
'handler' => 'views_handler_relationship', |
| 318 |
|
'label' => t("Program's scheduling"), |
| 319 |
|
), |
| 320 |
|
); |
| 321 |
} |
} |