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


PHP SLA::getName方法代码示例

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


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

示例1: showForSLA

 /**
  * @param $sla SLA object
  **/
 function showForSLA(SLA $sla)
 {
     global $DB;
     $ID = $sla->getField('id');
     if (!$sla->can($ID, READ)) {
         return false;
     }
     $canedit = $sla->can($ID, UPDATE);
     $rand = mt_rand();
     if ($canedit) {
         echo "<div class='center first-bloc'>";
         echo "<form name='slalevel_form{$rand}' id='slalevel_form{$rand}' method='post' action='";
         echo Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='7'>" . __('Add an escalation level') . "</tr>";
         echo "<tr class='tab_bg_2'><td class='center'>" . __('Name') . "";
         echo "<input type='hidden' name='slas_id' value='{$ID}'>";
         echo "<input type='hidden' name='entities_id' value='" . $sla->getEntityID() . "'>";
         echo "<input type='hidden' name='is_recursive' value='" . $sla->isRecursive() . "'>";
         echo "<input type='hidden' name='match' value='AND'>";
         echo "</td><td><input  name='name' value=''>";
         echo "</td><td class='center'>" . __('Execution') . "</td><td>";
         $resolution_time = $sla->getResolutionTime();
         self::dropdownExecutionTime('execution_time', array('max_time' => $resolution_time, 'used' => self::getAlreadyUsedExecutionTime($sla->fields['id'])));
         echo "</td><td class='center'>" . __('Active') . "</td><td>";
         Dropdown::showYesNo("is_active", 1);
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . _sx('button', 'Add') . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table>";
         Html::closeForm();
         echo "</div>";
     }
     $query = "SELECT *\n                FROM `glpi_slalevels`\n                WHERE `slas_id` = '{$ID}'\n                ORDER BY `execution_time`";
     $result = $DB->query($query);
     $numrows = $DB->numrows($result);
     echo "<div class='spaced'>";
     if ($canedit && $numrows) {
         Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
         $massiveactionparams = array('num_displayed' => $numrows, 'container' => 'mass' . __CLASS__ . $rand);
         Html::showMassiveActions($massiveactionparams);
     }
     echo "<table class='tab_cadre_fixehov'>";
     echo "<tr>";
     if ($canedit && $numrows) {
         echo "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand) . "</th>";
     }
     echo "<th>" . __('Name') . "</th>";
     echo "<th>" . __('Execution') . "</th>";
     echo "<th>" . __('Active') . "</th>";
     echo "</tr>";
     Session::initNavigateListItems('SlaLevel', sprintf(__('%1$s = %2$s'), SLA::getTypeName(1), $sla->getName()));
     while ($data = $DB->fetch_assoc($result)) {
         Session::addToNavigateListItems('SlaLevel', $data["id"]);
         echo "<tr class='tab_bg_2'>";
         if ($canedit) {
             echo "<td>" . Html::getMassiveActionCheckBox(__CLASS__, $data["id"]) . "</td>";
         }
         echo "<td>";
         if ($canedit) {
             echo "<a href='" . Toolbox::getItemTypeFormURL('SlaLevel') . "?id=" . $data["id"] . "'>";
         }
         echo $data["name"];
         if (empty($data["name"])) {
             echo "(" . $data['id'] . ")";
         }
         if ($canedit) {
             echo "</a>";
         }
         echo "</td>";
         echo "<td>" . ($data["execution_time"] != 0 ? Html::timestampToString($data["execution_time"], false) : __('Due date')) . "</td>";
         echo "<td>" . Dropdown::getYesNo($data["is_active"]) . "</td>";
         echo "</tr>";
         echo "<tr class='tab_bg_1'><td colspan='2'>";
         $this->getRuleWithCriteriasAndActions($data['id'], 1, 1);
         $this->showCriteriasList($data["id"], array('readonly' => true));
         echo "</td><td colspan='2'>";
         $this->showActionsList($data["id"], array('readonly' => true));
         echo "</td></tr>";
     }
     echo "</table>";
     if ($canedit && $numrows) {
         $massiveactionparams['ontop'] = false;
         Html::showMassiveActions($massiveactionparams);
         Html::closeForm();
     }
     echo "</div>";
 }
开发者ID:jose-martins,项目名称:glpi,代码行数:91,代码来源:slalevel.class.php

示例2: showForSla

 /**
  * Print the HTML array for SLTs linked to a SLA
  *
  * @param SLA $sla
  * @return boolean
  */
 static function showForSla(SLA $sla)
 {
     global $CFG_GLPI;
     $instID = $sla->fields['id'];
     $slt = new self();
     $calendar = new Calendar();
     if (!$sla->can($instID, READ)) {
         return false;
     }
     $canedit = $sla->canEdit($instID) && isset($_SESSION["glpiactiveprofile"]) && $_SESSION["glpiactiveprofile"]["interface"] == "central";
     $rand = mt_rand();
     if ($canedit) {
         echo "<div id='viewslt{$instID}{$rand}'></div>\n";
         echo "<script type='text/javascript' >";
         echo "function viewAddSlt{$instID}{$rand}() {";
         $params = array('type' => $slt->getType(), 'parenttype' => $sla->getType(), $sla->getForeignKeyField() => $instID, 'id' => -1);
         Ajax::updateItemJsCode("viewslt{$instID}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
         echo "}";
         echo "</script>";
         echo "<div class='center firstbloc'>" . "<a class='vsubmit' href='javascript:viewAddSlt{$instID}{$rand}();'>";
         echo __('Add a new SLT') . "</a></div>\n";
     }
     // SLT list
     $sltList = $slt->find("`slas_id` = '" . $instID . "'");
     Session::initNavigateListItems('SLT', sprintf(__('%1$s = %2$s'), $sla::getTypeName(1), $sla->getName()));
     echo "<div class='spaced'>";
     if (count($sltList)) {
         if ($canedit) {
             Html::openMassiveActionsForm('mass' . __CLASS__ . $rand);
             $massiveactionparams = array('container' => 'mass' . __CLASS__ . $rand);
             Html::showMassiveActions($massiveactionparams);
         }
         echo "<table class='tab_cadre_fixehov'>";
         $header_begin = "<tr>";
         $header_top = '';
         $header_bottom = '';
         $header_end = '';
         if ($canedit) {
             $header_top .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
             $header_top .= "</th>";
             $header_bottom .= "<th width='10'>" . Html::getCheckAllAsCheckbox('mass' . __CLASS__ . $rand);
             $header_bottom .= "</th>";
         }
         $header_end .= "<th>" . __('Name') . "</th>";
         $header_end .= "<th>" . __('Type') . "</th>";
         $header_end .= "<th>" . __('Maximum time') . "</th>";
         $header_end .= "<th>" . __('Calendar') . "</th>";
         echo $header_begin . $header_top . $header_end;
         foreach ($sltList as $val) {
             $edit = $canedit ? "style='cursor:pointer' onClick=\"viewEditSlt" . $instID . $val["id"] . "{$rand}();\"" : '';
             echo "\n<script type='text/javascript' >\n";
             echo "function viewEditSlt" . $instID . $val["id"] . "{$rand}() {\n";
             $params = array('type' => $slt->getType(), 'parenttype' => $sla->getType(), $sla->getForeignKeyField() => $instID, 'id' => $val["id"]);
             Ajax::updateItemJsCode("viewslt{$instID}{$rand}", $CFG_GLPI["root_doc"] . "/ajax/viewsubitem.php", $params);
             echo "};";
             echo "</script>\n";
             echo "<tr class='tab_bg_1'>";
             echo "<td width='10' {$edit}>";
             if ($canedit) {
                 Html::showMassiveActionCheckBox($slt->getType(), $val['id']);
             }
             echo "</td>";
             $slt->getFromDB($val['id']);
             echo "<td {$edit}>" . $slt->getLink() . "</td>";
             echo "<td {$edit}>" . $slt->getSpecificValueToDisplay('type', $slt->fields['type']) . "</td>";
             echo "<td {$edit}>";
             echo $slt->getSpecificValueToDisplay('number_time', array('number_time' => $slt->fields['number_time'], 'definition_time' => $slt->fields['definition_time']));
             echo "</td>";
             if (!$sla->fields['calendars_id']) {
                 $link = __('24/7');
             } else {
                 if ($sla->fields['calendars_id'] == -1) {
                     $link = __('Calendar of the ticket');
                 } else {
                     if ($calendar->getFromDB($sla->fields['calendars_id'])) {
                         $link = $calendar->getLink();
                     }
                 }
             }
             echo "<td {$edit}>" . $link . "</td>";
             echo "</tr>";
         }
         echo $header_begin . $header_bottom . $header_end;
         echo "</table>";
         if ($canedit) {
             $massiveactionparams['ontop'] = false;
             Html::showMassiveActions($massiveactionparams);
             Html::closeForm();
         }
     } else {
         echo __('No item to display');
     }
     echo "</div>";
 }
开发者ID:stweil,项目名称:glpi,代码行数:100,代码来源:slt.class.php

示例3: showForSLA

 function showForSLA(SLA $sla)
 {
     global $DB, $CFG_GLPI, $LANG;
     $ID = $sla->getField('id');
     if (!$sla->can($ID, 'r')) {
         return false;
     }
     $canedit = $sla->can($ID, 'w');
     $rand = mt_rand();
     echo "<form name='slalevel_form{$rand}' id='slalevel_form{$rand}' method='post' action='";
     echo getItemTypeFormURL(__CLASS__) . "'>";
     if ($canedit) {
         echo "<div class='center first-bloc'>";
         echo "<table class='tab_cadre_fixe'>";
         echo "<tr class='tab_bg_1'><th colspan='4'>" . $LANG['sla'][4] . "</tr>";
         echo "<tr class='tab_bg_2'><td class='center'>" . $LANG['common'][16] . "&nbsp;: ";
         echo "<input type='hidden' name='slas_id' value='{$ID}'>";
         echo "<input type='hidden' name='entities_id' value='" . $sla->getEntityID() . "'>";
         echo "<input type='hidden' name='is_recursive' value='" . $sla->isRecursive() . "'>";
         echo "<input  name='name' value=''>";
         echo "</td><td class='center'>" . $LANG['sla'][3] . "&nbsp;: ";
         self::dropdownExecutionTime('execution_time', array('max_time' => $sla->fields['resolution_time'], 'used' => self::getAlreadyUsedExecutionTime($sla->fields['id'])));
         echo "</td><td class='center'>" . $LANG['common'][60] . "&nbsp;: ";
         Dropdown::showYesNo("is_active", array('value' => 1));
         echo "</td><td class='center'>";
         echo "<input type='submit' name='add' value=\"" . $LANG['buttons'][8] . "\" class='submit'>";
         echo "</td></tr>";
         echo "</table></div>";
         $query = "SELECT *\n                  FROM `glpi_slalevels`\n                  WHERE `slas_id` = '{$ID}'\n                  ORDER BY `execution_time`";
         $result = $DB->query($query);
         if ($DB->numrows($result) > 0) {
             echo "<div class='center'><table class='tab_cadre_fixehov'>";
             echo "<tr><th colspan='2'>" . $LANG['common'][16] . "</th>";
             echo "<th>" . $LANG['sla'][3] . "</th>";
             echo "<th>" . $LANG['common'][60] . "</th>";
             echo "</tr>";
             initNavigateListItems('SlaLevel', $LANG['sla'][1] . " - " . $sla->getName());
             while ($data = $DB->fetch_array($result)) {
                 addToNavigateListItems('SlaLevel', $data["id"]);
                 echo "<tr class='tab_bg_2'>";
                 echo "<td width='10'>";
                 if ($canedit) {
                     echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
                 } else {
                     echo "&nbsp;";
                 }
                 echo "</td>";
                 echo "<td>";
                 if ($canedit) {
                     echo "<a href='" . getItemTypeFormURL('SlaLevel') . "?id=" . $data["id"] . "'>";
                 }
                 echo $data["name"];
                 if (empty($data["name"])) {
                     echo "(" . $data['id'] . ")";
                 }
                 if ($canedit) {
                     echo "</a>";
                 }
                 echo "</td>";
                 echo "<td>" . ($data["execution_time"] != 0 ? timestampToString($data["execution_time"], false) : $LANG['sla'][5]) . "</td>";
                 echo "<td>" . Dropdown::getYesNo($data["is_active"]) . "</td>";
                 echo "</tr>";
                 echo "<tr class='tab_bg_1'><td colspan='4'>";
                 $this->getRuleWithCriteriasAndActions($data['id'], 0, 1);
                 $this->showActionsList($data["id"], array('readonly' => true));
                 echo "</td></tr>";
             }
             openArrowMassive("slalevel_form{$rand}", true);
             closeArrowMassive('delete', $LANG['buttons'][6]);
             echo "</table></div>";
         }
     }
     echo "</form>";
 }
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:74,代码来源:slalevel.class.php


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