本文整理汇总了PHP中calendar::getFrontiersPeriods方法的典型用法代码示例。如果您正苦于以下问题:PHP calendar::getFrontiersPeriods方法的具体用法?PHP calendar::getFrontiersPeriods怎么用?PHP calendar::getFrontiersPeriods使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类calendar
的用法示例。
在下文中一共展示了calendar::getFrontiersPeriods方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GenerateCalendar
public function GenerateCalendar($id_calendrier)
{
$result = '';
$debut = array();
$fin = array();
$TableSemaines = calendar::getDaysTable();
$TableDaysInPeriods = calendar::getDaysFromPeriods($id_calendrier);
calendar::getFrontiersPeriods($debut, $fin, $id_calendrier);
$i = 1;
$result .= "<div><input id=\"id_calendar\" type=\"hidden\" value=\"" . $id_calendrier . "\"></div>";
foreach ($TableSemaines as $semaine) {
if (in_array($i, $debut)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_first_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['lundi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['lundi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
if (in_array($i, $TableDaysInPeriods)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['lundi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['lundi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['lundi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['lundi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
}
}
$i++;
if (in_array($i, $debut)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_first_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['mardi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['mardi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
if (in_array($i, $TableDaysInPeriods)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['mardi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['mardi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['mardi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['mardi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
}
}
$i++;
if (in_array($i, $debut)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_first_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['mercredi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['mercredi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
if (in_array($i, $TableDaysInPeriods)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['mercredi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['mercredi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['mercredi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['mercredi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
}
}
$i++;
if (in_array($i, $debut)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_first_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['jeudi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['jeudi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
if (in_array($i, $TableDaysInPeriods)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['jeudi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['jeudi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['jeudi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['jeudi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
}
}
$i++;
if (in_array($i, $debut)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_first_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['vendredi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['vendredi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
if (in_array($i, $TableDaysInPeriods)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['vendredi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['vendredi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['vendredi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['vendredi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
}
}
$i++;
if (in_array($i, $debut)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_first_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['samedi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['samedi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
if (in_array($i, $TableDaysInPeriods)) {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell_period\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['samedi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['samedi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
} else {
$result .= "\r\n\t\t\t\t\t<div id=\"div" . $i . "\" class=\"calendar_cell\">\r\n\t\t\t\t\t\t<div id=\"div_" . $i . "\" class=\"month_" . $semaine['samedi-mois'] . "\" >\r\n\t\t\t\t\t\t\t<div style=\"margin:3px;\">" . $semaine['samedi'] . "</div>\r\n\t\t\t\t\t\t</div>\r\n\t\t\t\t\t</div>\r\n\t\t\t\t";
}
}
$result .= "\t<div style=\"clear:both;\"></div>";
$i++;
}
return $result;
}
示例2: editPeriod
public function editPeriod(&$content, Request $request)
{
if ($request->getParam('id_calendar')) {
$id_calendar = $request->getParam('id_calendar');
if ($request->getParam('day')) {
$debut = array();
$fin = array();
$day = $request->getParam('day');
$period = calendar::getPeriodFromDay($day, $id_calendar);
calendar::getFrontiersPeriods($debut, $fin, $id_calendar);
$success = false;
$debut_periode = 0;
$fin_periode = 0;
$stop = false;
$i = 0;
while (!$success && !$stop) {
if ($day >= $debut[$i] && $day <= $fin[$i]) {
$success = true;
$debut_periode = $debut[$i];
$fin_periode = $fin[$i];
}
$i++;
if (!isset($debut[$i])) {
$stop = true;
}
}
header('Content-type: text/html;charset=utf-8;');
//header('Content-type: application/x-json');
$content = '[{
"id": "' . $period['id'] . '",
"name": "' . $period['nom'] . '",
"start_date": "' . strftime("%d/%m/%Y", $period['debut']) . '",
"end_date": "' . strftime("%d/%m/%Y", $period['fin']) . '",
"periode_notes": "' . $period['periode_notes'] . '",
"ouvert": "' . $period['ouvert'] . '",
"type": "' . $period['type'] . '",
"num_jour_initial" : "' . $debut_periode . '",
"num_jour_final" : "' . $fin_periode . '"
}]';
}
}
}