当前位置: 首页>>代码示例>>PHP>>正文


PHP CommonGLPI::getId方法代码示例

本文整理汇总了PHP中CommonGLPI::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP CommonGLPI::getId方法的具体用法?PHP CommonGLPI::getId怎么用?PHP CommonGLPI::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CommonGLPI的用法示例。


在下文中一共展示了CommonGLPI::getId方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: displayTabContentForItem

 /**
  * 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"
//.........这里部分代码省略.........
开发者ID:CHCI74,项目名称:formcreator,代码行数:101,代码来源:question.class.php

示例2: getTypeIdForGLPIItem

 /**
  * 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;
     }
 }
开发者ID:Etiennef,项目名称:configmanager,代码行数:23,代码来源:common.class.php

示例3: displayTabContentForItem

    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>';
    }
开发者ID:nicholaseduardo,项目名称:formcreator,代码行数:74,代码来源:target.class.php

示例4: displayTabContentForItem

    /**
     * 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 {
//.........这里部分代码省略.........
开发者ID:nicholaseduardo,项目名称:formcreator,代码行数:101,代码来源:question.class.php


注:本文中的CommonGLPI::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。