diff --git a/controllers/class.badgescontroller.php b/controllers/class.badgescontroller.php index 92fe53e..d3309e1 100644 --- a/controllers/class.badgescontroller.php +++ b/controllers/class.badgescontroller.php @@ -25,6 +25,7 @@ class BadgesController extends Gdn_Controller { $this->AddJsFile('global.js'); $this->AddCssFile('style.css'); $this->AddCssFile('badges.css'); + $this->AddModule('MyBadgesModule'); } /** diff --git a/modules/class.mybadgesmodule.php b/modules/class.mybadgesmodule.php new file mode 100755 index 0000000..3082356 --- /dev/null +++ b/modules/class.mybadgesmodule.php @@ -0,0 +1,34 @@ +Data = FALSE; + if(Gdn::Session()->IsValid()) { + $UserID = Gdn::Session()->UserID; + $BadgeModel = new BadgeModel(); + + $Data = $BadgeModel->GetUserBadgeAwards($UserID); + $this->Data = $Data; + } + } + + public function AssetTarget() { + return 'Panel'; + } + + public function ToString() { + if($this->Data) + return parent::ToString(); + + return ''; + } + +} \ No newline at end of file diff --git a/views/badges/detail.php b/views/badges/detail.php new file mode 100644 index 0000000..496b75c --- /dev/null +++ b/views/badges/detail.php @@ -0,0 +1,46 @@ +Title(), 'h1'); +echo ''; diff --git a/views/modules/mybadges.php b/views/modules/mybadges.php new file mode 100644 index 0000000..384deb8 --- /dev/null +++ b/views/modules/mybadges.php @@ -0,0 +1,18 @@ +'; +echo '

' . T('My Badges') . '

'; +echo '
'; +foreach($this->Data as $Badge) { + echo Anchor( + Img( + Gdn_Upload::Url($Badge['Photo']), + array('class' => 'ProfilePhoto ProfilePhotoSmall') + ), + 'badges/detail/' . $Badge['BadgeID'] . '/' . Gdn_Format::Url($Badge['Name']), + array('title' => $Badge['Name']) + ); +} +echo '
'; +echo '';