Skip to content

Commit 7db9ca0

Browse files
Merge pull request #169 from CodeForPhilly/development
Release: laddr v2.3.7
2 parents 087e912 + 307e6c4 commit 7db9ca0

File tree

3 files changed

+80
-80
lines changed

3 files changed

+80
-80
lines changed
Lines changed: 43 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,43 @@
1-
<li><a href="/projects">{_ "Projects"}</a></li>
2-
<li><a href="/people">{_ "Members"}</a></li>
3-
<li><a href="/mission">{_ "Mission"}</a></li>
4-
<li><a href="/how-to-help">{_ "How to Help"}</a></li>
5-
<li><a href="http://forum.codeforphilly.org/login" target="_blank">Discuss</a></li>
6-
<li><a href="/resources">{_ "Resources"}</a></li>
1+
<li class="dropdown">
2+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Projects"} <span class="caret"></span></a>
3+
<ul class="dropdown-menu">
4+
<li><a href="/projects">{_ "Browse Projects"}</a></li>
5+
<li><a href="/pages/project_guidelines">{_ "Project Guidelines"}</a></li>
6+
</ul>
7+
</li>
8+
9+
<li class="dropdown">
10+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Connect"} <span class="caret"></span></a>
11+
<ul class="dropdown-menu">
12+
<li><a href="/chat" target="_blank">{_ "Chat"} <small>({_ "Slack"})</small></a></li>
13+
<li><a href="/contact">{_ "Contact Us"}</a></li>
14+
<li><a href="/members">{_ "Browse Members"}</a></li>
15+
</ul>
16+
</li>
17+
18+
<li class="dropdown">
19+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Events"} <span class="caret"></span></a>
20+
<ul class="dropdown-menu">
21+
<li class="dropdown-header">{_ "Programs"}</li>
22+
<li><a href="/pages/weekly_meetups">Weekly Meetups</a></li>
23+
<li><a href="/pages/hackathons">Hackathons</a></li>
24+
</ul>
25+
</li>
26+
27+
<li class="dropdown">
28+
<a href="/resources" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Resources"} <span class="caret"></span></a>
29+
<ul class="dropdown-menu">
30+
{include includes/site.resourcelinks.tpl}
31+
</ul>
32+
</li>
33+
34+
<li class="dropdown">
35+
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "About"} <span class="caret"></span></a>
36+
<ul class="dropdown-menu">
37+
<li><a href="/mission">{_ "Mission"}</a></li>
38+
<li><a href="/pages/leadership">{_ "Leadership"}</a></li>
39+
<li><a href="/pages/sponsors">{_ "Sponsors"}</a></li>
40+
<li><a href="/how-to-help">{_ "How to Help"}</a></li>
41+
<li><a href="/pages/code_of_conduct">{_ "Code of Conduct"}</a></li>
42+
</ul>
43+
</li>

php-classes/RemoteSystems/Meetup.php

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@
33
namespace RemoteSystems;
44

55
use Cache;
6+
use Exception;
67

78
class Meetup
89
{
910
public static $groupUrl;
1011
public static $signedEventsUrl;
11-
public static $defaultCacheTime = 1800;
12+
public static $defaultCacheTime = 600;
13+
public static $failureCacheTime = 60;
1214
public static $eventsFilter;
1315

1416
public static function getEventUrl($meetupID)
@@ -31,9 +33,18 @@ public static function getEvents($ttl = null)
3133
}
3234

3335
$cacheKey = 'meetup/events';
36+
$data = Cache::fetch($cacheKey);
3437

35-
if (!$data = Cache::fetch($cacheKey)) {
36-
$data = json_decode(file_get_contents(static::$signedEventsUrl), true);
38+
if ($data === null) {
39+
// cached failure
40+
throw new Exception('Meetup API unavailable');
41+
} elseif ($data === false) {
42+
$data = @json_decode(@file_get_contents(static::$signedEventsUrl), true);
43+
44+
if (!$data) {
45+
Cache::store($cacheKey, null, static::$failureCacheTime);
46+
throw new Exception('Meetup API unavailable');
47+
}
3748

3849
if (static::$eventsFilter) {
3950
if (is_string(static::$eventsFilter)) {

site-root/home.php

Lines changed: 23 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -6,81 +6,33 @@
66

77

88
// meetups
9-
$meetups = RemoteSystems\Meetup::getEvents();
10-
$nextMeetup = array_shift($meetups);
9+
try {
10+
$meetups = RemoteSystems\Meetup::getEvents();
1111

12-
// detect if meetup is happening right now
13-
if($nextMeetup && $nextMeetup['time'] < $now) {
14-
$currentMeetup = $nextMeetup;
1512
$nextMeetup = array_shift($meetups);
13+
14+
// detect if meetup is happening right now
15+
if($nextMeetup && $nextMeetup['time'] < $now) {
16+
$currentMeetup = $nextMeetup;
17+
$nextMeetup = array_shift($meetups);
18+
}
19+
20+
// TODO: delete this!
21+
elseif(!empty($_GET['force_current'])) {
22+
$currentMeetup = $nextMeetup;
23+
}
24+
25+
if($currentMeetup) {
26+
$currentMeetup['checkins'] = Laddr\MemberCheckin::getAllForMeetupByProject($currentMeetup['id']);
27+
}
28+
29+
$pageData['currentMeetup'] = $currentMeetup;
30+
$pageData['nextMeetup'] = $nextMeetup;
31+
$pageData['futureMeetups'] = $meetups;
32+
} catch (Exception $e) {
33+
// just omit meetup data
1634
}
1735

18-
// TODO: delete this!
19-
elseif(!empty($_GET['force_current'])) {
20-
$currentMeetup = $nextMeetup;
21-
}
22-
23-
if($currentMeetup) {
24-
$currentMeetup['checkins'] = Laddr\MemberCheckin::getAllForMeetupByProject($currentMeetup['id']);
25-
}
26-
27-
$pageData['currentMeetup'] = $currentMeetup;
28-
$pageData['nextMeetup'] = $nextMeetup;
29-
$pageData['futureMeetups'] = $meetups;
30-
31-
32-
// projects
33-
$pageData['projectsTotal'] = Laddr\Project::getCount();
34-
$pageData['projectsTags']['byTech'] = TagItem::getTagsSummary(array(
35-
'tagConditions' => array(
36-
'Handle LIKE "tech.%"'
37-
)
38-
,'itemConditions' => array(
39-
'ContextClass' => Laddr\Project::getStaticRootClass()
40-
)
41-
,'limit' => 10
42-
));
43-
$pageData['projectsTags']['byTopic'] = TagItem::getTagsSummary(array(
44-
'tagConditions' => array(
45-
'Handle LIKE "topic.%"'
46-
)
47-
,'itemConditions' => array(
48-
'ContextClass' => Laddr\Project::getStaticRootClass()
49-
)
50-
,'limit' => 10
51-
));
52-
$pageData['projectsTags']['byEvent'] = TagItem::getTagsSummary(array(
53-
'tagConditions' => array(
54-
'Handle LIKE "event.%"'
55-
)
56-
,'itemConditions' => array(
57-
'ContextClass' => Laddr\Project::getStaticRootClass()
58-
)
59-
));
60-
$pageData['projectsStages'] = Laddr\Project::getStagesSummary();
61-
62-
63-
// members
64-
$pageData['membersTotal'] = Emergence\People\Person::getCount();
65-
$pageData['membersTags']['byTech'] = TagItem::getTagsSummary(array(
66-
'tagConditions' => array(
67-
'Handle LIKE "tech.%"'
68-
)
69-
,'itemConditions' => array(
70-
'ContextClass' => Emergence\People\Person::getStaticRootClass()
71-
)
72-
,'limit' => 10
73-
));
74-
$pageData['membersTags']['byTopic'] = TagItem::getTagsSummary(array(
75-
'tagConditions' => array(
76-
'Handle LIKE "topic.%"'
77-
)
78-
,'itemConditions' => array(
79-
'ContextClass' => Emergence\People\Person::getStaticRootClass()
80-
)
81-
,'limit' => 10
82-
));
83-
8436

8537
// build activity stream
8638
if (!$pageData['activity'] = Cache::fetch('home-activity')) {

0 commit comments

Comments
 (0)