Example #1
0
 protected function ConstructField($mData, $sKey, $sFormat = '')
 {
     // Are we dealing with a Complex Key?
     if (strpos($sFormat, '|') !== false) {
         return $this->BuildComplexKey($mData, $sKey, $sFormat);
     } else {
         switch ($sFormat) {
             case 'email':
                 return '<a href="mailto:' . $mData[$sKey] . '">' . $mData[$sKey] . '</a>';
             case 'ip_address':
                 return $mData[$sKey] ? inet_ntoa($mData[$sKey]) : '<i>empty</i>';
             case 'coordinates':
                 if (!empty($mData[$sKey])) {
                     $aCoords = explode(',', $mData[$sKey]);
                     if (count($aCoords) == 2) {
                         $sUrl = 'http://maps.google.com/?ll=' . $aCoords[0] . ',' . $aCoords[1] . '&z=16';
                         return '<a href="' . $sUrl . '"><img src="' . BuildImage('16x16/map-pin.png') . '" align="left" />&nbsp;' . $aCoords[0] . ', ' . $aCoords[1] . '</a>';
                     } else {
                         return '<i>Invalid Coords</i>';
                     }
                 } else {
                     return '<i>No Coords</i>';
                 }
                 break;
             case 'relative_time':
                 return $mData[$sKey] ? RelativeTime($mData[$sKey]) : '<i>empty</i>';
             case 'datetime':
                 return $mData[$sKey] ? date('Y-m-d H:i:s', $mData[$sKey]) : '<i>empty</i>';
             case 'date':
                 return $mData[$sKey] ? date('Y-m-d', $mData[$sKey]) : '<i>empty</i>';
             case 'time':
                 return $mData[$sKey] ? date('H:i:s', $mData[$sKey]) : '<i>empty</i>';
             default:
                 if (!is_array($mData)) {
                     return !empty($mData) ? $mData : '&nbsp;';
                 } else {
                     return !empty($mData[$sKey]) ? $mData[$sKey] : '&nbsp;';
                 }
         }
     }
 }
Example #2
0
        } else {
            $diff = floor($shift / 60 / 60 / 24 / 7);
            $shift %= 604800;
            $term = "week";
        }
        if ($diff != 1) {
            $term .= "s";
        }
        $ret .= "{$diff} {$term},&nbsp;&nbsp;";
    }
    return substr($ret, 0, strlen($ret) - 13);
}
?>
<table border="0">
	<tr><td align="right"><small><b>interval</b></small></td><td><small>&nbsp;</small></td><td><small><?php 
echo RelativeTime($dbitem->date);
?>
</small></td></tr>
	<tr><td align="right"><small><b>updates</b></small></td><td><small>&nbsp;</small></td><td><small><?php 
echo $updates;
?>
</small></td></tr>
	<tr><td align="right"><small><b>last update</b></small></td><td><small>&nbsp;</small></td><td><small>
		<script type="text/javascript">showtime(<?php 
echo $dbitem->date . "000";
?>
)</script>
	</small></td></tr>
	<tr><td align="right"><small><b>current time</b></small></td><td><small>&nbsp;</small></td><td><small>
		<script type="text/javascript">showtime(<?php 
echo time() . "000";