當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。