You are here

function legal_display_changes in Legal 5

Same name and namespace in other branches
  1. 8 legal.module \legal_display_changes()
  2. 6.8 legal.module \legal_display_changes()
  3. 6.7 legal.module \legal_display_changes()
  4. 7.2 legal.module \legal_display_changes()
  5. 7 legal.module \legal_display_changes()
  6. 2.0.x legal.module \legal_display_changes()
1 call to legal_display_changes()
legal_login in ./legal.module

File

./legal.module, line 676

Code

function legal_display_changes($form, $uid) {
  $last_accepted = legal_get_accept($uid);
  if (empty($last_accepted)) {
    return $form;
  }
  $results = db_query("SELECT * FROM {legal_conditions} WHERE tc_id > %d ORDER BY tc_id DESC", $last_accepted->tc_id);
  if (empty($results)) {
    return $form;
  }
  $form['changes'] = array(
    '#type' => 'fieldset',
    '#title' => t('Changes List'),
    '#description' => t('Changes to the Terms & Conditions since last accepted:'),
    '#collapsible' => TRUE,
    '#collapsed' => TRUE,
    '#tree' => TRUE,
  );
  while ($conditions = db_fetch_object($results)) {
    unset($changes);
    if (!empty($conditions->changes)) {
      $changes = explode("\r\n", $conditions->changes);
      foreach ($changes as $change) {
        $form['changes'][] = array(
          '#value' => filter_xss_admin($change),
          '#weight' => 2,
        );
        $is_list = TRUE;
      }
    }
  }
  if (!$is_list) {
    $form['changes'] = NULL;
  }
  return $form;
}