Example #1
0
        switch (quickGet('type_extended')) {
            case 'date':
                // Keep only the date in YYYY-mm-dd format
                quickSet('value', substr(quickGet('value'), 0, 10));
                break;
            case 'int':
                // Check if the value of the input is a number
                $correct = preg_match("#^[0-9]+\$#", quickGet('value'));
                break;
        }
    }
    if ($correct) {
        $sub = new SubRequest(quickGet('req'), quickGet('param'), quickGet('value'), quickGet('value2'), quickGet('operator'));
        if (quickGet('sub_id') != '') {
            $sub->id = quickGet('sub_id');
            $request->editSub($sub);
        } else {
            $request->addSub($sub);
        }
    }
}
// select the module in which a part of the request must be launch
//TODO put in class
$modules = getPossiblesModules();
if (count($modules) == 1) {
    quickSet('add_req', $modules[0]);
} else {
    $add_req = quickget('add_req');
    if (!isset($add_req) || count($add_req) == 0 || $add_req == '') {
        $default = getDefaultModule();
        quickSet('add_req', $default);