You are here

function disqus_migrate_admin_export in Disqus 6

Menu callback for the export actions

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

File

include/disqus_migrate.export.inc, line 46

Code

function disqus_migrate_admin_export() {
  $form = array();
  $form['export'] = array(
    '#type' => 'fieldset',
    '#title' => t('Export Now'),
  );
  $pending_comments = db_result(db_query("SELECT COUNT(*) FROM {comments} c WHERE c.cid NOT IN (SELECT dm.cid FROM {disqus_migrate} dm)"));
  if ($pending_comments === FALSE) {
    $pending_comments = 0;
  }
  $form['export']['pending'] = array(
    '#type' => 'markup',
    '#prefix' => '<p>',
    '#value' => t('There are @pending comments awaiting export.', array(
      '@pending' => $pending_comments,
    )),
    '#suffix' => '</p>',
  );
  $form['export']['export_api'] = array(
    '#type' => 'submit',
    '#value' => t('Export awaiting comments using API'),
    '#validate' => array(
      '_disqus_migrate_export_api_validate',
    ),
    '#submit' => array(
      '_disqus_migrate_export_api',
    ),
  );
  $form['export']['export_xml'] = array(
    '#type' => 'submit',
    '#value' => t('Export all comments to XML file'),
    '#submit' => array(
      '_disqus_migrate_export_wxr',
    ),
  );
  return $form;
}