Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Commit

Permalink
Adding Rapportive support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyler Hall authored and Tyler Hall committed May 5, 2011
1 parent 9a71b89 commit ea45e32
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 10 deletions.
12 changes: 12 additions & 0 deletions feedback-view.php
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,13 @@
</div></div>
</div>
<div id="sidebar" class="yui-b">
<div class="block">
<div class="hd">
<h3>Customer Info</h3>
</div>
<div id="rapportive" class="bd"></div>
</div>


<div class="block">
<div class="hd">
Expand Down Expand Up @@ -218,3 +225,8 @@
</div>

<?PHP include('inc/footer.inc.php'); ?>
<script type="text/javascript" charset="utf-8">
$(function() {
$('#rapportive').load('rapportive.php?email=<?PHP echo $f->email; ?>');
});
</script>
36 changes: 36 additions & 0 deletions includes/functions.inc.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,40 @@
<?PHP
function rapportive($email)
{
$json_str = geturl('https://rapportive.com/contacts/email/' . $email);
$json = json_decode($json_str);

if($json === false) {
return "<p>Failed to load Rapportive</p>";
}

if(!isset($json->contact)) {
return "<p>No information found</p>";
}

$out = "<div>";
if(isset($json->contact->image_url_raw) && strlen($json->contact->image_url_raw))
$out .= "<img style='float:left;margin-right:5px;margin-bottom:5px;;' width='75px' height='75px' src='{$json->contact->image_url_raw}'> ";
if(isset($json->contact->name) && strlen($json->contact->name))
$out .= "<strong>{$json->contact->name}</strong><br>";
if(isset($json->contact->email) && strlen($json->contact->email))
$out .= "<a href='mailto:$email'>$email</a><br>";
if(isset($json->contact->location) && strlen($json->contact->location))
$out .= "{$json->contact->location}</div>";
$out .= "<div style='clear:both;'></div>";

foreach($json->contact->occupations as $o) {
$out .= "&bull; {$o->job_title} at {$o->company}<br>";
}

foreach($json->contact->memberships as $m) {
$out .= "<div style='float:left;margin-right:5px;'><img src='https://rapportive.com/images/icons/{$m->icon_name}.png'> ";
$out .= "<a href='{$m->profile_url}'>{$m->formatted}</a></div>";
}
$out .= "<div style='clear:both;'></div>";

return $out;
}
function set_option($key, $val)
{
$db = Database::getDatabase();
Expand Down
24 changes: 14 additions & 10 deletions order.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,17 @@
<div id="sidebar" class="yui-b">
<div class="block">
<div class="hd">
<h3>Related Orders</h3>
<h3>Customer Info</h3>
</div>
<div id="rapportive" class="bd"></div>
</div>

<div class="block">
<div class="hd">
<h3>Related Orders and Activations</h3>
</div>
<div class="bd">
<p><a href="activations.php?q=<?PHP echo $o->payer_email; ?>">Activated <?PHP echo $o->activationCount(); ?> times</a></p>
<table class="lines">
<thead>
<tr>
Expand Down Expand Up @@ -142,15 +150,6 @@
</div>
</div>

<div class="block">
<div class="hd">
<h3>Activations</h3>
</div>
<div class="bd">
<a href="activations.php?q=<?PHP echo $o->payer_email; ?>">Activated <?PHP echo $o->activationCount(); ?> times</a>
</div>
</div>

<div class="block">
<div class="hd">
<h3>Cut &amp; Paste License</h3>
Expand All @@ -171,3 +170,8 @@
</div>

<?PHP include('inc/footer.inc.php'); ?>
<script type="text/javascript" charset="utf-8">
$(function() {
$('#rapportive').load('rapportive.php?email=<?PHP echo $o->payer_email; ?>');
});
</script>
5 changes: 5 additions & 0 deletions rapportive.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?PHP
require 'includes/master.inc.php';
$Auth->requireAdmin('login.php');

echo rapportive($_GET['email']);

0 comments on commit ea45e32

Please sign in to comment.