From c96e6bd070c3bb50f7c95a91859af281ff88ba5b Mon Sep 17 00:00:00 2001 From: Victor Berger Date: Sun, 16 Feb 2014 17:04:23 +0100 Subject: [PATCH] Adding hobby visibility on profile. Signed-off-by: Victor Berger --- classes/profile.php | 16 ++++++++++++++++ templates/profile/profile.tpl | 8 ++++++++ 2 files changed, 24 insertions(+) diff --git a/classes/profile.php b/classes/profile.php index 29de2b1..7065598 100644 --- a/classes/profile.php +++ b/classes/profile.php @@ -1013,6 +1013,22 @@ class Profile implements PlExportable } } + /* Hobbies + */ + public function getHobbies() { + if ($this->visibility->isVisible(Visibility::EXPORT_PRIVATE)) { + return XDB::fetchAllAssoc('type', 'SELECT type, GROUP_CONCAT(text) + FROM profile_hobby + WHERE pid = {?} + GROUP BY type', $this->id()); + } else { + return XDB::fetchAllAssoc('type', 'SELECT type, GROUP_CONCAT(text) + FROM profile_hobby + WHERE pub = \'public\' AND pid = {?} + GROUP BY type', $this->id()); + } + } + /* Medals */ private $medals = null; diff --git a/templates/profile/profile.tpl b/templates/profile/profile.tpl index ff67147..2fee8b6 100644 --- a/templates/profile/profile.tpl +++ b/templates/profile/profile.tpl @@ -86,6 +86,14 @@ $($.closeOnEsc); {/foreach} {/if} + {assign var=hobbies value=$profile->getHobbies()} + {if count($hobbies) > 0} +

Hobbies...

+ {foreach from=$hobbies key=type item=text} +
{$type} : {$text}
+ {/foreach} + {/if} + {if $profile->freetext}

Commentaires :

{$profile->freetext|miniwiki|smarty:nodefaults} -- 2.1.4