$row, 'class' => 'formgroup'); $class = 'formgroup' . (!empty($form['#attributes']['class']) ? ' ' . $form['#attributes']['class'] : ''); if (!empty($form['#title'])) { $output .= ''; } return $output; } function theme_datetime($element) { return theme('form_element', $element, '
'. $element['#children'] .'
'); } function theme_dateext($element) { return theme('form_element', $element, '
'. $element['#children'] .'
'); } function theme_storm_list_report($header, $rows, $title, $footer) { $css_all_file = drupal_get_path('module', 'storm') .'/storm_list_report_all.css'; $query_string = '?'. drupal_substr(variable_get('css_js_query_string', '0'), 0, 1); $o = "\n"; $o .= ''; $o .= ''; $o .= ''. (drupal_get_title() ? strip_tags(drupal_get_title()) : variable_get('site_name', 'Drupal')) .''; $o .= ''; $o .= ''; $o .= ''; $o .= ''; $o .= ''; $o .= ''; $o .= '
'; $o .= '
'. variable_get('site_name', '') .'
'; $o .= '
'. variable_get('site_slogan', '') .'
'; $o .= '
'. variable_get('storm_report_header', '') .'
'; $o .= '
'. $title .'
'; $o .= '
'; $o .= theme('table', $header, $rows); $o .= '
'; $o .= ''; $o .= ''; $o .= ''; return $o; } function theme_storm_report($header, $content, $title, $footer, $headtitle='') { $css_all_file = drupal_get_path('module', 'storm') .'/storm_report_all.css'; $query_string = '?'. drupal_substr(variable_get('css_js_query_string', '0'), 0, 1); $o = "\n"; $o .= ''; $o .= ''; $o .= ''. ($headtitle ? strip_tags($headtitle) : $title) .''; $o .= ''; $o .= ''; $o .= ''; $o .= ''; $myorg = node_load(variable_get('storm_organization_nid', 0)); $o .= ''; $o .= ''; $o .= '
'; $o .= '
'. variable_get('site_name', '') .'
'; $o .= '
'. variable_get('site_slogan', '') .'
'; $o .= '
'. variable_get('storm_report_header', '') .'
'; $o .= '
'. $title .'
'; $o .= '
'; $o .= $content; $o .= '
'; $o .= ''; $o .= ''; $o .= ''; return $o; } function theme_storm_view_item($label, $value) { global $language; if (!empty($label)) { $o = '
' . $label . ':
'; } if (empty($value) || (preg_match('/^<\/a>$/i', $value))) { /* || ($value == '') || ($value == '') || ($value == '')) { */ $value = ' '; } $o .= '
' . $value . '
'; return $o; } function theme_storm_dashboard($link_blocks) { $content = '
'; if (!empty($link_blocks)) { $content .= '
'; foreach ($link_blocks as $block_id => $link_block_array) { $content .= '
'; if (!empty($link_block_array)) { foreach ($link_block_array as $key => $link_array) { if (!empty($link_array['theme'])) { $content .= theme($link_array['theme'], $link_array); } else { $content .= theme('storm_dashboard_link', $link_array); } } } $content .= '
'; } $content .= '
'; } else { # $content .= t('No dashboard links available'); $content .= ''; } $content .= '
'; return $content; } function theme_storm_dashboard_block($link_blocks) { $content = '
'; if (!empty($link_blocks)) { foreach ($link_blocks as $block_id => $link_block_array) { if (!empty($link_block_array)) { foreach ($link_block_array as $key => $link_array) { if (!empty($link_array['theme'])) { $content .= theme($link_array['theme'], $link_array); } else { $content .= theme('storm_dashboard_link', $link_array); } } } } } else { // no links, hide block return ''; } $content .= '
'; return $content; } function theme_storm_dashboard_link($link_array) { $content = ''; // DEFAULT ICON if (empty($link_array['icon'])) { $dt_id = 'stormexpense-item'; } else { $dt_id = $link_array['icon']; } $params = array(); if (!empty($link_array['nid'])) { $params_key = $link_array['node_type'] .'_nid'; $params['query'] = array($params_key => $link_array['nid']); } $link = l($link_array['title'], $link_array['path'], $params); // ADD PLUS SIGN (node/add) if (!empty($link_array['add_type'])) { $item = new stdClass(); $item->type = $link_array['add_type']; if (empty($link_array['params'])) { $link_array['params'] = array(); } $link .= storm_icon_add('node/add/'. str_replace('_', '-', $link_array['add_type']), $item, $link_array['params']); } if (empty($link_array['nid']) || 0 == $link_array['nid']) { if (variable_get('storm_icons_display', TRUE)) { $content .= '
'; } else { $content .= '
'; } $content .= $link; $content .= '
'; } else { $content = array( '#prefix' => variable_get('storm_icons_display', TRUE) ? '
' : '
', '#suffix' => '
', '#value' => $link, '#weight' => $link_array['weight'], ); } return $content; } function theme_storm_dashboard_links_weight_table($form = array()) { $type = $form['#infix']; $rows = array(); foreach ($form as $id => &$value) { if ($id[0] == '#') { continue; } $value[$type .'_storm_dashboard_link_weight_'. $id]['#attributes']['class'] = $type .'dashboard-link-table-weight'; $row = array(); $row[] = $value['#value']; $row[] = drupal_render($value[$type .'_storm_dashboard_link_active_'. $id]); $row[] = drupal_render($value[$type .'_storm_dashboard_link_weight_'. $id]); unset($value['#value']); if (!empty($row)) { $rows[] = array( 'data' => $row, 'class' => 'draggable', ); } } $headers = array(t('Link'), t('Active'), t('Weight')); $output = theme('table', $headers, $rows, array('id' => $type .'dashboard-link-table')); drupal_add_tabledrag($type .'dashboard-link-table', 'order', 'sibling', $type .'dashboard-link-table-weight'); $output .= drupal_render($form); return $output; } function theme_storm_link($source_module='', $destination_module='', $node_nid=0, $weight=0) { switch ($source_module) { case "stormorganization": $params_key = 'organization_nid'; break; case "stormproject": $params_key = 'project_nid'; break; case "stormtask": $params_key = 'task_nid'; break; case "stormticket": $params_key = 'ticket_nid'; break; } switch ($destination_module) { case "stormattribute": $user_access_check = 'Storm: access administration pages'; $list_text = t('Attributes'); $list_path = 'attributes'; $add_icon_type = 'stormattribute'; $add_path = 'attributes/add'; $dt_id = 'stormattributes'; break; case "stormconfiguration": $user_access_check = 'Storm: access administration pages'; $list_text = t('Configuration'); $list_path = 'admin/settings/storm'; $add_icon_type = ''; $add_path = ''; $dt_id = 'stormconfiguration'; break; case "stormdok": $user_access_check = 'Storm dok: access'; $list_text = t('Doks'); $list_path = 'doks'; $add_icon_type = 'stormdok'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormdok-item'; break; case "stormevent": $user_access_check = 'Storm event: access'; $list_text = t('Events'); $list_path = 'events'; $add_icon_type = 'stormevent'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormevent-item'; break; case "stormexpense": $user_access_check = 'Storm expense: access'; $list_text = t('Expenses'); $list_path = 'expenses'; $add_icon_type = 'stormexpense'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormexpense-item'; break; case "storminvoice": $user_access_check = 'Storm invoice: access'; $list_text = t('Invoices'); $list_path = 'invoices'; $add_icon_type = 'storminvoice'; $add_path = 'node/add/'. $destination_module; $dt_id = 'storminvoice-item'; break; case "stormnote": $user_access_check = 'Storm note: access'; $list_text = t('Notes'); $list_path = 'notes'; $add_icon_type = 'stormnote'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormnote-item'; break; case "stormorganization": $user_access_check = 'Storm organization: access'; $list_text = t('Organizations'); $list_path = 'organizations'; $add_icon_type = 'stormorganization'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormorganization-item'; break; case "stormperson": $user_access_check = 'Storm person: access'; $list_text = t('People'); $list_path = 'people'; $add_icon_type = 'stormperson'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormperson-item'; break; case "stormproject": $user_access_check = 'Storm project: access'; $list_text = t('Projects'); $list_path = 'projects'; $add_icon_type = 'stormproject'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormproject-item'; break; case "stormtask": $user_access_check = 'Storm task: access'; $list_text = t('Tasks'); $list_path = 'tasks'; $add_icon_type = 'stormtask'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormtask-item'; break; case "stormteam": $user_access_check = 'Storm team: access'; $list_text = t('Teams'); $list_path = 'teams'; $add_icon_type = 'stormteam'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormteam-item'; break; case "stormticket": $user_access_check = 'Storm ticket: access'; $list_text = t('Tickets'); $list_path = 'tickets'; $add_icon_type = 'stormticket'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormticket-item'; break; case "stormtimetracking": $user_access_check = 'Storm timetracking: access'; $list_text = t('Timetrackings'); $list_path = 'timetrackings'; $add_icon_type = 'stormtimetracking'; $node_links_key = 'timetrackings'; $add_path = 'node/add/'. $destination_module; $dt_id = 'stormtimetracking-item'; break; } if (($destination_module=='stormconfiguration' && user_access($user_access_check)) || (module_exists($destination_module) && user_access($user_access_check))) { if ($node_nid == 0) { $params = array(); } else { $params = array('query' => array($params_key => $node_nid)); } $v = l($list_text, $list_path, $params); if (!$add_icon_type=='') { $i = new stdClass(); $i->type = $add_icon_type; if ($node_nid == 0) { $params = $_GET; } else { if ($i->type == 'stormtask') { $i->project_nid = $node_nid; } $params = $_GET; $params[$params_key] = $node_nid; } $nmb_itms = _storm_number_of_items($source_module, $destination_module, $node_nid); $nmb_itms = theme('storm_number_items', $nmb_itms); $v .= $nmb_itms . storm_icon_add($add_path, $i, $params); } if ($node_nid == 0) { $r = variable_get('storm_icons_display', TRUE) ? '
' : '
'; $r .= $v; $r .= '
'; } else { $r = array( '#prefix' => variable_get('storm_icons_display', TRUE) ? '
' : '
', '#suffix' => '
', '#value' => $v, '#weight' => $weight, ); } return $r; } } function theme_storm_number_items($number) { $content = ''; if ($number !== '' && $number > 0) { $content .= '('. $number .')'; } return $content; } function theme_storm_attribute_list($form) { drupal_add_tabledrag('attributes', 'order', 'sibling', 'attribute-weight'); $header = array(); $row = array(); $rows = array(); $header = $form['header']['#value']; unset($form['header']); if (isset($form['attributes'])) { foreach (element_children($form['attributes']) as $key) { $form['attributes'][$key]['attribute_weight_'. $key]['#attributes']['class'] = 'attribute-weight'; $domain = check_markup(drupal_render($form['attributes'][$key]['attribute_domain_'. $key])); $isdefault = $form['attributes'][$key]['attribute_default_'. $key]['#default_value']; if ($isdefault) { $ischecked = 'checked="checked"'; } else { $ischecked = ''; } $domain_name = 'attribute_default_'. str_replace(' ', '|', $domain); $default_ctl = ''; $data = array( $domain, check_markup(drupal_render($form['attributes'][$key]['attribute_akey_'. $key])), check_markup(drupal_render($form['attributes'][$key]['attribute_avalue_'. $key])), drupal_render($form['attributes'][$key]['attribute_isactive_'. $key]), $default_ctl, drupal_render($form['attributes'][$key]['attribute_weight_'. $key]), array( 'data' => drupal_render($form['attributes'][$key]['attribute_operations_'. $key]), 'class' => 'storm_list_operations', ), ); $row['data'] = $data; $row['class'] = empty($row['class']) ? 'draggable' : $row['class'] .' draggable'; $rows[] = $row; } } $o = theme('table', $header, $rows, array('id' => 'attributes')); return $o; } function theme_storm_notify_admin_users($form) { // Theme the admin user settings form in a table format. $output = drupal_render($form['info']); $header = array(t('Username'), t('E-mail address'), t('Content'), t('Comment'), t('Failed attempts')); $rows = array(); foreach (element_children($form['users']) as $uid) { $row = array(); foreach (element_children($form['users'][$uid]) as $entry_key) { unset($form['users'][$uid][$entry_key]['#title']); $row[] = drupal_render($form['users'][$uid][$entry_key]); } $rows[] = $row; } if (!$rows) { $rows[] = array(array('data' => t('No users have notifications enabled.'), 'colspan' => 6)); } $output .= theme('table', $header, $rows); $output .= drupal_render($form); return $output; }