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 '
';
+foreach($this->Data('Badges') as $Badge) {
+ // Don't show disabled badges
+ //if(!$Badge->Enabled) {
+ // continue;
+ //}
+ $Row = '';
+ $AwardDescription = '';
+ $ReadClass = ' Read';
+
+ if($Badge->UserID) {
+ $ReadClass = '';
+ $AwardDescription = 'You earned this badge ' . Gdn_Format::Date($Badge->DateInserted, 'html') . ' from ' . $Badge->InsertUserName;
+ if($Badge->Reason) {
+ $AwardDescription .= ': "' . $Badge->Reason . '"';
+ }
+ }
+
+ if($Badge->Photo) {
+ $Row .= Img(Gdn_Upload::Url($Badge->Photo), array('class' => 'BadgePhoto'));
+ }
+ else {
+ $Row .= Img('tododefault', array('class' => 'BadgePhoto'));
+ }
+
+ $Row .= Wrap(
+ Wrap(
+ Anchor($Badge->Name, 'badges/detail/' . $Badge->BadgeID . '/' . Gdn_Format::Url($Badge->Name), array('class' => 'Title')), 'div', array('class' => 'Title')
+ ) .
+ Wrap(
+ Wrap($Badge->Description, 'span', array('class' => 'MItem BadgeDescription')) .
+ Wrap($Badge->AwardValue . ' points.', 'span', array('class' => 'MItem BadgePoints')) .
+ WrapIf($AwardDescription, 'p'),
+ 'div',
+ array('class' => 'Meta')),
+ 'div',
+ array('class' => 'ItemContent Badge')
+ );
+ echo Wrap($Row, 'li', array('class' => 'Item ItemBadge' . $ReadClass));
+}
+
+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 '';