You are here

function CampaignMonitor::clientGetSegmentsDropdown in Campaign Monitor 6.2

Same name and namespace in other branches
  1. 5.2 lib/CMBase.php \CampaignMonitor::clientGetSegmentsDropdown()
  2. 6.3 lib/CMBase.php \CampaignMonitor::clientGetSegmentsDropdown()

* Creates an associative array with list_id:List_Label => (list_id) List_label pairings. * Remember that you'll need to split the key on ':' only once to get the appropriate ListID * and Segment Name. * *

Parameters

int $client_id (Optional) A valid Client ID to check against. If not given, the default class property is used.:

File

lib/CMBase.php, line 905

Class

CampaignMonitor
The new CampaignMonitor class that now extends from CMBase. This should be backwards compatible with the original (PHP5) version.

Code

function clientGetSegmentsDropdown($client_id = null) {
  $lists = $this
    ->clientGetSegments($client_id);
  if (!isset($lists['List'])) {
    return null;
  }
  else {
    $lists = $lists['List'];
  }
  $_lists = array();
  if (isset($lists[0])) {
    foreach ($lists as $list) {
      $_lists[$list['ListID'] . ':' . $list['Name']] = '(' . $list['ListID'] . ') ' . $list['Name'];
    }
  }
  else {
    $_lists[$lists['ListID'] . ':' . $lists['Name']] = '(' . $lists['ListID'] . ') ' . $lists['Name'];
  }
  return $_lists;
}