From: Victor Berger Date: Sun, 16 Feb 2014 16:04:23 +0000 (+0100) Subject: Adding hobby visibility on profile. X-Git-Tag: xorg/1.1.12~32 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=c96e6bd070c3bb50f7c95a91859af281ff88ba5b;p=platal.git Adding hobby visibility on profile. Signed-off-by: Victor Berger --- 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}