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


PHP Calendar::getFromDB方法代码示例

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


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

示例1: getPeriodTime

 static function getPeriodTime(CommonGLPI $ticket, $start, $end)
 {
     $totaltime = 0;
     if ($ticket->fields['slas_id'] != 0) {
         // Have SLA
         $sla = new SLA();
         $sla->getFromDB($ticket->fields['slas_id']);
         $totaltime = $sla->getActiveTimeBetween($start, $end);
     } else {
         $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
         if ($calendars_id != 0) {
             // Ticket entity have calendar
             $calendar = new Calendar();
             $calendar->getFromDB($calendars_id);
             $totaltime = $calendar->getActiveTimeBetween($start, $end);
         } else {
             // No calendar
             $totaltime = strtotime($end) - strtotime($start);
         }
     }
     return $totaltime;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:22,代码来源:display.class.php

示例2: generateTimeperiodsCfg

 function generateTimeperiodsCfg($file = 0, $tag = '')
 {
     global $DB;
     PluginMonitoringToolbox::logIfExtradebug('pm-shinken', "Starting generateTimeperiodsCfg ...\n");
     $calendar = new Calendar();
     $calendarSegment = new CalendarSegment();
     $calendar_Holiday = new Calendar_Holiday();
     $holiday = new Holiday();
     $hostconfig = new PluginMonitoringHostconfig();
     $pmEntity = new PluginMonitoringEntity();
     // Get list of entities
     $a_entities_allowed = $pmEntity->getEntitiesByTag($tag);
     $a_entities_list = array();
     foreach ($a_entities_allowed as $entity) {
         $a_entities_list = getSonsOf("glpi_entities", $entity);
     }
     $where = '';
     if (!isset($a_entities_allowed['-1'])) {
         $where = getEntitiesRestrictRequest("WHERE", "glpi_entities", '', $a_entities_list);
     }
     foreach ($a_entities_list as $entities_id) {
         $jetlag = $hostconfig->getValueAncestor('jetlag', $entities_id);
         $a_entities_list[$entities_id] = $jetlag;
     }
     // Get all calendars of components
     $cals_entities = array();
     $query = "SELECT `entities_id`, `calendars_id`\n         FROM `glpi_plugin_monitoring_services`\n         LEFT JOIN `glpi_plugin_monitoring_components`\n            ON `plugin_monitoring_components_id` = `glpi_plugin_monitoring_components`.`id` ";
     if ($where == '') {
         $query .= "WHERE `glpi_plugin_monitoring_components`.`id` IS NOT NULL";
     } else {
         $query .= $where . " AND `glpi_plugin_monitoring_components`.`id` IS NOT NULL";
     }
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         if (!isset($cals_entities[$data['entities_id']])) {
             $cals_entities[$data['entities_id']] = array();
         }
         $cals_entities[$data['entities_id']][$data['calendars_id']] = $data['calendars_id'];
     }
     // get all calendars of servciescatalog
     $query = "SELECT `entities_id`, `calendars_id`\n         FROM `glpi_plugin_monitoring_servicescatalogs` " . $where;
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         if (!isset($cals_entities[$data['entities_id']])) {
             $cals_entities[$data['entities_id']] = array();
         }
         $cals_entities[$data['entities_id']][$data['calendars_id']] = $data['calendars_id'];
     }
     // Get all calendars of contacts TODO
     $calendars_added = array();
     $a_timeperiods = array();
     $i = 0;
     foreach ($cals_entities as $entities_id => $calendars) {
         foreach ($calendars as $calendars_id) {
             $jetlag = $a_entities_list[$entities_id];
             if (!isset($calendars_added[$calendars_id . "-" . $jetlag])) {
                 $calendars_added[$calendars_id . "-" . $jetlag] = 1;
                 $calendar->getFromDB($calendars_id);
                 $tmp = array();
                 $tmp['timeperiod_name'] = $calendar->fields['name'];
                 $tmp['alias'] = $calendar->fields['name'];
                 $a_listsegment = $calendarSegment->find("`calendars_id`='" . $calendar->fields['id'] . "'");
                 $a_cal = array();
                 foreach ($a_listsegment as $datasegment) {
                     $begin = preg_replace("/:00\$/", "", $datasegment['begin']);
                     $end = preg_replace("/:00\$/", "", $datasegment['end']);
                     $day = "";
                     switch ($datasegment['day']) {
                         case "0":
                             $day = "sunday";
                             break;
                         case "1":
                             $day = "monday";
                             break;
                         case "2":
                             $day = "tuesday";
                             break;
                         case "3":
                             $day = "wednesday";
                             break;
                         case "4":
                             $day = "thursday";
                             break;
                         case "5":
                             $day = "friday";
                             break;
                         case "6":
                             $day = "saturday";
                             break;
                     }
                     $a_cal[$day][] = $begin . "-" . $end;
                 }
                 foreach ($a_cal as $day => $a_times) {
                     $tmp[$day] = implode(',', $a_times);
                 }
                 $a_cholidays = $calendar_Holiday->find("`calendars_id`='" . $calendar->fields['id'] . "'");
                 foreach ($a_cholidays as $a_choliday) {
                     $holiday->getFromDB($a_choliday['holidays_id']);
                     if ($holiday->fields['is_perpetual'] == 1 && $holiday->fields['begin_date'] == $holiday->fields['end_date']) {
                         $datetime = strtotime($holiday->fields['begin_date']);
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:shinken.class.php

示例3: showForm

 /**
  *
  * @param $items_id integer ID 
  * @param $options array
  *
  *@return bool true if form is ok
  *
  **/
 function showForm($items_id, $itemtype, $options = array())
 {
     global $DB, $CFG_GLPI;
     $pmCommand = new PluginMonitoringCommand();
     $pmCheck = new PluginMonitoringCheck();
     $calendar = new Calendar();
     $pmRealm = new PluginMonitoringRealm();
     $entities_id = 0;
     if ($itemtype == "Entity") {
         $entities_id = $items_id;
     } else {
         $item = new $itemtype();
         $item->getFromDB($items_id);
         $entities_id = $item->fields['entities_id'];
     }
     $query = "SELECT * FROM `" . $this->getTable() . "`\n         WHERE `items_id`='" . $items_id . "'\n            AND `itemtype`='" . $itemtype . "'\n         LIMIT 1";
     $result = $DB->query($query);
     if ($DB->numrows($result) == '0') {
         $this->getEmpty();
         if ($entities_id != '0' or $itemtype != 'Entity') {
             $this->fields['plugin_monitoring_commands_id'] = -1;
             $this->fields['plugin_monitoring_checks_id'] = -1;
             $this->fields['calendars_id'] = -1;
             $this->fields['plugin_monitoring_realms_id'] = -1;
         }
     } else {
         $data = $DB->fetch_assoc($result);
         $this->getFromDB($data['id']);
     }
     echo "<form name='form' method='post' \n         action='" . $CFG_GLPI['root_doc'] . "/plugins/monitoring/front/hostconfig.form.php'>";
     echo "<table class='tab_cadre_fixe'";
     echo "<tr class='tab_bg_1'>";
     echo "<th colspan='4'>";
     echo __('Hosts configuration', 'monitoring');
     echo "</th>";
     echo "</tr>";
     echo "<tr class='tab_bg_1'>";
     echo "<td>";
     echo __('Command', 'monitoring') . "&nbsp;:";
     echo "</td>";
     echo "<td>";
     $input = array();
     if ($entities_id != '0' or $itemtype != 'Entity') {
         $input["-1"] = __('Inheritance of the parent entity');
     }
     $query = "SELECT * FROM `" . getTableForItemType("PluginMonitoringCommand") . "`\n         ORDER BY `name`";
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         $input[$data['id']] = $data['name'];
     }
     Dropdown::showFromArray('plugin_monitoring_commands_id', $input, array('value' => $this->fields['plugin_monitoring_commands_id']));
     echo "</td>";
     echo "<td>" . __('Check definition', 'monitoring') . "&nbsp;:</td>";
     echo "<td>";
     $input = array();
     if ($entities_id != '0' or $itemtype != 'Entity') {
         $input["-1"] = __('Inheritance of the parent entity');
     }
     $query = "SELECT * FROM `" . getTableForItemType("PluginMonitoringCheck") . "`\n         ORDER BY `name`";
     $result = $DB->query($query);
     while ($data = $DB->fetch_array($result)) {
         $input[$data['id']] = $data['name'];
     }
     Dropdown::showFromArray('plugin_monitoring_checks_id', $input, array('value' => $this->fields['plugin_monitoring_checks_id']));
     echo "</td>";
     echo "</tr>";
     // Inheritance
     if ($this->fields['plugin_monitoring_commands_id'] == '-1' or $this->fields['plugin_monitoring_checks_id'] == '-1') {
         echo "<tr class='tab_bg_1'>";
         if ($this->fields['plugin_monitoring_commands_id'] == '-1') {
             echo "<td colspan='2' class='green center'>";
             echo __('Inheritance of the parent entity') . "&nbsp;:&nbsp;";
             $pmCommand->getFromDB($this->getValueAncestor("plugin_monitoring_commands_id", $entities_id));
             echo $pmCommand->fields['name'];
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         if ($this->fields['plugin_monitoring_checks_id'] == '-1') {
             echo "<td colspan='2' class='green center'>";
             echo __('Inheritance of the parent entity') . "&nbsp;:&nbsp;";
             $pmCheck->getFromDB($this->getValueAncestor("plugin_monitoring_checks_id", $entities_id));
             echo $pmCheck->fields['name'];
             echo "</td>";
         } else {
             echo "<td colspan='2'>";
             echo "</td>";
         }
         echo "</tr>";
     }
     echo "<tr class='tab_bg_1'>";
//.........这里部分代码省略.........
开发者ID:geldarr,项目名称:hack-space,代码行数:101,代码来源:hostconfig.class.php

示例4: computeTakeIntoAccountDelayStat

 /**
  * Compute take into account stat of the current ticket
  **/
 function computeTakeIntoAccountDelayStat()
 {
     if (isset($this->fields['id']) && !empty($this->fields['date'])) {
         $calendars_id = $this->getCalendar();
         $calendar = new Calendar();
         // Using calendar
         if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
             return max(1, $calendar->getActiveTimeBetween($this->fields['date'], $_SESSION["glpi_currenttime"]));
         }
         // Not calendar defined
         return max(1, strtotime($_SESSION["glpi_currenttime"]) - strtotime($this->fields['date']));
     }
     return 0;
 }
开发者ID:glpi-project,项目名称:glpi,代码行数:17,代码来源:ticket.class.php

示例5: computeCloseDelayStat

 /**
  * Compute close delay stat of the current ticket
  **/
 function computeCloseDelayStat()
 {
     if (isset($this->fields['id']) && !empty($this->fields['date']) && !empty($this->fields['closedate'])) {
         $calendars_id = Entity::getUsedConfig('calendars_id', $this->fields['entities_id']);
         $calendar = new Calendar();
         // Using calendar
         if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
             return max(0, $calendar->getActiveTimeBetween($this->fields['date'], $this->fields['closedate']) - $this->fields["waiting_duration"]);
         }
         // Not calendar defined
         return max(0, strtotime($this->fields['closedate']) - strtotime($this->fields['date']) - $this->fields["waiting_duration"]);
     }
     return 0;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:17,代码来源:commonitilobject.class.php

示例6: 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')."&nbsp;:";
      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')."&nbsp;:";
      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'>&nbsp;</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 "&nbsp;:</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')."&nbsp;:";
      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',
//.........这里部分代码省略.........
开发者ID:euqip,项目名称:glpi-smartcities,代码行数:101,代码来源:service.class.php

示例7: getActiveTimeBetween

 /**
  * Get active time between to date time for the active calendar
  *
  * @param $start  datetime begin
  * @param $end    datetime end
  *
  * @return timestamp of delay
  **/
 function getActiveTimeBetween($start, $end)
 {
     if ($end < $start) {
         return 0;
     }
     if (isset($this->fields['id'])) {
         $cal = new Calendar();
         $work_in_days = $this->fields['definition_time'] == 'day';
         // Based on a calendar
         if ($this->fields['calendars_id'] > 0) {
             if ($cal->getFromDB($this->fields['calendars_id'])) {
                 return $cal->getActiveTimeBetween($start, $end, $work_in_days);
             }
         } else {
             // No calendar
             $timestart = strtotime($start);
             $timeend = strtotime($end);
             return $timeend - $timestart;
         }
     }
     return 0;
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:30,代码来源:sla.class.php

示例8: showTimeline

 function showTimeline(Ticket $ticket, $params = array())
 {
     global $DB, $CFG_GLPI;
     /* Create and populate the pData object */
     $MyData = new pData();
     /* Create the pChart object */
     $myPicture = new pImage(820, 29, $MyData);
     /* Create the pIndicator object */
     $Indicator = new pIndicator($myPicture);
     $myPicture->setFontProperties(array("FontName" => GLPI_ROOT . "/plugins/timelineticket/lib/pChart2.1.4/fonts/pf_arma_five.ttf", "FontSize" => 6));
     /* Define the indicator sections */
     $IndicatorSections = array();
     $a_states = array(Ticket::INCOMING, Ticket::ASSIGNED, Ticket::PLANNED, Ticket::WAITING, Ticket::SOLVED, Ticket::CLOSED);
     $a_status_color = array();
     $a_status_color[Ticket::INCOMING] = array('R' => 197, 'G' => 204, 'B' => 79);
     $a_status_color[Ticket::ASSIGNED] = array('R' => 38, 'G' => 174, 'B' => 38);
     $a_status_color[Ticket::PLANNED] = array('R' => 255, 'G' => 102, 'B' => 0);
     $a_status_color[Ticket::WAITING] = array('R' => 229, 'G' => 184, 'B' => 0);
     $a_status_color[Ticket::SOLVED] = array('R' => 83, 'G' => 141, 'B' => 184);
     $a_status_color[Ticket::CLOSED] = array('R' => 51, 'G' => 51, 'B' => 51);
     $delaystatus = array();
     foreach ($a_states as $status) {
         $IndicatorSections[$status] = '';
         $delaystatus[$status] = 0;
     }
     $a_status = $this->find("`tickets_id`='" . $ticket->getField('id') . "'", "`date`");
     $begin = 0;
     if ($params['totaltime'] > 0) {
         foreach ($a_status as $data) {
             foreach ($a_states as $statusSection) {
                 $R = 235;
                 $G = 235;
                 $B = 235;
                 $caption = '';
                 if ($statusSection == $data['old_status']) {
                     $R = $a_status_color[$statusSection]['R'];
                     $G = $a_status_color[$statusSection]['G'];
                     $B = $a_status_color[$statusSection]['B'];
                     //$caption = $status;
                     $delaystatus[$statusSection] += round($data['delay'] * 100 / $params['totaltime'], 2);
                 }
                 $IndicatorSections[$statusSection][] = array("Start" => $begin, "End" => $begin + $data['delay'], "Caption" => $caption, "R" => $R, "G" => $G, "B" => $B);
             }
             $begin += $data['delay'];
         }
         if ($ticket->fields['status'] != Ticket::CLOSED) {
             foreach ($a_states as $statusSection) {
                 $R = 235;
                 $G = 235;
                 $B = 235;
                 $caption = ' ';
                 if ($statusSection == $ticket->fields['status']) {
                     $R = $a_status_color[$statusSection]['R'];
                     $G = $a_status_color[$statusSection]['G'];
                     $B = $a_status_color[$statusSection]['B'];
                     //$caption = $status;
                     $delaystatus[$statusSection] += round(($params['totaltime'] - $begin) * 100 / $params['totaltime'], 2);
                 }
                 $IndicatorSections[$statusSection][] = array("Start" => $begin, "End" => $begin + ($params['totaltime'] - $begin), "Caption" => $caption, "R" => $R, "G" => $G, "B" => $B);
             }
         }
     }
     if (count($a_status) > 1) {
         foreach ($a_states as $status) {
             echo "<tr class='tab_bg_2'>";
             echo "<td width='100'>";
             echo Ticket::getStatus($status);
             echo "<br/>(" . $delaystatus[$status] . "%)";
             echo "</td>";
             echo "<td>";
             if ($ticket->fields['status'] != Ticket::CLOSED) {
                 $IndicatorSettings = array("Values" => array(100, 201), "CaptionPosition" => INDICATOR_CAPTION_BOTTOM, "CaptionLayout" => INDICATOR_CAPTION_DEFAULT, "CaptionR" => 0, "CaptionG" => 0, "CaptionB" => 0, "DrawLeftHead" => FALSE, "ValueDisplay" => false, "IndicatorSections" => $IndicatorSections[$status], "SectionsMargin" => 0);
                 $Indicator->draw(2, 2, 805, 25, $IndicatorSettings);
             } else {
                 $IndicatorSettings = array("Values" => array(100, 201), "CaptionPosition" => INDICATOR_CAPTION_BOTTOM, "CaptionLayout" => INDICATOR_CAPTION_DEFAULT, "CaptionR" => 0, "CaptionG" => 0, "CaptionB" => 0, "DrawLeftHead" => FALSE, "DrawRightHead" => FALSE, "ValueDisplay" => false, "IndicatorSections" => $IndicatorSections[$status], "SectionsMargin" => 0);
                 $Indicator->draw(2, 2, 814, 25, $IndicatorSettings);
             }
             $filename = $uid = Session::getLoginUserID(false) . "_test" . $status;
             $myPicture->render(GLPI_GRAPH_DIR . "/" . $filename . ".png");
             echo "<img src='" . $CFG_GLPI['root_doc'] . "/front/graph.send.php?file=" . $filename . ".png'><br/>";
             echo "</td>";
             echo "</tr>";
         }
     }
     // Display ticket have Due date
     if ($ticket->fields['due_date'] && 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)) {
             $duedate = $calendar->getActiveTimeBetween($ticket->fields['date'], $ticket->fields['due_date']);
             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
             $duedate = strtotime($ticket->fields['due_date']) - strtotime($ticket->fields['date']);
             if ($ticket->fields['closedate']) {
                 $dateend = strtotime($ticket->fields['closedate']) - strtotime($ticket->fields['due_date']);
//.........这里部分代码省略.........
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:101,代码来源:state.class.php

示例9: 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] . "&nbsp;:&nbsp;</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] . "&nbsp;:&nbsp;</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] . "&nbsp;:&nbsp;</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] . "&nbsp;:&nbsp;</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 "&nbsp;" . $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] . "&nbsp;:&nbsp;</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] . "&nbsp;:&nbsp;";
         if ($inquestrate == 0) {
             echo $LANG['crontask'][31];
         } else {
             echo $typeinquest[$inquestconfig];
             echo " - " . self::getUsedConfig('inquest_config', $entdata->fields['entities_id'], 'inquest_delay');
             echo "&nbsp;" . $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";
//.........这里部分代码省略.........
开发者ID:ryukansent,项目名称:Thesis-SideB,代码行数:101,代码来源:entitydata.class.php

示例10: getActiveTimeBetween

 /**
  * Get active time between to date time for the active calendar
  *
  * @param $start  datetime begin
  * @param $end    datetime end
  *
  * @return timestamp of delay
  **/
 function getActiveTimeBetween($start, $end)
 {
     if ($end < $start) {
         return 0;
     }
     if (isset($this->fields['id'])) {
         $slalevel = new SlaLevel();
         $cal = new Calendar();
         $work_in_days = $this->fields['resolution_time'] >= DAY_TIMESTAMP;
         // Based on a calendar
         if ($this->fields['calendars_id'] > 0) {
             if ($cal->getFromDB($this->fields['calendars_id'])) {
                 return $cal->getActiveTimeBetween($start, $end, $work_in_days);
             }
         } else {
             // No calendar
             $timestart = strtotime($start);
             $timeend = strtotime($end);
             return $timeend - $timestart;
         }
     }
     return 0;
 }
开发者ID:gaforeror,项目名称:glpi,代码行数:31,代码来源:sla.class.php

示例11: plugin_timelineticket_giveItem

function plugin_timelineticket_giveItem($type, $ID, $data, $num)
{
    global $CFG_GLPI, $DB;
    $searchopt =& Search::getOptions($type);
    $table = $searchopt[$ID]["table"];
    $field = $searchopt[$ID]["field"];
    switch ($table . '.' . $field) {
        case "glpi_plugin_timelineticket_grouplevels.groups":
            if (empty($data["ITEM_{$num}"])) {
                $out = __('None');
            } else {
                $out = "";
                $groups = json_decode($data["ITEM_{$num}"], true);
                if (!empty($groups)) {
                    foreach ($groups as $key => $val) {
                        $out .= Dropdown::getDropdownName("glpi_groups", $val) . "<br>";
                    }
                }
            }
            return $out;
            break;
        case "glpi_plugin_timelineticket_assigngroups.groups_id":
            $ptAssignGroup = new PluginTimelineticketAssignGroup();
            $group = new Group();
            $ticket = new Ticket();
            $out = "";
            $a_out = array();
            $a_groupname = array();
            if (!isset($data["ITEM_{$num}"]) or !strstr($data["ITEM_{$num}"], '$$')) {
                return "";
            }
            $splitg = explode("\$\$\$\$", $data["ITEM_{$num}"]);
            foreach ($splitg as $datag) {
                $split = explode("\$\$", $datag);
                $group->getFromDB($split[0]);
                $ptAssignGroup->getFromDB($split[1]);
                $time = $ptAssignGroup->fields['delay'];
                if ($ptAssignGroup->fields['delay'] === NULL) {
                    $ticket->getFromDB($data["ITEM_0"]);
                    $calendar = new Calendar();
                    $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
                    $datedebut = $ptAssignGroup->fields['date'];
                    $enddate = $_SESSION["glpi_currenttime"];
                    if ($ticket->fields['status'] == Ticket::CLOSED) {
                        $enddate = $ticket->fields['closedate'];
                    }
                    if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
                        $time = $calendar->getActiveTimeBetween($datedebut, $enddate);
                    } else {
                        // cas 24/24 - 7/7
                        $time = strtotime($enddate) - strtotime($datedebut);
                    }
                } else {
                    if ($ptAssignGroup->fields['delay'] == 0) {
                        $time = 0;
                    }
                }
                $a_groupname[$group->fields['id']] = $group->getLink();
                if (isset($a_out[$group->fields['id']])) {
                    $a_out[$group->fields['id']] += $time;
                } else {
                    $a_out[$group->fields['id']] = $time;
                }
            }
            $a_out_comp = array();
            foreach ($a_out as $groups_id => $time) {
                $a_out_comp[] = $a_groupname[$groups_id] . " : " . Html::timestampToString($time, TRUE, FALSE);
            }
            $out = implode("<hr/>", $a_out_comp);
            return $out;
            break;
    }
    return "";
}
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:74,代码来源:hook.php

示例12: getSpecificValueToDisplay

 static function getSpecificValueToDisplay($field, $values, array $options = array())
 {
     if (!is_array($values)) {
         $values = array($field => $values);
     }
     switch ($field) {
         case 'calendars_id':
             $calendar = new Calendar();
             $calendar->getFromDB($values[$field]);
             return $calendar->getName(1);
             break;
         case 'freshness_type':
             $a_freshness_type = array();
             $a_freshness_type['seconds'] = __('Second(s)', 'monitoring');
             $a_freshness_type['minutes'] = __('Minute(s)', 'monitoring');
             $a_freshness_type['hours'] = __('Hour(s)', 'monitoring');
             $a_freshness_type['days'] = __('Day(s)', 'monitoring');
             return $a_freshness_type[$values[$field]];
             break;
     }
     return parent::getSpecificValueToDisplay($field, $values, $options);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:22,代码来源:component.class.php

示例13: PluginMonitoringContact

 function _addContactUser($a_contacts, $users_id, $i)
 {
     $pmContact = new PluginMonitoringContact();
     $pmNotificationcommand = new PluginMonitoringNotificationcommand();
     $pmContacttemplate = new PluginMonitoringContacttemplate();
     $user = new User();
     $calendar = new Calendar();
     $user->getFromDB($users_id);
     // Get template
     $a_pmcontact = current($pmContact->find("`users_id`='" . $users_id . "'", "", 1));
     if (empty($a_pmcontact) or isset($a_pmcontact['plugin_monitoring_contacttemplates_id']) and $a_pmcontact['plugin_monitoring_contacttemplates_id'] == '0') {
         $a_pmcontact = current($pmContacttemplate->find("`is_default`='1'", "", 1));
     } else {
         $a_pmcontact = current($pmContacttemplate->find("`id`='" . $a_pmcontact['plugin_monitoring_contacttemplates_id'] . "'", "", 1));
     }
     $a_contacts[$i]['contact_name'] = $user->fields['name'];
     $a_contacts[$i]['alias'] = $user->getName();
     $a_contacts[$i]['host_notifications_enabled'] = $a_pmcontact['host_notifications_enabled'];
     $a_contacts[$i]['service_notifications_enabled'] = $a_pmcontact['service_notifications_enabled'];
     $calendar->getFromDB($a_pmcontact['service_notification_period']);
     $a_contacts[$i]['service_notification_period'] = $calendar->fields['name'];
     $calendar->getFromDB($a_pmcontact['host_notification_period']);
     $a_contacts[$i]['host_notification_period'] = $calendar->fields['name'];
     $a_servicenotif = array();
     if ($a_pmcontact['service_notification_options_w'] == '1') {
         $a_servicenotif[] = "w";
     }
     if ($a_pmcontact['service_notification_options_u'] == '1') {
         $a_servicenotif[] = "u";
     }
     if ($a_pmcontact['service_notification_options_c'] == '1') {
         $a_servicenotif[] = "c";
     }
     if ($a_pmcontact['service_notification_options_r'] == '1') {
         $a_servicenotif[] = "r";
     }
     if ($a_pmcontact['service_notification_options_f'] == '1') {
         $a_servicenotif[] = "f";
     }
     if ($a_pmcontact['service_notification_options_n'] == '1') {
         $a_servicenotif = array("n");
     }
     if (count($a_servicenotif) == "0") {
         $a_servicenotif = array("n");
     }
     $a_contacts[$i]['service_notification_options'] = implode(",", $a_servicenotif);
     $a_hostnotif = array();
     if ($a_pmcontact['host_notification_options_d'] == '1') {
         $a_hostnotif[] = "d";
     }
     if ($a_pmcontact['host_notification_options_u'] == '1') {
         $a_hostnotif[] = "u";
     }
     if ($a_pmcontact['host_notification_options_r'] == '1') {
         $a_hostnotif[] = "r";
     }
     if ($a_pmcontact['host_notification_options_f'] == '1') {
         $a_hostnotif[] = "f";
     }
     if ($a_pmcontact['host_notification_options_s'] == '1') {
         $a_hostnotif[] = "s";
     }
     if ($a_pmcontact['host_notification_options_n'] == '1') {
         $a_hostnotif = array("n");
     }
     if (count($a_hostnotif) == "0") {
         $a_hostnotif = array("n");
     }
     $a_contacts[$i]['host_notification_options'] = implode(",", $a_hostnotif);
     $pmNotificationcommand->getFromDB($a_pmcontact['service_notification_commands']);
     $a_contacts[$i]['service_notification_commands'] = $pmNotificationcommand->fields['command_name'];
     $pmNotificationcommand->getFromDB($a_pmcontact['host_notification_commands']);
     $a_contacts[$i]['host_notification_commands'] = $pmNotificationcommand->fields['command_name'];
     $a_contacts[$i]['email'] = $user->fields['email'];
     $a_contacts[$i]['pager'] = $user->fields['phone'];
     return $a_contacts;
 }
开发者ID:RubichonL,项目名称:glpi_monitoring,代码行数:77,代码来源:shinken.class.php

示例14: strtotime

                     $delay = $calendar->getActiveTimeBetween($group["date"], $data["closedate"]);
                 } else {
                     $delay = strtotime($data["closedate"]) - strtotime($group["date"]);
                 }
                 if ($delay < 0) {
                     $delay = 0;
                 }
                 $timegroups[$group["groups_id"]] += $delay;
             }
         } else {
             if ($group["delay"] != null) {
                 $timegroups[$group["groups_id"]] = $group["delay"];
             } else {
                 $calendar = new Calendar();
                 $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
                 if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
                     $delay = $calendar->getActiveTimeBetween($group["date"], $data["closedate"]);
                 } else {
                     $delay = strtotime($data["closedate"]) - strtotime($group["date"]);
                 }
                 if ($delay < 0) {
                     $delay = 0;
                 }
                 $timegroups[$group["groups_id"]] = $delay;
             }
         }
         if (!in_array($group["groups_id"], $ticketgroups)) {
             $ticketgroups[] = $group["groups_id"];
         }
     }
 }
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:31,代码来源:statSpentTimeByGroup.php

示例15: update0782to080

/**
 * Update from 0.78.2 to 0.80
 *
 * @return bool for success (will die for most error)
**/
function update0782to080()
{
    global $DB, $migration;
    $updateresult = true;
    $ADDTODISPLAYPREF = array();
    //TRANS: %s is the number of new version
    $migration->displayTitle(sprintf(__('Update to %s'), '0.80'));
    $migration->setVersion('0.80');
    $backup_tables = false;
    $newtables = array('glpi_calendars', 'glpi_calendars_holidays', 'glpi_calendarsegments', 'glpi_computervirtualmachines', 'glpi_computers_softwarelicenses', 'glpi_fieldblacklists', 'glpi_fieldunicities', 'glpi_groups_tickets', 'glpi_holidays', 'glpi_rulecacheprinters', 'glpi_slas', 'glpi_slalevels', 'glpi_slalevels_tickets', 'glpi_slalevelactions', 'glpi_tickets_tickets', 'glpi_tickets_users', 'glpi_ticketsatisfactions', 'glpi_ticketsolutiontemplates', 'glpi_virtualmachinestates', 'glpi_virtualmachinesystems', 'glpi_virtualmachinetypes');
    foreach ($newtables as $new_table) {
        // rename new tables if exists ?
        if (TableExists($new_table)) {
            if (TableExists("backup_{$new_table}")) {
                $query = "DROP TABLE `backup_" . $new_table . "`";
                $DB->queryOrDie($query, "0.80 drop backup table backup_{$new_table}");
            }
            $migration->displayWarning("{$new_table} table already exists. " . "A backup have been done to backup_{$new_table}.");
            $backup_tables = true;
            $query = $migration->renameTable("{$new_table}", "backup_{$new_table}");
        }
    }
    if ($backup_tables) {
        $migration->displayWarning("You can delete backup tables if you have no need of them.", true);
    }
    $migration->displayMessage(sprintf(__('Change of the database layout - %s'), 'Calendar'));
    // Updating schema
    $default_calendar_id = 0;
    if (!TableExists('glpi_calendars')) {
        $query = "CREATE TABLE `glpi_calendars` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) default NULL,\n                  `entities_id` int(11) NOT NULL default '0',\n                  `is_recursive` tinyint(1) NOT NULL default '0',\n                  `comment` TEXT DEFAULT NULL ,\n                  `date_mod` DATETIME DEFAULT NULL ,\n                  `cache_duration` TEXT DEFAULT NULL ,\n                  PRIMARY KEY  (`id`),\n                  KEY `name` (`name`),\n                  KEY `entities_id` (`entities_id`),\n                  KEY `is_recursive` (`is_recursive`),\n                  KEY `date_mod` (`date_mod`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.80 create glpi_calendars");
        $ADDTODISPLAYPREF['Calendar'] = array(19);
        // Create default calendar : use existing config planning_begin _end
        $query = "INSERT INTO `glpi_calendars`\n                       (`name`, `entities_id`, `is_recursive`, `comment`)\n                VALUES ('Default', 0, 1, 'Default calendar');";
        $DB->queryOrDie($query, "0.80 add default glpi_calendars");
        $default_calendar_id = $DB->insert_id();
    }
    if (!TableExists('glpi_calendarsegments')) {
        $query = "CREATE TABLE `glpi_calendarsegments` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `calendars_id` int(11) NOT NULL default '0',\n                  `entities_id` int(11) NOT NULL default '0',\n                  `is_recursive` tinyint(1) NOT NULL default '0',\n                  `day` tinyint(1) NOT NULL default '1' COMMENT 'numer of the day based on date(w)',\n                  `begin` time DEFAULT NULL,\n                  `end` time DEFAULT NULL,\n                  PRIMARY KEY  (`id`),\n                  KEY `calendars_id` (`calendars_id`),\n                  KEY `day` (`day`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.80 create glpi_calendarsegments");
        // add defautl days : from monday to friday
        if ($default_calendar_id > 0) {
            $query = "SELECT `planning_begin`, `planning_end`\n                   FROM `glpi_configs`\n                   WHERE `id` = '1'";
            if ($result = $DB->query($query)) {
                $begin = $DB->result($result, 0, 'planning_begin');
                $end = $DB->result($result, 0, 'planning_end');
                if ($begin < $end) {
                    for ($i = 1; $i < 6; $i++) {
                        $query = "INSERT INTO `glpi_calendarsegments`\n                                   (`calendars_id`, `day`, `begin`, `end`)\n                            VALUES ({$default_calendar_id}, {$i}, '{$begin}', '{$end}')";
                        $DB->queryOrDie($query, "0.80 add default glpi_calendarsegments");
                    }
                }
            }
            // Update calendar
            $calendar = new Calendar();
            if ($calendar->getFromDB($default_calendar_id)) {
                $query = "UPDATE `glpi_calendars`\n                      SET `cache_duration` = '" . exportArrayToDB($calendar->getDaysDurations()) . "'\n                      WHERE `id` = '{$default_calendar_id}'";
                $DB->queryOrDie($query, "0.80 update default calendar cache");
            }
        }
    }
    // Holidays : wrong management : may be a group of several days : will be easy to managed holidays
    if (!TableExists('glpi_holidays')) {
        $query = "CREATE TABLE `glpi_holidays` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) default NULL,\n                  `entities_id` int(11) NOT NULL default '0',\n                  `is_recursive` tinyint(1) NOT NULL default '0',\n                  `comment` TEXT DEFAULT NULL ,\n                  `begin_date` date default NULL,\n                  `end_date` date default NULL,\n                  `is_perpetual` tinyint(1) NOT NULL default '0',\n                  PRIMARY KEY  (`id`),\n                  KEY `name` (`name`),\n                  KEY `begin_date` (`begin_date`),\n                  KEY `end_date` (`end_date`),\n                  KEY `is_perpetual` (`is_perpetual`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.80 create glpi_holidays");
        $ADDTODISPLAYPREF['Holiday'] = array(11, 12, 13);
    }
    if (!TableExists('glpi_calendars_holidays')) {
        $query = "CREATE TABLE `glpi_calendars_holidays` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `calendars_id` int(11) NOT NULL default '0',\n                  `holidays_id` int(11) NOT NULL default '0',\n                  PRIMARY KEY  (`id`),\n                  UNIQUE KEY `unicity` (`calendars_id`,`holidays_id`),\n                  KEY `holidays_id` (`holidays_id`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.80 create glpi_calendars_holidays");
    }
    $migration->displayMessage(sprintf(__('Change of the database layout - %s'), 'SLA'));
    // Updating schema
    if (!TableExists('glpi_slas')) {
        $query = "CREATE TABLE `glpi_slas` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) default NULL,\n                  `entities_id` int(11) NOT NULL default '0',\n                  `is_recursive` tinyint(1) NOT NULL default '0',\n                  `comment` TEXT DEFAULT NULL ,\n                  `resolution_time` int(11) NOT NULL,\n                  `calendars_id` int(11) NOT NULL default '0',\n                  `date_mod` datetime default NULL,\n                  PRIMARY KEY  (`id`),\n                  KEY `name` (`name`),\n                  KEY `calendars_id` (`calendars_id`),\n                  KEY `entities_id` (`entities_id`),\n                  KEY `is_recursive` (`is_recursive`),\n                  KEY `date_mod` (`date_mod`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.80 create glpi_slas");
        $ADDTODISPLAYPREF['SLA'] = array(4);
        // Get first Ticket template
        $query = "SELECT `id`\n                FROM `glpi_notificationtemplates`\n                WHERE `itemtype` LIKE 'Ticket%'\n                ORDER BY `id` ASC";
        if ($result = $DB->query($query)) {
            if ($DB->numrows($result) > 0) {
                $query = "INSERT INTO `glpi_notifications`\n                             (`name`, `entities_id`, `itemtype`, `event`, `mode`,\n                              `notificationtemplates_id`, `comment`, `is_recursive`, `is_active`,\n                              `date_mod`)\n                      VALUES ('Ticket Recall', 0, 'Ticket', 'recall', 'mail',\n                              " . $DB->result($result, 0, 0) . ", '', 1, 1,\n                              NOW());";
                $DB->queryOrDie($query, "0.80 insert notification");
            }
        }
    }
    if (!TableExists('glpi_slalevels')) {
        $query = "CREATE TABLE `glpi_slalevels` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `name` varchar(255) collate utf8_unicode_ci default NULL,\n                  `slas_id` int(11) NOT NULL default '0',\n                  `execution_time` int(11) NOT NULL,\n                  `is_active` tinyint(1) NOT NULL default '1',\n                  PRIMARY KEY  (`id`),\n                  KEY `name` (`name`),\n                  KEY `is_active` (`is_active`),\n                  KEY `slas_id` (`slas_id`)\n                ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci";
        $DB->queryOrDie($query, "0.80 create glpi_slalevels");
    }
    if (!TableExists('glpi_slalevelactions')) {
        $query = "CREATE TABLE `glpi_slalevelactions` (\n                  `id` int(11) NOT NULL auto_increment,\n                  `slalevels_id` int(11) NOT NULL default '0',\n                  `action_type` varchar(255) collate utf8_unicode_ci default NULL,\n                  `field` varchar(255) collate utf8_unicode_ci default NULL,\n                  `value` varchar(255) collate utf8_unicode_ci default NULL,\n                  PRIMARY KEY  (`id`),\n                  KEY `slalevels_id` (`slalevels_id`)\n                ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci ;";
        $DB->queryOrDie($query, "0.80 create glpi_slalevelactions");
    }
    $migration->addField("glpi_profiles", "calendar", "CHAR( 1 ) NULL", array('update' => "`entity_dropdown`"));
//.........这里部分代码省略.........
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:101,代码来源:update_0782_080.php


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