| 1 |
<?php |
<?php |
| 2 |
// $Id: transcription.module,v 1.8 2008/11/12 15:14:55 grndlvl Exp $ |
// $Id: transcription.module,v 1.9 2008/11/19 17:14:37 grndlvl Exp $ |
| 3 |
|
|
| 4 |
// Initial code by Jonathan DeLaigle (grndlvl). |
// Initial code by Jonathan DeLaigle (grndlvl). |
| 5 |
// Modified by Aaron Winborn for the Media Transcriptions module. |
// Modified by Aaron Winborn for the Media Transcriptions module. |
| 18 |
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'transcription' && !is_null(arg(3))) { |
if (arg(0) == 'node' && is_numeric(arg(1)) && arg(2) == 'transcription' && !is_null(arg(3))) { |
| 19 |
$node = node_load(arg(1)); |
$node = node_load(arg(1)); |
| 20 |
if ($node->nid) { |
if ($node->nid) { |
| 21 |
$items[] = array('path' => 'node/'. arg(1) .'/transcription/'. arg(3), 'title' => t('View'), |
$items[] = array('path' => 'node/'. arg(1) .'/transcription/'. arg(3), 'title' => t('Transcription'), |
| 22 |
'callback' => 'transcription_handler', |
'callback' => 'transcription_handler', |
| 23 |
'callback arguments' => array($node, arg(3)), |
'callback arguments' => array($node, arg(3)), |
| 24 |
'access' => node_access('view', $node), |
'access' => node_access('view', $node), |
| 40 |
break; |
break; |
| 41 |
} |
} |
| 42 |
} |
} |
| 43 |
|
if (!empty($transcription_field)) { |
| 44 |
|
$handlers = module_invoke_all('transcription_type', $type, $transcription_field, $node); |
| 45 |
|
if (empty($handlers[$type])) { |
| 46 |
|
$default_handler = transcription_default_type($type, $transcription_field, $node); |
| 47 |
|
$output = $default_handler[$type]; |
| 48 |
|
} |
| 49 |
|
else { |
| 50 |
|
$output = $handlers[$type]; |
| 51 |
|
} |
| 52 |
|
|
| 53 |
$handlers = module_invoke_all('transcription_type', $type, $transcription_field, $node); |
print $output; |
| 54 |
if (empty($handlers[$type])) { |
exit; |
|
$default_handler = transcription_default_type($type, $transcription_field, $node); |
|
|
$output = $default_handler[$type]; |
|
| 55 |
} |
} |
| 56 |
else { |
return t('There are no transcription fields assigned to this node.'); |
|
$output = $handlers[$type]; |
|
|
} |
|
|
|
|
|
print $output; |
|
|
exit; |
|
| 57 |
} |
} |
| 58 |
|
|
| 59 |
function transcription_default_type($type, $transcriptions, $node) { |
function transcription_default_type($type, $transcriptions, $node) { |