예제 #1
0
 /**
  * Display a list of all form sections and questions
  *
  * @param  CommonGLPI $item         Instance of a CommonGLPI Item (The Form Item)
  * @param  integer    $tabnum       Number of the current tab
  * @param  integer    $withtemplate
  *
  * @see CommonDBTM::displayTabContentForItem
  *
  * @return null                     Nothing, just display the list
  */
 public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
 {
     echo '<table class="tab_cadre_fixe">';
     // Get sections
     $section = new PluginFormcreatorSection();
     $found_sections = $section->find('plugin_formcreator_forms_id = ' . $item->getId(), '`order`');
     $section_number = count($found_sections);
     $tab_sections = array();
     $tab_questions = array();
     $token = Session::getNewCSRFToken();
     foreach ($found_sections as $section) {
         $tab_sections[] = $section['id'];
         echo '<tr id="section_row_' . $section['id'] . '">';
         echo '<th>' . $section['name'] . '</th>';
         echo '<th align="center" width="32">&nbsp;</th>';
         echo '<th align="center" width="32">';
         if ($section['order'] != 1) {
             echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/up2.png"
                  alt="*" title="' . __('Edit') . '"
                  onclick="moveSection(\'' . $token . '\', ' . $section['id'] . ', \'up\');" align="absmiddle" style="cursor: pointer" /> ';
         } else {
             echo '&nbsp;';
         }
         echo '</th>';
         echo '<th align="center" width="32">';
         if ($section['order'] != $section_number) {
             echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/down2.png"
                  alt="*" title="' . __('Edit') . '"
                  onclick="moveSection(\'' . $token . '\', ' . $section['id'] . ', \'down\');" align="absmiddle" style="cursor: pointer" /> ';
         } else {
             echo '&nbsp;';
         }
         echo '</th>';
         echo '<th align="center" width="32">';
         echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/pencil.png"
               alt="*" title="' . __('Edit') . '"
               onclick="editSection(' . $item->getId() . ', \'' . $token . '\', ' . $section['id'] . ')" align="absmiddle" style="cursor: pointer" /> ';
         echo '</th>';
         echo '<th align="center" width="32">';
         echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/delete.png"
               alt="*" title="' . __('Delete', 'formcreator') . '"
               onclick="deleteSection(' . $item->getId() . ', \'' . $token . '\', ' . $section['id'] . ', \'' . addslashes($section['name']) . '\')"
               align="absmiddle" style="cursor: pointer" /> ';
         echo '</th>';
         echo '</tr>';
         // Get questions
         $question = new PluginFormcreatorQuestion();
         $found_questions = $question->find('plugin_formcreator_sections_id = ' . $section['id'], '`order`');
         $question_number = count($found_questions);
         $i = 0;
         foreach ($found_questions as $question) {
             $i++;
             $tab_questions[] = $question['id'];
             echo '<tr class="line' . $i % 2 . '" id="question_row_' . $question['id'] . '">';
             echo '<td onclick="editQuestion(' . $item->getId() . ', \'' . $token . '\', ' . $question['id'] . ', ' . $section['id'] . ')" style="cursor: pointer">';
             echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/ui-' . $question['fieldtype'] . '-field.png" alt="" title="" /> ';
             echo $question['name'];
             echo '</td>';
             echo '<td align="center">';
             $question_type = $question['fieldtype'] . 'Field';
             $question_types = PluginFormcreatorFields::getTypes();
             $classname = $question['fieldtype'] . 'Field';
             $fields = $classname::getPrefs();
             // avoid quote js error
             $question['name'] = htmlspecialchars_decode($question['name'], ENT_QUOTES);
             if ($fields['required'] == 0) {
                 echo '&nbsp;';
             } elseif ($question['required']) {
                 echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/required.png"
                     alt="*" title="' . __('Required', 'formcreator') . '"
                     onclick="setRequired(\'' . $token . '\', ' . $question['id'] . ', 0)" align="absmiddle" style="cursor: pointer" /> ';
             } else {
                 echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/not-required.png"
                     alt="*" title="' . __('Required', 'formcreator') . '"
                     onclick="setRequired(\'' . $token . '\', ' . $question['id'] . ', 1)" align="absmiddle" style="cursor: pointer" /> ';
             }
             echo '</td>';
             echo '<td align="center">';
             if ($question['order'] != 1) {
                 echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/up.png"
                     alt="*" title="' . __('Edit') . '"
                     onclick="moveQuestion(\'' . $token . '\', ' . $question['id'] . ', \'up\');" align="absmiddle" style="cursor: pointer" /> ';
             } else {
                 echo '&nbsp;';
             }
             echo '</td>';
             echo '<td align="center">';
             if ($question['order'] != $question_number) {
                 echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/down.png"
                     alt="*" title="' . __('Edit') . '"
                     onclick="moveQuestion(\'' . $token . '\', ' . $question['id'] . ', \'down\');" align="absmiddle" style="cursor: pointer" /> ';
             } else {
                 echo '&nbsp;';
             }
             echo '</td>';
             echo '<td align="center">';
             echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/pencil.png"
                  alt="*" title="' . __('Edit') . '"
                  onclick="editQuestion(' . $item->getId() . ', \'' . $token . '\', ' . $question['id'] . ', ' . $section['id'] . ')" align="absmiddle" style="cursor: pointer" /> ';
             echo '</td>';
             echo '<td align="center">';
             echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/delete.png"
                  alt="*" title="' . __('Delete', 'formcreator') . '"
                  onclick="deleteQuestion(' . $item->getId() . ', \'' . $token . '\', ' . $question['id'] . ', \'' . addslashes($question['name']) . '\')" align="absmiddle" style="cursor: pointer" /> ';
             echo '</td>';
             echo '</tr>';
         }
         echo '<tr class="line' . ($i + 1) % 2 . '">';
         echo '<td colspan="6" id="add_question_td_' . $section['id'] . '" class="add_question_tds">';
         echo '<a href="javascript:addQuestion(' . $item->getId() . ', \'' . $token . '\', ' . $section['id'] . ');">
                <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
                ' . __('Add a question', 'formcreator') . '
            </a>';
         echo '</td>';
         echo '</tr>';
     }
     echo '<tr class="line1">';
     echo '<th colspan="6" id="add_section_th">';
     echo '<a href="javascript:addSection(' . $item->getId() . ', \'' . $token . '\');">
             <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
             ' . __('Add a section', 'formcreator') . '
         </a>';
     echo '</th>';
     echo '</tr>';
     echo "</table>";
     $js_tab_sections = "";
     $js_tab_questions = "";
     $js_line_questions = "";
     foreach ($tab_sections as $key) {
         $js_tab_sections .= "tab_sections[{$key}] = document.getElementById('section_row_{$key}').innerHTML;" . PHP_EOL;
         $js_tab_questions .= "tab_questions[{$key}] = document.getElementById('add_question_td_{$key}').innerHTML;" . PHP_EOL;
     }
     foreach ($tab_questions as $key) {
         $js_line_questions .= "line_questions[{$key}] = document.getElementById('question_row_{$key}').innerHTML;" . PHP_EOL;
     }
 }
예제 #2
0
 /**
  * Détermine le type_id de la (des) configuration(s) rattachée à un objet GLPI
  *
  * @param CommonGLPI $item
  *           l'objet auquel est rattaché la configuration
  * @return number type_id de la (des) configuration(s) associée
  */
 private static final function getTypeIdForGLPIItem(CommonGLPI $item)
 {
     // CHANGE WHEN ADD GLPI_TYPE
     switch ($item->getType()) {
         case 'Config':
             return 0;
         case 'Entity':
         case 'Profile':
         case 'User':
             return $item->getId();
         case 'Preference':
             return Session::getLoginUserID();
         default:
             return false;
     }
 }
예제 #3
0
    public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
    {
        echo '<table class="tab_cadre_fixe">';
        echo '<tr>';
        echo '<th colspan="3">' . _n('Destinations', 'Destinations', 2, 'formcreator') . '</th>';
        echo '</tr>';
        $target_class = new PluginFormcreatorTarget();
        $founded_targets = $target_class->find('plugin_formcreator_forms_id = ' . $item->getID());
        $target_number = count($founded_targets);
        $i = 0;
        foreach ($founded_targets as $target) {
            $i++;
            echo '<tr class="line' . $i % 2 . '">';
            echo '<td onclick="document.location=\'../front/targetticket.form.php?id=' . $target['items_id'] . '\'" style="cursor: pointer">';
            echo $target['name'];
            echo '</td>';
            echo '<td align="center" width="32">';
            echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/pencil.png"
                  alt="*" title="' . __('Edit') . '"
                  onclick="document.location=\'../front/targetticket.form.php?id=' . $target['items_id'] . '\'" align="absmiddle" style="cursor: pointer" /> ';
            echo '</td>';
            echo '<td align="center" width="32">';
            echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/delete.png"
                  alt="*" title="' . __('Delete', 'formcreator') . '"
                  onclick="deleteTarget(' . $target['id'] . ', \'' . addslashes($target['name']) . '\')" align="absmiddle" style="cursor: pointer" /> ';
            echo '</td>';
            echo '</tr>';
        }
        // Display add target link...
        echo '<tr class="line' . ($i + 1) % 2 . '" id="add_target_row">';
        echo '<td colspan="3">';
        echo '<a href="javascript:addTarget(' . $item->fields['id'] . ');">
                <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
                ' . __('Add a destination', 'formcreator') . '
            </a>';
        echo '</td>';
        echo '</tr>';
        // OR display add target form
        echo '<tr class="line' . ($i + 1) % 2 . '" id="add_target_form" style="display: none;">';
        echo '<td colspan="3" id="add_target_form_td"></td>';
        echo '</tr>';
        echo "</table>";
        echo '<script type="text/javascript">
               function addTarget(form) {
                  document.getElementById("add_target_form").style.display = "table-row";
                  document.getElementById("add_target_row").style.display = "none";
                  Ext.get("add_target_form_td").load({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/ajax/target.php",
                     scripts: true,
                     params: "form_id=" + ' . $item->getId() . '
                  });
               }

               function cancelAddTarget() {
                  document.getElementById("add_target_row").style.display = "table-row";
                  document.getElementById("add_target_form").style.display = "none";
               }

               function deleteTarget(target_id, target_name) {
                  if(confirm("' . __('Are you sure you want to delete this destination:', 'formcreator') . ' " + target_name)) {
                     Ext.Ajax.request({
                        url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/target.form.php",
                        success: reloadTab,
                        params: {
                           delete: 1,
                           id: target_id,
                           plugin_formcreator_forms_id: ' . $item->getId() . ',
                           _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                        }
                     });
                  }
               }
            </script>';
    }
    /**
     * Display a list of all form sections and questions
     *
     * @param  CommonGLPI $item         Instance of a CommonGLPI Item (The Form Item)
     * @param  integer    $tabnum       Number of the current tab
     * @param  integer    $withtemplate
     *
     * @see CommonDBTM::displayTabContentForItem
     *
     * @return null                     Nothing, just display the list
     */
    public static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0)
    {
        echo '<table class="tab_cadre_fixe">';
        // Get sections
        $section = new PluginFormcreatorSection();
        $founded_sections = $section->find('plugin_formcreator_forms_id = ' . $item->getId(), '`order`');
        $section_number = count($founded_sections);
        $tab_sections = array();
        $tab_questions = array();
        foreach ($founded_sections as $section) {
            $tab_sections[] = $section['id'];
            echo '<tr id="section_row_' . $section['id'] . '">';
            echo '<th>' . $section['name'] . '</th>';
            echo '<th align="center" width="32">&nbsp;</th>';
            echo '<th align="center" width="32">';
            if ($section['order'] != 1) {
                echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/up2.png"
                     alt="*" title="' . __('Edit') . '"
                     onclick="moveSection(' . $section['id'] . ', \'up\');" align="absmiddle" style="cursor: pointer" /> ';
            } else {
                echo '&nbsp;';
            }
            echo '</th>';
            echo '<th align="center" width="32">';
            if ($section['order'] != $section_number) {
                echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/down2.png"
                     alt="*" title="' . __('Edit') . '"
                     onclick="moveSection(' . $section['id'] . ', \'down\');" align="absmiddle" style="cursor: pointer" /> ';
            } else {
                echo '&nbsp;';
            }
            echo '</th>';
            echo '<th align="center" width="32">';
            echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/pencil.png"
                  alt="*" title="' . __('Edit') . '"
                  onclick="editSection(' . $section['id'] . ')" align="absmiddle" style="cursor: pointer" /> ';
            echo '</th>';
            echo '<th align="center" width="32">';
            echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/delete.png"
                  alt="*" title="' . __('Delete', 'formcreator') . '"
                  onclick="deleteSection(' . $section['id'] . ', \'' . addslashes($section['name']) . '\')"
                  align="absmiddle" style="cursor: pointer" /> ';
            echo '</th>';
            echo '</tr>';
            // Get questions
            $question = new PluginFormcreatorQuestion();
            $founded_questions = $question->find('plugin_formcreator_sections_id = ' . $section['id'], '`order`');
            $question_number = count($founded_questions);
            $i = 0;
            foreach ($founded_questions as $question) {
                $i++;
                $tab_questions[] = $question['id'];
                echo '<tr class="line' . $i % 2 . '" id="question_row_' . $question['id'] . '">';
                echo '<td onclick="editQuestion(' . $question['id'] . ', ' . $section['id'] . ')" style="cursor: pointer">';
                echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/ui-' . $question['fieldtype'] . '-field.png" alt="" title="" /> ';
                echo $question['name'];
                echo '</td>';
                echo '<td align="center">';
                $question_type = $question['fieldtype'] . 'Field';
                $question_types = PluginFormcreatorFields::getTypes();
                $classname = $question['fieldtype'] . 'Field';
                $fields = $classname::getPrefs();
                if ($fields['required'] == 0) {
                    echo '&nbsp;';
                } elseif ($question['required']) {
                    echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/required.png"
                        alt="*" title="' . __('Required', 'formcreator') . '"
                        onclick="setRequired(' . $question['id'] . ', 0)" align="absmiddle" style="cursor: pointer" /> ';
                } else {
                    echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/not-required.png"
                        alt="*" title="' . __('Required', 'formcreator') . '"
                        onclick="setRequired(' . $question['id'] . ', 1)" align="absmiddle" style="cursor: pointer" /> ';
                }
                echo '</td>';
                echo '<td align="center">';
                if ($question['order'] != 1) {
                    echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/up.png"
                        alt="*" title="' . __('Edit') . '"
                        onclick="moveQuestion(' . $question['id'] . ', \'up\');" align="absmiddle" style="cursor: pointer" /> ';
                } else {
                    echo '&nbsp;';
                }
                echo '</td>';
                echo '<td align="center">';
                if ($question['order'] != $question_number) {
                    echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/down.png"
                        alt="*" title="' . __('Edit') . '"
                        onclick="moveQuestion(' . $question['id'] . ', \'down\');" align="absmiddle" style="cursor: pointer" /> ';
                } else {
                    echo '&nbsp;';
                }
                echo '</td>';
                echo '<td align="center">';
                echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/pencil.png"
                     alt="*" title="' . __('Edit') . '"
                     onclick="editQuestion(' . $question['id'] . ', ' . $section['id'] . ')" align="absmiddle" style="cursor: pointer" /> ';
                echo '</td>';
                echo '<td align="center">';
                echo '<img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/pics/delete.png"
                     alt="*" title="' . __('Delete', 'formcreator') . '"
                     onclick="deleteQuestion(' . $question['id'] . ', \'' . addslashes($question['name']) . '\')" align="absmiddle" style="cursor: pointer" /> ';
                echo '</td>';
                echo '</tr>';
            }
            echo '<tr class="line' . ($i + 1) % 2 . '">';
            echo '<td colspan="6" id="add_question_td_' . $section['id'] . '" class="add_question_tds">';
            echo '<a href="javascript:addQuestion(' . $section['id'] . ');">
                   <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
                   ' . __('Add a question', 'formcreator') . '
               </a>';
            echo '</td>';
            echo '</tr>';
        }
        echo '<tr class="line1">';
        echo '<th colspan="6" id="add_section_th">';
        echo '<a href="javascript:addSection();" class="submit">
                <img src="' . $GLOBALS['CFG_GLPI']['root_doc'] . '/pics/menu_add.png" alt="+" align="absmiddle" />
                ' . __('Add a section', 'formcreator') . '
            </a>';
        echo '</th>';
        echo '</tr>';
        echo "</table>";
        $js_tab_sections = "";
        $js_tab_questions = "";
        $js_line_questions = "";
        foreach ($tab_sections as $key) {
            $js_tab_sections .= "tab_sections[{$key}] = document.getElementById('section_row_{$key}').innerHTML;" . PHP_EOL;
            $js_tab_questions .= "tab_questions[{$key}] = document.getElementById('add_question_td_{$key}').innerHTML;" . PHP_EOL;
        }
        foreach ($tab_questions as $key) {
            $js_line_questions .= "line_questions[{$key}] = document.getElementById('question_row_{$key}').innerHTML;" . PHP_EOL;
        }
        echo '<script type="text/javascript">
               var modalWindow = new Ext.Window({
                  layout: "fit",
                  width: "964",
                  height: "600",
                  closeAction: "hide",
                  modal: "true",
                  autoScroll: true,
                  y: 500
               });


               // === QUESTIONS ===
               var tab_questions = [];
               ' . $js_tab_questions . '
               var line_questions = [];
               ' . $js_line_questions . '

               function addQuestion(section) {
                  modalWindow.show();
                  modalWindow.load({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/ajax/question.php",
                     params: {
                        section_id: section,
                        form_id: ' . $item->getId() . ',
                        _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                     },
                     timeout: 30,
                     scripts: true
                  });
               }

               function editQuestion(question, section) {
                  modalWindow.show();
                  modalWindow.load({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/ajax/question.php",
                     params: {
                        question_id: question,
                        section_id: section,
                        form_id: ' . $item->getId() . ',
                        _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                     },
                     timeout: 30,
                     scripts: true
                  });
               }

               function setRequired(question_id, value) {
                  Ext.Ajax.request({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/question.form.php",
                     success: reloadTab,
                     params: {
                        set_required: 1,
                        id: question_id,
                        value: value,
                        _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                     }
                  });
               }

               function moveQuestion(question_id, way) {
                  Ext.Ajax.request({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/question.form.php",
                     success: reloadTab,
                     params: {
                        move: 1,
                        id: question_id,
                        way: way,
                        _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                     }
                  });
               }

               function deleteQuestion(question_id, question_name) {
                  if(confirm("' . __('Are you sure you want to delete this question:', 'formcreator') . ' " + question_name)) {
                     Ext.Ajax.request({
                        url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/question.form.php",
                        success: reloadTab,
                        params: {
                           delete: 1,
                           id: question_id,
                           plugin_formcreator_forms_id: ' . $item->getId() . ',
                           _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                        }
                     });
                  }
               }

               // === SECTIONS ===
               var add_section_link = document.getElementById("add_section_th").innerHTML;

               var tab_sections = [];
               ' . $js_tab_sections . '

               function addSection() {
                  Ext.get("add_section_th").load({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/ajax/section.php",
                     scripts: true,
                     params: "form_id=' . $item->getId() . '"
                  });
               }

               function editSection(section) {
                  document.getElementById("section_row_" + section).innerHTML = "<th colspan=\\"6\\"></th>";
                  Ext.get("section_row_" + section + "").child("th").load({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/ajax/section.php",
                     scripts: true,
                     params: "section_id=" + section + "&form_id=' . $item->getId() . '"
                  });
               }

               function deleteSection(section_id, section_name) {
                  if(confirm("' . __('Are you sure you want to delete this section:', 'formcreator') . ' " + section_name)) {
                     Ext.Ajax.request({
                        url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/section.form.php",
                        success: reloadTab,
                        params: {
                           delete: 1,
                           id: section_id,
                           plugin_formcreator_forms_id: ' . $item->getId() . ',
                           _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                        }
                     });
                  }
               }

               function moveSection(section_id, way) {
                  Ext.Ajax.request({
                     url: "' . $GLOBALS['CFG_GLPI']['root_doc'] . '/plugins/formcreator/front/section.form.php",
                     success: reloadTab,
                     params: {
                        move: 1,
                        id: section_id,
                        way: way,
                        _glpi_csrf_token: "' . Session::getNewCSRFToken() . '"
                     }
                  });
               }

               function resetAll() {
                  document.getElementById("add_section_th").innerHTML = add_section_link;
                  for (section_id in tab_sections) {
                     if(parseInt(section_id)) {
                        document.getElementById("section_row_" + section_id).innerHTML = tab_sections[section_id];
                        document.getElementById("add_question_td_" + section_id).innerHTML = tab_questions[section_id];
                     }
                  }
                  for (question_id in line_questions) {
                     if(parseInt(question_id)) {
                        document.getElementById("question_row_" + question_id).innerHTML = line_questions[question_id];
                     }
                  }
               }

            </script>';
    }