summaryrefslogtreecommitdiff
path: root/lib/deck/index.php
blob: ad497d50bac073632e1b72eb458d4bb51c133030 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php

$filters = array (
	"order" => array (
		"nbUsers" => "popularity",
		"name" => "name",
		"owner" => "author",
	),
	"way" => $ord_ways,
);
$fdefaults = array (
	"order" => "nbUsers",
	"way" => "DESC",
);

$decks = array();
$n = sql(
		"SELECT decks.id AS id, decks.name AS name, account.login AS owner, COUNT(deck_study.id) AS nbUsers ".
		"FROM decks LEFT JOIN account ON decks.owner = account.id LEFT JOIN deck_study ON deck_study.deck = decks.id ".
		"GROUP BY decks.id ORDER BY " . get_filter("order") . " " . get_filter("way")
	);
while ($nn = mysql_fetch_assoc($n)) $decks[] = $nn;

require("tpl/deck/index.php");