1:   2:   3:   4:   5:   6:   7:   8:   9:  10:  11:  12:  13:  14:  15:  16:  17:  18:  19:  20:  21:  22:  23:  24:  25:  26:  27:  28:  29:  30:  31:  32:  33:  34:  35:  36:  37:  38:  39:  40:  41:  42:  43:  44:  45:  46:  47:  48:  49:  50:  51:  52:  53:  54:  55:  56:  57:  58:  59:  60:  61:  62:  63:  64:  65:  66:  67:  68:  69:  70:  71:  72:  73:  74:  75:  76:  77:  78:  79:  80:  81:  82:  83:  84:  85:  86:  87:  88:  89:  90:  91:  92:  93:  94:  95:  96:  97:  98:  99: 100: 101: 102: 103: 104: 105: 106: 107: 108: 109: 110: 111: 112: 113: 114: 115: 116: 117: 118: 119: 120: 121: 122: 123: 124: 125: 126: 127: 128: 129: 130: 131: 132: 133: 134: 135: 136: 137: 138: 139: 140: 141: 142: 143: 144: 145: 146: 147: 148: 149: 150: 151: 152: 153: 154: 155: 156: 157: 158: 159: 160: 161: 162: 163: 164: 165: 166: 167: 168: 169: 170: 171: 172: 173: 174: 175: 176: 177: 178: 179: 180: 181: 182: 183: 184: 185: 186: 187: 188: 189: 190: 191: 192: 193: 194: 195: 196: 197: 198: 199: 200: 201: 202: 203: 204: 205: 206: 207: 208: 209: 210: 211: 212: 213: 214: 215: 216: 217: 218: 219: 220: 221: 222: 223: 224: 225: 226: 227: 228: 229: 230: 231: 232: 233: 234: 235: 236: 237: 
<?php
/**
 * Simple Machines Forum (SMF)
 *
 * @package SMF
 * @author Simple Machines http://www.simplemachines.org
 * @copyright 2019 Simple Machines and individual contributors
 * @license http://www.simplemachines.org/about/smf/license.php BSD
 *
 * @version 2.1 RC1
 */

/**
 * Choose which type of report to run?
 */
function template_report_type()
{
    global $context, $scripturl, $txt;

    echo '
        <form action="', $scripturl, '?action=admin;area=reports" method="post" accept-charset="', $context['character_set'], '">
            <div class="cat_bar">
                <h3 class="catbg">', $txt['generate_reports_type'], '</h3>
            </div>
            <div class="windowbg">
                <dl class="settings">';

    // Go through each type of report they can run.
    foreach ($context['report_types'] as $type)
    {
        if (isset($type['description']))
            echo '
                    <dt>', $type['description'], '</dt>';

        echo '
                    <dd>
                        <input type="radio" id="rt_', $type['id'], '" name="rt" value="', $type['id'], '"', $type['is_first'] ? ' checked' : '', '>
                        <strong><label for="rt_', $type['id'], '">', $type['title'], '</label></strong>
                    </dd>';
    }
    echo '
                </dl>
                <input type="submit" name="continue" value="', $txt['generate_reports_continue'], '" class="button">
                <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '">
            </div><!-- .windowbg -->
        </form>';
}

/**
 * This is the standard template for showing reports.
 */
function template_main()
{
    global $context, $txt;

    echo '
        <div class="cat_bar">
            <h3 class="catbg">', $txt['results'], '</h3>
        </div>
        <div id="report_buttons">';

    if (!empty($context['report_buttons']))
        template_button_strip($context['report_buttons'], 'right');

    echo '
        </div>';

    // Go through each table!
    foreach ($context['tables'] as $table)
    {
        echo '
        <table class="table_grid report_results">';

        if (!empty($table['title']))
            echo '
            <thead>
                <tr class="title_bar">
                    <th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th>
                </tr>
            </thead>
            <tbody>';

        // Now do each row!
        $row_number = 0;
        foreach ($table['data'] as $row)
        {
            if ($row_number == 0 && !empty($table['shading']['top']))
                echo '
                <tr class="windowbg table_caption">';
            else
                echo '
                <tr class="', !empty($row[0]['separator']) ? 'title_bar' : 'windowbg', '">';

            // Now do each column.
            $column_number = 0;

            foreach ($row as $data)
            {
                // If this is a special separator, skip over!
                if (!empty($data['separator']) && $column_number == 0)
                {
                    echo '
                    <td colspan="', $table['column_count'], '" class="smalltext">
                        ', $data['v'], ':
                    </td>';
                    break;
                }

                // Shaded?
                if ($column_number == 0 && !empty($table['shading']['left']))
                    echo '
                    <td class="table_caption ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
                        ', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
                    </td>';
                else
                    echo '
                    <td class="smalltext centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
                        ', $data['v'], '
                    </td>';

                $column_number++;
            }

            echo '
                </tr>';

            $row_number++;
        }
        echo '
            </tbody>
        </table>';
    }
}

/**
 * Header of the print page!
 */
function template_print_above()
{
    global $context, $settings, $modSettings;

    echo '<!DOCTYPE html>
<html', $context['right_to_left'] ? ' dir="rtl"' : '', '>
    <head>
        <meta charset="', $context['character_set'], '">
        <title>', $context['page_title'], '</title>
        <link rel="stylesheet" href="', $settings['default_theme_url'], '/css/report.css', $context['browser_cache'], '">
    </head>
    <body>';
}

/**
 * The main print page
 */
function template_print()
{
    global $context;

    // Go through each table!
    foreach ($context['tables'] as $table)
    {
        echo '
        <div style="overflow: visible;', $table['max_width'] != 'auto' ? ' width: ' . $table['max_width'] . 'px;' : '', '">
            <table class="bordercolor">';

        if (!empty($table['title']))
            echo '
                <tr class="title_bar">
                    <td colspan="', $table['column_count'], '">
                        ', $table['title'], '
                    </td>
                </tr>';

        // Now do each row!
        $row_number = 0;
        foreach ($table['data'] as $row)
        {
            if ($row_number == 0 && !empty($table['shading']['top']))
                echo '
                <tr class="titlebg">';
            else
                echo '
                <tr class="windowbg">';

            // Now do each column!!
            $column_number = 0;
            foreach ($row as $data)
            {
                // If this is a special separator, skip over!
                if (!empty($data['separator']) && $column_number == 0)
                {
                    echo '
                    <td colspan="', $table['column_count'], '" class="smalltext">
                        <strong>', $data['v'], ':</strong>
                    </td>';
                    break;
                }

                // Shaded?
                if ($column_number == 0 && !empty($table['shading']['left']))
                    echo '
                    <td class="titlebg ', $table['align']['shaded'], 'text"', $table['width']['shaded'] != 'auto' ? ' width="' . $table['width']['shaded'] . '"' : '', '>
                        ', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
                    </td>';
                else
                    echo '
                    <td class="centertext" ', $table['width']['normal'] != 'auto' ? ' width="' . $table['width']['normal'] . '"' : '', !empty($data['style']) ? ' style="' . $data['style'] . '"' : '', '>
                        ', $data['v'], '
                    </td>';

                $column_number++;
            }

            echo '
                </tr>';

            $row_number++;
        }
        echo '
            </table>
        </div>
        <br>';
    }
}

/**
 * Footer of the print page.
 */
function template_print_below()
{
    echo '
        <div class="copyright">', theme_copyright(), '</div>
    </body>
</html>';
}

?>