예제 #1
0
<?php

include '../../../inc/includes.php';
Session::checkLoginUser();
if (empty($_REQUEST["id"])) {
    $_REQUEST["id"] = "";
}
$form = new PluginFormcreatorSection();
if (isset($_POST["add"])) {
    $form->check(-1, 'w', $_POST);
    $newID = $form->add($_POST);
    Html::back();
} else {
    if (isset($_POST["delete"])) {
        $form->check($_POST["id"], 'd');
        $form->delete($_POST);
        $sectionID = $_POST["id"];
        //suppresion question
        $question = new PluginFormcreatorQuestion();
        $listQuestion = $question->find("plugin_formcreator_sections_id = '{$sectionID}'");
        foreach ($listQuestion as $question_id => $values) {
            $question->delete($values);
        }
        Html::back();
    } else {
        if (isset($_POST["restore"])) {
            $form->check($_POST["id"], 'd');
            $form->restore($_POST);
            $form->redirectToList();
        } else {
            if (isset($_REQUEST["purge"])) {
예제 #2
0
if ($plugin->isActivated("formcreator")) {
    $section = new PluginFormcreatorSection();
    // Add a new Section
    if (isset($_POST["add"])) {
        $section->check(-1, 'w', $_POST);
        $section->add($_POST);
        Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/form.form.php?id=' . $_POST['plugin_formcreator_forms_id']);
        // Edit an existing Section
    } elseif (isset($_POST["update"])) {
        $section->check($_POST['id'], 'w');
        $section->update($_POST);
        Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/form.form.php?id=' . $_POST['plugin_formcreator_forms_id']);
        // Delete a Section
    } elseif (isset($_POST["delete"])) {
        $section->check($_POST['id'], 'd');
        $section->delete($_POST);
        Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/form.form.php?id=' . $_POST['plugin_formcreator_forms_id']);
        // Move a Section
    } elseif (isset($_POST["move"])) {
        global $DB;
        $section->check($_POST['id'], 'd');
        $table = getTableForItemtype('PluginFormcreatorSection');
        $result = $DB->query("SELECT `order`, `plugin_formcreator_forms_id` FROM {$table} WHERE id = " . $_POST['id']);
        list($order, $form_id) = $DB->fetch_array($result);
        if ($_POST["way"] == 'up') {
            $result = $DB->query("SELECT `id`, `order` FROM {$table} WHERE `order` < {$order} AND plugin_formcreator_forms_id = {$form_id} ORDER BY `order` DESC LIMIT 0, 1");
            if ($DB->numrows($result) != 0) {
                list($id2, $order2) = $DB->fetch_array($result);
                $DB->query("UPDATE {$table} SET `order` = {$order2} WHERE `id` = " . (int) $_POST['id']);
                $DB->query("UPDATE {$table} SET `order` = {$order} WHERE `id` = {$id2}");
            }
예제 #3
0
} else {
    if (isset($_POST["delete"])) {
        $form->check($_POST["id"], 'd');
        $form->delete($_POST);
        $formID = $_POST["id"];
        //suppresion question
        $question = new PluginFormcreatorQuestion();
        $listQuestion = $question->find("plugin_formcreator_forms_id = '{$formID}'");
        foreach ($listQuestion as $question_id => $values) {
            $question->delete($values);
        }
        //suppresion section
        $section = new PluginFormcreatorSection();
        $listSection = $section->find("plugin_formcreator_forms_id = '{$formID}'");
        foreach ($listSection as $section_id => $values) {
            $section->delete($values);
        }
        //suppression target
        $target = new PluginFormcreatorTarget();
        $listTarget = $target->find("plugin_formcreator_forms_id = '{$formID}'");
        foreach ($listTarget as $target_id => $values) {
            $target->delete($values);
        }
        $form->redirectToList();
    } else {
        if (isset($_POST["restore"])) {
            $form->check($_POST["id"], 'd');
            $form->restore($_POST);
            $form->redirectToList();
        } else {
            if (isset($_REQUEST["purge"])) {