示例#1
0
$dicts = array();
@($res = mysql_query("select * from dicts"));
while (@($row = mysql_fetch_array($res))) {
    $dicts[$row['d_id']] = $row['d_name'];
}
asort($dicts);
if (is_numeric($dict)) {
    $tab = new TABLE();
    if (!is_numeric($offset) or $offset < 0) {
        $offset = 0;
    }
    if (!is_numeric($limit) or $limit < 1) {
        $limit = 20;
    }
    @($res = mysql_query("select count(*) as cnt from vocab where v_d_id={$dict}"));
    @($row = mysql_fetch_array($res));
    $cnt = $row['cnt'];
    $tab->add_row(array(array('attr' => 'colspan=5', 'cont' => pnav($cnt, $offset, $limit, "?dict={$dict}&") . "<br><br>")));
    @($res = mysql_query("select * from vocab where v_d_id={$dict} order by v_english limit {$offset},{$limit}"));
    while (@($row = mysql_fetch_array($res))) {
        $tab->add_row(array($row['v_english'], "<i>" . $row['v_latin'] . "</i>", $row['v_czech'], $row['v_slovak'], $row['v_german']));
    }
    $page->add_to_middle($tab->prepare());
} else {
    $menu = new VMENU();
    while (list($k, $v) = each($dicts)) {
        $menu->add_item($v, "?dict={$k}");
    }
    $page->add_to_middle($menu->prepare());
}
$page->display();
示例#2
0
    $rtab->add_row(array('Name contains', array('attr' => 'colspan=3', 'cont' => "<input type=\"text\" name=\"name_re\" value=\"{$name_re}\" size=40 maxlength=40 class=\"boxedfield\"> (\"Not\" <input type=\"checkbox\" name=\"not_name_re\" value=\"not\"" . ($not_name_re ? ' checked' : '') . " class=\"checkbox\">)")));
    $rtab->add_row(array('Description contains', array('attr' => 'colspan=3', 'cont' => "<input type=\"text\" name=\"desc_re\" value=\"{$desc_re}\" size=40 maxlength=40 class=\"boxedfield\"> (\"Not\" <input type=\"checkbox\" name=\"not_desc_re\" value=\"not\"" . ($not_desc_re ? ' checked' : '') . " class=\"checkbox\">)")));
    $ltab = new BOXEDTABLE();
    $ltab->set_parameters(array('style' => 'subtable'));
    $ltab->add_row(array(array('attr' => 'align="center"', 'cont' => "<h3>Exercises</h3>")));
    if ($limit < $cnt) {
        $ltab->add_row(array(array('attr' => 'align="center"', 'cont' => pnav($cnt, $offset, $limit, "?{$href_cond}&") . "<br><br>\n")));
    }
    @($res = mysql_query("select ex_id as id,ex_type as type,ex_name as name,ex_description as description, ex_creator as creator,ec_et_id from exercises left join exercise_categories on ex_id=ec_ex_id where {$cond} group by ex_type,ex_id order by ex_type,ex_name {$desc} limit {$offset},{$limit}"));
    $t = 0;
    if (@mysql_num_rows($res)) {
        $menu = new VMENU();
        $menu->set_itemized(0);
        while (@($row = mysql_fetch_array($res))) {
            if ($row['description']) {
                $descr = "({$row['description']})";
            } else {
                $descr = '';
            }
            $menu->add_item("<a href=\"?exercise={$row['id']}\"><strong>{$row['name']}</strong></a> <small>{$descr}</small>", $row['id']);
        }
        $ltab->add_row(array($menu->prepare() . "<br>"));
    } else {
        $ltab->add_row(array("No exercises in selected categories."));
    }
    $tab = new TABLE();
    $tab->add_row(array(array('attr' => 'valign="top"', 'cont' => $ltab->prepare()), array('attr' => 'valign="top"', 'cont' => $rtab->prepare())));
    $page->add_to_middle($tab->prepare());
}
$page->add_to_middle("</form>\n");
#echo $page->display();