本文整理汇总了PHP中Calendar::getLink方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::getLink方法的具体用法?PHP Calendar::getLink怎么用?PHP Calendar::getLink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::getLink方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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>";
}
示例2: showHelpdeskOptions
/**
* @since version 0.84 (before in entitydata.class)
*
* @param $entity Entity object
**/
static function showHelpdeskOptions(Entity $entity)
{
global $CFG_GLPI;
$ID = $entity->getField('id');
if (!$entity->can($ID, READ) || !Session::haveRightsOr(self::$rightname, array(self::READHELPDESK, self::UPDATEHELPDESK))) {
return false;
}
$canedit = Session::haveRight(self::$rightname, self::UPDATEHELPDESK) && Session::haveAccessToEntity($ID);
echo "<div class='spaced'>";
if ($canedit) {
echo "<form method='post' name=form action='" . Toolbox::getItemTypeFormURL(__CLASS__) . "'>";
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . _n('Ticket template', 'Ticket templates', 1) . "</td>";
echo "<td colspan='2'>";
$toadd = array();
if ($ID != 0) {
$toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
}
$options = array('value' => $entity->fields["tickettemplates_id"], 'entity' => $ID, 'toadd' => $toadd);
TicketTemplate::dropdown($options);
if ($entity->fields["tickettemplates_id"] == self::CONFIG_PARENT && $ID != 0) {
echo "<font class='green'> ";
$tt = new TicketTemplate();
$tid = self::getUsedConfig('tickettemplates_id', $ID, '', 0);
if (!$tid) {
echo Dropdown::EMPTY_VALUE;
} else {
if ($tt->getFromDB($tid)) {
echo $tt->getLink();
}
}
echo "</font>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Calendar') . "</td>";
echo "<td colspan='2'>";
$options = array('value' => $entity->fields["calendars_id"], 'emptylabel' => __('24/7'));
if ($ID != 0) {
$options['toadd'] = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
}
Calendar::dropdown($options);
if ($entity->fields["calendars_id"] == self::CONFIG_PARENT && $ID != 0) {
echo "<font class='green'> ";
$calendar = new Calendar();
$cid = self::getUsedConfig('calendars_id', $ID, '', 0);
if (!$cid) {
_e('24/7');
} else {
if ($calendar->getFromDB($cid)) {
echo $calendar->getLink();
}
}
echo "</font>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Tickets default type') . "</td>";
echo "<td colspan='2'>";
$toadd = array();
if ($ID != 0) {
$toadd = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'));
}
Ticket::dropdownType('tickettype', array('value' => $entity->fields["tickettype"], 'toadd' => $toadd));
if ($entity->fields['tickettype'] == self::CONFIG_PARENT && $ID != 0) {
echo "<font class='green'> ";
echo Ticket::getTicketTypeName(self::getUsedConfig('tickettype', $ID, '', Ticket::INCIDENT_TYPE));
echo "</font>";
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . __('Automatic assignment of tickets') . "</td>";
echo "<td colspan='2'>";
$autoassign = self::getAutoAssignMode();
if ($ID == 0) {
unset($autoassign[self::CONFIG_PARENT]);
}
Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entity->fields["auto_assign_mode"]));
if ($entity->fields['auto_assign_mode'] == self::CONFIG_PARENT && $ID != 0) {
$auto_assign_mode = self::getUsedConfig('auto_assign_mode', $entity->fields['entities_id']);
echo "<font class='green'> ";
echo $autoassign[$auto_assign_mode];
echo "</font>";
}
echo "</td></tr>";
echo "<tr><th colspan='4'>" . __('Automatic closing configuration') . "</th></tr>";
echo "<tr class='tab_bg_1'>" . "<td colspan='2'>" . __('Automatic closing of solved tickets after') . "</td>";
echo "<td colspan='2'>";
$autoclose = array(self::CONFIG_PARENT => __('Inheritance of the parent entity'), self::CONFIG_NEVER => __('Never'), 0 => __('Immediatly'));
if ($ID == 0) {
unset($autoclose[self::CONFIG_PARENT]);
}
Dropdown::showNumber('autoclose_delay', array('value' => $entity->fields['autoclose_delay'], 'min' => 1, 'max' => 99, 'step' => 1, 'toadd' => $autoclose, 'unit' => 'day'));
if ($entity->fields['autoclose_delay'] == self::CONFIG_PARENT && $ID != 0) {
$autoclose_mode = self::getUsedConfig('autoclose_delay', $entity->fields['entities_id'], '', self::CONFIG_NEVER);
echo "<br><font class='green'> ";
if ($autoclose_mode >= 0) {
//.........这里部分代码省略.........
示例3: showForTicket
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Summary') . "</th></tr>";
echo "<tr class='tab_bg_1 center'><td>" . _n('Time range', 'Time ranges', 2) . " : ";
$calendar = new Calendar();
$calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
echo $calendar->getLink();
} else {
echo NOT_AVAILABLE;
}
echo "</td></tr>";
PluginTimelineticketState::showHistory($ticket);
// Display ticket have Due date
if ($ticket->fields['due_date'] && $ticket->fields['status'] != CommonITILObject::WAITING && strtotime(date('Y-m-d H:i:s')) - strtotime($ticket->fields['due_date']) > 0) {
$calendar = new Calendar();
$calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
if ($ticket->fields['closedate']) {
$dateend = $calendar->getActiveTimeBetween($ticket->fields['due_date'], $ticket->fields['closedate']);
} else {
$dateend = $calendar->getActiveTimeBetween($ticket->fields['due_date'], date('Y-m-d H:i:s'));
}
} else {
// cas 24/24 - 7/7
if ($ticket->fields['closedate']) {
$dateend = strtotime($ticket->fields['closedate']) - strtotime($ticket->fields['due_date']);
} else {
$dateend = strtotime(date('Y-m-d H:i:s')) - strtotime($ticket->fields['due_date']);
}
}
echo "<tr>";
echo "<th>" . __('Late') . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td align='center' class='tab_bg_2_2'>" . Html::timestampToString($dateend, true) . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='2'>" . __('Status') . "</th>";
echo "</tr>";
/* pChart library inclusions */
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pData.class.php";
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pDraw.class.php";
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pImage.class.php";
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pIndicator.class.php";
$a_data = PluginTimelineticketDisplay::getTotaltimeEnddate($ticket);
$totaltime = $a_data['totaltime'];
$end_date = $a_data['end_date'];
$params = array('totaltime' => $totaltime, 'end_date' => $end_date);
$ptState = new PluginTimelineticketState();
$ptState->showTimeline($ticket, $params);
$ptAssignGroup = new PluginTimelineticketAssignGroup();
$ptAssignGroup->showTimeline($ticket, $params);
$ptAssignUser = new PluginTimelineticketAssignUser();
$ptAssignUser->showTimeline($ticket, $params);
echo "</table>";
PluginTimelineticketToolbox::ShowDetail($ticket, 'group');
PluginTimelineticketToolbox::ShowDetail($ticket, 'user');
}
示例4: showForm
function showForm($items_id, $options=array(), $services_id='') {
$pMonitoringCommand = new PluginMonitoringCommand();
$pMonitoringServicedef = new PluginMonitoringServicedef();
if (isset($_GET['withtemplate']) AND ($_GET['withtemplate'] == '1')) {
$options['withtemplate'] = 1;
} else {
$options['withtemplate'] = 0;
}
if ($services_id!='') {
$this->getEmpty();
} else {
$this->getFromDB($items_id);
}
$this->showTabs($options);
$this->showFormHeader($options);
if (!isset($this->fields['plugin_monitoring_servicedefs_id'])
OR empty($this->fields['plugin_monitoring_servicedefs_id'])) {
$pMonitoringServicedef->getEmpty();
} else {
$pMonitoringServicedef->getFromDB($this->fields['plugin_monitoring_servicedefs_id']);
}
$template = false;
echo "<tr>";
echo "<td>";
if ($services_id!='') {
echo "<input type='hidden' name='plugin_monitoring_services_id' value='".$services_id."' />";
}
echo __('Name')." :";
echo "</td>";
echo "<td>";
$objectName = autoName($this->fields["name"], "name", ($template === "newcomp"),
$this->getType());
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
echo "<td>";
echo __('Template')." :";
echo "</td>";
echo "<td>";
if ($items_id != '0') {
echo "<input type='hidden' name='update' value='update'>\n";
}
echo "<input type='hidden' name='plugin_monitoring_servicedefs_id_s' value='".$this->fields['plugin_monitoring_servicedefs_id']."'>\n";
if ($pMonitoringServicedef->fields['is_template'] == '0') {
$this->fields['plugin_monitoring_servicedefs_id'] = 0;
}
Dropdown::show("PluginMonitoringServicetemplate", array(
'name' => 'plugin_monitoring_servicetemplates_id',
'value' => $this->fields['plugin_monitoring_servicetemplates_id'],
'auto_submit' => true
));
echo "</td>";
echo "<td>";
if ($this->fields["items_id"] == '') {
} else {
echo "<input type='hidden' name='items_id' value='".$this->fields["items_id"]."'>\n";
echo "<input type='hidden' name='itemtype' value='".$this->fields["itemtype"]."'>\n";
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='4'> </th>";
echo "</tr>";
echo "<tr>";
// * itemtype link
if ($this->fields['itemtype'] != '') {
$itemtype = $this->fields['itemtype'];
$item = new $itemtype();
$item->getFromDB($this->fields['items_id']);
echo "<td>";
echo __('Item Type')." <i>".$item->getTypeName()."</i>";
echo " :</td>";
echo "<td>";
echo $item->getLink(1);
echo "</td>";
} else {
echo "<td colspan='2' align='center'>";
echo __('No type associated', 'monitoring');
echo "</td>";
}
// * command
echo "<td>";
echo __('Command', 'monitoring')." :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['plugin_monitoring_servicetemplates_id'] > 0) {
$pMonitoringServicetemplate = new PluginMonitoringServicetemplate();
$pMonitoringServicetemplate->getFromDB($this->fields['plugin_monitoring_servicetemplates_id']);
$pMonitoringCommand->getFromDB($pMonitoringServicetemplate->fields['plugin_monitoring_commands_id']);
echo $pMonitoringCommand->getLink(1);
} else {
$pMonitoringCommand->getFromDB($pMonitoringServicedef->fields['plugin_monitoring_commands_id']);
Dropdown::show("PluginMonitoringCommand", array(
'name' =>'plugin_monitoring_commands_id',
//.........这里部分代码省略.........
示例5: showForm
/**
* Display form for service configuration
*
* @param $items_id integer ID
* @param $options array
*
*@return bool true if form is ok
*
**/
function showForm($items_id, $options = array())
{
$pMonitoringCommand = new PluginMonitoringCommand();
if ($items_id == '0') {
$this->getEmpty();
} else {
$this->getFromDB($items_id);
}
$this->showFormHeader($options);
echo "<tr>";
echo "<td>";
echo __('Template name') . " :";
echo "</td>";
echo "<td>";
echo "<input type='hidden' name='is_template' value='1' />";
$objectName = autoName($this->fields["name"], "name", 1, $this->getType());
Html::autocompletionTextField($this, 'name', array('value' => $objectName));
echo "</td>";
// * commande
echo "<td>";
echo __('Command', 'monitoring') . " :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
$pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']);
echo $pMonitoringCommand->getLink(1);
} else {
$pMonitoringCommand->getFromDB($this->fields['plugin_monitoring_commands_id']);
Dropdown::show("PluginMonitoringCommand", array('name' => 'plugin_monitoring_commands_id', 'value' => $this->fields['plugin_monitoring_commands_id']));
}
echo "</td>";
echo "</tr>";
echo "<tr>";
// * checks
echo "<td>" . __('Check definition', 'monitoring') . " :</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
$pMonitoringCheck = new PluginMonitoringCheck();
$pMonitoringCheck->getFromDB($this->fields['plugin_monitoring_checks_id']);
echo $pMonitoringCheck->getLink(1);
} else {
Dropdown::show("PluginMonitoringCheck", array('name' => 'plugin_monitoring_checks_id', 'value' => $this->fields['plugin_monitoring_checks_id']));
}
echo "</td>";
// * active check
echo "<td>";
echo __('Active checks enable', 'monitoring') . " :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
echo Dropdown::getYesNo($this->fields['active_checks_enabled']);
} else {
Dropdown::showYesNo("active_checks_enabled", $this->fields['active_checks_enabled']);
}
echo "</td>";
echo "</tr>";
echo "<tr>";
// * passive check
echo "<td>";
echo __('Passive checks enable', 'monitoring') . " :";
echo "</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
echo Dropdown::getYesNo($this->fields['passive_checks_enabled']);
} else {
Dropdown::showYesNo("passive_checks_enabled", $this->fields['passive_checks_enabled']);
}
echo "</td>";
// * calendar
echo "<td>" . __('Check period', 'monitoring') . " :</td>";
echo "<td align='center'>";
if ($this->fields['is_template'] == '1') {
$calendar = new Calendar();
$calendar->getFromDB($this->fields['calendars_id']);
echo $calendar->getLink(1);
} else {
dropdown::show("Calendar", array('name' => 'calendars_id', 'value' => $this->fields['calendars_id']));
}
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<th colspan='4'>" . __('Remote check', 'monitoring') . "</th>";
echo "</tr>";
echo "<tr>";
// * remotesystem
echo "<td>";
echo __('Utility used for remote check', 'monitoring') . " :";
echo "</td>";
echo "<td>";
$input = array();
$input[''] = '------';
//.........这里部分代码省略.........
示例6: showComponents
function showComponents($componentscatalogs_id)
{
global $DB, $LANG, $CFG_GLPI;
$this->addComponent($componentscatalogs_id);
$rand = mt_rand();
$pmComponent = new PluginMonitoringComponent();
$pmCommand = new PluginMonitoringCommand();
$pmCheck = new PluginMonitoringCheck();
$calendar = new Calendar();
echo "<form method='post' name='componentscatalog_component_form{$rand}' id='componentscatalog_component_form{$rand}' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/front/componentscatalog_component.form.php\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th>";
echo $LANG['plugin_monitoring']['component'][2];
echo "</th>";
echo "</tr>";
echo "</table>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th width='10'> </th>";
echo "<th>" . $LANG['common'][16] . "</th>";
echo "<th>" . $LANG['plugin_monitoring']['command'][2] . "</th>";
echo "<th>" . $LANG['plugin_monitoring']['check'][0] . "</th>";
echo "<th>" . $LANG['plugin_monitoring']['host'][9] . "</th>";
echo "<th>" . $LANG['plugin_monitoring']['service'][8] . "</th>";
echo "</tr>";
$used = array();
$query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscatalogs_id . "'";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$used[] = $data['plugin_monitoring_components_id'];
$pmComponent->getFromDB($data['plugin_monitoring_components_id']);
echo "<tr>";
echo "<td>";
echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
echo "</td>";
echo "<td class='center'>";
echo $pmComponent->getLink(1);
echo "</td>";
echo "<td class='center'>";
$pmCommand->getFromDB($pmComponent->fields['plugin_monitoring_commands_id']);
echo $pmCommand->getLink();
echo "</td>";
echo "<td class='center'>";
$pmCheck->getFromDB($pmComponent->fields['plugin_monitoring_checks_id']);
echo $pmCheck->getLink();
echo "</td>";
echo "<td class='center'>";
$calendar->getFromDB($pmComponent->fields['calendars_id']);
echo $calendar->getLink();
echo "</td>";
echo "<td class='center'>";
if ($pmComponent->fields['remotesystem'] == '') {
echo "-";
} else {
echo $pmComponent->fields['remotesystem'];
}
echo "</td>";
echo "</tr>";
}
openArrowMassive("componentscatalog_host_form{$rand}", true);
closeArrowMassive('deleteitem', $LANG['buttons'][6]);
echo "</table>";
}
示例7: showComponents
function showComponents($componentscatalogs_id)
{
global $DB, $CFG_GLPI;
$this->addComponent($componentscatalogs_id);
$rand = mt_rand();
$pmComponent = new PluginMonitoringComponent();
$pmCommand = new PluginMonitoringCommand();
$pmCheck = new PluginMonitoringCheck();
$calendar = new Calendar();
echo "<form method='post' name='componentscatalog_component_form{$rand}' id='componentscatalog_component_form{$rand}' action=\"" . $CFG_GLPI["root_doc"] . "/plugins/monitoring/front/componentscatalog_component.form.php\">";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th>";
echo __('Associated components', 'monitoring');
echo "</th>";
echo "</tr>";
echo "</table>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th width='10'> </th>";
echo "<th>" . __('Name') . "</th>";
echo "<th>" . __('Command name', 'monitoring') . "</th>";
echo "<th>" . __('Check definition', 'monitoring') . "</th>";
echo "<th>" . __('Check period', 'monitoring') . "</th>";
echo "<th>" . __('Remote check', 'monitoring') . "</th>";
echo "</tr>";
$used = array();
$query = "SELECT * FROM `" . $this->getTable() . "`\n WHERE `plugin_monitoring_componentscalalog_id`='" . $componentscatalogs_id . "'";
$result = $DB->query($query);
while ($data = $DB->fetch_array($result)) {
$used[] = $data['plugin_monitoring_components_id'];
$pmComponent->getFromDB($data['plugin_monitoring_components_id']);
echo "<tr>";
echo "<td>";
echo "<input type='checkbox' name='item[" . $data["id"] . "]' value='1'>";
echo "</td>";
echo "<td class='center'>";
echo $pmComponent->getLink(1);
echo "</td>";
echo "<td class='center'>";
$pmCommand->getFromDB($pmComponent->fields['plugin_monitoring_commands_id']);
echo $pmCommand->getLink();
echo "</td>";
echo "<td class='center'>";
$pmCheck->getFromDB($pmComponent->fields['plugin_monitoring_checks_id']);
echo $pmCheck->getLink();
echo "</td>";
echo "<td class='center'>";
$calendar->getFromDB($pmComponent->fields['calendars_id']);
echo $calendar->getLink();
echo "</td>";
echo "<td class='center'>";
if ($pmComponent->fields['remotesystem'] == '') {
echo "-";
} else {
echo $pmComponent->fields['remotesystem'];
}
echo "</td>";
echo "</tr>";
}
Html::openArrowMassives("componentscatalog_host_form{$rand}", true);
Html::closeArrowMassives(array('deleteitem' => _sx('button', 'Delete permanently')));
Html::closeForm();
echo "</table>";
}
示例8: showHelpdeskOptions
static function showHelpdeskOptions(Entity $entity)
{
global $LANG, $CFG_GLPI;
$ID = $entity->getField('id');
if (!$entity->can($ID, 'r') || !haveRight('entity_helpdesk', 'r')) {
return false;
}
$canedit = haveRight('entity_helpdesk', 'w') && haveAccessToEntity($ID);
// Get data
$entdata = new EntityData();
if (!$entdata->getFromDB($ID)) {
$entdata->getEmpty();
}
echo "<div class='spaced'>";
if ($canedit) {
echo "<form method='post' name=form action='" . getItemTypeFormURL(__CLASS__) . "'>";
}
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['buttons'][15] . " : </td>";
echo "<td colspan='2'>";
$options = array('value' => $entdata->fields["calendars_id"], 'emptylabel' => $LANG['common'][102]);
if ($ID == 0) {
$options['emptylabel'] = $LANG['sla'][10];
}
Dropdown::show('Calendar', $options);
if ($entdata->fields["calendars_id"] == 0) {
$calendar = new Calendar();
if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) {
echo " - " . $calendar->getLink();
}
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][28] . " : </td>";
echo "<td colspan='2'>";
$toadd = array();
if ($ID != 0) {
$toadd = array(0 => $LANG['common'][102]);
}
Ticket::dropdownType('tickettype', $entdata->fields["tickettype"], $toadd);
if ($entdata->fields["calendars_id"] == 0) {
$calendar = new Calendar();
if ($calendar->getFromDB(self::getUsedConfig('calendars_id', $ID))) {
echo " - " . $calendar->getLink();
}
}
echo "</td></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['setup'][52] . " : </td>";
echo "<td colspan='2'>";
$autoassign = array(-1 => $LANG['setup'][731], NO_AUTO_ASSIGN => $LANG['choice'][0], AUTO_ASSIGN_HARDWARE_CATEGORY => $LANG['setup'][51], AUTO_ASSIGN_CATEGORY_HARDWARE => $LANG['setup'][50]);
Dropdown::showFromArray('auto_assign_mode', $autoassign, array('value' => $entdata->fields["auto_assign_mode"]));
echo "</td></tr>";
echo "<tr><th colspan='4'>" . $LANG['entity'][17] . "</th></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][18] . " : </td>";
echo "<td colspan='2'>";
Dropdown::showInteger('autoclose_delay', $entdata->fields['autoclose_delay'], 0, 99, 1, array(-1 => $LANG['setup'][731], -10 => $LANG['setup'][307]));
/*
Alert::dropdownIntegerNever('autoclose_delay', $entdata->fields['autoclose_delay'],
array('max' => 99,
'inherit_global' => 1,
'never_value' => -10,));
*/
echo " " . $LANG['stats'][31] . "</td></tr>";
echo "<tr><th colspan='4'>" . $LANG['entity'][19] . "</th></tr>";
echo "<tr class='tab_bg_1'><td colspan='2'>" . $LANG['entity'][19] . " : </td>";
echo "<td colspan='2'>";
/// no inquest case = rate 0
$typeinquest = array(0 => $LANG['common'][102], 1 => $LANG['satisfaction'][9], 2 => $LANG['satisfaction'][10]);
// No inherit from parent for root entity
if ($entdata->fields['entities_id'] == 0) {
unset($typeinquest[0]);
if ($entdata->fields['inquest_config'] == 0) {
$entdata->fields['inquest_config'] = 1;
}
}
$rand = Dropdown::showFromArray('inquest_config', $typeinquest, $options = array('value' => $entdata->fields['inquest_config']));
echo "</td></tr>\n";
// Do not display for root entity in inherit case
if ($entdata->fields['inquest_config'] == 0 && $entdata->fields['entities_id'] != 0) {
$inquestconfig = self::getUsedConfig('inquest_config', $entdata->fields['entities_id']);
$inquestrate = self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_rate');
echo "<tr><td colspan='4' class='green center'>" . $LANG['common'][102] . " : ";
if ($inquestrate == 0) {
echo $LANG['crontask'][31];
} else {
echo $typeinquest[$inquestconfig];
echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_delay');
echo " " . $LANG['stats'][31] . " - ";
echo $inquestrate . "%";
if ($inquestconfig == 2) {
echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_URL');
}
}
echo "</td></tr>\n";
}
echo "<tr class='tab_bg_1'><td colspan='4'>";
$_REQUEST = array('inquest_config' => $entdata->fields['inquest_config'], 'entities_id' => $ID);
$params = array('inquest_config' => '__VALUE__', 'entities_id' => $ID);
echo "<div id='inquestconfig'>";
include GLPI_ROOT . '/ajax/ticketsatisfaction.php';
echo "</div>\n";
//.........这里部分代码省略.........
示例9: showForTicket
static function showForTicket(Ticket $ticket)
{
global $DB, $CFG_GLPI;
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>" . __('Summary') . "</th></tr>";
echo "<tr class='tab_bg_1 center'><td>" . _n('Time range', 'Time ranges', 2) . " : ";
$calendar = new Calendar();
$calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
echo $calendar->getLink();
} else {
echo NOT_AVAILABLE;
}
echo "</td></tr>";
PluginTimelineticketState::showHistory($ticket);
// Display ticket have Due date
if ($ticket->fields['due_date'] && $ticket->fields['status'] != CommonITILObject::WAITING && strtotime(date('Y-m-d H:i:s')) - strtotime($ticket->fields['due_date']) > 0) {
$calendar = new Calendar();
$calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
if ($ticket->fields['closedate']) {
$dateend = $calendar->getActiveTimeBetween($ticket->fields['due_date'], $ticket->fields['closedate']);
} else {
$dateend = $calendar->getActiveTimeBetween($ticket->fields['due_date'], date('Y-m-d H:i:s'));
}
} else {
// cas 24/24 - 7/7
if ($ticket->fields['closedate']) {
$dateend = strtotime($ticket->fields['closedate']) - strtotime($ticket->fields['due_date']);
} else {
$dateend = strtotime(date('Y-m-d H:i:s')) - strtotime($ticket->fields['due_date']);
}
}
echo "<tr>";
echo "<th>" . __('Late') . "</th>";
echo "</tr>";
echo "<tr>";
echo "<td align='center' class='tab_bg_2_2'>" . Html::timestampToString($dateend, true) . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='2'>" . __('Status') . "</th>";
echo "</tr>";
/* pChart library inclusions */
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pData.class.php";
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pDraw.class.php";
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pImage.class.php";
include GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/class/pIndicator.class.php";
$a_data = PluginTimelineticketDisplay::getTotaltimeEnddate($ticket);
$totaltime = $a_data['totaltime'];
$end_date = $a_data['end_date'];
$params = array('totaltime' => $totaltime, 'end_date' => $end_date);
$ptState = new PluginTimelineticketState();
$ptState->showTimeline($ticket, $params);
$ptAssignGroup = new PluginTimelineticketAssignGroup();
$ptAssignGroup->showTimeline($ticket, $params);
$ptAssignUser = new PluginTimelineticketAssignUser();
$ptAssignUser->showTimeline($ticket, $params);
echo "</table>";
PluginTimelineticketToolbox::ShowDetail($ticket, 'group');
PluginTimelineticketToolbox::ShowDetail($ticket, 'user');
if ($_SESSION['glpi_use_mode'] == Session::DEBUG_MODE) {
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='5'>" . __('DEBUG') . " " . __('Group') . "</th>";
echo "</tr>";
echo "<tr>";
echo "<th>" . __('ID') . "</th>";
echo "<th>" . __('Date') . "</th>";
echo "<th>" . __('Group') . "</th>";
echo "<th>" . __('Begin') . "</th>";
echo "<th>" . __('Delay', 'timelineticket') . "</th>";
echo "</tr>";
$query = "SELECT *\n FROM `glpi_plugin_timelineticket_assigngroups`\n WHERE `tickets_id` = '" . $ticket->getID() . "'";
$result = $DB->query($query);
while ($data = $DB->fetch_assoc($result)) {
echo "<tr class='tab_bg_1'>";
echo "<td>" . $data['id'] . "</td>";
echo "<td>" . Html::convDateTime($data['date']) . "</td>";
echo "<td>" . Dropdown::getDropdownName("glpi_groups", $data['groups_id']) . "</td>";
echo "<td>" . Html::timestampToString($data['begin']) . "</td>";
echo "<td>" . Html::timestampToString($data['delay']) . "</td>";
echo "</tr>";
}
echo "</table>";
echo "<br><table class='tab_cadre_fixe'>";
echo "<tr>";
echo "<th colspan='5'>" . __('DEBUG') . " " . __('Technician') . "</th>";
echo "</tr>";
echo "<tr>";
echo "<th>" . __('ID') . "</th>";
echo "<th>" . __('Date') . "</th>";
echo "<th>" . __('Technician') . "</th>";
echo "<th>" . __('Begin') . "</th>";
echo "<th>" . __('Delay', 'timelineticket') . "</th>";
echo "</tr>";
$query = "SELECT *\n FROM `glpi_plugin_timelineticket_assignusers`\n WHERE `tickets_id` = '" . $ticket->getID() . "'";
$result = $DB->query($query);
//.........这里部分代码省略.........