Ejemplo n.º 1
0
<?php

include "../../../inc/includes.php";
Session::checkRight("config", "w");
// Check if plugin is activated...
$plugin = new Plugin();
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') {
Ejemplo n.º 2
0
 function createDefaultSection($formID, $targetID)
 {
     global $LANG;
     $section = new PluginFormcreatorSection();
     $defaultSection['name'] = $LANG['plugin_formcreator']["default"]["section"][0];
     $defaultSection['content'] = $LANG['plugin_formcreator']["default"]["section"][1];
     $defaultSection['plugin_formcreator_forms_id'] = $formID;
     $defaultSection['plugin_formcreator_targets_id'] = $targetID;
     $section->add($defaultSection);
 }
Ejemplo n.º 3
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"])) {