function globallink_get_log_data in GlobalLink Connect for Drupal 7.5
Same name and namespace in other branches
- 7.7 globallink_settings.inc \globallink_get_log_data()
- 7.6 globallink_settings.inc \globallink_get_log_data()
Gets log data from specific date in the form of HTML.
Parameters
string $from_date: The timestamp.
Return value
string HTML representation of log data.
1 call to globallink_get_log_data()
- globallink_view_log_submit in ./
globallink_settings.inc - Exports log.
File
- ./
globallink_settings.inc, line 329
Code
function globallink_get_log_data($from_date) {
$html = '<html><head><title>GlobalLink Log</title><style>.datagrid table { border-collapse: collapse; text-align: left; width: 100%; } .datagrid {font: normal 12px/150% Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #006699; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; }.datagrid table td, .datagrid table th { padding: 3px 10px; }.datagrid table thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #006699), color-stop(1, #00557F) );background:-moz-linear-gradient( center top, #006699 5%, #00557F 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr="#006699", endColorstr="#00557F");background-color:#006699; color:#FFFFFF; font-size: 15px; font-weight: bold; border-left: 1px solid #0070A8; } .datagrid table thead th:first-child { border: none; }.datagrid table tbody td { color: #00496B; border-left: 1px solid #E1EEF4;font-size: 12px;font-weight: normal; }.datagrid table tbody .alt td { background: #E1EEF4; color: #00496B; }.datagrid table tbody td:first-child { border-left: none; }.datagrid table tbody tr:last-child td { border-bottom: none; }</style></head><body>';
$result = db_select('globallink_log', 'tl')
->fields('tl')
->condition('timestamp', $from_date, '>=')
->execute();
$html .= '<div class="datagrid"><table>';
$html .= '<thead><tr><th>Date Time</th><th>Log Severity</th><th>Type</th><th>Message</th></tr></thead><tbody>';
$i = 0;
foreach ($result as $row) {
$date = format_date($row->timestamp, 'custom', 'Y-m-d H:i:s');
$mod = $i % 2;
if ($mod == 0) {
$html .= '<tr><td style="width:10%;">' . $date . '</td><td style="width:10%;">' . $row->severity . '</td><td style="width:10%;">' . $row->type . '</td><td style="width:70%; text-style:justify;">' . $row->message . '</td></tr>';
}
else {
$html .= '<tr class="alt"><td style="width:10%;">' . $date . '</td><td style="width:10%;">' . $row->severity . '</td><td style="width:10%;">' . $row->type . '</td><td style="width:70%; text-style:justify;">' . $row->message . '</td></tr>';
}
$i++;
}
$html .= '</tbody></table></div>';
$html .= '</body></html>';
return $html;
}