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


PHP Planning::displayPlanningItem方法代码示例

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


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

示例1: constructEventsArray

 /**
  * Prepare a set of events for jquery fullcalendar.
  * Call populatePlanning functions for all $CFG_GLPI['planning_types'] types
  *
  * @since 9.1
  *
  * @param array $options: must contains this keys :
  *  - begin : planning start .
  *       (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime)
  *  - end : planning end .
  *       (should be an ISO_8601 date, but could be anything wo can be parsed by strtotime)
  * @return array $events : array with events in fullcalendar.io format
  */
 static function constructEventsArray($options = array())
 {
     global $CFG_GLPI;
     $param['start'] = '';
     $param['end'] = '';
     if (is_array($options) && count($options)) {
         foreach ($options as $key => $val) {
             $param[$key] = $val;
         }
     }
     $param['begin'] = date("Y-m-d H:i:s", strtotime($param['start']));
     $param['end'] = date("Y-m-d H:i:s", strtotime($param['end']));
     $raw_events = array();
     foreach ($CFG_GLPI['planning_types'] as $planning_type) {
         if ($_SESSION['glpi_plannings']['filters'][$planning_type]['display']) {
             $event_type_color = $_SESSION['glpi_plannings']['filters'][$planning_type]['color'];
             foreach ($_SESSION['glpi_plannings']['plannings'] as $actor => $actor_params) {
                 $actor_params['event_type_color'] = $event_type_color;
                 $actor_params['planning_type'] = $planning_type;
                 self::constructEventsArraySingleLine($actor, array_merge($param, $actor_params), $raw_events);
             }
         }
     }
     // construct events (in fullcalendar format)
     $events = array();
     foreach ($raw_events as $event) {
         $users_id = isset($event['users_id_tech']) && !empty($event['users_id_tech']) ? $event['users_id_tech'] : $event['users_id'];
         $content = Planning::displayPlanningItem($event, $users_id, 'in', true);
         $begin = date('c', strtotime($event['begin']));
         $end = date('c', strtotime($event['end']));
         // retreive all day events
         if (strpos($event['begin'], "00:00:00") != false && (strtotime($event['end']) - strtotime($event['begin'])) % DAY_TIMESTAMP == 0) {
             $begin = date('Y-m-d', strtotime($event['begin']));
             $end = date('Y-m-d', strtotime($event['end']));
         }
         $index_color = array_search("user_{$users_id}", array_keys($_SESSION['glpi_plannings']));
         $events[] = array('title' => $event['name'], 'content' => $content, 'start' => $begin, 'end' => $end, 'editable' => isset($event['editable']) ? $event['editable'] : false, 'color' => empty($event['color']) ? Planning::$palette_bg[$index_color] : $event['color'], 'borderColor' => empty($event['event_type_color']) ? self::$event_type_color[$event['itemtype']] : $event['event_type_color'], 'textColor' => Planning::$palette_fg[$index_color], 'typeColor' => empty($event['event_type_color']) ? self::$event_type_color[$event['itemtype']] : $event['event_type_color'], 'url' => isset($event['url']) ? $event['url'] : "", 'ajaxurl' => isset($event['ajaxurl']) ? $event['ajaxurl'] : "", 'itemtype' => $event['itemtype'], 'parentitemtype' => isset($event['parentitemtype']) ? $event['parentitemtype'] : "", 'items_id' => $event['id'], 'priority' => isset($event['priority']) ? $event['priority'] : "");
     }
     return $events;
 }
开发者ID:korial29,项目名称:glpi,代码行数:53,代码来源:planning.class.php

示例2: show


//.........这里部分代码省略.........
                     // From midnight
                     if ($hour == $hour_begin) {
                         $begin_time = date("Y-m-d H:i:s", strtotime($when) + ($i - $dayofweek) * DAY_TIMESTAMP);
                     } else {
                         $begin_time = date("Y-m-d H:i:s", strtotime($when) + ($i - $dayofweek) * DAY_TIMESTAMP + $hour * HOUR_TIMESTAMP);
                     }
                     // To midnight
                     if ($hour == $hour_end) {
                         $end_time = date("Y-m-d H:i:s", strtotime($when) + ($i - $dayofweek) * DAY_TIMESTAMP + 24 * HOUR_TIMESTAMP);
                     } else {
                         $end_time = date("Y-m-d H:i:s", strtotime($when) + ($i - $dayofweek) * DAY_TIMESTAMP + ($hour + 1) * HOUR_TIMESTAMP);
                     }
                     reset($interv);
                     while ($data = current($interv)) {
                         $type = "";
                         if ($data["begin"] >= $begin_time && $data["end"] <= $end_time) {
                             $type = "in";
                         } else {
                             if ($data["begin"] < $begin_time && $data["end"] > $end_time) {
                                 $type = "through";
                             } else {
                                 if ($data["begin"] >= $begin_time && $data["begin"] < $end_time) {
                                     $type = "begin";
                                 } else {
                                     if ($data["end"] > $begin_time && $data["end"] <= $end_time) {
                                         $type = "end";
                                     }
                                 }
                             }
                         }
                         if (empty($type)) {
                             next($interv);
                         } else {
                             self::displayPlanningItem($data, $who);
                             if ($type == "in") {
                                 unset($interv[key($interv)]);
                             } else {
                                 next($interv);
                             }
                         }
                     }
                     echo "</td>";
                 }
                 echo "</tr>\n";
             }
             break;
         case "day":
             for ($hour = $hour_begin; $hour <= $hour_end; $hour++) {
                 echo "<tr>";
                 $begin_time = date("Y-m-d H:i:s", strtotime($when) + $hour * HOUR_TIMESTAMP);
                 $end_time = date("Y-m-d H:i:s", strtotime($when) + ($hour + 1) * HOUR_TIMESTAMP);
                 echo "<td class='td_hour'>" . self::displayUsingTwoDigits($hour) . ":00</td>";
                 echo "<td class='tab_bg_3 top' width='12%'>";
                 reset($interv);
                 while ($data = current($interv)) {
                     $type = "";
                     if ($data["begin"] >= $begin_time && $data["end"] <= $end_time) {
                         $type = "in";
                     } else {
                         if ($data["begin"] < $begin_time && $data["end"] > $end_time) {
                             $type = "through";
                         } else {
                             if ($data["begin"] >= $begin_time && $data["begin"] < $end_time) {
                                 $type = "begin";
                             } else {
                                 if ($data["end"] > $begin_time && $data["end"] <= $end_time) {
开发者ID:JULIO8,项目名称:respaldo_glpi,代码行数:67,代码来源:planning.class.php


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