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: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 238: 239: 240: 241: 242: 243: 244: 245: 246: 247: 248: 249: 250: 251: 252: 253: 254: 255: 256: 257: 258: 259: 260: 261: 262: 263: 264: 265: 266: 267: 268: 269: 270: 271: 272: 273: 274: 275: 276: 277: 278: 279: 280: 281: 282: 283: 284: 285: 286: 287: 288: 289: 290: 291: 292: 293: 294: 295: 296: 297: 298: 299: 300: 301: 302: 303: 304: 305: 306: 307: 308: 309: 310: 311: 312: 313: 314: 315: 316: 317: 318: 319: 320: 321: 322: 323: 324: 325: 326: 327: 328: 329: 330: 331: 332: 333: 334: 335: 336: 337: 338: 339: 340: 341: 342: 343: 344: 345: 346: 347: 348: 349: 350: 351: 352: 353: 354: 355: 356: 357: 358: 359: 360: 361: 362: 363: 364: 365: 366: 367: 368: 369: 370: 371: 372: 373: 374: 375: 376: 377: 378: 379: 380: 381: 382: 383: 384: 385: 386: 387: 388: 389: 390: 391: 392: 393: 394: 395: 396: 397: 398: 399: 400: 401: 402: 403: 404: 405: 406: 407: 408: 409: 410: 411: 412: 413: 414: 415: 416: 417: 418: 419: 420: 421: 422: 423: 424: 425: 426: 427: 428: 429: 430: 431: 432: 433: 434: 435: 436: 437: 438: 439: 440: 441: 442: 443: 444: 445: 446: 447: 448: 449: 450: 451: 452: 453: 454: 455: 456: 457: 458:
<?php
if (!class_exists('Inbound_Visitor_Event_Report')) {
class Inbound_Visitor_Event_Report extends Inbound_Reporting_Templates {
static $lead;
static $range;
static $events;
public static function define_range() {
if (!isset($_GET['range'])) {
self::$range = 30;
} else {
self::$range = $_GET['range'];
}
}
public static function load_template() {
self::load_data();
if (self::$lead) {
$lead_meta = get_post_meta(self::$lead->ID);
$first_name = (isset($lead_meta['wpleads_first_name'][0])) ? $lead_meta['wpleads_first_name'][0] : __('n/a');
$last_name = (isset($lead_meta['wpleads_last_name'][0])) ? $lead_meta['wpleads_first_name'][0] : '';
$name = $first_name . ' ' .$last_name;
$lead_exists =true;
} else {
$lead_exists = false;
$name = __('This visitor does not have a lead profile' , 'inbound-pro' );
}
?>
<aside class="profile-card">
<header>
<!-- s the avatar -->
<a href="<?php echo ( self::$lead ) ? 'post.php?action=edit&post=' . self::$lead->ID . '&small_lead_preview=true&tb_hide_nav=true' : '#'; ?>" target="_self" class="profile-img-link">
<?php
$default = INBOUND_PRO_URLPATH . '/assets/images/gravatar-unknown.png';
$gravatar = ($lead_exists) ? Leads_Post_Type::get_gravatar(self::$lead->ID , 100) : $default;
echo '<img src="' . $gravatar . '">';
?>
</a>
<!-- the username -->
<h1><?php echo $name; ?> <a href="<?php echo ( self::$lead ) ? 'post.php?action=edit&post=' . self::$lead->ID . '&small_lead_preview=true&tb_hide_nav=true' : '#'; ?>" target="_self">
<i class="fa fa-pencil-square-o" aria-hidden="true"></i>
</a></h1>
</header>
<!-- some social links to show off -->
<ul class="profile-social-links">
<!-- add or remove social profiles as you see fit -->
</ul>
</aside>
<!-- s all folks! -->
<?php
Inbound_Reporting_Templates::display_filters();
?>
<table class="visits-by-lead">
<thead>
<tr>
<th scope="col" class="manage-column sort-lead-report-by" sort-by="report-name-field-header">
<span><?php _e('Page Visited' , 'inbound-pro'); ?></span>
</th>
<th scope="col" class="manage-column column-modified sort-lead-report-by" sort-by="report-date-header" sort-order="1">
<span><?php _e('Datetime Visited' , 'inbound-pro'); ?>
<i class="fa fa-caret-down lead-report-sort-indicater" aria-hidden="true" style="padding-left:4px"></i>
</span>
</th>
<th scope="col" class="manage-column column-modified ">
<span><?php _e('Origin' , 'inbound-pro'); ?></span>
</th>
</tr>
</thead>
<tbody id="the-list">
<?php
$date_number = 0;
foreach (self::$events as $key => $event) {
$title = get_the_title($event['page_id']);
$permalink = get_permalink($event['page_id']);
$title_text = ($title) ? $title : 'ZZZZZZZZZZZZZZZZZZZZZ';
$title = ($title) ? $title . ' <i class="fa fa-external-link" aria-hidden="true"></i>' : __('Page does not exist' , 'inbound-pro');
$permalink = ($permalink) ? $permalink : '#'.$event['id'];
?>
<tr id="post-98600" class="hentry lead-table-data-report-row" data-name-field="<?php echo $title_text; ?>" data-date-number="<?php echo $date_number;?>">
<td style="">
<a href="<?php echo $permalink; ?>" target="_blank"><?php echo $title; ?> </a>
</td>
<td class="" data-colname="">
<p class="mod-date"><em> <?php echo date("F j, Y, g:i a" , strtotime($event['datetime'])); ?>
</td>
<td class="" data-colname="">
<?php
echo $event['source'];
?>
</td>
</tr>
<?php
$date_number++;
}
?>
</tbody>
<tfoot>
<tr>
<th scope="col" class="manage-column ">
<span><?php _e('Page Visited' , 'inbound-pro'); ?></span>
</th>
<th scope="col" class="manage-column column-modified sort-lead-report-by" sort-by="report-date-header" sort-order="1">
<span>
<?php _e('Datetime Visited' , 'inbound-pro'); ?>
<i class="fa fa-caret-down lead-report-sort-indicater" aria-hidden="true" style="padding-left:4px"></i>
</span>
</th>
<th scope="col" class="manage-column column-modified ">
<span><?php _e('Origin' , 'inbound-pro'); ?></span>
</th>
</tr>
</tfoot>
</table>
<?php
self::print_css();
parent::js_lead_table_sort();
die();
}
public static function print_css() {
?>
<style type="text/css">
body {
font-family: sans-serif;
color:
}
table {
border-spacing: 0;
margin-bottom: 1rem;
border-radius: 0;
font-size: 9px;
width:97%;
}
th {
background-color:
color:
-webkit-user-select: none;
-moz-user-select: none;
-user-select: none;
}
th,
td {
padding: 10px 5px;
text-align:center;
width: 33%;
}
tbody tr:nth-child(even) {
background-color:
}
margin-bottom: 10px;
}
display: flex;
margin-top: 5px;
}
margin-left: 5px;
margin-right: 5px;
}
background-color:
border-color:
color: rgba(255, 255, 255, 0.66);
}
.lead-grav-img {
background:
border: 1px solid
-moz-border-radius: 0px;
border-radius: 0px;
}
a {
color:
text-decoration:none;
}
.fa-sort-desc {
position:relative;
top:-2px;
left:2px;
}
@import url(
@-webkit-keyframes pulsate {
0% {
-webkit-transform: scale(0.6, 0.6);
transform: scale(0.6, 0.6);
opacity: 0.0;
}
50% {
opacity: 1.0;
}
100% {
-webkit-transform: scale(1, 1);
transform: scale(1, 1);
opacity: 0.0;
}
}
@keyframes pulsate {
0% {
-webkit-transform: scale(0.6, 0.6);
transform: scale(0.6, 0.6);
opacity: 0.0;
}
50% {
opacity: 1.0;
}
100% {
-webkit-transform: scale(1, 1);
transform: scale(1, 1);
opacity: 0.0;
}
}
body {
background-repeat: repeat, no-repeat;
background-size: auto, 100% 100%;
background-attachment: fixed;
margin:0px;
}
.profile-card {
height: 185px;
position: relative;
background-position: 50% 50%;
background-repeat: no-repeat;
background-size: cover;
background-color:
color:
font-family: "Lato", "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 16px;
line-height: 1.5;
font-weight: 300;
width: 100%;
margin-bottom:21px;
}
.profile-card header {
width: 100%;
height: 100%;
text-align: center;
background: -webkit-gradient(linear, left bottom, right top, color-stop(0%, rgba(0, 0, 0, 0.9)), color-stop(100%, transparent));
background: -webkit-linear-gradient(45deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
background: linear-gradient(45deg, rgba(0, 0, 0, 0.9) 0%, transparent 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#cc000000', endColorstr='#00000000',GradientType=1 );
}
.profile-card header .profile-img-link {
position: relative;
}
.profile-card header .profile-img-link:before {
content: "";
border: 15px solid rgba(255, 255, 255, 0.3);
border-radius: 50%;
height: 90px;
width: 90px;
position: absolute;
left: 0;
bottom: 3px;
-webkit-animation: pulsate 1.6s ease-out;
animation: pulsate 1.6s ease-out;
-webkit-animation-iteration-count: infinite;
animation-iteration-count: infinite;
opacity: 0.0;
z-index: 99;
}
.profile-card header img {
position: relative;
border-radius: 50%;
height: 90px;
width: 90px;
padding: 0;
margin: 0;
border: 15px solid transparent;
margin-top: 12px;
z-index: 9999;
-webkit-transition: all .3s ease-out;
transition: all .3s ease-out;
}
.profile-card header a:hover img {
-webkit-transform: scale(1.06, 1.06);
transform: scale(1.06, 1.06);
}
.profile-card header a:hover:before {
-webkit-animation: none;
animation: none;
}
.profile-card header h1 {
text-align: center;
font-size: 28px;
opacity: 0.9;
margin-top: 0px;
margin-bottom: 8px;
}
.profile-card header h2 {
font-size: 18px;
margin-top: 0;
opacity: 0.9;
}
.profile-card .profile-bio {
position: absolute;
bottom: 0;
}
.profile-card .profile-bio p {
margin: 24px;
text-align: center;
opacity: 0.9;
}
.profile-card .profile-social-links {
position: relative;
background-color: white;
margin: 0 auto;
text-align: center;
padding: 6px 0;
}
.profile-card .profile-social-links li {
display: inline-block;
padding: 3px 5px 0;
}
.profile-card .profile-social-links li img {
height: 28px;
opacity: 0.8;
-webkit-transition: all .2s ease-out;
transition: all .2s ease-out;
}
.profile-card .profile-social-links li a:hover img {
opacity: 1;
-webkit-transform: scale(1.1, 1.1);
transform: scale(1.1, 1.1);
}
.profile-card .profile-social-links:after {
bottom: 100%;
left: 50%;
border: solid transparent;
content: " ";
height: 0;
width: 0;
position: absolute;
pointer-events: none;
border-color: rgba(255, 255, 255, 0);
border-bottom-color:
border-width: 10px;
margin-left: -10px;
}
.fa-pencil-square-o {
font-size:21px;
}
.visits-by-lead {
margin-left:10px;
margin-right:10px;
margin-top:20px;
}
</style>
<link rel='stylesheet' id='fontawesome-css' href='<?php echo INBOUNDNOW_SHARED_URLPATH ;?>assets/fonts/fontawesome/css/font-awesome.min.css?ver=4.6.1' type='text/css' media='all' />
<?php
}
public static function load_data() {
$dates = Inbound_Reporting_Templates::prepare_range( intval($_REQUEST['range']) );
$lookup = (isset($_REQUEST['lead_id'])) ? 'lead_id' : 'lead_uid';
$params = array(
'page_id' => (isset($_REQUEST['page_id'])) ? sanitize_text_field($_REQUEST['page_id']) : 0,
'lead_uid' => (isset($_REQUEST['lead_uid'])) ? sanitize_text_field($_REQUEST['lead_uid']) : 0,
'lead_id' => (isset($_REQUEST['lead_id'])) ? sanitize_text_field($_REQUEST['lead_id']) : 0,
'start_date' => $dates['start_date'],
'end_date' => $dates['end_date'],
'orderby' => 'ORDER BY datetime DESC, session_id DESC, lead_id DESC'
);
self::$events = Inbound_Events::get_page_views_by( 'mixed' , $params);
self::$lead = ($lookup == 'lead_id' ) ? get_post(intval($_REQUEST['lead_id'])) : false;
if (!self::$lead && isset(self::$events[0]['lead_id']) && self::$events[0]['lead_id'] ) {
self::$lead = get_post(self::$events[0]['lead_id']);
}
}
}
new Inbound_Visitor_Event_Report;
}