You are here

function theme_casetracker_case_form_common in Case Tracker 6

Same name and namespace in other branches
  1. 7 casetracker.module \theme_casetracker_case_form_common()

Theme function for cleaning up the casetracker common form.

1 theme call to theme_casetracker_case_form_common()
casetracker_case_form_common in ./casetracker.module
Common form elements for cases, generic enough for use either in a full node display, or in comment displays and updating. Default values are calculated based on an existing $form['nid']['#value'].

File

./casetracker.module, line 813
Enables the handling of projects and their cases.

Code

function theme_casetracker_case_form_common($form) {
  drupal_add_css(drupal_get_path('module', 'casetracker') . '/casetracker.css');
  $output = '';
  $output .= drupal_render($form['pid']);
  $output .= drupal_render($form['case_title']);
  if ($form['assign_to']['#type'] == 'radios') {
    if ($form['assign_to']['#access']) {
      $header = array_fill(0, 5, array());
      $header[0] = $form['assign_to']['#title'];
      $radios = array();
      foreach (element_children($form['assign_to']) as $id) {
        $radios[] = drupal_render($form['assign_to'][$id]);
      }
      $radios = array_chunk($radios, 5);
      $output .= theme('table', $header, $radios, array(
        'class' => 'casetracker-assign-to',
      ));
    }
    drupal_render($form['assign_to']);
  }
  else {
    $output .= drupal_render($form['assign_to']);
  }
  $row = array();
  foreach (element_children($form) as $id) {
    if (!in_array($id, array(
      'pid',
      'case_title',
      'assign_to',
    ))) {
      $row[] = drupal_render($form[$id]);
    }
  }
  $rows = array(
    $row,
  );
  $output .= theme('table', array(), $rows);
  $output .= drupal_render($form);
  return $output;
}