function _display_state_table($stats, $prefix) { ?> <table border=1> <? $t = array(); $types = array(); $state_totals = array(); $type_totals = array(); global $state_help_notes_map; foreach ($stats as $k=>$v) { if (stristr($k, $prefix)) { list($type, $state) = explode(" ", str_replace($prefix, "", $k)); $t[$state][$type] = $v; if (!array_key_exists($state, $state_totals)) $state_totals[$state] = 0; if (!array_key_exists($type, $type_totals)) $type_totals[$type] = 0; $state_totals[$state] += $v; $type_totals[$type] += $v; if (!array_key_exists($state, $state_help_notes_map)) die("missing entry from state_help_notes_map '$state'"); $types[$type] = 1; } } $states = array_keys($state_help_notes_map); $types = array_keys($types); sort($types); print "<tr><td> </td>"; foreach ($states as $state) { print "<td><b>"; print add_tooltip($state, $this->state_help_notes($state)); print "</b></td>"; } print "<td><b>Total</b></td>"; print "</tr>"; global $va_type_name, $va_inside; foreach ($types as $type) { print "<tr>"; print "<td><b>"; if (array_key_exists($type, $va_inside)) print $va_type_name[$va_inside[$type]]; print " (".$type.")"; print "</b></td>"; foreach ($states as $state) { print "<td style=\"text-align: right\">"; if (array_key_exists($state, $t)) { if (array_key_exists($type, $t[$state])) { print $t[$state][$type]; } } print "</td>"; } print "<td style=\"text-align: right\"><b>"; print $type_totals[$type]; print "</b></td>"; print "</tr>\n"; } print "<tr><td><b>Total:</b></td>"; foreach ($states as $state) { print "<td style=\"text-align: right\"><b>"; if (array_key_exists($state, $state_totals)) print $state_totals[$state]; else print " "; print "</b></td>"; } $type_grand_total = array_sum(array_values($type_totals)); $state_grand_total = array_sum(array_values($state_totals)); if ($type_grand_total != $state_grand_total) die("type_grand_total != state_grand_total"); print "<td><b>".$type_grand_total."</b></td>"; print "</tr>"; ?> </table> <? }
| This program is released as free software under the Affero GPL license. | You can redistribute it and/or modify it under the terms of this license | which you can read by viewing the included agpl.txt or online | at www.gnu.org/licenses/agpl.html. Removal of this copyright header is | strictly prohibited without written permission from the original author(s). +---------------------------------------------------------------------------*/ if (!defined("PIMPED_FUSION")) { die("Access Denied"); } if (!isset($lastvisited) || !isnum($lastvisited)) { $lastvisited = time(); } $display_more = 10; add_to_head("<script type='text/javascript'>\r\n<!--\r\nfunction show_more_threads() {\r\n\tvar smt = document.getElementById('show_more_threads');\r\n\tvar smttxt = document.getElementById('show_more_threads_text');\r\n\tif (smt.style.display == 'none') {\r\n\tsmt.style.display = 'block';\r\n\tsmttxt.innerHTML = '" . $locale['global_063'] . "';\r\n\t} else {\r\n\tsmt.style.display = 'none';\r\n\tsmttxt.innerHTML = '" . $locale['global_062'] . "';\r\n\t}\r\n}\r\n//-->\r\n</script>"); // Add Tooltip-JavaScript add_tooltip(); #$data = dbarray(dbquery("SELECT tt.thread_lastpost # FROM ".DB_FORUMS." tf # INNER JOIN ".DB_THREADS." tt ON tf.forum_id = tt.forum_id # WHERE ".groupaccess('tf.forum_access')." # ORDER BY tt.thread_lastpost DESC LIMIT ".($settings['numofthreads']-1).", ".$settings['numofthreads'])); # #$timeframe = empty($data['thread_lastpost']) ? 0 : $data['thread_lastpost']; # #What is this $timeframe for? if (IF_MULTI_LANGUAGE_FORUM && iMEMBER && isset($userdata['user_forumpanellocale']) && $userdata['user_forumpanellocale'] != '') { $insert = $userdata['user_forumpanellocale'] == "all" ? "" : " AND tc.forum_language='" . $userdata['user_forumpanellocale'] . "' "; } else { $insert = ""; } $result = dbquery("SELECT tt.thread_id, tt.thread_subject, tt.thread_views, tt.thread_lastuser, tt.thread_lastpost,\r\n\ttt.thread_poll, tt.thread_lastpostid, tt.thread_postcount, tt.thread_resolved,\r\n\ttu.user_id, tu.user_name, tu.user_status,\r\n\ttp.post_message, tp.post_smileys,\r\n\ttf.forum_id, tf.forum_name, tf.forum_access, tf.forum_markresolved,\r\n\ttc.forum_language\r\n\tFROM " . DB_THREADS . " tt\r\n\tINNER JOIN " . DB_FORUMS . " tf ON tt.forum_id=tf.forum_id\r\n\tINNER JOIN " . DB_FORUMS . " tc ON tf.forum_cat=tc.forum_id\r\n\tINNER JOIN " . DB_POSTS . " tp ON tt.thread_lastpostid=tp.post_id\r\n\tINNER JOIN " . DB_USERS . " tu ON tt.thread_lastuser=tu.user_id\r\n\tWHERE " . groupaccess('tf.forum_access') . $insert . " AND thread_hidden='0' \r\n\tORDER BY tt.thread_lastpost DESC LIMIT 0," . ($settings['numofthreads'] + $display_more));