PageRenderTime 17ms CodeModel.GetById 10ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/halogy/application/modules/halogy/views/activity_ajax.php

https://bitbucket.org/haloweb/halogy-1.0/
PHP | 96 lines | 82 code | 11 blank | 3 comment | 10 complexity | 643b09998a19f0b903eea3856abdf9a0 MD5 | raw file
 1<?php if ($todaysActivity): $i=0; $title = ''; ?>
 2
 3	<?php if ($recentActivity): ?>
 4		<h3>Recent Activity</h3>
 5		
 6		<ul>	
 7		<?php foreach($recentActivity as $visit): $style = ''; ?>
 8		<?php
 9			// get userdata
10			$userdata = @unserialize($visit['userdata']);
11			$style = '';
12		?>	
13			<li style="background: #FFFCDF;">
14				<small><?php echo dateFmt($visit['date'], 'g:i a'); ?>:</small>
15				<?php if ($userdata): ?>
16					<?php if ($userdata['userID']): ?>
17						<?php echo anchor('/admin/users/edit/'.$userdata['userID'], $userdata['firstName'].' '.$userdata['lastName']); ?>
18				 		<?php echo ($userdata['dateCreated'] && strtotime($userdata['dateCreated']) >= strtotime('5 minutes ago')) ? '<strong>signed up</strong>' : 'returned'; ?>
19				 	<?php else: ?>
20			 		<?php echo anchor('/admin/webforms/tickets', $userdata['firstName'].' '.$userdata['lastName']); ?>
21				 		<strong>submitted a web form</strong>
22				 	<?php endif; ?>
23			 	<?php else: ?>
24				 	Someone visited 
25				 <?php endif; ?>
26			 		<?php echo (strtotime($visit['date']) >= strtotime('-2 minutes')) ? '<em>just now</em>' : ''; ?> 
27			 		<?php echo ($visit['referer']) ? 'from '.anchor($visit['referer'], preg_replace('/http(s)?\:\/\/|www\.|\/(.*)$/i', '', htmlentities($visit['referer']))) : ''; ?>
28			 	 	and looked at <?php echo ($visit['views']+1); ?> <?php echo ($visit['views']) ? 'pages' : 'page'; ?>.
29			</li>
30			
31		<?php endforeach; ?>
32		</ul>
33	<?php endif; ?>
34
35<h3>Today on Your Site</h3>	
36
37	<ul>	
38	<?php foreach($todaysActivity as $visit): $style = ''; ?>
39	<?php
40		// get userdata
41		$userdata = @unserialize($visit['userdata']);
42	?>	
43		<li>
44			<?php if ($userdata): ?>
45				<small><?php echo dateFmt($visit['date'], 'g:i a'); ?>:</small>			
46				<?php if ($userdata['userID']): ?>
47					<?php echo anchor('/admin/users/edit/'.$userdata['userID'], $userdata['firstName'].' '.$userdata['lastName']); ?>
48			 		<?php echo (strtotime($userdata['dateCreated']) >= strtotime(date("Y-m-d 00:00:00"))) ? '<strong>signed up</strong>' : 'returned'; ?>
49			 	<?php else: ?>
50			 		<?php echo anchor('/admin/webforms/tickets', $userdata['firstName'].' '.$userdata['lastName']); ?>
51			 		<strong>submitted a web form</strong>
52			 	<?php endif; ?>
53			 	<?php echo ($visit['referer']) ? 'from '.anchor($visit['referer'], preg_replace('/http(s)?\:\/\/|www\.|\/(.*)$/i', '', htmlentities($visit['referer']))) : ''; ?> 	
54		 	<?php else: ?>
55			 	<?php echo $visit['guests'].' guest(s)'; ?> visited
56			<?php endif; ?>
57		 	and looked at <?php echo ($visit['views']+1); ?> <?php echo ($visit['views']) ? 'pages' : 'page'; ?>.
58		</li>
59		
60	<?php endforeach; ?>
61	</ul>
62<?php else: ?>
63
64	<p>Nothing has happened yet!</p>
65	
66<?php endif; ?>
67<?php if ($yesterdaysActivity): $i=0; $title = ''; ?>
68
69	<h3>Yesterday</h3>
70
71	<ul>
72	<?php foreach($yesterdaysActivity as $visit): $style = ''; ?>
73	<?php
74		// get userdata
75		$userdata = @unserialize($visit['userdata']);
76	?>	
77		<li>
78			<?php if ($userdata): ?>
79				<small><?php echo dateFmt($visit['date'], 'g:i a'); ?>:</small>			
80				<?php if ($userdata['userID']): ?>
81					<?php echo anchor('/admin/users/edit/'.$userdata['userID'], $userdata['firstName'].' '.$userdata['lastName']); ?>
82			 		<?php echo (strtotime($userdata['dateCreated']) >= strtotime(date("Y-m-d 00:00:00", strtotime('1 day ago')))) ? '<strong>signed up</strong>' : 'returned'; ?>
83			 	<?php else: ?>
84			 		<?php echo anchor('/admin/webforms/tickets', $userdata['firstName'].' '.$userdata['lastName']); ?>
85			 		<strong>submitted a web form</strong>
86			 	<?php endif; ?>
87			 	<?php echo ($visit['referer']) ? 'from '.anchor($visit['referer'], preg_replace('/http(s)?\:\/\/|www\.|\/(.*)$/i', '', htmlentities($visit['referer']))) : ''; ?> 	
88		 	<?php else: ?>
89			 	<?php echo $visit['guests'].' guest(s)'; ?> visited
90			<?php endif; ?>
91		 	and looked at <?php echo ($visit['views']+1); ?> <?php echo ($visit['views']) ? 'pages' : 'page'; ?>.
92		</li>
93		
94	<?php endforeach; ?>
95	</ul>	
96<?php endif; ?>