You are here

function theme_feeds_source_status in Feeds 7.2

Same name and namespace in other branches
  1. 8.2 feeds.pages.inc \theme_feeds_source_status()

Themes a status display for a source.

1 theme call to theme_feeds_source_status()
feeds_source_status in ./feeds.pages.inc
Renders a status display for a source.

File

./feeds.pages.inc, line 393
Menu callbacks, form callbacks and helpers.

Code

function theme_feeds_source_status($v) {
  $output = '<div class="info-box feeds-source-status">';
  $items = array();
  if ($v['progress_importing']) {
    $progress = number_format(100.0 * $v['progress_importing'], 0);
    $items[] = t('Importing - @progress % complete.', array(
      '@progress' => $progress,
    ));
  }
  if ($v['progress_clearing']) {
    $progress = number_format(100.0 * $v['progress_clearing'], 0);
    $items[] = t('Deleting items - @progress % complete.', array(
      '@progress' => $progress,
    ));
  }
  if (!count($items)) {
    if ($v['count']) {
      if ($v['imported']) {
        $items[] = t('Last import: @ago ago.', array(
          '@ago' => format_interval(REQUEST_TIME - $v['imported'], 1),
        ));
      }
      $items[] = t('@count imported items total.', array(
        '@count' => $v['count'],
      ));
    }
    else {
      $items[] = t('No imported items.');
    }
  }
  if ($v['next']) {

    // Check if medium date format contains hours/minutes.
    $date_format = variable_get('date_format_medium');
    $use_custom_date_format = $date_format && !strpos($date_format, 'H:i');
    if (!empty($v['next']['message'])) {
      $items[] = t('Next import: @message.', array(
        '@message' => $v['next']['message'],
      ));
    }
    elseif ($v['next']['time'] > REQUEST_TIME) {
      $items[] = t('Next import: @date (via @method)', array(
        '@date' => $use_custom_date_format ? format_date($v['next']['time'], 'custom', 'Y/m/d H:i:s') : format_date($v['next']['time']),
        '@method' => $v['next']['method'],
      ));
    }
    else {
      $items[] = t('Next import: on next cron run (via @method).', array(
        '@method' => $v['next']['method'],
      ));
    }
  }
  else {
    $items[] = t('Next import: not scheduled.');
  }
  $output .= theme('item_list', array(
    'items' => $items,
  ));
  $output .= '</div>';
  return $output;
}