コード例 #1
0
ファイル: Modifications.php プロジェクト: h3rb/page
function ShowModifications(&$p, $db_table, $db_id)
{
    global $database;
    $m_mod = new Modification($database);
    $m_auth = new Auth($database);
    $mods = $m_mod->byTableID($db_table, $db_id);
    if (!false_or_null($mods)) {
        $data = array();
        foreach ($mods as $mod) {
            $user = $m_auth->Get($mod['r_Auth']);
            $what = '';
            $w = json_decode($mod['What'], true);
            foreach ($w as $dataset) {
                foreach ($dataset as $table => $change) {
                    $what .= $table . ' #' . $change['I'] . '\'s ' . $change['F'] . (isset($change['E']) ? ' » ' . $change['E'] : '');
                }
            }
            $data[] = array($user['username'], $what, $mod['Message'], human_datetime(intval($mod['Timestamp'])));
        }
        $table = new TableHelper(array('table' => "table wide", 'thead' => "tablehead", 'th' => "tablehead", 'td' => "tablecell", 'headings' => array('Who', 'What', ' ', 'When'), 'data' => $data));
        $p->HTML('<div class="formgroup">');
        $p->HTML('<h4>Recent Activity</h4>');
        $p->Table($table);
        $p->HTML('</div>');
    }
}