From b9fc85ac9143f6829acbd3bdc55854830229eb9f Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Mon, 31 Oct 2011 23:05:52 +0100 Subject: [PATCH] Fixes AX profile edition for general, address and job pages. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/address.php | 4 +++- modules/profile/addresses.inc.php | 2 +- modules/profile/jobs.inc.php | 4 ++-- modules/profile/page.inc.php | 2 +- templates/geoloc/form.address.tpl | 6 ++++++ templates/profile/adresses.address.tpl | 2 +- templates/profile/jobs.job.tpl | 2 +- 7 files changed, 15 insertions(+), 7 deletions(-) diff --git a/classes/address.php b/classes/address.php index 18f752e..8423f9a 100644 --- a/classes/address.php +++ b/classes/address.php @@ -896,6 +896,7 @@ class Address class AddressIterator implements PlIterator { private $dbiter; + private $visibility; public function __construct(array $pids, array $types, array $jobids, $visibility, $_where) { @@ -936,6 +937,7 @@ class AddressIterator implements PlIterator GROUP BY pa.pid, pa.jobid, pa.groupid, pa.type, pa.id ORDER BY pa.pid, pa.jobid, pa.id'; $this->dbiter = XDB::iterator($sql, $visibility->level()); + $this->visibility = $visibility; } public function next() @@ -948,7 +950,7 @@ class AddressIterator implements PlIterator return null; } // Adds phones to addresses. - $it = Phone::iterate(array($data['pid']), array(Phone::LINK_ADDRESS), array($data['id'])); + $it = Phone::iterate(array($data['pid']), array(Phone::LINK_ADDRESS), array($data['id']), $this->visibility); while ($phone = $it->next()) { $data['phones'][$phone->id] = $phone->toFormArray(); } diff --git a/modules/profile/addresses.inc.php b/modules/profile/addresses.inc.php index 50f86fd..3a7c52a 100644 --- a/modules/profile/addresses.inc.php +++ b/modules/profile/addresses.inc.php @@ -27,7 +27,7 @@ class ProfileSettingAddresses implements ProfileSetting $addresses = array(); if (is_null($value)) { - $it = Address::iterate(array($page->pid()), array(Address::LINK_PROFILE), array(0)); + $it = Address::iterate(array($page->pid()), array(Address::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_PRIVATE)); while ($address = $it->next()) { $addresses[] = $address->toFormArray(); } diff --git a/modules/profile/jobs.inc.php b/modules/profile/jobs.inc.php index 268d5f3..eada2bd 100644 --- a/modules/profile/jobs.inc.php +++ b/modules/profile/jobs.inc.php @@ -86,11 +86,11 @@ class ProfileSettingJob implements ProfileSetting $backtrack[$job['id']] = $key; } - $it = Address::iterate(array($page->pid()), array(Address::LINK_JOB)); + $it = Address::iterate(array($page->pid()), array(Address::LINK_JOB), array(), Visibility::get(Visibility::VIEW_PRIVATE)); while ($address = $it->next()) { $jobs[$address->id]['w_address'] = $address->toFormArray(); } - $it = Phone::iterate(array($page->pid()), array(Phone::LINK_JOB)); + $it = Phone::iterate(array($page->pid()), array(Phone::LINK_JOB), array(), Visibility::get(Visibility::VIEW_PRIVATE)); while ($phone = $it->next()) { $jobs[$phone->link_id]['w_phone'][$phone->id] = $phone->toFormArray(); } diff --git a/modules/profile/page.inc.php b/modules/profile/page.inc.php index f9e93a4..76be815 100644 --- a/modules/profile/page.inc.php +++ b/modules/profile/page.inc.php @@ -108,7 +108,7 @@ class ProfileSettingPhones implements ProfileSetting $phones = array(); if (is_null($value)) { - $it = Phone::iterate(array($page->pid()), array(Phone::LINK_PROFILE), array(0)); + $it = Phone::iterate(array($page->pid()), array(Phone::LINK_PROFILE), array(0), Visibility::get(Visibility::VIEW_PRIVATE)); while ($phone = $it->next()) { $success = ($phone->format() && $success); $phones[] = $phone->toFormArray(); diff --git a/templates/geoloc/form.address.tpl b/templates/geoloc/form.address.tpl index b4add50..6400a19 100644 --- a/templates/geoloc/form.address.tpl +++ b/templates/geoloc/form.address.tpl @@ -26,7 +26,11 @@ {/if} + {if !t($hiddenaddr)} + {else} + + {/if} @@ -52,6 +56,7 @@ {/if} + {if !t($hiddenaddr)}
promoColor()}" alt="Position de l'adresse" /> {if t($geocoding_removal)} @@ -66,6 +71,7 @@ {/if}
+ {/if} {if t($validation)}
diff --git a/templates/profile/adresses.address.tpl b/templates/profile/adresses.address.tpl index 7f32152..806ba81 100644 --- a/templates/profile/adresses.address.tpl +++ b/templates/profile/adresses.address.tpl @@ -61,7 +61,7 @@ {include file="include/flags.radio.tpl" name="`$prefname`[pub]" val=$address.pub mainField='addresses' mainId=$i subField='phones' subId=-1} - {include file="geoloc/form.address.tpl" prefname=$prefname prefid=$prefid address=$address id=$i} + {include file="geoloc/form.address.tpl" prefname=$prefname prefid=$prefid address=$address id=$i hiddenaddr=$hiddenaddr} {if !$isMe} diff --git a/templates/profile/jobs.job.tpl b/templates/profile/jobs.job.tpl index 747347b..7872b0d 100644 --- a/templates/profile/jobs.job.tpl +++ b/templates/profile/jobs.job.tpl @@ -193,7 +193,7 @@ {include file="geoloc/form.address.tpl" prefname="`$jobpref`[w_address]" - prefid=$jobid address=$job.w_address class="pair"} + prefid=$jobid address=$job.w_address class="pair" hiddenaddr=$hiddenaddr}