public function action_view()
 {
     $view = View::factory('leaderboard_view');
     $community_id = $this->request->param('id');
     $view->community = com_from_id($community_id);
     $view->scores = DB::select()->from('leaderboards')->where('community', '=', $community_id)->order_by('score', 'DESC')->execute()->as_array();
     $this->template->content = $view;
 }
Beispiel #2
0
 public function action_add()
 {
     $community = $this->request->param('id');
     if (!$community) {
         $this->request->redirect(URL::base() . 'tournament');
     }
     $view = View::factory('tournament_add');
     $view->community = com_from_id($community);
     $view->available_maps = get_maps();
     /*
     $view->refs = '';
     $view->maps = '';
     */
     $view->description = '';
     $view->exclusive = '';
     if ($_POST) {
         $refs = array();
         $refCount = $_POST['refCount'];
         for ($i = 1; $i <= $refCount; $i++) {
             array_push($refs, $_POST['ref' . $i]);
         }
         $ref_ids = array();
         foreach ($refs as $ref) {
             if (!id_from_name($ref)) {
                 array_push($this->template->errors, "Could not find user: "******"You are not the admin of this community.");
         }
         if (empty($this->template->errors)) {
             //DB::insert('tournies', array('community','admin','description','exclusive'))->values(array($community,$this->user,$description,$exclusive))->execute();
             $this->request->redirect("/tournament?success");
         } else {
             $view->description = $description;
             $view->exclusive = $exclusive;
         }
     }
     $this->template->content = $view;
 }
Beispiel #3
0
 <?php 
echo $message;
?>
 <a href="<?php 
echo URL::base() . "community/view/" . $community_id;
?>
">Return to <?php 
echo com_from_id($community_id);
?>
</a>
 <h2><?php 
echo $name;
?>
 - <?php 
echo com_from_id($community);
?>
</h2>
<h4>Admin: <?php 
echo $admin;
?>
</h4>
<h4>Refs: 
<?
	$i = 0;
	foreach($refs as $ref)
	{
		echo name_from_id($ref);
		if($i+1 != count($refs)) {
			echo ", ";
		}
		$i++;
	}
?>
</h4>
<h4>Players</h4>
<ul>
	<? foreach($players as $player) {
		echo "<li>" . name_from_id($player) . "</li>";
	}
	?>
</ul>
<h2>Leaderboards</h2>
<table>
<tr>
	<th>Community</th>
	<th>Total Users</th>
</tr>
<?
	foreach($boards as $board) {
		echo "<tr>\n";
		echo "\t" . '<td><a href="' . URL::base() . 'leaderboard/view/' . $board['community'] . '">' . com_from_id($board['community']) . "</a></td>\n";
		echo "\t<td>" . count_from_id($board['community']) . "</td>\n";
		echo "</tr>\n";
	}
?>
</table>