You are here

function calendar_systems_profile_overview in Calendar Systems 7

Same name and namespace in other branches
  1. 8 calendar_systems.admin.inc \calendar_systems_profile_overview()
  2. 6.3 calendar_systems.admin.inc \calendar_systems_profile_overview()
  3. 6 calendar_systems.admin.inc \calendar_systems_profile_overview()
  4. 7.3 calendar_systems.admin.inc \calendar_systems_profile_overview()
  5. 7.2 calendar_systems.admin.inc \calendar_systems_profile_overview()

Form callback for calendar systems profiles.

1 string reference to 'calendar_systems_profile_overview'
calendar_systems_menu in ./calendar_systems.module
Implements hook_menu().

File

./calendar_systems.admin.inc, line 13
Contains Calendar Systems administration form callbacks.

Code

function calendar_systems_profile_overview($form, &$form_state) {
  _calendar_systems_add_strings();
  $form = array();
  if (_calendar_systems_is_patch_applied() !== TRUE) {
    drupal_set_message(t('There is a problem with calendar systems installation, please visit <a href="!readme-link">site status page</a> for more information.', array(
      '!readme-link' => url('admin/reports/status'),
    )), 'warning', FALSE);
  }

  // build the overview form array.
  $form['formats'] = array();
  $form['formats']['#tree'] = TRUE;

  // Set initials.
  $profiles = _calendar_systems_profiles();
  $languages = _calendar_systems_langauges();
  $calendar_systems = _calendar_systems_plugins();
  $options = _calendar_systems_profiles_simple();

  /*
  $form['test'] = array(
    '#type' => 'date',
    '#title' => 'test',
    '#calendar_system' =>'iranian'
    //'#default_value' => $edit[$field->name],
    //'#description' => _profile_form_explanation($field),
    //'#required' => $field->required
  );
  */

  // Table rows:
  foreach ($languages as $id => $language) {

    // Language:
    $form['formats'][$id]['name'] = array(
      '#type' => 'markup',
      '#markup' => check_plain($language['name']),
    );

    // Calendar systems:
    $form['formats'][$id]['editor'] = array(
      '#type' => 'select',
      '#options' => $options,
      '#id' => "edit-editor-{$id}",
      '#default_value' => isset($profiles[$id]) ? $profiles[$id]->calendar_system : '',
      '#disabled' => isset($profiles[$id]) ? (bool) $profiles[$id]->calendar_system : FALSE,
    );

    // Operation links:
    if (isset($profiles[$id]) && !empty($profiles[$id]->calendar_system)) {
      $form['formats'][$id]['remove'] = array(
        '#type' => 'markup',
        '#markup' => l(t('Remove'), "admin/config/regional/calendar-systems/profile/{$id}/delete"),
      );
    }
  }
  $form['form_fields_date_picker'] = array(
    '#type' => 'fieldset',
    '#title' => t('Javascript Date Picker'),
  );
  if (module_exists('jquery_calendar')) {
    $form['form_fields_date_picker']['core_text_date_fields'] = array(
      '#type' => 'checkbox',
      '#title' => t('Add to text date fields'),
      '#default_value' => variable_get('calendar_systems_js_date_picker_core_text_date_fields'),
    );
  }
  else {
    $form['form_fields_date_picker']['note'] = array(
      '#type' => 'markup',
      '#markup' => t('You must enable %s module in order to be able to use this feature', array(
        '%s' => 'jquery calendars',
      )),
    );
  }

  // Append submit button:
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );

  // Render:
  return $form;
}