本文整理汇总了PHP中Reminder::populatePlanning方法的典型用法代码示例。如果您正苦于以下问题:PHP Reminder::populatePlanning方法的具体用法?PHP Reminder::populatePlanning怎么用?PHP Reminder::populatePlanning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Reminder
的用法示例。
在下文中一共展示了Reminder::populatePlanning方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateIcal
/**
* Generate ical file content
*
* @param $who user ID
* @param $who_group group ID
*
* @return icalendar string
**/
static function generateIcal($who, $who_group)
{
global $CFG_GLPI, $LANG;
if ($who == 0 && $who_group == 0) {
return false;
}
include_once GLPI_ROOT . "/lib/icalcreator/iCalcreator.class.php";
$v = new vcalendar();
if (!empty($CFG_GLPI["version"])) {
$v->setConfig('unique_id', "GLPI-Planning-" . trim($CFG_GLPI["version"]));
} else {
$v->setConfig('unique_id', "GLPI-Planning-UnknownVersion");
}
$v->setConfig('filename', "glpi.ics");
$v->setProperty("method", "PUBLISH");
$v->setProperty("version", "2.0");
$v->setProperty("x-wr-calname", "GLPI-" . $who . "-" . $who_group);
$v->setProperty("calscale", "GREGORIAN");
$interv = array();
$begin = time() - MONTH_TIMESTAMP * 12;
$end = time() + MONTH_TIMESTAMP * 12;
$begin = date("Y-m-d H:i:s", $begin);
$end = date("Y-m-d H:i:s", $end);
// ---------------Tracking
$interv = TicketPlanning::populatePlanning(array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end));
// ---------------Reminder
$data = Reminder::populatePlanning(array('who' => $who, 'who_group' => $who_group, 'begin' => $begin, 'end' => $end));
$interv = array_merge($interv, $data);
// ---------------Plugin
$data = doHookFunction("planning_populate", array("begin" => $begin, "end" => $end, "who" => $who, "who_group" => $who_group));
if (isset($data["items"]) && count($data["items"])) {
$interv = array_merge($data["items"], $interv);
}
if (count($interv) > 0) {
foreach ($interv as $key => $val) {
$vevent = new vevent();
//initiate EVENT
if (isset($val["tickettasks_id"])) {
$vevent->setProperty("uid", "Job#" . $val["tickettasks_id"]);
} else {
if (isset($val["reminders_id"])) {
$vevent->setProperty("uid", "Event#" . $val["reminders_id"]);
} else {
if (isset($val['planningID'])) {
// Specify the ID (for plugins)
$vevent->setProperty("uid", "Plugin#" . $val['planningID']);
} else {
$vevent->setProperty("uid", "Plugin#" . $key);
}
}
}
$vevent->setProperty("dstamp", $val["begin"]);
$vevent->setProperty("dtstart", $val["begin"]);
$vevent->setProperty("dtend", $val["end"]);
if (isset($val["tickets_id"])) {
$vevent->setProperty("summary", $LANG['planning'][8] . " # " . $val["tickets_id"] . " " . $LANG['document'][14] . " # " . $val["device"]);
} else {
if (isset($val["name"])) {
$vevent->setProperty("summary", $val["name"]);
}
}
if (isset($val["content"])) {
$vevent->setProperty("description", html_clean($val["content"]));
} else {
if (isset($val["name"])) {
$vevent->setProperty("description", $val["name"]);
}
}
if (isset($val["tickets_id"])) {
$vevent->setProperty("url", $CFG_GLPI["url_base"] . "/index.php?redirect=tracking_" . $val["tickets_id"]);
}
$v->setComponent($vevent);
}
}
$v->sort();
//$v->parse();
return $v->returnCalendar();
}
示例2: show
//.........这里部分代码省略.........
case "day":
$step = DAY_TIMESTAMP;
break;
}
$next = $time + $step + 10;
$prev = $time - $step;
$next = strftime("%Y-%m-%d", $next);
$prev = strftime("%Y-%m-%d", $prev);
}
$navBar = self::showNavBar($next, $prev, $type, $who, $who_group);
// Print Headers
echo "<div class='center'><table class='tab_cadre_fixe mobile_calendar'>";
// Print Headers
echo "<tr class='tab_bg_1'>";
switch ($type) {
case "month":
for ($i = 1; $i <= 7; $i++) {
echo "<th width='12%'>" . $LANG['calendarD'][$i % 7] . "</th>";
}
break;
case "week":
echo "<th />";
for ($i = 1; $i <= 7; $i++, $tbegin += DAY_TIMESTAMP) {
echo "<th width='12%'>" . $LANG['calendarD'][$i % 7] . " " . date('d', $tbegin) . "</th>";
}
break;
case "day":
echo "<th />";
echo "<th width='12%'>" . $LANG['calendarDay'][$dayofweek % 7] . " " . date('d', $tbegin) . "</th>";
break;
}
echo "</tr>\n";
// ---------------Tracking
$interv = TicketPlanning::populatePlanning($who, $who_group, $begin, $end);
// ---------------reminder
$datareminders = Reminder::populatePlanning($who, $who_group, $begin, $end);
$interv = array_merge($interv, $datareminders);
// --------------- Plugins
$data = doHookFunction("planning_populate", array("begin" => $begin, "end" => $end, "who" => $who, "who_group" => $who_group));
if (isset($data["items"]) && count($data["items"])) {
$interv = array_merge($data["items"], $interv);
}
// Display Items
$tmp = explode(":", $CFG_GLPI["planning_begin"]);
$hour_begin = $tmp[0];
$tmp = explode(":", $CFG_GLPI["planning_end"]);
$hour_end = $tmp[0];
if ($tmp[1] > 0) {
$hour_end++;
}
switch ($type) {
case "week":
for ($hour = $hour_begin; $hour <= $hour_end; $hour++) {
echo "<tr>";
echo "<td class='td_hour'>" . self::displayUsingTwoDigits($hour) . "</td>";
for ($i = 1; $i <= 7; $i++) {
echo "<td class='tab_bg_3 top' width='12%'>";
// 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);