function theme_simplenews_status in Simplenews 7
Same name and namespace in other branches
- 5 simplenews.module \theme_simplenews_status()
- 7.2 includes/simplenews.admin.inc \theme_simplenews_status()
Return a status image.
Parameters
$variables An associative array containing:: source: Source which status will be displayed ('published', 'activated', 'sent') status: Status of the source (0 or 1)
Return value
string HTML string containing an image tag.
2 theme calls to theme_simplenews_status()
- simplenews_admin_issues in includes/
simplenews.admin.inc - Form builder: Builds a list of newsletters with operations.
- simplenews_subscription_list_form in includes/
simplenews.admin.inc - Menu callback: subscription administration.
File
- includes/
simplenews.admin.inc, line 1730 - Newsletter admin, subscription admin, simplenews settings
Code
function theme_simplenews_status($variables) {
$source = $variables['source'];
$status = $variables['status'];
switch ($source) {
case 'published':
$images = array(
0 => 'sn-saved.png',
1 => 'sn-sent.png',
);
$title = array(
0 => t('Not published'),
1 => t('Published'),
);
break;
case 'activated':
$images = array(
0 => 'sn-saved.png',
1 => 'sn-sent.png',
);
$title = array(
0 => t('Inactive: no newsletters will be sent'),
1 => t('Active: user will receive newsletters'),
);
break;
case 'sent':
$images = array(
SIMPLENEWS_STATUS_SEND_PENDING => 'sn-cron.png',
SIMPLENEWS_STATUS_SEND_READY => 'sn-sent.png',
);
$title = array(
SIMPLENEWS_STATUS_SEND_NOT => t('Not yet sent'),
SIMPLENEWS_STATUS_SEND_PENDING => t('Currently sending by cron'),
SIMPLENEWS_STATUS_SEND_READY => t('Sent'),
SIMPLENEWS_STATUS_SEND_PUBLISH => t('Send on publish'),
);
break;
}
// Build the output
if (isset($images[$status])) {
$img_vars = array(
'path' => drupal_get_path('module', 'simplenews') . '/' . $images[$status],
'alt' => $title[$status],
'title' => $title[$status],
'getsize' => TRUE,
);
$output = theme('image', $img_vars);
}
else {
$output = check_plain($title[$status]);
}
return $output;
}