Skip to content

Commit

Permalink
Only show GMap insights when there's more than 5 geo replies [ci skip]
Browse files Browse the repository at this point in the history
  • Loading branch information
ginatrapani committed Jun 15, 2012
1 parent 8f98ddd commit 6a17a16
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions webapp/_lib/view/_insights.post.tpl
Expand Up @@ -52,7 +52,7 @@
</div>

{if $i->slug eq 'geoencoded_replies'}
<script type="text/javascript" src="/plugins/geoencoder/assets/js/iframe.js"></script>
<iframe width="680" frameborder="0" src="/plugins/geoencoder/map.php?pid={$post->post_id}&n=twitter&t=post" name="childframe" id="childframe" >
<script type="text/javascript" src="{$site_root_path}plugins/geoencoder/assets/js/iframe.js"></script>
<iframe width="680" frameborder="0" src="{$site_root_path}plugins/geoencoder/map.php?pid={$post->post_id}&n=twitter&t=post" name="childframe" id="childframe" >
</iframe>
{/if}
15 changes: 9 additions & 6 deletions webapp/plugins/twitter/model/class.TwitterCrawler.php
Expand Up @@ -1934,12 +1934,15 @@ private function generateInsightFeedItems($number_days=3) {
$simplified_post_date);
}

//If geoencoded, show the map in the stream
$plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
$options = $plugin_option_dao->getOptionsHash('geoencoder', true);
if (isset($options['gmaps_api_key']->option_value) && $post->is_geo_encoded == 1) {
$insight_dao->insertInsight('geoencoded_replies', $this->instance->id, $simplified_post_date,
"Going global! You've got replies all over the map.", Insight::EMPHASIS_LOW, serialize($post));
//If not a reply or retweet and geoencoded, show the map in the stream
if (!isset($post->$in_reply_to_user_id) && !isset($post->$in_reply_to_post_id)
&& !isset($post->in_retweet_of_post_id) && $post->reply_count_cache > 5) {
$plugin_option_dao = DAOFactory::GetDAO('PluginOptionDAO');
$options = $plugin_option_dao->getOptionsHash('geoencoder', true);
if (isset($options['gmaps_api_key']->option_value) && $post->is_geo_encoded == 1) {
$insight_dao->insertInsight('geoencoded_replies', $this->instance->id, $simplified_post_date,
"Going global! You've got replies all over the map.", Insight::EMPHASIS_LOW, serialize($post));
}
}
}

Expand Down

0 comments on commit 6a17a16

Please sign in to comment.