You are here

function disqus_migrate_admin_import in Disqus 6

Menu callback for importing actions

1 string reference to 'disqus_migrate_admin_import'
disqus_migrate_menu in ./disqus_migrate.module
Implementation of hook_menu().

File

include/disqus_migrate.import.inc, line 66

Code

function disqus_migrate_admin_import() {
  $form = array();
  $form['import'] = array(
    '#type' => 'fieldset',
    '#title' => t('Import Now'),
  );
  $form['import']['since'] = array(
    '#type' => 'textfield',
    '#title' => t('Since this date/time'),
    '#size' => 15,
    '#description' => t('Import comments created after this date. PHP !strtotime format. Leave blank to import from the start.', array(
      '!strtotime' => l('strtotime()', 'http://php.net/manual/en/function.strtotime.php'),
    )),
  );
  $imports_exist = db_result(db_query("SELECT COUNT(*) FROM {disqus_migrate}"));
  $form['import']['since_last'] = array(
    '#type' => 'checkbox',
    '#title' => t("Use last import/export time as 'since' date/time"),
    '#disabled' => $imports_exist == 0 ? TRUE : FALSE,
    '#description' => t('If you have imported previously, or used the export API, use this option to continue where left off. <b>If unchecked, this will likely bring in duplicate comments</b>, unless you have yet to import any.'),
    '#default_value' => $imports_exist == 0 ? 0 : 1,
  );
  $form['import']['disqus_import_now'] = array(
    '#type' => 'submit',
    '#value' => t('Import Comments Now'),
    '#submit' => array(
      '_disqus_migrate_import_now',
    ),
    '#validate' => array(
      '_disqus_migrate_import_now_validate',
    ),
  );
  return $form;
}