本文整理汇总了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;
}
示例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) {