| [ Index ] |
PHP Cross Reference of Drupal 6 (gatewave) |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * Show a download link to an audio file 5 */ 6 class audio_handler_field_download_link extends views_handler_field { 7 function allow_advanced_render() { 8 return FALSE; 9 } 10 11 function option_definition() { 12 $options = parent::option_definition(); 13 $options['text'] = array('default' => 'Download', 'translatable' => TRUE); 14 return $options; 15 } 16 17 function options_form(&$form, &$form_state) { 18 parent::options_form($form, $form_state); 19 $form['text'] = array( 20 '#type' => 'textfield', 21 '#title' => t('Text to display'), 22 '#default_value' => $this->options['text'], 23 ); 24 } 25 26 function render($values) { 27 if (!empty($values->{$this->aliases['downloadable']}) && !empty($values->{$this->aliases['nid']}) && !empty($values->{$this->aliases['fid']})) { 28 $file = db_fetch_object(db_query("SELECT * FROM {files} WHERE fid=%d", $values->{$this->aliases['fid']})); 29 if (isset($file->filepath) && file_exists($file->filepath)) { 30 // iTunes and other podcasting programs check the url to determine the 31 // file type. we'll add the original file name on to the end. see issues 32 // #35398 and #68716 for more info. 33 return l($this->options['text'], 'audio/download/'. $values->{$this->aliases['nid']} .'/'. $file->filename, array('absolute' => TRUE)); 34 } 35 } 36 } 37 }
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 |