function mailchimp_campaign_overview_page in Mailchimp 7.5
Same name and namespace in other branches
- 7.2 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_overview_page()
- 7.3 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_overview_page()
- 7.4 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_overview_page()
Page callback for showing a list of MailChimp Campaign entities.
1 string reference to 'mailchimp_campaign_overview_page'
- mailchimp_campaign_menu in modules/
mailchimp_campaign/ mailchimp_campaign.module - Implements hook_menu().
File
- modules/
mailchimp_campaign/ mailchimp_campaign.module, line 215 - Module file for mailchimp_campaign.
Code
function mailchimp_campaign_overview_page() {
$campaigns = mailchimp_campaign_load_multiple();
$templates = mailchimp_campaign_list_templates(FALSE, 0, 500);
$rows = array();
foreach ($campaigns as $campaign) {
$actions = array();
$actions[] = l(t('View Archive'), $campaign->mc_data->archive_url, array(
'attributes' => array(
'target' => '_blank',
),
));
$actions[] = l(t('View'), 'admin/config/services/mailchimp/campaigns/' . $campaign->mc_campaign_id);
if ($campaign->mc_data->status == 'save') {
$actions[] = l(t('Send'), 'admin/config/services/mailchimp/campaigns/' . $campaign->mc_campaign_id . '/send');
}
else {
$actions[] = t('Sent');
}
$campaign_template = NULL;
foreach ($templates as $template_set) {
foreach ($template_set as $template) {
if ($template->id == $campaign->mc_data->settings->template_id) {
$campaign_template = $template;
}
}
}
$rows[] = array(
l($campaign
->label(), 'admin/config/services/mailchimp/campaigns/' . $campaign->mc_campaign_id),
$campaign->mc_data->settings->subject_line,
$campaign->mc_data->status,
l($campaign->list->name, 'https://admin.mailchimp.com/lists/', array(
'attributes' => array(
'target' => '_blank',
),
)),
$campaign_template != NULL ? $campaign_template->name : '',
format_date(strtotime($campaign->mc_data->create_time), 'custom', 'F j, Y - g:ia'),
implode(' | ', $actions),
);
}
return array(
'#theme' => 'table',
'#header' => array(
t('Title'),
t('Subject'),
t('Status'),
t('MailChimp audience'),
t('MailChimp template'),
t('Created'),
t('Actions'),
),
'#rows' => $rows,
);
}