You are here

function globallink_get_user_pd_projects in GlobalLink Connect for Drupal 7.7

Same name and namespace in other branches
  1. 7.5 gl_ws/gl_ws_common.inc \globallink_get_user_pd_projects()
  2. 7.6 gl_ws/gl_ws_common.inc \globallink_get_user_pd_projects()
1 call to globallink_get_user_pd_projects()
globallink_save_project_names in ./globallink_settings.inc
Saves project names.

File

gl_ws/gl_ws_common.inc, line 14

Code

function globallink_get_user_pd_projects($pd_obj) {
  $proj_arr = array();
  $connectorConfig = new PDConfig();
  $connectorConfig->url = $pd_obj->url;
  $connectorConfig->username = $pd_obj->username;
  $connectorConfig->password = $pd_obj->password;
  $connectorConfig->userAgent = $pd_obj->userAgent;
  $glExchange = new GLExchange($connectorConfig);
  $pdProjects = $glExchange
    ->getProjects();
  if (isset($pdProjects) && is_array($pdProjects)) {
    foreach ($pdProjects as $project) {
      $proj_arr[$project->shortcode] = $project->name;
    }
  }
  return $proj_arr;
}