You are here

function globallink_get_user_pd_projects in GlobalLink Connect for Drupal 7.6

Same name and namespace in other branches
  1. 7.7 gl_ws/gl_ws_common.inc \globallink_get_user_pd_projects()
  2. 7.5 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 24

Code

function globallink_get_user_pd_projects($pd_obj) {
  $username = $pd_obj->username;
  $password = $pd_obj->password;
  $url = $pd_obj->url;
  $session_service = new SessionService2(GL_WSDL_PATH . 'SessionService2.wsdl', array(
    'location' => $url . '/services/SessionService2',
  ));
  $project_service = new ProjectService2(GL_WSDL_PATH . 'ProjectService2.wsdl', array(
    'location' => $url . '/services/ProjectService2',
  ));
  $token = globallink_login($session_service, $username, $password);
  $projects = globallink_get_user_projects($project_service, $token);
  $proj_arr = array();
  foreach ($projects as $project) {
    $short_code = $project->projectInfo->shortCode;
    $proj_arr[$short_code] = $project->projectInfo->name;
  }
  return $proj_arr;
}