$company_ids = array((int)@$_REQUEST['project_company'] => @$_REQUEST['project_company_name']);

        // - then scrape the contact list and add those in too
        foreach ($bc->companies() as $company) {
            $cid = (int)$company['id'];
            if (!@$company_ids[$cid]) $company_ids[$cid] = $company['name'];
        }

        $form_id = 1000; // start at 1000 so we don't overlap with the entered names/emails

        // now fetch all people from each company that are on the given project
        foreach ($company_ids as $company_id => $company_name) {
            $existing_people = array();
            $new_people = array();
            echo '<div class="font-size-14" style="background-color: #f0f0f0; width: 100%">Company: '.htmlspecialchars($company_name).'</div>';
            foreach ($bc->people($company_id, $project_id) as $person) {
                $email = $person->{'email-address'};
                try {
                    $u = new User();
                    $u->load($email, "email");
                } catch (PAException $e) {
                    $u = NULL;
                    if ($e->code != USER_NOT_FOUND) throw $e;
                }
                $name = $person->{'first-name'}.' '.$person->{'last-name'};
//                echo "<li>person: $name $email";
                if ($u) {
                    $existing_people[] = $u;
                } else {
                    $new_people[] = $person;
                }
Exemplo n.º 2
0
    echo "<h1>company: ".htmlspecialchars($company['name'])."</h1>";
    foreach ($company['people'] as $person) {
	echo '<li><a href="mailto:'.$person['email'].'">'.$person['name'].'</a></li>';
    }
}

echo "<p>getting project list</p>"; flush();

$projects = $bc->list_projects();

foreach ($projects as $project) {
    echo "<h1>project</h1>";
    foreach ($project as $k=>$v) {
        echo "<li>$k -> $v</li>";
    }

    // now get detail on the people from each company who are involved in this project
    foreach ($companies as $company) {
	echo "<p>getting list of people from company ".$company['id']." who are working on this project</p>";
	flush();
	$people = $bc->people($company['id'], $project->id);
	
	foreach ($people as $person) {
	    echo "<h1>person</h1>";
	    foreach ($person as $k=>$v) {
		echo "<li>$k -> $v</li>";
	    }
	}
    }
}
?>