| 1 |
<?php |
<?php |
| 2 |
// $Id: storm.module,v 1.8 2008/06/11 12:49:39 robertogerola Exp $ |
// $Id: storm.module,v 1.9 2008/06/23 16:46:34 robertogerola Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 72 |
); |
); |
| 73 |
} |
} |
| 74 |
|
|
| 75 |
|
function storm_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) { |
| 76 |
|
switch ($op) { |
| 77 |
|
case 'view': |
| 78 |
|
global $user; |
| 79 |
|
if (!node_access('view', $node, $user)) { |
| 80 |
|
$node=NULL; |
| 81 |
|
} |
| 82 |
|
break; |
| 83 |
|
} |
| 84 |
|
} |
| 85 |
|
|
| 86 |
function storm_storm() { |
function storm_storm() { |
| 87 |
$o = '<dl>'; |
$o = '<dl>'; |
| 88 |
foreach (module_invoke_all('storm_indexpage') as $key => $content) { |
foreach (module_invoke_all('storm_indexpage') as $key => $content) { |
| 95 |
function storm_admin_settings() { |
function storm_admin_settings() { |
| 96 |
$form = array(); |
$form = array(); |
| 97 |
|
|
| 98 |
$form['storm_report_header'] = array( |
$form['storm_icons_dir'] = array( |
| 99 |
|
'#type' => 'textfield', |
| 100 |
|
'#title' => t('Icons directory'), |
| 101 |
|
'#default_value' => variable_get('storm_icons_path', drupal_get_path('module', 'storm') .'/icons'), |
| 102 |
|
'#description' => t("The directory that contains the Storm's icons"), |
| 103 |
|
'#weight' => -11, |
| 104 |
|
); |
| 105 |
|
|
| 106 |
|
$form['stormreports'] = array( |
| 107 |
|
'#type' => 'fieldset', |
| 108 |
|
'#title' => t('Reports'), |
| 109 |
|
'#collapsed' => false, |
| 110 |
|
'#collapsible' => true, |
| 111 |
|
'#weight' => -10, |
| 112 |
|
); |
| 113 |
|
|
| 114 |
|
$form['stormreports']['storm_report_header'] = array( |
| 115 |
'#type' => 'textarea', |
'#type' => 'textarea', |
| 116 |
'#title' => t('Report header'), |
'#title' => t('Report header'), |
| 117 |
'#default_value' => variable_get('storm_report_header', ''), |
'#default_value' => variable_get('storm_report_header', ''), |
| 118 |
'#description' => t('The header that will appear on the reports'), |
'#description' => t('The header that will appear on the reports'), |
|
'#weight' => -29, |
|
| 119 |
); |
); |
| 120 |
|
|
| 121 |
return system_settings_form($form); |
return system_settings_form($form); |
| 355 |
function storm_icon($icon, $title) { |
function storm_icon($icon, $title) { |
| 356 |
global $base_path; |
global $base_path; |
| 357 |
$icon = str_replace(' ', '_', $icon); |
$icon = str_replace(' ', '_', $icon); |
| 358 |
$img_src = $base_path . drupal_get_path('module', 'storm') .'/icons/'. $icon .'.png'; |
$img_src = $base_path . variable_get('storm_icons_path', drupal_get_path('module', 'storm') .'/icons') .'/'. $icon .'.png'; |
| 359 |
$o = '<img src="'. $img_src .'" alt="'. $title .'" title="'. $title .'" />'; |
$o = '<img src="'. $img_src .'" alt="'. $title .'" title="'. $title .'" />'; |
| 360 |
return $o; |
return $o; |
| 361 |
} |
} |