-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoincommunities.php
127 lines (109 loc) · 5.46 KB
/
joincommunities.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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
/*
Copyright (C) 2008-2009 Gilles Dubuc (www.kouiskas.com - [email protected])
Page where users create, join and leave communities
*/
require_once(dirname(__FILE__).'/entities/community.php');
require_once(dirname(__FILE__).'/entities/communitylist.php');
require_once(dirname(__FILE__).'/entities/communitymembership.php');
require_once(dirname(__FILE__).'/entities/communitymembershiplist.php');
require_once(dirname(__FILE__).'/entities/pointsvalue.php');
require_once(dirname(__FILE__).'/entities/user.php');
require_once(dirname(__FILE__).'/entities/userlevellist.php');
require_once(dirname(__FILE__).'/utilities/page.php');
require_once(dirname(__FILE__).'/utilities/string.php');
require_once(dirname(__FILE__).'/utilities/ui.php');
require_once(dirname(__FILE__).'/constants.php');
require_once(dirname(__FILE__).'/settings.php');
$user = User::getSessionUser();
$levels = UserLevelList::getByUid($user->getUid());
$ispremium = in_array($USER_LEVEL['PREMIUM'], $levels);
$hideads = ($ispremium && $user->getHideAds());
$page = new Page('JOIN_COMMUNITIES', 'COMMUNITIES', $user);
$page->addJavascript('VIEW_COMMUNITIES');
$page->addStyle('COMMUNITIES');
$page->setTitle('<translate id="JOIN_COMMUNITIES_PAGE_TITLE">Join communities on inspi.re</translate>');
$page->startHTML();
$page->addJavascriptVariable('request_update_communities_per_page', $REQUEST['UPDATE_COMMUNITIES_PER_PAGE']);
$page->addJavascriptVariable('request_joinable_community_list', $REQUEST['JOINABLE_COMMUNITY_LIST']);
echo '<div class="hint">';
echo '<div class="hint_title">';
echo '<translate id="COMMUNITIES_JOINABLE">';
echo 'Communities you can join';
echo '</translate>';
echo '</div> <!-- hint_title -->';
echo '<translate id="COMMUNITIES_JOINABLE_BODY">';
echo 'Click on any community\'s name and you will access its description page, which is where you can join it.';
echo '</translate>';
echo '</div> <!-- hint -->';
echo UI::RenderJoinableCommunityPaging($user, 1, true);
echo '<ad ad_id="COMMUNITIES"/>';
echo '<div id="joinable_order" class="'.($hideads?'abovemargin':'').'">';
echo '<translate id="JOINABLE_COMMUNITY_ORDER">';
echo 'Order: ';
echo '<a class="order_option" id="order_'.$COMMUNITY_ORDER['RECENT'].'" href="javascript:orderJoinableCommunities('.$COMMUNITY_ORDER['RECENT'].', current_page, restrict_language, restrict_labels);">';
echo 'most recent first';
echo '</a>';
echo ' - ';
echo '<a class="order_option" id="order_'.$COMMUNITY_ORDER['OLD'].'" href="javascript:orderJoinableCommunities('.$COMMUNITY_ORDER['OLD'].', current_page, restrict_language, restrict_labels);">';
echo 'oldest first';
echo '</a>';
echo ' - ';
echo '<a class="order_option" id="order_'.$COMMUNITY_ORDER['BIG'].'" href="javascript:orderJoinableCommunities('.$COMMUNITY_ORDER['BIG'].', current_page, restrict_language, restrict_labels);">';
echo 'biggest first';
echo '</a>';
echo ' - ';
echo '<a class="order_option" id="order_'.$COMMUNITY_ORDER['SMALL'].'" href="javascript:orderJoinableCommunities('.$COMMUNITY_ORDER['SMALL'].', current_page, restrict_language, restrict_labels);">';
echo 'smallest first';
echo '</a>';
echo '</translate>';
echo '</div>';
echo '<img src="'.$GRAPHICS_PATH.'ajax-loader.gif" id="loader" style="display:none">';
echo '<div id="language_toggle">';
echo '<input id="language_switch" type="checkbox" checked/>';
echo '<translate id="JOINABLE_COMMUNITY_LANGUAGE_RESTRICT">';
echo 'Restrict list to communities whose main language is <language_name lid="'.$user->getLid().'"/>';
echo '</translate>';
echo '</div>';
echo '<div id="label_filter">';
echo '<div id="label_filter_header">';
echo '<translate id="JOINABLE_COMMUNITY_KEYWORD_FILTER">Filter by keyword(s):</translate> ';
echo '</div> <!-- label_filter_header -->';
foreach ($COMMUNITY_LABEL_NAME as $clid => $name) {
echo '<div class="filter_label" id="label_'.$clid.'">';
echo '<a href="javascript:selectLabel('.$clid.');">';
echo '<translate id="COMMUNITY_LABEL_'.$clid.'">'.$name.'</translate>';
echo '</a>';
echo '</div> <!-- label_'.$clid.' -->';
}
echo '</div> <!-- label_filter -->';
$page->addJavascriptVariable('current_page', 1);
$page->addJavascriptVariable('current_order', $COMMUNITY_ORDER['BIG']);
echo UI::RenderJoinableCommunityList($user, $COMMUNITY_ORDER['BIG'], 1, true);
$amount_per_page = UserPaging::getPagingValue($user->getUid(), 'COMMUNITIES_COMMUNITIES');
echo '<div class="light_hint clearboth abovemargin">';
echo '<div id="communities_current_amount">';
if ($amount_per_page > 1) {
echo '<translate id="COMMUNITIES_AMOUNT_PLURAL">';
echo 'Currently displaying <integer value="'.$amount_per_page.'"/> communities per page.';
echo '</translate>';
} else {
echo '<translate id="COMMUNITIES_AMOUNT_SINGULAR">';
echo 'Currently displaying <integer value="'.$amount_per_page.'"/> community per page.';
echo '</translate>';
}
echo '</div>';
echo '<div id="communities_change_amount">';
echo '<translate id="HOME_INBOX_BOTTOM_CHANGE_AMOUNT">';
echo '<a href="javascript:changeCommunitiesAmount();">Change that amount</a>.';
echo '</translate>';
echo '</div>';
echo '<div id="communities_change_input" style="display:none">';
echo '<translate id="COMMUNITIES_INPUT_AMOUNT">';
echo 'Display <input id="communities_per_page" class="number_field" maximum="4" numerical="true" type="text" value="'.$amount_per_page.'" /> communities per page. <a href="javascript:saveCommunitiesAmount()">Save</a> <a href="javascript:cancelCommunitiesAmount()">Cancel</a>';
echo '</translate>';
echo '</div>';
echo '</div> <!-- hint -->';
$page->endHTML();
$page->render();
?>