forked from theclimber/Bilboplanet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
portal.php
81 lines (69 loc) · 1.69 KB
/
portal.php
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
# Valeurs par defaut
$num_start = 0;
$nb_items = $blog_settings->get('planet_nb_post');
$popular = false;
$period = null;
$users = array();
$tags = array();
$page = 0;
$search_value = null;
$post_id = null;
$post_status = 1;
$params = array(
'title'=> $blog_settings->get('planet_title')." - ".T_('Portal'),
'popular'=> 'false',
'filter'=> 'week',
'page' => 0
);
$core->tpl->setVar('params', $params);
if ($core->auth->sessionExists() ) {
$user_condition = "OR user_id = '".$core->auth->userID()."'";
}
$sql_tribes = "SELECT
tribe_id,
user_id,
tribe_name
FROM ".$core->prefix."tribe
WHERE visibility = 1
AND (user_id = 'root' ".$user_condition.")
ORDER BY ordering DESC";
//print $sql_tribes;
//exit;
$rs = $core->con->select($sql_tribes);
$align= 'right';
while ($rs->fetch()) {
$align = $align=='right'? 'left' : 'right';
$tribe = array(
"title" => $rs->tribe_name,
"id" => $rs->tribe_id,
"align" => $align
);
$core->tpl->setVar('tribe', $tribe);
// Generating the SQL request
$sql_posts = generate_tribe_SQL($rs->tribe_id);
showTribe($sql_posts);
// For each tribe I'll have to generate a list of 10 posts with their title and permalink
}
$align = $align=='right'? 'left' : 'right';
$tribe = array(
"title" => T_('Popular posts'),
"id" => 'popular',
"align" => $align
);
$core->tpl->setVar('tribe', $tribe);
$popular_sql = generate_SQL(
0, // num start
10, // nb items
array(), // users
array(), // tags
null, // search
"week", // period
true); // popular
showTribe($popular_sql, true);
$core->tpl->render("content.portal");
# Show result
$analytics_code = getAnalyticsCode();
$core->tpl->setVar('analytics_html', $analytics_code);
echo $core->tpl->render();
?>