forked from elementary/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathteam.php
164 lines (135 loc) · 7.21 KB
/
team.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<?php
include '_templates/sitewide.php';
$page['description'] = 'Meet the people behind elementary.';
$page['title'] = 'Team ⋅ elementary';
// $page['theme-color'] = '#226BB3';
$page['scripts'] = '<link rel="stylesheet" type="text/css" media="all" href="styles/team.css">';
include $template['header'];
include $template['alert'];
require_once __DIR__.'/backend/config.loader.php';
$apiUrl = "https://slack.com/api/users.list?presence=1&token={$config['slack_token']}";
$apiContent = file_get_contents($apiUrl);
$apiResponse = json_decode($apiContent, true);
$apiFilter = array( // Filter certain member IDs from showing up on the page
"USLACKBOT", // slackbot
"U0299PY5U", // David Gomes (Fix title!)
"U0299C8QT", // teemperor (Fix title!)
"U02RCLE6C", // Gero (Remove "Elementary" from title)
"U028XTDHM", // Kiran (inactive)
"U02AEMYH1", // Tom (inactive)
"U02AENUA1", // Mario (inactive)
);
$apiCommunity = array( // List of community members and collaborators
"U02CH39T2", // nathandyer
"U0J4L6LLB", // bflo
"U02DCH8AF", // ikey
"U043P7SCH", // debarshi.ray
"U02RZBX56", // sri
"U0R3F5GUC", // linusbobcat
"U098RCR0U", // gandalfn
"U15815M6C", // decathorpe
"U02C59PF7", // ochosi
);
?>
<section class="grid">
<div class="two-thirds">
<h2>We believe in the unique combination of top-notch UX and the world-changing power of Open Source.</h2>
<p>elementary was founded in 2007 by a small group of passionate volunteers. Over the years, we’ve been able to grow into a tiny company and fund the development of open source software. We’re a dedicated team of developers, designers, writers, and everyday computer users crafting an incredible open computing experience. We are elementary.</p>
</div>
</section>
<section class="grid">
<div class="whole">
<?php
if ($apiResponse['ok']) {
?>
<div class="team-directory">
<?php
$members = array_filter( $apiResponse['members'], function($member) use ($apiFilter, $apiCommunity) {
if ( in_array( $member['id'], $apiFilter ) ) return false;
if ( in_array( $member['id'], $apiCommunity ) ) return false;
if ( $member['deleted'] ) return false;
if ( !isset($member['profile']['title']) || $member['profile']['title'] == '' ) return false;
if ( $member['is_bot'] ) return false;
return true;
});
foreach ( $members as $key => $member ) {
// Because some people just want to see the page burn
if ( !empty($member['real_name']) ) {
$members[$key]['name'] = htmlspecialchars($member['real_name']);
} else {
$members[$key]['name'] = htmlspecialchars($member['name']);
}
$members[$key]['profile']['title'] = htmlspecialchars($member['profile']['title']);
}
usort( $members, function($a, $b) {
if ( $a['id'] == 'U029601AF' ) return -1; // "I'm #1!" ~ Dan
if ( $b['id'] == 'U029601AF' ) return 1;
if ( $a['is_admin'] && !$b['is_admin'] ) return -1; // Admin's first
if ( $b['is_admin'] && !$a['is_admin'] ) return 1;
if ( $a['presence'] == 'active' && $b['presence'] != 'active') return -1; // Online people first
if ( $b['presence'] == 'active' && $a['presence'] != 'active') return 1;
return strcasecmp( $a['name'], $b['name'] ); // Sort alphabetically
});
foreach( $members as $member ) {
?>
<div class="member">
<div class="member_photo" style="background-image:url(<?=$member['profile']['image_192']?>)"></div>
<h5 class="member_name"><?=$member['name']?><?php if ($member['presence'] == 'active') { ?><img class="member_status" title="Online" src="<?=$sitewide['root'];?>images/team/user-available.svg"><?php } ?></h5>
<span class="member_title"><?=$member['profile']['title']?></span>
<span class="member_time"><?=$member['tz_label']?></span>
</div>
<?php
}
?>
</div>
</div>
</section>
<section class="grid">
<div class="two-thirds">
<h2>Community & Collaborators</h2>
<p>elementary would not exist without the involvement of dedicated community members and collaborators from other free and open source projects.</p>
</div>
<div class="whole">
<div class="team-directory">
<?php
$community_members = array_filter( $apiResponse['members'], function($community_member) use ($apiCommunity) {
if ( !isset($community_member['profile']['title']) || $community_member['profile']['title'] == '' ) return false;
if ( in_array( $community_member['id'], $apiCommunity ) ) return true;
return false;
});
foreach ( $community_members as $key => $community_member ) {
// Because some people just want to see the page burn
if ( !empty($community_member['real_name']) ) {
$community_members[$key]['name'] = htmlspecialchars($community_member['real_name']);
} else {
$community_members[$key]['name'] = htmlspecialchars($community_member['name']);
}
$community_members[$key]['profile']['title'] = htmlspecialchars($community_member['profile']['title']);
}
usort( $community_members, function($a, $b) {
if ( $a['presence'] == 'active' && $b['presence'] != 'active') return -1; // Online people first
if ( $b['presence'] == 'active' && $a['presence'] != 'active') return 1;
return strcasecmp( $a['name'], $b['name'] ); // Sort alphabetically
});
foreach( $community_members as $community_member ) {
?>
<div class="member">
<div class="member_photo" style="background-image:url(<?=$community_member['profile']['image_192']?>)"></div>
<h5 class="member_name"><?=$community_member['name']?><?php if ($community_member['presence'] == 'active') { ?><img class="member_status" title="Online" src="<?=$sitewide['root'];?>images/team/user-available.svg"><?php } ?></h5>
<span class="member_title"><?=$community_member['profile']['title']?></span>
<span class="member_time"><?=$community_member['tz_label']?></span>
</div>
<?php
}
?>
</div>
<?php
}
?>
<a class="button suggested-action" href="get-involved">Get Involved</a>
<p class="small-label"><i class="fa fa-slack"></i> Powered by Slack</p>
</div>
</section>
<?php
include $template['footer'];
?>