You are here

function og_migrate_admin in Organic groups 7

Migration overview.

1 string reference to 'og_migrate_admin'
og_migrate_menu in og_migrate/og_migrate.module
Implements hook_menu().

File

og_migrate/og_migrate.module, line 294
Migrate and upgrade Organic groups data.

Code

function og_migrate_admin() {
  $form = array();
  $plugins = og_migrate_get_accessible_plugins();
  if ($plugins) {
    $header = array(
      'name' => t('Name'),
      'description' => t('Description'),
      'status' => t('Status'),
    );
    $query = db_select('og_migrate', 'ogm');
    $result = $query
      ->fields('ogm', array(
      'plugin',
      'status',
    ))
      ->execute()
      ->fetchAll();
    $status_map = og_migrate_status();
    $status = array();
    foreach ($result as $row) {
      $status[$row->plugin] = $row->status;
    }
    $options = array();
    foreach ($plugins as $name => $plugin) {
      $options[$name] = array(
        'name' => filter_xss($plugin['name']),
        'description' => filter_xss($plugin['description']),
        'status' => $status_map[$status[$name]],
      );
    }
    $form['migrate'] = array(
      '#type' => 'tableselect',
      '#header' => $header,
      '#options' => $options,
    );
    $form['actions'] = array(
      '#type' => 'actions',
    );
    $form['actions']['submit'] = array(
      '#type' => 'submit',
      '#value' => t('Migrate'),
    );
  }
  else {
    $form['no-options'] = array(
      '#markup' => t('There are no migration options.'),
    );
  }
  return $form;
}