示例#1
0
文件: index.php 项目: PayIcam/shotgun
        $desc = new Desc($desc_id);
        $form = $desc->getForm("Modification d'un shotgun", "shotgunform?fun_id=" . $fun_id . "&desc_id=" . $desc_id, "Modifier");
        $form->load();
        $desc->update();
    } else {
        $desc = new Desc();
        $form = $desc->getForm("Création d'un shotgun", "createshotgun?fun_id=" . $fun_id, "Créer");
        $form->load();
        try {
            // Création de la catégorie dans payutc (celle ou on rentrera les articles)
            $ret = $payutcClient->setCategory(array("name" => $desc->titre, "parent_id" => null, "fun_id" => $fun_id));
            if (isset($ret->success)) {
                $desc->payutc_fun_id = $fun_id;
                $desc->payutc_cat_id = $ret->success;
            }
            $desc_id = $desc->insert();
        } catch (\Exception $e) {
            $app->flashNow('info', "Une erreur est survenu, la création du shotgun à échoué. => {$e->getMessage()}");
            $app->render('header.php', array());
            $app->render('form.php', array("form" => $form));
            $app->render('footer.php', array('isAdminFondation' => $isAdminFondation));
            return;
        }
    }
    $app->redirect("adminshotgun?id=" . $desc_id);
});
$app->get('/adminshotgun', function () use($app, $isAdminFondation) {
    $payutcClient = getPayutcClient("GESARTICLE");
    if (!isset($_GET["id"])) {
        $app->redirect("admin");
    } else {