function output_foot_rows(&$rows, $format) { if (count($rows) == 0) { return; } echo $format == OUTPUT_HTML ? "<tfoot>\n" : ""; foreach ($rows as $row) { output_row($row, $format, FALSE); } echo $format == OUTPUT_HTML ? "</tfoot>\n" : ""; }
function generate_table($tpl) { global $debug, $template_dir; /* sanity check global_message table */ $row = db_query_first("select max(gid) from f_global_messages"); $max = $row[0]; if ($max > 31) { db_exec("delete from f_global_messages where gid>31"); } $sth = db_query("select * from f_global_messages order by gid"); for ($i = 0; $i < 32; $i++) { for ($msg = $sth->fetch(); (!$msg || $i != $msg['gid']) && $i < 32; $i++) { $m['gid'] = $i; $m['state'] = 'Empty'; output_row($tpl, $m); // output blank row } if ($msg) { output_row($tpl, $msg); } // output real row } $sth->closeCursor(); $tpl->parse('table'); }
} } echo "</tr>\n"; echo "</thead>\n"; // The table body echo "<tbody>\n"; } // If we're Ajax capable and this is not an Ajax request then don't ouput // the table body, because that's going to be sent later in response to // an Ajax request if (!$ajax_capable || $ajax) { for ($i = 0; $row = sql_row_keyed($res, $i); $i++) { // You can only see this row if (a) we allow everybody to see all rows or // (b) you are an admin or (c) you are this user if (!$auth['only_admin_can_see_other_users'] || $level >= $min_user_viewing_level || strcasecmp($row['name'], $user) == 0) { output_row($row); } } } if (!$ajax) { echo "</tbody>\n"; echo "</table>\n"; echo "</div>\n"; } } // ($initial_user_creation != 1) if ($ajax) { echo json_encode($json_data); } else { output_trailer(); }
if ($fromtime) { $fromtime = strtotime($fromtime); } else { $fromtime = time() - $time; } if ($totime) { $totime = strtotime($totime); } else { $totime = time(); } output_header($format); foreach ($useridsleft as $userid) { output_row($userid, $courseid, $fromtime, $totime, $format, 'A'); } foreach ($useridsright as $userid) { output_row($userid, $courseid, $fromtime, $totime, $format, 'B'); } output_footer($format); die; function output_row($userid, $courseid, $fromtime, $totime, $format, $label = '') { $events = get_user_events($userid, $courseid, $fromtime, $totime); list($revisits, $durations) = intuitel\IntuitelController::compute_revisits($events, $totime); foreach ($durations as $event) { $date = date('Y-m-d H:i:s', $event->time); $lo = intuitel\Intuitel::getAdaptorInstance()->createLO($event->loId); switch ($format) { case "txt": echo "{$event->userId}->id;{$date}; {$event->loId}; {$event->duration} ; {$label} ; {$lo->loName}\n"; break; case "csv":