Ejemplo n.º 1
0
        case "CGroups":
            $group_id = $owner->_id;
    }
    // Object columns on the first line
    $cols = fgetcsv($fp);
    // Each line
    while ($line = fgetcsv($fp)) {
        $object = new CListeChoix();
        foreach ($cols as $index => $field) {
            $object->{$field} = $line[$index] === "" ? null : $line[$index];
        }
        $object->user_id = $user_id;
        $object->function_id = $function_id;
        $object->group_id = $group_id;
        $alreadyExists = $object->loadMatchingObjectEsc();
        if ($msg = $object->store()) {
            CAppUI::setMsg($msg);
            continue;
        }
        if ($alreadyExists) {
            CAppUI::setMsg("Liste de choix déjà présente");
        } else {
            CAppUI::setMsg("CAideSaisie-msg-create");
        }
    }
    fclose($fp);
    // Window refresh
    echo "<script type='text/javascript'>window.opener.location.reload();</script>";
}
// Création du template
$smarty = new CSmartyDP();