Esempio n. 1
0
        if ($e['type'] == 'radio') {
            $pat[] = false;
        } else {
            $pat[] = true;
        }
        $opt_pat[] = 0;
        $th .= '<th rowspan="2">' . $e['caption'] . '</th>';
        $id_pat[] = intval($e['fieldid']);
    }
}
if (admin()) {
    $th .= '<th rowspan="2">#</th>';
}
$th .= '</tr>' . "\n" . $th2 . '</tr>' . "\n";
while ($e = sql('SELECT `recordid`,`fieldid`,`value` FROM `pool` WHERE `eventid`="' . $eventid . '" ORDER BY `recordid` DESC')) {
    $e['value'] = condom($e['value']);
    if ($checkbox[$e['fieldid']]) {
        $e['value'] = linebreak($e['value']);
    }
    $data[$e['recordid']][$e['fieldid']] = $e['value'];
}
$i = 0;
echo $th;
while ($e = sql('SELECT `recordid` FROM `records` WHERE `eventid`="' . $eventid . '" ORDER BY `recordid` DESC')) {
    ++$i;
    if ($i % 30 == 0) {
        echo $th;
    }
    echo '<tr style="background:#' . ($i % 2 == 0 ? 'fff' : 'eee') . ';">';
    foreach ($id_pat as $idx => $fid) {
        if ($pat[$idx] === true) {
Esempio n. 2
0
	function delRow(obj){
		getelm('signup').deleteRow(obj.parentNode.parentNode.rowIndex);
	}

	function preload(){<?php 
if (!empty($_GET['eventid'])) {
    $tpl = '';
} elseif (!empty($_GET['tpl_eventid'])) {
    $tpl = 'tpl_';
}
$preload[$tpl . 'eventid'] = $_GET[$tpl . 'eventid'];
if ($e = sql('SELECT * FROM `' . $tpl . 'events` WHERE `eventid`="' . $preload[$tpl . 'eventid'] . '"')) {
    $preload['title'] = condom($e['title']);
    $preload['expose'] = $e['expose'] == 0 ? '' : ' checked="checked"';
    $preload['desc'] = condom($e['desc']);
    if (empty($tpl)) {
        $preload['beg_y'] = substr($e['beg_date'], 0, 4);
        $preload['beg_m'] = substr($e['beg_date'], 4, 2);
        $preload['beg_d'] = substr($e['beg_date'], 6, 2);
        $preload['end_y'] = substr($e['end_date'], 0, 4);
        $preload['end_m'] = substr($e['end_date'], 4, 2);
        $preload['end_d'] = substr($e['end_date'], 6, 2);
    }
}
if (!empty($preload[$tpl . 'eventid'])) {
    while ($e = sql('SELECT * FROM `' . $tpl . 'fields` WHERE `eventid`="' . $preload[$tpl . 'eventid'] . '" ORDER BY `order` ASC')) {
        $opt = array();
        while ($e2 = sql('SELECT `caption` FROM `' . $tpl . 'options` WHERE `eventid`="' . $preload[$tpl . 'eventid'] . '" AND `fieldid`="' . $e['fieldid'] . '" ORDER BY `optionid` ASC')) {
            $opt[] = $e2['caption'];
        }
Esempio n. 3
0
function mk_checkbox($eid, $f)
{
    global $not;
    $fid = $f['fieldid'];
    if (isset($_SESSION['cache']['f' . $fid])) {
        if (!is_array($_SESSION['cache']['f' . $fid])) {
            $_SESSION['cache']['f' . $fid] = array();
        }
        $defval = $_SESSION['cache']['f' . $fid];
    } else {
        $defval = linebreak($f['default']);
    }
    $options = array();
    while ($e = sql('SELECT `optionid`,`caption` FROM `options` WHERE `eventid`="' . $eid . '" AND `fieldid`="' . $fid . '" ORDER BY `optionid`')) {
        $options[] = $e;
    }
    if (count($options) == 1) {
        echo '<input type="checkbox" name="f' . $fid . '[]" id="f' . $fid . '-' . $e['optionid'] . '" value="' . condom($e['caption']) . '"' . (in_array($e['caption'], $defval) ? ' checked="checked"' : '') . $not . ' />';
    } else {
        foreach ($options as $e) {
            echo '<span style="float:leftl"><input type="checkbox" name="f' . $fid . '[]" id="f' . $fid . '-' . $e['optionid'] . '" value="' . condom($e['caption']) . '"' . (in_array($e['caption'], $defval) ? ' checked="checked"' : '') . $not . ' /><label for="f' . $fid . '-' . $e['optionid'] . '">' . condom($e['caption']) . '</label></span>' . "\n";
        }
    }
}
Esempio n. 4
0
<?php

include 'config.php';
$eventid = $_GET['eventid'];
if ($e = sql('SELECT * FROM `events` WHERE `eventid`="' . $eventid . '"')) {
    $title = condom($e['title']);
} else {
    redirect('events.php');
}
$opt_pat = $id_pat = $pat = $data = $options = $checkbox = $fields = array();
while ($e = sql('SELECT `optionid`,`fieldid`,`caption` FROM `options` WHERE `eventid`="' . $eventid . '" ORDER BY `optionid` ASC')) {
    $options[$e['fieldid']][$e['optionid']] = condom($e['caption']);
}
while ($e = sql('SELECT * FROM `fields` WHERE `eventid`="' . $eventid . '"' . (admin() ? '' : ' AND public="1"') . ' ORDER BY `order` ASC')) {
    $e['title'] = condom($e['title']);
    $fields[$e['fieldid']] = $e;
}
if ($_GET['mode'] == 'fakexls') {
    include 'list.fakexls.php';
} else {
    include 'list.web.php';
}
Esempio n. 5
0
include 'config.php';
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="/jscss/bg.css">
<style type="text/css">
th{text-align:center; background-color:#ccc;}
</style>
</head>
<body>
<?php 
if (admin()) {
    echo '<a href="event.php">新增報名表</a>';
}
?>
<table>
<tr><th>#</th><th>活動名稱</th><th>報名開始</th><th>報名截止</th><th>#</th></tr>
<?php 
$i = 0;
while ($e = sql('SELECT * FROM `events`' . (admin() ? '' : ' WHERE `expose`="1"') . ' ORDER BY `eventid` DESC')) {
    echo '<tr style="background:#' . ($i % 2 == 0 ? 'eee' : 'fff') . ';"><td>' . $e['eventid'] . '</td><td><a href="event.php?eventid=' . $e['eventid'] . '">' . ($e['title'] == '' ? '&nbsp;' : condom($e['title'])) . '</a></td><td>' . $e['beg_date'] . '</td><td>' . $e['end_date'] . '</td><td><a href="list.php?eventid=' . $e['eventid'] . '">報名清單</a></td></tr>';
    ++$i;
}
if ($i == 0) {
    echo '<tr><td colspan="5" align="center">目前沒有活動</td></tr>';
}
?>
</table>
</body>
</html>