You are here

function lingotek_get_projects_v4 in Lingotek Translation 7.2

1 call to lingotek_get_projects_v4()
lingotek_project_select_form in ./lingotek.setup.inc
Project Select Screen (for Current Users) - Form Layout

File

./lingotek.setup.inc, line 1025
Lingotek Easy Install Process.

Code

function lingotek_get_projects_v4($login, $passwd, $community_identity, $url) {

  // API V4 Connection
  $client = new LingotekSession();
  $client->login_id = $login;
  $client->password = $passwd;
  $client->url = $url;
  $client->community = $community_identity;
  if (!$client
    ->canLogIn()) {
    return FALSE;
  }
  $options = array();
  $list_projects = $client
    ->request("listProjects", array(
    'community' => $community_identity,
  ));
  if ($list_projects->results == "success") {
    foreach ($list_projects->projects as $project) {
      if ($project->state == 'Active') {
        if (!empty($project->workflowId)) {

          // Send back the ProjectID AND WorkflowID.  Joined by |||
          $options[$project->id . '|||' . $project->workflowId] = $project->name;
        }
        else {

          // Just send back the Project ID
          $options[$project->id] = $project->name;
        }
      }
    }
  }
  return $options;
}