| 1 |
<?php // $Id: send.theme.inc,v 1.3 2009/05/22 15:21:56 vauxia Exp $ |
<?php // $Id: send.theme.inc,v 1.4 2009/05/22 17:18:35 vauxia Exp $ |
| 2 |
|
|
| 3 |
function send_theme_theme() { |
function send_theme_theme() { |
| 4 |
$path = drupal_get_path('module', 'send') .'/theme'; |
$path = drupal_get_path('module', 'send') .'/theme'; |
| 6 |
'send' => array( |
'send' => array( |
| 7 |
'arguments' => array( 'element' => NULL ), |
'arguments' => array( 'element' => NULL ), |
| 8 |
'file' => 'send.theme.inc', |
'file' => 'send.theme.inc', |
| 9 |
|
'template' => 'send', |
| 10 |
|
'path' => $path, |
| 11 |
|
), |
| 12 |
|
'send_element' => array( |
| 13 |
|
'arguments' => array( 'element' => NULL ), |
| 14 |
|
'file' => 'send.theme.inc', |
| 15 |
'path' => $path, |
'path' => $path, |
| 16 |
), |
), |
| 17 |
'send_template' => array( |
'send_template' => array( |
| 29 |
'file' => 'send.theme.inc', |
'file' => 'send.theme.inc', |
| 30 |
'path' => $path, |
'path' => $path, |
| 31 |
), |
), |
| 32 |
|
'send_draggable' => array( |
| 33 |
|
'arguments' => array( 'element' => array() ), |
| 34 |
|
'file' => 'send.theme.inc', |
| 35 |
|
'path' => $path, |
| 36 |
|
), |
| 37 |
); |
); |
| 38 |
} |
} |
| 39 |
|
|
| 40 |
|
function send_preprocess(&$variables, $hook) { |
| 41 |
|
$variables['from'] = $variables['element']['from']['#children']; |
| 42 |
|
$variables['to'] = $variables['element']['to']['#children']; |
| 43 |
|
$variables['buttons'] = $variables['element']['buttons']['#children']; |
| 44 |
|
$variables['message'] = $variables['element']['message']['#children']; |
| 45 |
|
//$variables['extra'] = drupal_render($variables['element']); |
| 46 |
|
} |
| 47 |
|
|
| 48 |
/** |
/** |
| 49 |
* The default theme function for a "send" element. |
* The default theme function any other "send" element. |
| 50 |
*/ |
*/ |
| 51 |
function theme_send($element) { |
function theme_send_element(&$element) { |
| 52 |
$from = $element['from']['#children']; |
if ($output = drupal_render($element)) { |
| 53 |
$to = $element['to']['#children']; |
return theme('form_element', $element, $output); |
| 54 |
$buttons = $element['buttons']['#children']; |
} |
|
$message = $element['message']['#children']; |
|
|
$extra = $element['#children']; |
|
|
|
|
|
if ($from) { |
|
|
$headers = theme('table', array(t('From'), t('To')), array(array('data' => array($from, $to), 'valign' => 'top')), array('width' => '100%')); |
|
|
} |
|
|
else { |
|
|
$headers = $to; |
|
|
} |
|
|
|
|
|
$out = $headers .'<br class="clear" />'; |
|
|
if($extra) $out .= $extra . '<br class="clear" />'; |
|
|
$out .= $message; |
|
|
return $out; |
|
| 55 |
} |
} |
| 56 |
|
|
| 57 |
// TODO in use? |
// TODO in use? |
| 120 |
|
|
| 121 |
return $body; |
return $body; |
| 122 |
} |
} |
| 123 |
|
|
| 124 |
|
function theme_send_draggable($element) { |
| 125 |
|
$id = $element['#id'] .'-table'; |
| 126 |
|
|
| 127 |
|
$rows = array(); |
| 128 |
|
foreach (element_children($element) as $key) { |
| 129 |
|
$rows[] = array( |
| 130 |
|
'data' => array(drupal_render($element[$key])), |
| 131 |
|
'class' => 'draggable', |
| 132 |
|
); |
| 133 |
|
} |
| 134 |
|
|
| 135 |
|
drupal_add_tabledrag($id, 'order', 'sibling', $id .'-weight'); |
| 136 |
|
|
| 137 |
|
$output = theme('table', array(), $rows, array('id' => $id)); |
| 138 |
|
return $output; |
| 139 |
|
} |