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


PHP Html::scriptBlock方法代码示例

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


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

示例1: showCriteria

 /**
  * Displays tab content
  * This function adapted from Search::showGenericSearch with controls removed
  * @param  bool $formcontrol : display form buttons
  * @return nothing, displays a seach form
  */
 static function showCriteria(PluginFusioninventoryDeployGroup $item, $formcontrol = true, $p)
 {
     global $CFG_GLPI, $DB;
     $is_dynamic = $item->isDynamicGroup();
     $itemtype = "PluginFusioninventoryComputer";
     $can_update = $item->canEdit($item->getID());
     if ($can_update) {
         //show generic search form (duplicated from Search class)
         echo "<form name='group_search_form' method='POST'>";
         echo "<input type='hidden' name='plugin_fusioninventory_deploygroups_id' value='" . $item->getID() . "'>";
         echo "<input type='hidden' name='id' value='" . $item->getID() . "'>";
         // add tow hidden fields to permit delete of (meta)criteria
         echo "<input type='hidden' name='criteria' value=''>";
         echo "<input type='hidden' name='metacriteria' value=''>";
     }
     echo "<div class='tabs_criteria'>";
     echo "<table class='tab_cadre_fixe'>";
     echo "<tr><th>" . _n('Criterion', 'Criteria', 2) . "</th></tr>";
     echo "<tr><td>";
     echo "<div id='searchcriteria'>";
     $nb_criteria = count($p['criteria']);
     if ($nb_criteria == 0) {
         $nb_criteria++;
     }
     $nb_meta_criteria = isset($p['metacriteria']) ? count($p['metacriteria']) : 0;
     $nbsearchcountvar = 'nbcriteria' . strtolower($itemtype) . mt_rand();
     $nbmetasearchcountvar = 'nbmetacriteria' . strtolower($itemtype) . mt_rand();
     $searchcriteriatableid = 'criteriatable' . strtolower($itemtype) . mt_rand();
     // init criteria count
     $js = "var {$nbsearchcountvar}=" . $nb_criteria . ";";
     $js .= "var {$nbmetasearchcountvar}=" . $nb_meta_criteria . ";";
     echo Html::scriptBlock($js);
     echo "<table class='tab_format' id='{$searchcriteriatableid}'>";
     // Displays normal search parameters
     for ($i = 0; $i < $nb_criteria; $i++) {
         $_POST['itemtype'] = $itemtype;
         $_POST['num'] = $i;
         include GLPI_ROOT . '/ajax/searchrow.php';
     }
     $metanames = array();
     $linked = Search::getMetaItemtypeAvailable('Computer');
     if (is_array($linked) && count($linked) > 0) {
         for ($i = 0; $i < $nb_meta_criteria; $i++) {
             $_POST['itemtype'] = $itemtype;
             $_POST['num'] = $i;
             include GLPI_ROOT . '/ajax/searchmetarow.php';
         }
     }
     echo "</table>\n";
     echo "</td>";
     echo "</tr>";
     echo "</table>\n";
     // For dropdown
     echo "<input type='hidden' name='itemtype' value='{$itemtype}'>";
     if ($can_update) {
         // add new button to search form (to store and preview)
         echo "<div class='center'>";
         if ($is_dynamic) {
             echo "<input type='submit' value=\" " . _sx('button', 'Save') . " \" class='submit' name='save'>";
         } else {
             echo "<input type='submit' value=\" " . __('Preview') . " \" class='submit' name='preview'>";
         }
         echo "</div>";
     }
     echo "</td></tr></table>";
     echo "</div>";
     //restore search session variables
     //$_SESSION['glpisearch'] = $glpisearch_session;
     // Reset to start when submit new search
     echo "<input type='hidden' name='start' value='0'>";
     Html::closeForm();
     //clean with javascript search control
     /*
           $clean_script = "jQuery( document ).ready(function( $ ) {
              $('#parent_criteria img').remove();
              $('.tabs_criteria img[name=img_deleted').remove();
           });";
           echo Html::scriptBlock($clean_script);*/
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:85,代码来源:deploygroup.class.php

示例2: showGenericSearch

 /**
  * Print generic search form
  *
  * Params need to parsed before using Search::manageParams function
  *
  * @param $itemtype        type to display the form
  * @param $params    array of parameters may include sort, is_deleted, criteria, metacriteria
  *
  * @return nothing (displays)
  **/
 static function showGenericSearch($itemtype, array $params)
 {
     global $CFG_GLPI;
     // Default values of parameters
     $p['sort'] = '';
     $p['is_deleted'] = 0;
     $p['criteria'] = array();
     $p['metacriteria'] = array();
     if (class_exists($itemtype)) {
         $p['target'] = $itemtype::getSearchURL();
     } else {
         $p['target'] = Toolbox::getItemTypeSearchURL($itemtype);
     }
     $p['showreset'] = true;
     $p['showbookmark'] = true;
     $p['addhidden'] = array();
     $p['actionname'] = 'search';
     $p['actionvalue'] = _sx('button', 'Search');
     foreach ($params as $key => $val) {
         $p[$key] = $val;
     }
     echo "<form name='searchform{$itemtype}' method='get' action=\"" . $p['target'] . "\">";
     echo "<div id='searchcriterias'>";
     $nbsearchcountvar = 'nbcriteria' . strtolower($itemtype) . mt_rand();
     $nbmetasearchcountvar = 'nbmetacriteria' . strtolower($itemtype) . mt_rand();
     $searchcriteriatableid = 'criteriatable' . strtolower($itemtype) . mt_rand();
     // init criteria count
     $js = "var {$nbsearchcountvar}=" . count($p['criteria']) . ";";
     $js .= "var {$nbmetasearchcountvar}=" . count($p['metacriteria']) . ";";
     echo Html::scriptBlock($js);
     echo "<table class='tab_cadre_fixe' >";
     echo "<tr class='tab_bg_1'>";
     if (count($p['criteria']) + count($p['metacriteria']) > 1) {
         echo "<td width='10' class='center'>";
         echo "<a href=\"javascript:toggleTableDisplay('{$searchcriteriatableid}','searchcriteriasimg',\n                                                       '" . $CFG_GLPI["root_doc"] . "/pics/deplier_down.png',\n                                                       '" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png')\">";
         echo "<img alt='' name='searchcriteriasimg' src=\"" . $CFG_GLPI["root_doc"] . "/pics/deplier_up.png\">";
         echo "</td>";
     }
     echo "<td>";
     echo "<table class='tab_format' id='{$searchcriteriatableid}'>";
     // Display normal search parameters
     for ($i = 0; $i < count($p['criteria']); $i++) {
         $_POST['itemtype'] = $itemtype;
         $_POST['num'] = $i;
         include GLPI_ROOT . '/ajax/searchrow.php';
     }
     $metanames = array();
     $linked = self::getMetaItemtypeAvailable($itemtype);
     if (is_array($linked) && count($linked) > 0) {
         for ($i = 0; $i < count($p['metacriteria']); $i++) {
             $_POST['itemtype'] = $itemtype;
             $_POST['num'] = $i;
             include GLPI_ROOT . '/ajax/searchmetarow.php';
         }
     }
     echo "</table>\n";
     echo "</td>\n";
     echo "<td width='150px'>";
     echo "<table width='100%'>";
     // Display deleted selection
     echo "<tr>";
     // Display submit button
     echo "<td width='80' class='center'>";
     echo "<input type='submit' name='" . $p['actionname'] . "' value=\"" . $p['actionvalue'] . "\" class='submit' >";
     echo "</td>";
     if ($p['showbookmark'] || $p['showreset']) {
         echo "<td>";
         if ($p['showbookmark']) {
             Bookmark::showSaveButton(Bookmark::SEARCH, $itemtype);
         }
         if ($p['showreset']) {
             echo "<a href='" . $p['target'] . (strpos($p['target'], '?') ? '&amp;' : '?') . "reset=reset' >";
             echo "&nbsp;&nbsp;<img title=\"" . __s('Blank') . "\" alt=\"" . __s('Blank') . "\" src='" . $CFG_GLPI["root_doc"] . "/pics/reset.png' class='calendrier pointer'></a>";
         }
         echo "</td>";
     }
     echo "</tr></table>\n";
     echo "</td></tr>";
     echo "</table>\n";
     if (count($p['addhidden'])) {
         foreach ($p['addhidden'] as $key => $val) {
             echo Html::hidden($key, array('value' => $val));
         }
     }
     // For dropdown
     echo Html::hidden('itemtype', array('value' => $itemtype));
     // Reset to start when submit new search
     echo Html::hidden('start', array('value' => 0));
     echo "</div>";
     Html::closeForm();
//.........这里部分代码省略.........
开发者ID:jose-martins,项目名称:glpi,代码行数:101,代码来源:search.class.php

示例3: file

 /**
  * Creates an input file field. Send file names in _$name field as array.
  * Files are uploaded in files/_tmp/ directory
  *
  * @since version 0.85
  *
  * @param $options       array of options
  *    - name                string   field name (default filename)
  *    - multiple            boolean  allow multiple file upload (default false)
  *    - onlyimages          boolean  restrict to image files (default false)
  *    - showfilecontainer   string   DOM ID of the container showing file uploaded:
  *                                   use selector to display
  *    - showfilesize        boolean  show file size with file name
  *    - rand                string   already computed rand value
  *    - pasteZone           string   DOM ID of the paste zone
  *    - dropZone            string   DOM ID of the drop zone
  *
  * @return string input file field
  **/
 static function file($options = array())
 {
     global $CFG_GLPI;
     $randupload = mt_rand();
     $p['name'] = 'filename';
     $p['multiple'] = false;
     $p['onlyimages'] = false;
     $p['showfilecontainer'] = '';
     $p['showfilesize'] = true;
     $p['pasteZone'] = false;
     $p['dropZone'] = 'dropdoc' . $randupload;
     $p['rand'] = $randupload;
     $p['values'] = array();
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $p[$key] = $val;
         }
     }
     $addshowfilecontainer = false;
     if (empty($p['showfilecontainer'])) {
         $addshowfilecontainer = true;
         $p['showfilecontainer'] = "filedata{$randupload}";
     }
     //echo "<input type='file' name='filename' value='".$this->fields["filename"]."' size='39'>";
     $out = "<div class='fileupload' id='" . $p['dropZone'] . "'>";
     $out .= "<span class='b'>" . __('Drag and drop your file here, or') . '</span><br>';
     $out .= "<input id='fileupload{$randupload}' type='file' name='" . $p['name'] . "[]' data-url='" . $CFG_GLPI["root_doc"] . "/front/fileupload.php?name=" . $p['name'] . "&amp;showfilesize=" . $p['showfilesize'] . "'>";
     if ($addshowfilecontainer) {
         $out .= "<div id='" . $p['showfilecontainer'] . "'></div>";
     }
     $script = self::fileScript($p) . "\n uploadFile" . $p['rand'] . "();";
     $out .= Html::scriptBlock($script);
     $out .= "<div id='progress{$randupload}' style='display:none'>" . "<div class='uploadbar' style='width: 0%;'></div></div>";
     $out .= "</div>";
     return $out;
 }
开发者ID:OlivierLM,项目名称:glpi,代码行数:55,代码来源:html.class.php

示例4: showNavigationHeader

 /**
  * Show tabs
  *
  * @param $options array of parameters to add to URLs and ajax
  *     - withtemplate is a template view ?
  *
  * @return Nothing ()
  **/
 function showNavigationHeader($options = array())
 {
     global $CFG_GLPI;
     // for objects not in table like central
     if (isset($this->fields['id'])) {
         $ID = $this->fields['id'];
     } else {
         if (isset($options['id'])) {
             $ID = $options['id'];
         } else {
             $ID = 0;
         }
     }
     $target = $_SERVER['PHP_SELF'];
     $extraparamhtml = "";
     $extraparam = "";
     $withtemplate = "";
     if (is_array($options) && count($options)) {
         $cleanoptions = $options;
         if (isset($options['withtemplate'])) {
             $withtemplate = $options['withtemplate'];
             unset($cleanoptions['withtemplate']);
         }
         foreach ($cleanoptions as $key => $val) {
             // Do not include id options
             if ($key[0] == '_' || $key == 'id') {
                 unset($cleanoptions[$key]);
             }
         }
         $extraparamhtml = "&amp;" . Toolbox::append_params($cleanoptions, '&amp;');
         $extraparam = "&" . Toolbox::append_params($cleanoptions);
     }
     if (empty($withtemplate) && !$this->isNewID($ID) && $this->getType() && $this->displaylist) {
         $glpilistitems =& $_SESSION['glpilistitems'][$this->getType()];
         $glpilisttitle =& $_SESSION['glpilisttitle'][$this->getType()];
         $glpilisturl =& $_SESSION['glpilisturl'][$this->getType()];
         if (empty($glpilisturl)) {
             $glpilisturl = $this->getSearchURL();
         }
         //          echo "<div id='menu_navigate'>";
         $next = $prev = $first = $last = -1;
         $current = false;
         if (is_array($glpilistitems)) {
             $current = array_search($ID, $glpilistitems);
             if ($current !== false) {
                 if (isset($glpilistitems[$current + 1])) {
                     $next = $glpilistitems[$current + 1];
                 }
                 if (isset($glpilistitems[$current - 1])) {
                     $prev = $glpilistitems[$current - 1];
                 }
                 $first = $glpilistitems[0];
                 if ($first == $ID) {
                     $first = -1;
                 }
                 $last = $glpilistitems[count($glpilistitems) - 1];
                 if ($last == $ID) {
                     $last = -1;
                 }
             }
         }
         $cleantarget = HTML::cleanParametersURL($target);
         echo "<div class='navigationheader'><table class='tab_cadre_pager'>";
         echo "<tr class='tab_bg_2'>";
         if ($first >= 0) {
             echo "<td class='left' width='16px'><a href='{$cleantarget}?id={$first}{$extraparamhtml}'>" . "<img src='" . $CFG_GLPI["root_doc"] . "/pics/first.png' alt=\"" . __s('First') . "\" title=\"" . __s('First') . "\" class='pointer'></a></td>";
         } else {
             echo "<td class='left' width='16px'><img src='" . $CFG_GLPI["root_doc"] . "/pics/first_off.png' alt=\"" . __s('First') . "\" title=\"" . __s('First') . "\"></td>";
         }
         if ($prev >= 0) {
             echo "<td class='left' width='16px'><a href='{$cleantarget}?id={$prev}{$extraparamhtml}' id='previouspage'>" . "<img src='" . $CFG_GLPI["root_doc"] . "/pics/left.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\" class='pointer'></a></td>";
             $js = '$("body").keydown(function(e) {
                    if ($("input, textarea").is(":focus") === false) {
                       if(e.keyCode == 37 && e.ctrlKey) {
                         window.location = $("#previouspage").attr("href");
                       }
                    }
               });';
             echo Html::scriptBlock($js);
         } else {
             echo "<td class='left' width='16px'><img src='" . $CFG_GLPI["root_doc"] . "/pics/left_off.png' alt=\"" . __s('Previous') . "\" title=\"" . __s('Previous') . "\"></td>";
         }
         echo "<td width='200px'><a href=\"" . $glpilisturl . "\">";
         if ($glpilisttitle) {
             echo $glpilisttitle;
         } else {
             _e('List');
         }
         echo "</a></td>";
         $name = $this->getTypeName(1);
         if (isset($this->fields['id']) && $this instanceof CommonDBTM) {
             $name = sprintf(__('%1$s - %2$s'), $name, sprintf(__('%1$s - ID %2$d'), $this->getName(), $this->fields['id']));
//.........这里部分代码省略.........
开发者ID:korial29,项目名称:glpi,代码行数:101,代码来源:commonglpi.class.php

示例5: showForm


//.........这里部分代码省略.........
     } else {
         if (empty($this->fields["name"])) {
             _e('Without title');
         } else {
             echo $this->fields["name"];
         }
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<th style='width:{$colsize1}%'>" . $tt->getBeginHiddenFieldText('content');
     printf(__('%1$s%2$s'), __('Description'), $tt->getMandatoryMark('content'));
     if (!$ID || $canupdate_descr) {
         $content = Toolbox::unclean_cross_side_scripting_deep(Html::entity_decode_deep($this->fields['content']));
         Html::showTooltip(nl2br(Html::Clean($content)));
     }
     echo $tt->getEndHiddenFieldText('content') . "</th>";
     echo "<td colspan='3'>";
     if (!$ID || $canupdate_descr) {
         // Admin =oui on autorise la modification de la description
         echo $tt->getBeginHiddenFieldValue('content');
         $rand = mt_rand();
         $rand_text = mt_rand();
         $rows = 6;
         $content_id = "content{$rand}";
         if ($CFG_GLPI["use_rich_text"]) {
             $this->fields["content"] = $this->setRichTextContent($content_id, $this->fields["content"], $rand);
             $rows = 10;
         } else {
             $this->fields["content"] = $this->setSimpleTextContent($this->fields["content"]);
         }
         echo "<div id='content{$rand_text}'>";
         echo "<textarea id='{$content_id}' name='content' style='width:100%' rows='{$rows}'>" . $this->fields["content"] . "</textarea></div>";
         echo Html::scriptBlock("\$(document).ready(function() { \$('#{$content_id}').autogrow(); });");
         echo $tt->getEndHiddenFieldValue('content', $this);
     } else {
         $content = Toolbox::unclean_cross_side_scripting_deep(Html::entity_decode_deep($this->fields['content']));
         echo nl2br(Html::Clean($content));
     }
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     if ($view_linked_tickets) {
         echo "<th style='width:{$colsize1}%'>" . _n('Linked ticket', 'Linked tickets', Session::getPluralNumber());
         $rand_linked_ticket = mt_rand();
         if ($canupdate) {
             echo "&nbsp;";
             echo "<img onClick=\"" . Html::jsShow("linkedticket{$rand_linked_ticket}") . "\"\n                   title=\"" . __s('Add') . "\" alt=\"" . __s('Add') . "\"\n                   class='pointer' src='" . $CFG_GLPI["root_doc"] . "/pics/add_dropdown.png'>";
         }
         echo '</th>';
         echo "<td colspan='3'>";
         if ($canupdate) {
             echo "<div style='display:none' id='linkedticket{$rand_linked_ticket}'>";
             echo "<table class='tab_format' width='100%'><tr><td width='30%'>";
             Ticket_Ticket::dropdownLinks('_link[link]', isset($values["_link"]) ? $values["_link"]['link'] : '');
             echo "<input type='hidden' name='_link[tickets_id_1]' value='{$ID}'>\n";
             echo "</td><td width='70%'>";
             $linkparam = array('name' => '_link[tickets_id_2]', 'displaywith' => array('id'));
             if (isset($values["_link"])) {
                 $linkparam['value'] = $values["_link"]['tickets_id_2'];
             }
             Ticket::dropdown($linkparam);
             echo "</td></tr></table>";
             echo "</div>";
             if (isset($values["_link"]) && !empty($values["_link"]['tickets_id_2'])) {
                 echo "<script language='javascript'>";
开发者ID:glpi-project,项目名称:glpi,代码行数:67,代码来源:ticket.class.php

示例6: showForm

    /** form for Task
     *
     * @param $ID        Integer : Id of the task
     * @param $options   array
     *     -  parent Object : the object
     **/
    function showForm($ID, $options = array())
    {
        global $DB, $CFG_GLPI;
        $rand_template = mt_rand();
        $rand_text = mt_rand();
        $rand_type = mt_rand();
        $rand_time = mt_rand();
        if (isset($options['parent']) && !empty($options['parent'])) {
            $item = $options['parent'];
        }
        $fkfield = $item->getForeignKeyField();
        if ($ID > 0) {
            $this->check($ID, READ);
        } else {
            // Create item
            $options[$fkfield] = $item->getField('id');
            $this->check(-1, CREATE, $options);
        }
        $rand = mt_rand();
        $this->showFormHeader($options);
        $canplan = !$item->isStatusExists(CommonITILObject::PLANNED) || $item->isAllowedStatus($item->fields['status'], CommonITILObject::PLANNED);
        $rowspan = 5;
        if ($this->maybePrivate()) {
            $rowspan++;
        }
        if (isset($this->fields["state"])) {
            $rowspan++;
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td rowspan='{$rowspan}' style='width:100px'>" . __('Description') . "</td>";
        echo "<td rowspan='{$rowspan}' style='width:50%' id='content{$rand_text}'>" . "<textarea name='content' style='width: 95%; height: 160px' id='task{$rand_text}'>" . $this->fields["content"] . "</textarea>";
        echo Html::scriptBlock("\$(document).ready(function() { \$('#content{$rand}').autogrow(); });");
        echo "</td>";
        echo "<input type='hidden' name='{$fkfield}' value='" . $this->fields[$fkfield] . "'>";
        echo "</td></tr>\n";
        echo "<tr class='tab_bg_1'>";
        echo "<td style='width:100px'>" . _n('Task template', 'Task templates', 1) . "</td><td>";
        TaskTemplate::dropdown(array('value' => 0, 'entity' => $this->getEntityID(), 'rand' => $rand_template, 'on_change' => 'tasktemplate_update(this.value)'));
        echo "</td>";
        echo "</tr>";
        echo Html::scriptBlock('
         function tasktemplate_update(value) {
            jQuery.ajax({
               url: "' . $CFG_GLPI["root_doc"] . '/ajax/task.php",
               type: "POST",
               data: {
                  tasktemplates_id: value
               }
            }).done(function(datas) {
               datas.taskcategories_id = isNaN(parseInt(datas.taskcategories_id)) ? 0 : parseInt(datas.taskcategories_id);
               datas.actiontime = isNaN(parseInt(datas.actiontime)) ? 0 : parseInt(datas.actiontime);

               $("#task' . $rand_text . '").html(datas.content);
               $("#dropdown_taskcategories_id' . $rand_type . '").select2("val", parseInt(datas.taskcategories_id));
               $("#dropdown_actiontime' . $rand_time . '").select2("val", parseInt(datas.actiontime));
            });
         }
      ');
        if ($ID > 0) {
            echo "<tr class='tab_bg_1'>";
            echo "<td>" . __('Date') . "</td>";
            echo "<td>";
            Html::showDateTimeField("date", array('value' => $this->fields["date"], 'timestep' => 1, 'maybeempty' => false));
            echo "</tr>";
        } else {
            echo "<tr class='tab_bg_1'>";
            echo "<td colspan='2'>&nbsp;";
            echo "</tr>";
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Category') . "</td><td>";
        TaskCategory::dropdown(array('value' => $this->fields["taskcategories_id"], 'rand' => $rand_type, 'entity' => $item->fields["entities_id"], 'condition' => "`is_active` = '1'"));
        echo "</td></tr>\n";
        if (isset($this->fields["state"])) {
            echo "<tr class='tab_bg_1'>";
            echo "<td>" . __('Status') . "</td><td>";
            Planning::dropdownState("state", $this->fields["state"]);
            echo "</td></tr>\n";
        }
        if ($this->maybePrivate()) {
            echo "<tr class='tab_bg_1'>";
            echo "<td>" . __('Private') . "</td>";
            echo "<td>";
            Dropdown::showYesNo('is_private', $this->fields["is_private"]);
            echo "</td>";
            echo "</tr>";
        }
        echo "<tr class='tab_bg_1'>";
        echo "<td>" . __('Duration') . "</td><td>";
        $toadd = array();
        for ($i = 9; $i <= 100; $i++) {
            $toadd[] = $i * HOUR_TIMESTAMP;
        }
        Dropdown::showTimeStamp("actiontime", array('min' => 0, 'max' => 8 * HOUR_TIMESTAMP, 'value' => $this->fields["actiontime"], 'rand' => $rand_time, 'addfirstminutes' => true, 'inhours' => true, 'toadd' => $toadd));
//.........这里部分代码省略.........
开发者ID:glpi-project,项目名称:glpi,代码行数:101,代码来源:commonitiltask.class.php

示例7: array

        Html::helpHeader(Ticket::getTypeName(Session::getPluralNumber()), '', $_SESSION["glpiname"]);
    } else {
        Html::header(Ticket::getTypeName(Session::getPluralNumber()), '', "helpdesk", "ticket");
    }
    $available_options = array('load_kb_sol', '_openfollowup');
    $options = array();
    foreach ($available_options as $key) {
        if (isset($_GET[$key])) {
            $options[$key] = $_GET[$key];
        }
    }
    $options['id'] = $_GET["id"];
    $track->display($options);
    if (isset($_GET['_sol_to_kb'])) {
        Ajax::createIframeModalWindow('savetokb', $CFG_GLPI["root_doc"] . "/front/knowbaseitem.form.php?_in_modal=1&item_itemtype=Ticket&item_items_id=" . $_GET["id"], array('title' => __('Save solution to the knowledge base'), 'reloadonclose' => false));
        echo Html::scriptBlock(Html::jsGetElementbyID('savetokb') . ".dialog('open');");
    }
} else {
    Html::header(__('New ticket'), '', "helpdesk", "ticket");
    unset($_REQUEST['id']);
    // Add a ticket from item : format data
    if (isset($_REQUEST['_add_fromitem'])) {
        $_REQUEST['items_id'] = array($_REQUEST['itemtype'] => array($_REQUEST['items_id']));
    }
    $track->display($_REQUEST);
}
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
    Html::helpFooter();
} else {
    Html::footer();
}
开发者ID:stweil,项目名称:glpi,代码行数:31,代码来源:ticket.form.php

示例8: showForm

 function showForm($ID, $options = array())
 {
     global $DB, $CFG_GLPI;
     $obj = $options['obj'];
     //Html::printCleanArray($obj);
     $itemtype = getItemTypeForTable($obj->getTable());
     $list_ip = array();
     $total_ip = 0;
     /*if ($itemtype == 'NetworkEquipment') {
              $query = "SELECT `ip`
                        FROM `glpi_networkequipments`
                        WHERE `id` = '".$obj->fields['id']."'";
     
              $res = $DB->query($query);
              while ($row = $DB->fetch_array($res)) {
                 if ($row['ip'] != '') {
                    $list_ip[$row['ip']] = $row['ip'];
                 }
              }
           }
           $tmp = array_values($list_ip);
           if (count($tmp) > 0 && $tmp[0] == '') {
              array_pop($list_ip);
           }*/
     $query = "SELECT `glpi_networknames`.`name`, `glpi_ipaddresses`.`name` as ip, `glpi_networkports`.`items_id`\n               FROM `glpi_networkports` \n               LEFT JOIN `" . $obj->getTable() . "` ON (`glpi_networkports`.`items_id` = `" . $obj->getTable() . "`.`id`\n                              AND `glpi_networkports`.`itemtype` = '" . $itemtype . "')\n               LEFT JOIN `glpi_networknames` ON (`glpi_networkports`.`id` =  `glpi_networknames`.`items_id`)\n               LEFT JOIN `glpi_ipaddresses` ON (`glpi_ipaddresses`.`items_id` = `glpi_networknames`.`id`)\n                WHERE `" . $obj->getTable() . "`.`id` = '" . $obj->fields['id'] . "'";
     $res = $DB->query($query);
     while ($row = $DB->fetch_array($res)) {
         if ($row['ip'] != '') {
             $port = $row['ip'];
             if ($row['name'] != '') {
                 $port = $row['name'] . " ({$port})";
             }
             $list_ip[$row['ip']] = $port;
         }
     }
     echo "<table class='tab_cadre_fixe'><tr class='tab_bg_2 left'>";
     echo "<tr><th colspan='4'>" . __('IP ping', 'addressing') . "</th></tr>";
     if (count($list_ip) > 0) {
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('IP') . " : </td>";
         echo "<td colspan='3'>";
         echo "<select id='ip'>";
         echo "<option>" . Dropdown::EMPTY_VALUE . "</option>";
         foreach ($list_ip as $ip => $name) {
             echo "<option value='{$ip}'>{$name}</option>";
         }
         echo "</select>";
         echo "&nbsp;<input class='submit' type='button' value='" . __s('Ping', 'addressing') . "' id='ping_ip'>";
         echo "</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_1'>";
         echo "<td>" . __('Result', 'addressing') . " : </td>";
         echo "<td colspan='3'>";
         echo "<div id='ping_response' class='plugin_addressing_ping_equipment'></div>";
         echo "</td></tr>";
     }
     echo "</table>";
     echo Html::scriptBlock("\$(document).on('click', '#ping_ip', function(event) {\n         \$('#ping_response').load('" . $CFG_GLPI["root_doc"] . "/plugins/addressing/ajax/ping.php', {\n            'ip': \$('#ip').val()\n         })\n      });");
     if (count($list_ip) == 0) {
         echo __('No IP for this equipment', 'addressing');
     }
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:62,代码来源:ping_equipment.class.php

示例9: showForm


//.........这里部分代码省略.........
         echo "</td><td></td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Select the network', 'addressing') . "</td>";
     echo "<td>";
     Dropdown::show('Network', array('name' => "networks_id", 'value' => $this->fields["networks_id"]));
     echo "</td>";
     if ($PluginAddressingConfig->fields["free_ip"]) {
         echo "<td>" . __('Free Ip', 'addressing') . "</td><td>";
         Dropdown::showYesNo('free_ip', $this->fields["free_ip"]);
         echo "</td>";
     } else {
         echo "<td>";
         echo Html::hidden('free_ip', array('value' => 0));
         echo "</td><td></td>";
         //echo "<td><input type='hidden' name='free_ip' value='0'></td><td></td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Detected subnet list', 'addressing') . "</td>";
     echo "<td>";
     $this->dropdownSubnet($ID > 0 ? $this->fields["entities_id"] : $_SESSION["glpiactive_entity"]);
     echo "</td>";
     if ($PluginAddressingConfig->fields["double_ip"]) {
         echo "<td>" . __('Same IP', 'addressing') . "</td><td>";
         Dropdown::showYesNo('double_ip', $this->fields["double_ip"]);
         echo "</td>";
     } else {
         //echo "<td><input type='hidden' name='double_ip' value='0'></td><td></td>";
         echo "<td>";
         echo Html::hidden('double_ip', array('value' => 0));
         echo "</td><td></td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('First IP', 'addressing') . "</td>";
     // Subnet
     echo "<td>";
     echo "<input type='text' id='plugaddr_ipdeb0' value='' name='_ipdeb0' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>.";
     echo "<input type='text' id='plugaddr_ipdeb1' value='' name='_ipdeb1' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>.";
     echo "<input type='text' id='plugaddr_ipdeb2' value='' name='_ipdeb2' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>.";
     echo "<input type='text' id='plugaddr_ipdeb3' value='' name='_ipdeb3' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>";
     echo "</td>";
     if ($PluginAddressingConfig->fields["reserved_ip"]) {
         echo "<td>" . __('Reserved IP', 'addressing') . "</td><td>";
         Dropdown::showYesNo('reserved_ip', $this->fields["reserved_ip"]);
         echo "</td>";
     } else {
         echo "<td>";
         echo Html::hidden('reserved_ip', array('value' => 0));
         echo "</td><td></td>";
         //echo "<td><input type='hidden' name='reserved_ip' value='0'></td><td></td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Last IP', 'addressing') . "</td>";
     // Mask
     echo "<td>";
     echo "<input type='text' id='plugaddr_ipfin0' value='' name='_ipfin0' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>.";
     echo "<input type='text' id='plugaddr_ipfin1' value='' name='_ipfin1' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>.";
     echo "<input type='text' id='plugaddr_ipfin2' value='' name='_ipfin2' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>.";
     echo "<input type='text' id='plugaddr_ipfin3' value='' name='_ipfin3' size='3' " . "onChange='plugaddr_ChangeNumber(\"" . __('Invalid data !!', 'addressing') . "\");'>";
     echo "</td>";
     if ($PluginAddressingConfig->fields["use_ping"]) {
         echo "<td>" . __('Ping free Ip', 'addressing') . "</td><td>";
         Dropdown::showYesNo('use_ping', $this->fields["use_ping"]);
         echo "</td>";
     } else {
         echo "<td>";
         echo Html::hidden('use_ping', array('value' => 0));
         echo "</td><td></td>";
         //echo "<td><input type='hidden' name='use_ping' value='0'></td><td></td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Report for the IP Range', 'addressing') . "</td>";
     // Mask
     echo "<td>";
     echo "<input type='hidden' id='plugaddr_ipdeb' value='" . $this->fields["begin_ip"] . "' name='begin_ip'>";
     echo "<input type='hidden' id='plugaddr_ipfin' value='" . $this->fields["end_ip"] . "' name='end_ip'>";
     echo "<div id='plugaddr_range'>-</div>";
     if ($ID > 0) {
         $js = "plugaddr_Init(\"" . __('Invalid data !!', 'addressing') . "\");";
         echo Html::scriptBlock($js);
     }
     echo "</td>";
     echo "<td></td>";
     echo "<td></td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td colspan = '4'>";
     echo "<table cellpadding='2' cellspacing='2'><tr><td>";
     echo __('Comments') . "</td></tr>";
     echo "<tr><td class='center'>" . "<textarea cols='125' rows='3' name='comment'>" . $this->fields["comment"] . "</textarea>";
     echo "</td></tr></table>";
     echo "</td>";
     $this->showFormButtons($options);
     return true;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:addressing.class.php

示例10: displayLockMessage

 /**
  * Summary of displayLockMessage
  * Shows a short message top-left of screen
  * This message is permanent, and can't be closed
  *
  * @param  $msg      : message to be shown
  * @param  $title    : if $title is '' then title bar it is not shown (default '')
  **/
 private function displayLockMessage($msg, $title = '')
 {
     $hideTitle = '';
     if ($title == '') {
         $hideTitle = "\$('.ui-dialog-titlebar', ui.dialog | ui).hide();";
     }
     echo "<div id='message_after_lock' title='{$title}'>";
     echo $msg;
     echo "</div>";
     echo Html::scriptBlock("\n         \$(document).ready(function() {\n            \$('#message_after_lock').dialog({\n               dialogClass: 'message_after_redirect',\n               minHeight: 10,\n               width: 'auto',\n               height: 'auto',\n               position: {\n                  my: 'left top',\n                  at: 'left+20 top-30',\n                  of: \$('#page'),\n                  collision: 'none'\n               },\n               autoOpen: false,\n               create: function(event, ui) {\n                  {$hideTitle}\n                  \$('.ui-dialog-titlebar-close', ui.dialog | ui).hide();\n               },\n               show: {\n                  effect: 'slide',\n                  direction: 'up',\n                  duration: 800\n               },\n            })\n            .dialog('open');\n         });\n      ");
 }
开发者ID:pvasener,项目名称:glpi,代码行数:19,代码来源:objectlock.class.php

示例11: ajaxModuleItemsDropdown

 public function ajaxModuleItemsDropdown($options)
 {
     $moduletype = $options['moduletype'];
     $itemtype = $options['itemtype'];
     if ($itemtype === "") {
         return;
     }
     switch ($options['moduletype']) {
         case 'actors':
             $title = __('Actor Item', 'fusioninventory');
             break;
         case 'targets':
             $title = __('Target Item', 'fusioninventory');
             break;
     }
     /**
      * get Itemtype choices dropdown
      */
     $dropdown_rand = $this->showDropdownForItemtype($title, $itemtype, array('width' => "95%"));
     $item = getItemForItemtype($itemtype);
     $itemtype_name = $item->getTypeName();
     $item_key_id = $item->getForeignKeyField();
     $dropdown_rand_id = "dropdown_" . $item_key_id . $dropdown_rand;
     echo implode(array("\n", "<div class='center' id='add_fusinv_job_item_button'>", "<input type='button' class=submit", "  value='" . __('Add') . " {$title}'", "  onclick='javascript:void(0)'>", "</input>", "</div>"));
     echo Html::scriptBlock(implode("\n", array("\$('#add_fusinv_job_item_button').on('click', function() {", "  taskjobs.add_item(", "     \"{$moduletype}\", \"{$itemtype}\", \"{$itemtype_name}\", \"{$dropdown_rand_id}\"", "  );", "});")));
 }
开发者ID:korial29,项目名称:fusioninventory-for-glpi,代码行数:26,代码来源:taskjob.view.class.php

示例12: showSelectAccountsList

 public static function showSelectAccountsList($ID)
 {
     global $CFG_GLPI;
     $rand = mt_rand();
     echo "<div align='center'>";
     echo "<table class='tab_cadre_fixe' cellpadding='5'>";
     echo "<tr><th colspan='2'>";
     echo __('Linked accounts list', 'accounts') . "</th></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Please fill the encryption key', 'accounts') . "</td>";
     echo "<td class='center'>";
     echo "<input type='password' autocomplete='off' name='key' id='key'>&nbsp;";
     echo "<input type='submit' name='select' value=\"" . __s('Display report') . "\"\n               class='submit' id='showAccountsList{$rand}'>";
     echo "</td>";
     echo "</tr>";
     echo "</table></div>";
     $url = $CFG_GLPI["root_doc"] . "/plugins/accounts/ajax/viewaccountslist.php";
     echo "<div id='viewaccountslist{$rand}'></div>";
     echo Html::scriptBlock("\$(document).on('click', '#showAccountsList{$rand}', function(){\n         var key = \$('#key').val();\n         if (key == '') {\n            alert('" . __('Please fill the encryption key', 'accounts') . "');\n         } else {\n            \$('#viewaccountslist{$rand}').load('{$url}', {'id': {$ID}, 'key': key});\n         }\n      });");
 }
开发者ID:puchadesc,项目名称:accounts,代码行数:21,代码来源:hash.class.php

示例13: showForm


//.........这里部分代码省略.........
     Html::autocompletionTextField($this, 'otherserial', array('value' => $objectName));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('User') . "</td>";
     echo "<td>";
     User::dropdown(array('value' => $this->fields["users_id"], 'entity' => $this->fields["entities_id"], 'right' => 'all'));
     echo "</td>";
     echo "<td>" . __('Network') . "</td>";
     echo "<td>";
     Network::dropdown(array('value' => $this->fields["networks_id"]));
     echo "</td></tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Group') . "</td>";
     echo "<td>";
     Group::dropdown(array('value' => $this->fields["groups_id"], 'entity' => $this->fields["entities_id"], 'condition' => '`is_itemgroup`'));
     echo "</td>";
     // Display auto inventory informations
     $rowspan = 7;
     $inventory_show = false;
     if (!empty($ID) && Plugin::haveImport() && $this->fields["is_dynamic"]) {
         $inventory_show = true;
         $rowspan -= 5;
     }
     echo "<td rowspan='{$rowspan}'>" . __('Comments') . "</td>";
     echo "<td rowspan='{$rowspan}' class='middle'>";
     echo "<textarea cols='45' rows='" . ($rowspan + 3) . "' name='comment' >" . $this->fields["comment"];
     echo "</textarea></td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Domain') . "</td>";
     echo "<td >";
     Domain::dropdown(array('value' => $this->fields["domains_id"], 'entity' => $this->fields["entities_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system') . "</td>";
     echo "<td>";
     OperatingSystem::dropdown(array('value' => $this->fields["operatingsystems_id"]));
     echo "<br /><a href='#' id='toggle_os_information'>" . __("More information") . "</a>";
     echo "</td>";
     if ($inventory_show) {
         echo "<td rowspan='4' colspan='2'>";
         Plugin::doHook("autoinventory_information", $this);
         echo "</td>";
     }
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Version of the operating system') . "</td>";
     echo "<td >";
     OperatingSystemVersion::dropdown(array('value' => $this->fields["operatingsystemversions_id"]));
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'><td colspan='2'>";
     echo Html::scriptBlock("\n      \$(document).ready(function(){\n         \$('#os_information').hide();\n\n         \$('#toggle_os_information').on('click',function() {\n            \$('#os_information').dialog({\n               width:'auto',\n               resizable: false,\n               appendTo: '#os_information_parent',\n               position: {\n                  my : 'left top',\n                  at : 'left bottom',\n                  of: \$('#toggle_os_information')\n               }\n            })\n         })\n      });");
     // group os advanced information in a single bloc (who can be toggled)
     echo "<div id='os_information_parent'>";
     echo "<div id='os_information' title=\"" . __('Operating system') . "\">";
     echo "<table>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Service pack') . "</td>";
     echo "<td >";
     OperatingSystemServicePack::dropdown(array('value' => $this->fields["operatingsystemservicepacks_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Operating system architecture') . "</td>";
     echo "<td >";
     OperatingSystemArchitecture::dropdown(array('value' => $this->fields["operatingsystemarchitectures_id"]));
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Kernel version of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_kernel_version');
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Product ID of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_licenseid');
     echo "</td></tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Serial of the operating system') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'os_license_number');
     echo "</td>";
     echo "</table>";
     echo "</div>";
     echo "</div>";
     echo "</td>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('UUID') . "</td>";
     echo "<td >";
     Html::autocompletionTextField($this, 'uuid');
     echo "</td>";
     echo "</tr>\n";
     echo "<tr class='tab_bg_1'>";
     echo "<td>" . __('Update Source') . "</td>";
     echo "<td >";
     AutoUpdateSystem::dropdown(array('value' => $this->fields["autoupdatesystems_id"]));
     echo "</td></tr>";
     $this->showFormButtons($options);
     return true;
 }
开发者ID:stweil,项目名称:glpi,代码行数:101,代码来源:computer.class.php

示例14: __s

 $addclass = '';
 if ($_POST["num"] == 0) {
     $addclass = ' headerRow';
 }
 echo "<tr class='normalcriteria{$addclass}' id='{$rowid}'><td class='left' width='45%'>";
 // First line display add / delete images for normal and meta search items
 if ($_POST["num"] == 0) {
     $linked = Search::getMetaItemtypeAvailable($_POST["itemtype"]);
     echo "<img class='pointer' src=\"" . $CFG_GLPI["root_doc"] . "/pics/plus.png\" alt='+' title=\"" . __s('Add a search criterion') . "\" id='addsearchcriteria{$randrow}'>";
     $js = Html::jsGetElementbyID("addsearchcriteria{$randrow}") . ".on('click', function(e) {\n               \$.post( '" . $CFG_GLPI['root_doc'] . "/ajax/searchrow.php',\n                     { itemtype: '" . $_POST["itemtype"] . "', num: {$nbsearchcountvar} })\n                        .done(function( data ) {\n                        \$('#" . $searchcriteriatableid . " .normalcriteria:last').after(data);\n                        });\n            {$nbsearchcountvar} = {$nbsearchcountvar} +1;});";
     echo Html::scriptBlock($js);
     echo "&nbsp;&nbsp;&nbsp;&nbsp;";
     if (is_array($linked) && count($linked) > 0) {
         echo "<img class='pointer' src=\"" . $CFG_GLPI["root_doc"] . "/pics/meta_plus.png\" \n                alt='+' title=\"" . __s('Add a global search criterion') . "\" id='addmetasearchcriteria{$randrow}'>";
         $js = Html::jsGetElementbyID("addmetasearchcriteria{$randrow}") . ".on('click', function(e) {\n                  \$.post( '" . $CFG_GLPI['root_doc'] . "/ajax/searchmetarow.php',\n                        { itemtype: '" . $_POST["itemtype"] . "', num: {$nbmetasearchcountvar} })\n                           .done(function( data ) {\n                           \$('#" . $searchcriteriatableid . "').append(data);\n                           });\n               {$nbmetasearchcountvar} = {$nbmetasearchcountvar} +1;});";
         echo Html::scriptBlock($js);
         echo "&nbsp;&nbsp;&nbsp;&nbsp;";
     }
     // Instanciate an object to access method
     $item = NULL;
     if ($_POST["itemtype"] != 'AllAssets') {
         $item = getItemForItemtype($_POST["itemtype"]);
     }
     if ($item && $item->maybeDeleted()) {
         echo "<input type='hidden' id='is_deleted' name='is_deleted' value='" . $p['is_deleted'] . "'>";
     }
 } else {
     echo "<img class='pointer' src=\"" . $CFG_GLPI["root_doc"] . "/pics/moins.png\" alt='-' title=\"" . __s('Delete a search criterion') . "\" onclick=\"" . Html::jsGetElementbyID($rowid) . ".remove();\">&nbsp;&nbsp;";
 }
 $criteria = array();
 if (isset($_SESSION['glpisearch'][$_POST["itemtype"]]['criteria'][$_POST["num"]]) && is_array($_SESSION['glpisearch'][$_POST["itemtype"]]['criteria'][$_POST["num"]])) {
开发者ID:jose-martins,项目名称:glpi,代码行数:31,代码来源:searchrow.php

示例15: showSltForTicket

 /**
  * Show SLT for ticket
  *
  * @param $ticket      Ticket item
  * @param $type
  * @param $tt
  * @param $canupdate
  **/
 function showSltForTicket(Ticket $ticket, $type, $tt, $canupdate)
 {
     global $CFG_GLPI;
     list($dateField, $sltField) = self::getSltFieldNames($type);
     echo "<table width='100%'>";
     echo "<tr class='tab_bg_1'>";
     if (!isset($ticket->fields[$dateField]) || $ticket->fields[$dateField] == 'NULL') {
         $ticket->fields[$dateField] = '';
     }
     if ($ticket->fields['id']) {
         if ($this->getSltDataForTicket($ticket->fields['id'], $type)) {
             echo "<td>";
             echo Html::convDateTime($ticket->fields[$dateField]);
             echo "</td>";
             echo "<th>" . __('SLT') . "</th>";
             echo "<td>";
             echo Dropdown::getDropdownName('glpi_slts', $ticket->fields[$sltField]) . "&nbsp;";
             $commentsla = "";
             $slalevel = new SlaLevel();
             $nextaction = new SlaLevel_Ticket();
             if ($nextaction->getFromDBForTicket($ticket->fields["id"], $type)) {
                 $commentsla .= '<span class="b spaced">' . sprintf(__('Next escalation: %s'), Html::convDateTime($nextaction->fields['date'])) . '</span><br>';
                 if ($slalevel->getFromDB($nextaction->fields['slalevels_id'])) {
                     $commentsla .= '<span class="b spaced">' . sprintf(__('%1$s: %2$s'), __('Escalation level'), $slalevel->getName()) . '</span>';
                 }
             }
             $slaoptions = array();
             if (Session::haveRight('sla', READ)) {
                 $slaoptions['link'] = Toolbox::getItemTypeFormURL('SLT') . "?id=" . $this->fields["id"];
             }
             Html::showToolTip($commentsla, $slaoptions);
             if ($canupdate) {
                 $fields = array('slt_delete' => 'slt_delete', 'id' => $ticket->getID(), 'type' => $type, '_glpi_csrf_token' => Session::getNewCSRFToken(), '_glpi_simple_form' => 1);
                 $JS = "  function delete_date{$type}(){\n                           if (nativeConfirm('" . addslashes(__('Also delete date ?')) . "')) {\n                              submitGetLink('" . $ticket->getFormURL() . "',\n                                            " . json_encode(array_merge($fields, array('delete_date' => 1))) . ");\n                           } else {\n                              submitGetLink('" . $ticket->getFormURL() . "',\n                                            " . json_encode(array_merge($fields, array('delete_date' => 0))) . ");\n                           }\n                        }";
                 echo Html::scriptBlock($JS);
                 echo "<a class='pointer' onclick='delete_date{$type}();return false;'>";
                 echo "<img src='" . $CFG_GLPI['root_doc'] . "/pics/delete.png' title='" . _x('button', 'Delete permanently') . "' " . "alt='" . _x('button', 'Delete permanently') . "' class='pointer'>";
                 echo "</a>";
             }
             echo "</td>";
         } else {
             echo "<td width='200px'>";
             echo $tt->getBeginHiddenFieldValue($dateField);
             if ($canupdate) {
                 Html::showDateTimeField($dateField, array('value' => $ticket->fields[$dateField], 'timestep' => 1, 'maybeempty' => true));
             } else {
                 echo Html::convDateTime($ticket->fields[$dateField]);
             }
             echo $tt->getEndHiddenFieldValue($dateField, $ticket);
             echo "</td>";
             $slt_data = $this->getSltData("`type` = '{$type}'\n                                           AND `entities_id` = '" . $ticket->fields['entities_id'] . "'");
             if ($canupdate && !empty($slt_data)) {
                 echo "<td>";
                 echo $tt->getBeginHiddenFieldText($sltField);
                 echo "<span id='slt_action{$type}'>";
                 echo "<a " . Html::addConfirmationOnAction(array(__('The assignment of a SLT to a ticket causes the recalculation of the date.'), __("Escalations defined in the SLT will be triggered under this new date.")), "cleanhide('slt_action{$type}');cleandisplay('slt_choice{$type}');") . "><img src='" . $CFG_GLPI['root_doc'] . "/pics/clock.png' title='" . __('SLT') . "' alt='" . __('SLT') . "' class='pointer'></a>";
                 echo "</span>";
                 echo "<div id='slt_choice{$type}' style='display:none'>";
                 echo "<span  class='b'>" . __('SLT') . "</span>&nbsp;";
                 Slt::dropdown(array('name' => $sltField, 'entity' => $ticket->fields["entities_id"], 'condition' => "`type` = '" . $type . "'"));
                 echo "</div>";
                 echo $tt->getEndHiddenFieldText($sltField);
                 echo "</td>";
             }
         }
     } else {
         // New Ticket
         echo "<td>";
         echo $tt->getBeginHiddenFieldValue($dateField);
         Html::showDateTimeField($dateField, array('value' => $ticket->fields[$dateField], 'timestep' => 1, 'maybeempty' => false, 'canedit' => $canupdate));
         echo $tt->getEndHiddenFieldValue($dateField, $ticket);
         echo "</td>";
         $slt_data = $this->getSltData("`type` = '{$type}'\n                                        AND `entities_id` = '" . $ticket->fields['entities_id'] . "'");
         if ($canupdate && !empty($slt_data)) {
             echo "<th>" . $tt->getBeginHiddenFieldText($sltField);
             printf(__('%1$s%2$s'), __('SLT'), $tt->getMandatoryMark($sltField));
             echo $tt->getEndHiddenFieldText('slas_id') . "</th>";
             echo "<td class='nopadding'>" . $tt->getBeginHiddenFieldValue($sltField);
             Slt::dropdown(array('name' => $sltField, 'entity' => $ticket->fields["entities_id"], 'value' => isset($ticket->fields[$sltField]) ? $ticket->fields[$sltField] : 0, 'condition' => "`type` = '" . $type . "'"));
             echo $tt->getEndHiddenFieldValue($sltField, $ticket);
             echo "</td>";
         }
     }
     echo "</tr>";
     echo "</table>";
 }
开发者ID:stweil,项目名称:glpi,代码行数:94,代码来源:slt.class.php


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