defined('_JEXEC') or die('Unauthorized Access'); ?> <div class="es-badges"> <h3><?php echo JText::_('COM_EASYBLOG_ACHIEVEMENTS'); ?> </h3> <?php if ($badges) { ?> <ul class="reset-ul"> <?php foreach ($badges as $badge) { ?> <li> <a href="<?php echo FRoute::badges(array('id' => $badge->id, 'layout' => 'item')); ?> "><img src="<?php echo $badge->getAvatar(); ?> " width="32" /></a> </li> <?php } ?> </ul> <?php } ?> </div>
?> <?php echo JText::_(FD::string()->computeNoun('COM_EASYSOCIAL_FOLLOWERS', $user->getTotalFollowers())); ?> </a> </span> <?php } ?> <?php if ($this->config->get('badges.enabled') && $user->badgesViewable(FD::user()->id)) { ?> <span> <a href="<?php echo FRoute::badges(array('layout' => 'achievements', 'userid' => $user->getAlias())); ?> "> <i class="ies-crown"></i> <?php echo $user->getTotalBadges(); ?> <?php echo JText::_(FD::string()->computeNoun('COM_EASYSOCIAL_ACHIEVEMENTS', $user->getTotalBadges())); ?> </a> </span> <?php } ?>
?> </a> </li> <?php } ?> <?php if ($this->config->get('badges.enabled')) { ?> <li class="<?php echo $view == 'badges' ? 'active' : ''; ?> "> <a href="<?php echo FRoute::badges(array('layout' => 'achievements')); ?> "> <?php echo JText::_('COM_EASYSOCIAL_TOOLBAR_PROFILE_ACHIEVEMENTS'); ?> </a> </li> <?php } ?> <?php if ($this->config->get('points.enabled')) { ?> <li class="<?php
/** * Retrieve the badge permalink * * @since 1.0 * @access public * @return int The total number of users who achieved this badge. */ public function getPermalink($xhtml = false, $external = false) { $url = FRoute::badges(array('id' => $this->getAlias(), 'external' => $external, 'layout' => 'item'), $xhtml); return $url; }
/** * Displays a list of badges the user has achieved * * @since 1.0 * @access public * @param string * @return */ public function achievements() { // Check for user profile completeness FD::checkCompleteProfile(); $config = FD::config(); if (!$config->get('badges.enabled')) { return $this->redirect(FRoute::dashboard(array(), false)); } // Get the current user id that should be displayed $userId = JRequest::getInt('userid', null); $user = FD::user($userId); // If user is not found, we need to redirect back to the dashboard page if (!$user->id) { return $this->redirect(FRoute::dashboard(array(), false)); } $title = JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS'); if (!$user->isViewer()) { $title = JText::sprintf('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS_USER', $user->getName()); // Let's test if the current viewer is allowed to view this user's achievements. $my = FD::user(); $privacy = $my->getPrivacy(); $allowed = $privacy->validate('achievements.view', $user->id, SOCIAL_TYPE_USER); if (!$allowed) { $this->set('user', $user); parent::display('site/badges/restricted'); return; } } // Set the page title FD::page()->title($title); // Set the page breadcrumb FD::page()->breadcrumb(JText::_('COM_EASYSOCIAL_PAGE_TITLE_ACHIEVEMENTS'), FRoute::badges(array('userid' => $userId, 'layout' => 'achievements'))); // Load admin translations FD::language()->loadAdmin(); // @TODO: Check for privacy $model = FD::model('badges'); $badges = $model->getBadges($user->id); $totalBadges = count($badges); $this->set('totalBadges', $totalBadges); $this->set('badges', $badges); $this->set('user', $user); parent::display('site/badges/achievements'); }
/** * Responsible to send notification to the user when they achieved a badge * * @since 1.0 * @access public * @param string * @return */ public function sendNotification(SocialTableBadge $badge, $userId) { // Load the language file from the front end too since badge titles are loaded from the back end language FD::language()->loadAdmin(); // We need the language file from the front end FD::language()->loadSite(); // We want to send a notification to the user who earned the badge $recipient = array($userId); // Add notification to the requester that the user accepted his friend request. $systemOptions = array('uid' => $badge->id, 'type' => SOCIAL_TYPE_BADGES, 'url' => FRoute::badges(array('id' => $badge->getAlias(), 'layout' => 'item', 'sef' => false)), 'image' => $badge->getAvatar()); $params = array('badgeTitle' => $badge->get('title'), 'badgePermalink' => $badge->getPermalink(false, true), 'badgeAvatar' => $badge->getAvatar(), 'badgeDescription' => $badge->get('description')); // Email template $emailOptions = array('title' => 'COM_EASYSOCIAL_EMAILS_UNLOCKED_NEW_BADGE_SUBJECT', 'badge' => $badge->get('title'), 'template' => 'site/badges/unlocked', 'params' => $params); // Send notifications to the receivers when they unlock the badge FD::notify('badges.unlocked', $recipient, $emailOptions, $systemOptions); }
background-image: linear-gradient(to bottom, #91C2EA, #6D9CCA); background-repeat: repeat-x; border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25); text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); border-style: solid; border-width: 1px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.2) inset, 0 1px 2px rgba(0, 0, 0, 0.05); border-radius:2px; -moz-border-radius:2px; -webkit-border-radius:2px; " href="<?php echo $badgePermalink; ?> "><?php echo JText::_('COM_EASYSOCIAL_EMAILS_VIEW_BADGE'); ?> </a> <p style="margin-top: 15px;"> <?php echo JText::_('COM_EASYSOCIAL_EMAILS_BADGES_CHECKOUT_YOUR_ACHIEVEMENTS'); ?> <a href="<?php echo FRoute::badges(array('external' => true, 'layout' => 'achievements')); ?> " style="color:#00aeef; text-decoration:none;"><?php echo JText::_('COM_EASYSOCIAL_EMAILS_BADGES_SEE_ALL'); ?> </a> </p> </td> </tr>