You are here

function calendar_systems_profile_overview in Calendar Systems 6.3

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

Display overview of setup Calendar systems Editor profiles; menu callback.

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

File

./calendar_systems.admin.inc, line 372
Integrate Calendar systems editors into Drupal.

Code

function calendar_systems_profile_overview() {
  $form = array();
  if (!calendar_systems_is_patch_applied()) {
    $path = drupal_get_path('module', 'calendar_systems');
    drupal_set_message("You haven't applied the required Drupal core's patch for this module to work, please follow the instructions in " . l('README.txt', $path . '/README.txt'), 'error');
  }
  $calendar_systems = calendar_systems_get_all_plugins();
  $options = array();
  foreach ($calendar_systems as $id => $calendar_system) {
    $options[$id] = $calendar_system['title'];
  }
  $languages = calendar_systems_get_all_langauges();
  $profiles = calendar_systems_profile_load_all();
  $form['formats']['#tree'] = TRUE;
  foreach ($languages as $id => $language) {
    $form['formats'][$id]['name'] = array(
      '#value' => check_plain($language['name']),
    );
    $form['formats'][$id]['editor'] = array(
      '#type' => 'select',
      '#default_value' => isset($profiles[$id]) ? $profiles[$id]->calendar_system : '',
      '#options' => $options,
      '#id' => "edit-editor-{$id}",
      '#disabled' => isset($profiles[$id]) ? (bool) $profiles[$id]->calendar_system : FALSE,
    );
    if (isset($profiles[$id]) && !empty($profiles[$id]->calendar_system)) {

      /*
      $form['formats'][$id]['edit'] = array(
        '#value' => l(t('Edit'), "admin/settings/calendar_systems/profile/$id/edit"),
      );
      */
      $form['formats'][$id]['remove'] = array(
        '#value' => l(t('Remove'), "admin/settings/calendar_systems/profile/{$id}/delete"),
      );
    }
  }
  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Save'),
  );
  return $form;
}