<?php
/***************************************************************************
- * Copyright (C) 2003-2010 Polytechnique.org *
+ * Copyright (C) 2003-2011 Polytechnique.org *
* http://opensource.polytechnique.org/ *
* *
* This program is free software; you can redistribute it and/or modify *
}
}
- public function setPhone(Phone &$phone)
+ public function setPhone(Phone $phone)
{
- if ($phone->linkType() == Phone::LINK_COMPANY && $phone->linkId() == $this->id) {
+ if ($phone->link_type == Phone::LINK_COMPANY && $phone->link_id == $this->id) {
$this->phone = $phone;
}
}
- public function setAddress(Address &$address)
+ public function setAddress(Address $address)
{
if ($address->type == Address::LINK_COMPANY && $address->jobid == $this->id) {
$this->address = $address;
return $this->address;
}
- public function addPhone(Phone &$phone)
+ public function addPhone(Phone $phone)
{
- if ($phone->linkType() == Phone::LINK_JOB && $phone->linkId() == $this->id && $phone->pid() == $this->pid) {
+ if ($phone->link_type == Phone::LINK_JOB && $phone->link_id == $this->id && $phone->pid == $this->pid) {
$this->phones[$phone->uniqueId()] = $phone;
}
}
}
}
- public function addTerm(JobTerm &$term)
+ public function addTerm(JobTerm $term)
{
$this->terms[$term->jtid] = $term;
}
$data = XDB::iterator('SELECT pe.id, pe.pid,
pe.entry_year, pe.grad_year, pe.program, pe.flags,
pee.name AS school, pee.abbreviation AS school_short,
- pee.url AS school_url, gc.countryFR AS country,
+ pee.url AS school_url, gc.country,
pede.degree, pede.abbreviation AS degree_short, pede.level AS degree_level,
pefe.field
FROM profile_education AS pe
public static function fetchData(array $pids, ProfileVisibility $visibility)
{
- $data = XDB::iterator('SELECT pmc.pid, pmc.country AS id, gc.countryFR AS name
+ $data = XDB::iterator('SELECT pmc.pid, pmc.country AS id, gc.country AS name
FROM profile_mentor_country AS pmc
LEFT JOIN geoloc_countries AS gc ON (gc.iso_3166_1_a2 = pmc.country)
WHERE pmc.pid IN {?}
$p = $phones->get(Profile::PHONE_LINK_ADDRESS | Profile::PHONE_TYPE_ANY);
foreach ($p as $phone) {
/* We must iterate on the addresses because id is not uniq thus,
- * $this->addresse[$phone->linkId()] is invalid.
+ * $this->addresse[$phone->link_id] is invalid.
*/
foreach ($this->addresses as $address) {
- if ($address->type == Address::LINK_PROFILE && $address->id == $phone->linkId()) {
+ if ($address->type == Address::LINK_PROFILE && $address->id == $phone->link_id) {
$address->addPhone($phone);
}
}
{
$p = $phones->get(Profile::PHONE_LINK_JOB | Profile::PHONE_TYPE_ANY);
foreach ($p as $phone) {
- if ($phone->linkType() == Phone::LINK_JOB && array_key_exists($phone->linkId(), $this->jobs)) {
- $this->jobs[$phone->linkId()]->addPhone($phone);
+ if ($phone->link_type == Phone::LINK_JOB && array_key_exists($phone->link_id, $this->jobs)) {
+ $this->jobs[$phone->link_id]->addPhone($phone);
}
}
}
{
$a = $addresses->get(Profile::ADDRESS_PRO);
foreach ($a as $address) {
- if ($address->type == Address::LINK_JOB && array_key_exists($address->jobid, $this->jobs)) {
+ if ($address->type == Address::LINK_JOB && array_key_exists($address->id, $this->jobs)) {
$this->jobs[$address->id]->setAddress($address);
}
}
$terms = $jobterms->get();
foreach ($terms as $term) {
if ($this->pid == $term->pid && array_key_exists($term->jid, $this->jobs)) {
- $this->jobs[$term->jid]->addTerm(&$term);
+ $this->jobs[$term->jid]->addTerm($term);
}
}
}
if (count($newcompanies)) {
$it = Phone::iterate(array(), array(Phone::LINK_COMPANY), $newcompanies);
while ($phone = $it->next()) {
- self::$companies[$phone->linkId()]->setPhone($phone);
+ self::$companies[$phone->link_id]->setPhone($phone);
}
}
if (!array_key_exists($id, self::$companies)) {
self::preload();
}
- return self::$companies[$id];
+ if (isset(self::$companies[$id])) {
+ return self::$companies[$id];
+ }
+ return null;
}
}