Ejemplo n.º 1
0
function get_pct_badges($badge_name_prefix, $badge_pctiles, $badge_images)
{
    $badges = array();
    for ($i = 0; $i < 3; $i++) {
        $badges[$i] = get_badge($badge_name_prefix . "_" . $i, "Top " . $badge_pctiles[$i] . "% in average credit", $badge_images[$i]);
    }
    return $badges;
}
function get_badges($badge_name_prefix, $badge_level_names, $badge_images, $sub_project)
{
    $badges = array();
    for ($i = 0; $i < count($badge_level_names); $i++) {
        $badges[$i] = get_badge($badge_name_prefix . "_" . $sub_project["short_name"] . "_" . $i, "{$badge_level_names[$i]} in " . $sub_project["name"] . " credit", $sub_project["short_name"] . $badge_images[$i]);
    }
    return $badges;
}
Ejemplo n.º 3
0
 function auto_share($userid, $quizid, $badge = FALSE, $badge_name = FALSE)
 {
     $auth = $this->auth($userid);
     $row1 = $this->db->query("SELECT point, amount FROM score WHERE user_id='{$userid}' AND quiz_id='{$quizid}' LIMIT 1")->row();
     $row2 = $this->db->query("SELECT share_created, share_took, share_onehundred, share_badge FROM user WHERE username='******' LIMIT 1")->row();
     $send = FALSE;
     if ($badge == FALSE) {
         if ($row1->point > $row1->amount && $row2->share_created == 1) {
             $tweet = 'I just created the quiz \'' . get_title($quizid, FALSE) . '\' on @OneExtraLap! Come & take it! ' . get_quiz_link($quizid);
             $send = TRUE;
         }
         if ($row1->point == $row1->amount && $row2->share_onehundred == 1) {
             $tweet = 'I just got 100% in the quiz \'' . get_title($quizid, FALSE) . '\' on @OneExtraLap! You can do it too! ' . get_quiz_link($quizid);
             $send = TRUE;
         } elseif ($row1->point <= $row1->amount && $row2->share_took == 1) {
             $tweet = 'I just got ' . get_percentage($row1->point, $row1->amount) . ' in the quiz \'' . get_title($quizid, FALSE) . '\' on @OneExtraLap! Can you beat me? ' . get_quiz_link($quizid);
             $send = TRUE;
         }
     } else {
         if ($row2->share_badge == 1) {
             $badge_info = get_badge($badge);
             $tweet = 'I just unlocked the badge \'' . $badge_name . '\' on @OneExtraLap! http://oneextralap.com/badges/' . $badge;
             $send = TRUE;
         }
     }
     if ($send == TRUE) {
         $this->twitter->call('statuses/update', array('status' => trim($tweet)));
         return TRUE;
     }
     return FALSE;
 }
Ejemplo n.º 4
0
 function badges($id, $page)
 {
     $return = $this->global_function->initialize('badges');
     $username = $return['username'];
     $return['badge_id'] = $id;
     $return['badges'] = $this->search_model->get_your_badges($username);
     if ($this->config->item('enable_badge') == FALSE) {
         $this->global_function->load_view($return, TRUE, 503);
     } elseif ($this->search_model->check_badge_existance($id) == FALSE) {
         $this->global_function->load_view($return, TRUE, 404);
     } else {
         $name = get_badge($id);
         $return['main'] = $this->search_model->get_badge($id, $username);
         $return['total'] = $this->search_model->get_badges_total();
         $return['body_title'] = 'Badge: ' . $name['name'];
         $return['content_type'] = 'badges';
         $this->global_function->load_view($return);
     }
 }
Ejemplo n.º 5
0
                echo $row->tag;
                ?>
"><?php 
                echo $row->tag;
                ?>
</a>
							</div>
							<div class="right tag_count number"><?php 
                echo $row->number;
                ?>
</div>
							<div class="clear"></div>
<?php 
            }
            if ($content_type == 'badges') {
                $badge = get_badge(FALSE, $row->id);
                ?>
							<ul class="individual">
								<li class="first_column"><?php 
                echo get_avatar($row->user_id);
                ?>
</li>
								<li class="second_column"><?php 
                echo get_fullname($row->user_id);
                ?>
</li>
								<li class="third_column timespan">Unlocked <?php 
                echo convert_timespan($row->time);
                ?>
</li>
							</ul>
Ejemplo n.º 6
0
function draw_activity($activity)
{
    ob_start();
    echo "&raquo; ";
    if (isset($activity->u_id) && isset($activity->b_id)) {
        /* User on group got a badge */
        $user = get_userdata($activity->u_id);
        $badge = get_badge($activity->b_id);
        echo "Medlem <a href=\"#fancyboxinfo\">{$user->first_name}</a> fikk badgen <a href=\"#fancyboxinfo\">{$badge->navn}</a> <img src=\"{$badge->icon}\" title=\"{$badge->besk}\" />.";
    } else {
        if (isset($activity->u_id)) {
            $user = get_userdata($activity->u_id);
            /* New member */
            echo "<a href=\"#fancyboxinfo\">{$user->first_name}</a> koblet til gruppen.";
        } else {
            if (isset($activity->k_id)) {
                /* New score */
                $contest = get_contest($activity->k_id);
                echo "Scoret {$contest->score} poeng i <a href=\"#fancyboxinfo\">{$contest->navn}</a>.";
            } else {
                if (isset($activity->b_id)) {
                    $badge = get_badge($activity->b_id);
                    /* New badge */
                    echo "Fikk badgen <a href=\"#fancyboxinfo\">{$badge->navn}</a> <img src=\"{$badge->icon}\" title=\"{$badge->besk}\" />.";
                } else {
                    echo "Invalid acitivity ID.";
                }
            }
        }
    }
    $data = ob_get_contents();
    ob_end_clean();
    return $data;
}
Ejemplo n.º 7
0
					</div>
					<div class="sidebar">
						<div class="top"></div>
						<div class="title first">Badges</div>
<?php 
                } else {
                    ?>
						<div class="title first">Your Badges</div>
<?php 
                }
                ?>
						<div class="badge">
							<ul>
<?php 
                foreach ($badges->result() as $row) {
                    $badge = get_badge($row->badge_id);
                    ?>
								<li>
									<a class="badge badge<?php 
                    echo $badge['class'];
                    ?>
" href="/badges/<?php 
                    echo $row->badge_id;
                    ?>
" title="<?php 
                    echo $badge['explanation'];
                    ?>
, <?php 
                    echo $badge['point'];
                    ?>
 points"><?php 
}
echo '<nav class="navbar navbar-default">
  			 <div class="container-fluid">
  
		    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		        <ul class="nav navbar-nav">
		            <li class="dropdown">
		              <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Shop by Category <span class="caret"></span></a>
		              <ul class="dropdown-menu">
		              	<li><a href="searchCategory.php?param1=All">All Products</a></li>
		                <li><a href="searchCategory.php?param1=Men">Men\'s Apparel</a></li>
		                <li><a href="searchCategory.php?param1=Women">Women\'s Apparel</a></li>
		                <li><a href="searchCategory.php?param1=Children">Children\'s Apparel</a></li>
		                <li role="separator" class="divider"></li>
		                <li><a href="searchCategory.php?param1=Accessories">Finest Programmer Accessories!</a></li>
		              </ul>
		            </li>
		        </ul>
		        <form class="navbar-form navbar-left" role="search" method="post" action="search.php">
		           <input type="text" class="form-control input-large" placeholder="Search..." name="search" id="searchBar">
		           <button type="submit" class="btn btn-default">Find It!</button>
		        </form>
		      <ul class="nav navbar-nav navbar-right">
		        <li><a href="Main.php">Home  <span class="glyphicon glyphicon-home" aria-hidden="true"></span> 
		        <li><a href="cart.php">Cart  <span class="glyphicon glyphicon-shopping-cart" aria-hidden="true"></span>  <span class="badge" id="loot">' . get_badge($_SESSION['eid']) . '</span></a></li>
		        <li><a href="profile.php">Welcome ' . $_SESSION['name'] . '!</a></li>
		        <li><a href="logout.php">Log Out</a></li>
		      </ul>
		    </div>
		  </div>
		</nav>';