Skip to content

Commit

Permalink
Merge pull request #169 from CodeForPhilly/development
Browse files Browse the repository at this point in the history
Release: laddr v2.3.7
  • Loading branch information
themightychris authored Mar 5, 2017
2 parents 087e912 + 307e6c4 commit 7db9ca0
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 80 deletions.
49 changes: 43 additions & 6 deletions html-templates/includes/site.nav-sitelinks.tpl
Original file line number Diff line number Diff line change
@@ -1,6 +1,43 @@
<li><a href="/projects">{_ "Projects"}</a></li>
<li><a href="/people">{_ "Members"}</a></li>
<li><a href="/mission">{_ "Mission"}</a></li>
<li><a href="/how-to-help">{_ "How to Help"}</a></li>
<li><a href="http://forum.codeforphilly.org/login" target="_blank">Discuss</a></li>
<li><a href="/resources">{_ "Resources"}</a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Projects"} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/projects">{_ "Browse Projects"}</a></li>
<li><a href="/pages/project_guidelines">{_ "Project Guidelines"}</a></li>
</ul>
</li>

<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Connect"} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/chat" target="_blank">{_ "Chat"} <small>({_ "Slack"})</small></a></li>
<li><a href="/contact">{_ "Contact Us"}</a></li>
<li><a href="/members">{_ "Browse Members"}</a></li>
</ul>
</li>

<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Events"} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li class="dropdown-header">{_ "Programs"}</li>
<li><a href="/pages/weekly_meetups">Weekly Meetups</a></li>
<li><a href="/pages/hackathons">Hackathons</a></li>
</ul>
</li>

<li class="dropdown">
<a href="/resources" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "Resources"} <span class="caret"></span></a>
<ul class="dropdown-menu">
{include includes/site.resourcelinks.tpl}
</ul>
</li>

<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">{_ "About"} <span class="caret"></span></a>
<ul class="dropdown-menu">
<li><a href="/mission">{_ "Mission"}</a></li>
<li><a href="/pages/leadership">{_ "Leadership"}</a></li>
<li><a href="/pages/sponsors">{_ "Sponsors"}</a></li>
<li><a href="/how-to-help">{_ "How to Help"}</a></li>
<li><a href="/pages/code_of_conduct">{_ "Code of Conduct"}</a></li>
</ul>
</li>
17 changes: 14 additions & 3 deletions php-classes/RemoteSystems/Meetup.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
namespace RemoteSystems;

use Cache;
use Exception;

class Meetup
{
public static $groupUrl;
public static $signedEventsUrl;
public static $defaultCacheTime = 1800;
public static $defaultCacheTime = 600;
public static $failureCacheTime = 60;
public static $eventsFilter;

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

$cacheKey = 'meetup/events';
$data = Cache::fetch($cacheKey);

if (!$data = Cache::fetch($cacheKey)) {
$data = json_decode(file_get_contents(static::$signedEventsUrl), true);
if ($data === null) {
// cached failure
throw new Exception('Meetup API unavailable');
} elseif ($data === false) {
$data = @json_decode(@file_get_contents(static::$signedEventsUrl), true);

if (!$data) {
Cache::store($cacheKey, null, static::$failureCacheTime);
throw new Exception('Meetup API unavailable');
}

if (static::$eventsFilter) {
if (is_string(static::$eventsFilter)) {
Expand Down
94 changes: 23 additions & 71 deletions site-root/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,81 +6,33 @@


// meetups
$meetups = RemoteSystems\Meetup::getEvents();
$nextMeetup = array_shift($meetups);
try {
$meetups = RemoteSystems\Meetup::getEvents();

// detect if meetup is happening right now
if($nextMeetup && $nextMeetup['time'] < $now) {
$currentMeetup = $nextMeetup;
$nextMeetup = array_shift($meetups);

// detect if meetup is happening right now
if($nextMeetup && $nextMeetup['time'] < $now) {
$currentMeetup = $nextMeetup;
$nextMeetup = array_shift($meetups);
}

// TODO: delete this!
elseif(!empty($_GET['force_current'])) {
$currentMeetup = $nextMeetup;
}

if($currentMeetup) {
$currentMeetup['checkins'] = Laddr\MemberCheckin::getAllForMeetupByProject($currentMeetup['id']);
}

$pageData['currentMeetup'] = $currentMeetup;
$pageData['nextMeetup'] = $nextMeetup;
$pageData['futureMeetups'] = $meetups;
} catch (Exception $e) {
// just omit meetup data
}

// TODO: delete this!
elseif(!empty($_GET['force_current'])) {
$currentMeetup = $nextMeetup;
}

if($currentMeetup) {
$currentMeetup['checkins'] = Laddr\MemberCheckin::getAllForMeetupByProject($currentMeetup['id']);
}

$pageData['currentMeetup'] = $currentMeetup;
$pageData['nextMeetup'] = $nextMeetup;
$pageData['futureMeetups'] = $meetups;


// projects
$pageData['projectsTotal'] = Laddr\Project::getCount();
$pageData['projectsTags']['byTech'] = TagItem::getTagsSummary(array(
'tagConditions' => array(
'Handle LIKE "tech.%"'
)
,'itemConditions' => array(
'ContextClass' => Laddr\Project::getStaticRootClass()
)
,'limit' => 10
));
$pageData['projectsTags']['byTopic'] = TagItem::getTagsSummary(array(
'tagConditions' => array(
'Handle LIKE "topic.%"'
)
,'itemConditions' => array(
'ContextClass' => Laddr\Project::getStaticRootClass()
)
,'limit' => 10
));
$pageData['projectsTags']['byEvent'] = TagItem::getTagsSummary(array(
'tagConditions' => array(
'Handle LIKE "event.%"'
)
,'itemConditions' => array(
'ContextClass' => Laddr\Project::getStaticRootClass()
)
));
$pageData['projectsStages'] = Laddr\Project::getStagesSummary();


// members
$pageData['membersTotal'] = Emergence\People\Person::getCount();
$pageData['membersTags']['byTech'] = TagItem::getTagsSummary(array(
'tagConditions' => array(
'Handle LIKE "tech.%"'
)
,'itemConditions' => array(
'ContextClass' => Emergence\People\Person::getStaticRootClass()
)
,'limit' => 10
));
$pageData['membersTags']['byTopic'] = TagItem::getTagsSummary(array(
'tagConditions' => array(
'Handle LIKE "topic.%"'
)
,'itemConditions' => array(
'ContextClass' => Emergence\People\Person::getStaticRootClass()
)
,'limit' => 10
));


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

0 comments on commit 7db9ca0

Please sign in to comment.