You are here

function constant_contact_manage_lists in Constant Contact 6.2

Same name and namespace in other branches
  1. 6.3 admin.lists.inc \constant_contact_manage_lists()
  2. 7.3 admin.lists.inc \constant_contact_manage_lists()

Displays the manage contact lists admin page

1 string reference to 'constant_contact_manage_lists'
constant_contact_menu in ./constant_contact.module
Adds an admin menu for the Cnstant Contact module

File

./contactlists.admin.inc, line 11

Code

function constant_contact_manage_lists() {
  $lists = array();
  $next_page = false;
  $prev_page = false;

  // if we have an object get the users contact lists
  $cc = constant_contact_create_object();
  if (is_object($cc)) {
    $_lists = $cc
      ->get_lists();
    if ($_lists) {
      foreach ($_lists as $k => $v) {
        $lists[$v['id']] = t($v['Name']);
      }
    }
    if ($cc->list_meta_data->next_page) {
      $next_page = $cc->list_meta_data->next_page;
    }
  }
  $html = '';
  $html .= '<p>' . l(t('Add a new contact list'), "admin/constant_contact/lists/add") . '</p>';
  $html .= '<table cellspacing="3" cellpadding="3" border="0">';
  $html .= '<tr><th>List Name</th><th colspan="2">&nbsp;</th></tr>';
  foreach ($lists as $id => $name) {
    $html .= '<tr>';
    $html .= '<td>' . $name . '</td>';
    $html .= '<td>' . l(t('Edit'), "admin/constant_contact/lists/edit/{$id}") . '</td>';
    $html .= '<td>' . l(t('Delete'), "admin/constant_contact/lists/delete/{$id}") . '</td>';
    $html .= '</tr>';
  }
  if ($next_page) {
    $html .= '<tr><td colspan="3" align="right">' . l(t('Next Page'), "admin/constant_contact/lists/{$next_page}") . '</td></tr>';
  }
  $html .= '</table>';
  return $html;
}