本文整理汇总了PHP中SLA::getType方法的典型用法代码示例。如果您正苦于以下问题:PHP SLA::getType方法的具体用法?PHP SLA::getType怎么用?PHP SLA::getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SLA
的用法示例。
在下文中一共展示了SLA::getType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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>";
}