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


PHP Calendar::getActiveTimeBetween方法代码示例

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


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

示例1: 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

示例2: 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

示例3: giveItem


//.........这里部分代码省略.........
                         $out = "<a id='ticket{$itemtype}" . $data['id'] . "' ";
                         $out .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&amp;') . "\">";
                         $out .= $data[$num][0]['name'] . "</a>";
                         return $out;
                     }
                 }
                 break;
             case "glpi_tickets.due_date":
             case "glpi_problems.due_date":
             case "glpi_changes.due_date":
                 // Due date + progress
                 if ($ID == 151) {
                     $out = Html::convDate($data[$num][0]['name']);
                     // No due date in waiting status
                     if ($data[$num][0]['status'] == CommonITILObject::WAITING) {
                         return '';
                     }
                     if (empty($data[$num][0]['name'])) {
                         return '';
                     }
                     if ($data[$num][0]['status'] == Ticket::SOLVED || $data[$num][0]['status'] == Ticket::CLOSED) {
                         return $out;
                     }
                     $itemtype = getItemTypeForTable($table);
                     $item = new $itemtype();
                     $item->getFromDB($data['id']);
                     $percentage = 0;
                     $totaltime = 0;
                     $currenttime = 0;
                     if ($item->isField('slas_id') && $item->fields['slas_id'] != 0) {
                         // Have SLA
                         $sla = new SLA();
                         $sla->getFromDB($item->fields['slas_id']);
                         $currenttime = $sla->getActiveTimeBetween($item->fields['date'], date('Y-m-d H:i:s'));
                         $totaltime = $sla->getActiveTimeBetween($item->fields['date'], $data[$num][0]['name']);
                     } else {
                         $calendars_id = Entity::getUsedConfig('calendars_id', $item->fields['entities_id']);
                         if ($calendars_id != 0) {
                             // Ticket entity have calendar
                             $calendar = new Calendar();
                             $calendar->getFromDB($calendars_id);
                             $currenttime = $calendar->getActiveTimeBetween($item->fields['date'], date('Y-m-d H:i:s'));
                             $totaltime = $calendar->getActiveTimeBetween($item->fields['date'], $data[$num][0]['name']);
                         } else {
                             // No calendar
                             $currenttime = strtotime(date('Y-m-d H:i:s')) - strtotime($item->fields['date']);
                             $totaltime = strtotime($data[$num][0]['name']) - strtotime($item->fields['date']);
                         }
                     }
                     if ($totaltime != 0) {
                         $percentage = round(100 * $currenttime / $totaltime);
                     } else {
                         // Total time is null : no active time
                         $percentage = 100;
                     }
                     if ($percentage > 100) {
                         $percentage = 100;
                     }
                     $percentage_text = $percentage;
                     if ($_SESSION['glpiduedatewarning_unit'] == '%') {
                         $less_warn_limit = $_SESSION['glpiduedatewarning_less'];
                         $less_warn = 100 - $percentage;
                     } else {
                         if ($_SESSION['glpiduedatewarning_unit'] == 'hour') {
                             $less_warn_limit = $_SESSION['glpiduedatewarning_less'] * HOUR_TIMESTAMP;
                             $less_warn = $totaltime - $currenttime;
开发者ID:jose-martins,项目名称:glpi,代码行数:67,代码来源:search.class.php

示例4: 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

示例5: 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

示例6: deleteGroupTicket

 static function deleteGroupTicket(Group_Ticket $item)
 {
     global $DB;
     $ticket = new Ticket();
     $ptAssignGroup = new PluginTimelineticketAssignGroup();
     $ticket->getFromDB($item->fields['tickets_id']);
     $calendar = new Calendar();
     $calendars_id = Entity::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
     $query = "SELECT MAX(`date`) AS datedebut, id\n                FROM `" . $ptAssignGroup->getTable() . "`\n                WHERE `tickets_id` = '" . $item->fields['tickets_id'] . "'\n                  AND `groups_id`='" . $item->fields['groups_id'] . "'\n                  AND `delay` IS NULL";
     $result = $DB->query($query);
     $datedebut = '';
     $input = array();
     if ($result && $DB->numrows($result)) {
         $datedebut = $DB->result($result, 0, 'datedebut');
         $input['id'] = $DB->result($result, 0, 'id');
     } else {
         return;
     }
     if (!$datedebut) {
         $delay = 0;
         // Utilisation calendrier
     } else {
         if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
             $delay = $calendar->getActiveTimeBetween($datedebut, $_SESSION["glpi_currenttime"]);
         } else {
             // cas 24/24 - 7/7
             $delay = strtotime($_SESSION["glpi_currenttime"]) - strtotime($datedebut);
         }
     }
     $input['delay'] = $delay;
     $ptAssignGroup->update($input);
 }
开发者ID:paisdelconocimiento,项目名称:glpi-smartcities,代码行数:32,代码来源:assigngroup.class.php

示例7: giveItem


//.........这里部分代码省略.........
                     }
                 }
                 $options['reset'] = 'reset';
                 $out = "<a id='ticket{$itemtype}" . $data['id'] . "' ";
                 $out .= "href=\"" . $CFG_GLPI["root_doc"] . "/front/ticket.php?" . Toolbox::append_params($options, '&amp;') . "\">";
                 $out .= $data[$NAME . $num] . "</a>";
             } else {
                 $out = $data[$NAME . $num];
             }
             return $out;
         case "glpi_tickets.due_date":
             // Due date + progress
             if ($ID == 151) {
                 $out = Html::convDate($data[$NAME . $num]);
                 // No due date in waiting status
                 if ($data[$NAME . $num . '_2'] == CommonITILObject::WAITING) {
                     return '';
                 }
                 if (empty($data[$NAME . $num])) {
                     return '';
                 }
                 if ($data[$NAME . $num . '_2'] == Ticket::SOLVED || $data[$NAME . $num . '_2'] == Ticket::CLOSED) {
                     return $data[$NAME . $num];
                 }
                 $ticket = new Ticket();
                 $ticket->getFromDB($data['ITEM_0']);
                 $percentage = 0;
                 $totaltime = 0;
                 $currenttime = 0;
                 if ($ticket->fields['slas_id'] != 0) {
                     // Have SLA
                     $sla = new SLA();
                     $sla->getFromDB($ticket->fields['slas_id']);
                     $currenttime = $sla->getActiveTimeBetween($ticket->fields['date'], date('Y-m-d H:i:s'));
                     $totaltime = $sla->getActiveTimeBetween($ticket->fields['date'], $data[$NAME . $num]);
                 } 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);
                         $currenttime = $calendar->getActiveTimeBetween($ticket->fields['date'], date('Y-m-d H:i:s'));
                         $totaltime = $calendar->getActiveTimeBetween($ticket->fields['date'], $data[$NAME . $num]);
                     } else {
                         // No calendar
                         $currenttime = strtotime(date('Y-m-d H:i:s')) - strtotime($ticket->fields['date']);
                         $totaltime = strtotime($data[$NAME . $num]) - strtotime($ticket->fields['date']);
                     }
                 }
                 if ($totaltime != 0) {
                     $percentage = round(100 * $currenttime / $totaltime);
                 } else {
                     // Total time is null : no active time
                     $percentage = 100;
                 }
                 if ($percentage > 100) {
                     $percentage = 100;
                 }
                 $percentage_text = $percentage;
                 if ($_SESSION['glpiduedatewarning_unit'] == '%') {
                     $less_warn_limit = $_SESSION['glpiduedatewarning_less'];
                     $less_warn = 100 - $percentage;
                 } else {
                     if ($_SESSION['glpiduedatewarning_unit'] == 'hours') {
                         $less_warn_limit = $_SESSION['glpiduedatewarning_less'] * HOUR_TIMESTAMP;
                         $less_warn = $totaltime - $currenttime;
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:67,代码来源:searcha.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: 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

示例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: strtotime

                 } 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"];
         }
     }
 }
 $timelevels = array();
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:31,代码来源:statSpentTimeByGroup.php

示例12: groups

 private function groups($closed = true)
 {
     global $DB;
     $DB->connect();
     $a_storedate_temp = self::$storedate;
     $a_states = getAllDatasFromTable('glpi_plugin_timelineticket_assigngroups', '', FALSE, 'id');
     $this->assertEquals(3, count($a_states), 'Number of lines in assigngroup table of plugin');
     $ticket = new Ticket();
     $calendar = new Calendar();
     $ticket->getFromDB(1);
     $calendars_id = EntityData::getUsedConfig('calendars_id', $ticket->fields['entities_id']);
     // * 07/
     if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
         $begin = $calendar->getActiveTimeBetween($ticket->fields['date'], $a_storedate_temp[3]);
     } else {
         // case 24/24 - 7/7
         $begin = strtotime($a_storedate_temp[3]) - strtotime($ticket->fields['date']);
     }
     $a_ref = array('id' => '1', 'tickets_id' => '1', 'date' => $a_storedate_temp[3], 'groups_id' => '1', 'begin' => $begin, 'delay' => strtotime($a_storedate_temp[7]) - strtotime($a_storedate_temp[3]));
     $this->assertEquals($a_ref, $a_states[1], '(07/) Group 1');
     // * 14/
     if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
         $begin = $calendar->getActiveTimeBetween($ticket->fields['date'], $a_storedate_temp[9]);
     } else {
         // case 24/24 - 7/7
         $begin = strtotime($a_storedate_temp[9]) - strtotime($ticket->fields['date']);
     }
     $a_ref = array('id' => '2', 'tickets_id' => '1', 'date' => $a_storedate_temp[9], 'groups_id' => '2', 'begin' => $begin, 'delay' => strtotime($a_storedate_temp[13]) - strtotime($a_storedate_temp[9]));
     $this->assertEquals($a_ref, $a_states[2], '(14/) Group 2');
     // * 20/
     if ($calendars_id > 0 && $calendar->getFromDB($calendars_id)) {
         $begin = $calendar->getActiveTimeBetween($ticket->fields['date'], $a_storedate_temp[13]);
     } else {
         // case 24/24 - 7/7
         $begin = strtotime($a_storedate_temp[13]) - strtotime($ticket->fields['date']);
     }
     $a_ref = array('id' => '3', 'tickets_id' => '1', 'date' => $a_storedate_temp[13], 'groups_id' => '1', 'begin' => $begin, 'delay' => NULL);
     $this->assertEquals($a_ref, $a_states[3], '(20/) Group 1');
 }
开发者ID:pluginsGLPI,项目名称:timelineticket,代码行数:39,代码来源:ManageTicket.php


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