You are here

function mailchimp_campaign_overview_page in Mailchimp 7.2

Same name and namespace in other branches
  1. 7.5 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_overview_page()
  2. 7.3 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_overview_page()
  3. 7.4 modules/mailchimp_campaign/mailchimp_campaign.module \mailchimp_campaign_overview_page()

Page callback for showing a list of MC Campaign entities.

Return value

array

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 135

Code

function mailchimp_campaign_overview_page() {
  $campaigns = mailchimp_campaign_load_multiple();
  $templates = mailchimp_campaign_get_templates();
  $rows = array();
  foreach ($campaigns as $campaign) {
    $actions = array(
      l(t('View Archive'), $campaign->mc_data['archive_url'], array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )),
      l(t('View'), 'admin/config/services/mailchimp/campaigns/' . $campaign->mc_campaign_id),
    );
    $rows[] = array(
      l($campaign
        ->label(), 'admin/config/services/mailchimp/campaigns/' . $campaign->mc_campaign_id),
      $campaign->mc_data['subject'],
      $campaign->mc_data['status'],
      l($campaign->list['name'], 'https://admin.mailchimp.com/lists/dashboard/overview?id=' . $campaign->list['web_id'], array(
        'attributes' => array(
          'target' => '_blank',
        ),
      )),
      isset($templates[$campaign->mc_data['template_id']]) ? $templates[$campaign->mc_data['template_id']]['name'] : '',
      $campaign->mc_data['create_time'],
      implode(' | ', $actions),
    );
  }
  return array(
    '#theme' => 'table',
    '#header' => array(
      t('Title'),
      t('Subject'),
      t('Status'),
      t('MailChimp list'),
      t('MailChimp template'),
      t('Created'),
      t('Actions'),
    ),
    '#rows' => $rows,
  );
}