}
if ($this->addresses == null) {
- return PlIteratorUtils::emptyIterator();
+ return array();
}
return $this->addresses->get($flags, $limit);
}
+ public function iterAddresses($flags, $limit = null)
+ {
+ return PlIteratorUtils::fromArray($this->getAddresses($flags, $limit), 1, true);
+ }
+
public function getMainAddress()
{
- $it = $this->getAddresses(self::ADDRESS_PERSO | self::ADDRESS_MAIN);
- if ($it->total() == 0) {
+ $addr = $this->getAddresses(self::ADDRESS_PERSO | self::ADDRESS_MAIN);
+ if (count($addr) == 0) {
return null;
} else {
- return $it->next();
+ return array_pop($addr);
}
}
}
if ($this->phones == null) {
- return PlIteratorUtils::emptyIterator();
+ return array();
}
return $this->phones->get($flags, $limit);
}
}
if ($this->educations == null) {
- return PlIteratorUtils::emptyIterator();
+ return array();
}
return $this->educations->get($flags, $limit);
}
$this->setNetworking($this->getProfileField('ProfileNetworking'));
}
if ($this->networks == null) {
- return PlIteratorUtils::emptyIterator();
+ return array();
}
return $this->networks->get($flags, $limit);
}
public function getWebSite()
{
$site = $this->getNetworking(self::NETWORKING_WEB, 1);
- if ($site->total() != 1) {
+ if (count($site) != 1) {
return null;
}
- $site = $site->next();
+ $site = array_pop($site);
return $site['address'];
}
}
if ($this->jobs == null) {
- return PlIteratorUtils::emptyIterator();
+ return array();
}
return $this->jobs->get($flags, $limit);
}
public function getMainJob()
{
$job = $this->getJobs(self::JOBS_MAIN, 1);
- if ($job->total() != 1) {
+ if (count($job) != 1) {
return null;
}
- return $job->next();
+ return array_pop($job);
}
/* Binets
break;
}
}
- return PlIteratorUtils::fromArray($educations, 1, true);
+ return $educations;
}
public static function fetchData(array $pids, $visibility)
break;
}
}
- return PlIteratorUtils::fromArray($nws, 1, true);
+ return $nws;
}
}
// }}}
break;
}
}
- return PlIteratorUtils::fromArray($res, 1, true);
+ return $res;
}
public static function fetchData(array $pids, $visibility)
public function addPhones(ProfilePhones $phones)
{
$p = $phones->get(0);
- while ($phone = $p->next()) {
+ foreach ($p as $phone) {
if ($phone->link_type == Phone::LINK_ADDRESS && array_key_exists($phone->link_id, $this->addresses)) {
$this->addresses[$phone->link_id]->addPhone($phone);
}
break;
}
}
- return PlIteratorUtils::fromArray($phones, 1, true);
+ return $phones;
}
public static function fetchData(array $pids, $visibility)
break;
}
}
- return PlIteratorUtils::fromArray($jobs, 1, true);
+ return $jobs;
}
public function addPhones(ProfilePhones $phones)
{
$p = $phones->get(0);
- while ($phone = $p->next()) {
+ foreach ($p as $phone) {
if ($phone->link_type == Phone::LINK_JOB && array_key_exists($phone->link_id, $this->jobs)) {
$this->jobs[$phone->link_id]->addPhones($phone);
}
public static function addAddresses(ProfileAddresses $addresses)
{
$a = $addresses->get(Profile::ADDRESS_PRO);
- while ($address = $a->next()) {
+ foreach ($a as $address) {
if ($address->link_type == Address::LINK_JOB && array_key_exists($address->link_id, $this->jobs)) {
$this->jobs[$address->link_id]->setAddress($address);
}
}
// Homes
- $adrs = $pf->getAddresses(Profile::ADDRESS_PERSO);
+ $adrs = $pf->iterAddresses(Profile::ADDRESS_PERSO);
while ($adr = $adrs->next()) {
// TODO : find a way to fetch only the "street" part of the address
$group = $entry->addHome($adr['text'], null, null, $adr['postalCode'],
}
// Pro
- $adrs = $pf->getAddresses(Profile::ADDRESS_PRO);
+ $adrs = $pf->iterAddresses(Profile::ADDRESS_PRO);
while ($adr = $adrs->next()) {
// TODO : link address to company
$group = $entry->addWork(null, null, null, null,
$self->TableRow('mobile', utf8_decode($profile->mobile), 'Mono');
}
- $it = $profile->getAddresses(Profile::ADDRESS_ALL);
+ $it = $profile->iterAddresses(Profile::ADDRESS_ALL);
while ($a = $it->next()) {
foreach ($a as &$value) {
$value = utf8_decode($value);
$self->Space();
$self->Address($a);
}
- $it = $profile->getAddresses(Profile::ADDRESS_PRO);
+ $it = $profile->iterAddresses(Profile::ADDRESS_PRO);
while ($a = $it->next()) {
foreach ($a as &$value) {
$value = utf8_decode($value);
<img src='images/flags/{$nat}.gif' alt='{$nat}' height='11' title='{$nat}' />
{/foreach}
{$profile->promo()}{*
- *}{iterate from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/iterate}{*
+ *}{foreach from=$profile->getExtraEducations(4) item=edu}, {display_education edu=$edu profile=$profile}{/foreach}{*
*}{if $dead}, {"décédé"|sex:"décédée":$profile} le {$profile->deathdate|date_format}{/if}
</div>
</div>