Exemple #1
0
            $i++;
        }
        $res .= "</td></tr></table>\n\n";
        return $res;
    }
}
/****************************************************************************/
/*}}}*/
// set up form for validation and forming
$fex = new formex('POST', 'bundler_formex_field');
$fex->js_src_inline = true;
$fex->left_td_style = '';
$fex->field_prefix = '';
$fex->add_element($bundle->get_colmap());
foreach ($bundle->colmap_help as $elem => $txt) {
    $fex->set_elem_helptext($elem, $txt);
}
// handle ADD and EDIT/*{{{*/
if (isset($_POST['op']) and ($ACTION == OP_ADD or $ACTION == OP_EDIT)) {
    $errs = $fex->validate($_POST);
    $req_id = $_POST['id'];
    if (empty($_POST['pcat_req_vals']) or !is_array($_POST['pcat_req_vals'])) {
        $errs[] = "Bundle selection was missing!";
    } else {
        $catquants = join('', array_values($_POST['pcat_req_vals']));
        if (empty($catquants)) {
            $errs[] = "Bundle must contain one or more categories of products to select from.";
        }
    }
    if (empty($errs)) {
        $vals = $fex->get_submitted_vals($_POST);
Exemple #2
0
        $msg = "The selected {$table_title} was totally removed.";
        // send back to self with messageness
        header("Location: {$_SERVER['PHP_SELF']}?class={$class}&info=" . base64_encode($msg));
    } else {
        $errs[] = "ERROR: could not delete: " . $res->getMessage();
    }
}
if ($SHOWFORM) {
    $fex = new formex();
    $fex->field_prefix = '';
    $fex->js_src_inline = true;
    $fex->add_element($colmap);
    // all those things in $colmap are in the form now
    if (isset($dbc->colmap_help) && is_array($dbc->colmap_help)) {
        foreach ($dbc->colmap_help as $k => $text) {
            $fex->set_elem_helptext($k, $text);
        }
    }
    $fex->add_element('op', array($ACTION, 'submit'));
    // the button
    $fex->add_element('class', array(null, 'hidden', $class));
    // important
    if ($ACTION == OP_EDIT) {
        $dbc->set_id($itemid);
        $fex->elem_vals = $dbc->fetch('', true);
        $fex->add_element('id', array(null, 'hidden', $itemid));
        // important
        $cat_name = $fex->elem_vals[$table_namecol];
        $confirm_msg = sprintf('This will remove this %s from the site permanently. Are you sure?', $table_title);
        $fex->add_element('op_kill', array(OP_KILL, 'submit', null, null, 'onclick="return confirm(\'' . $confirm_msg . '\')"'));
    }