當前位置: 首頁>>代碼示例>>PHP>>正文


PHP calendar::getFrontiersPeriods方法代碼示例

本文整理匯總了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;
 }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:75,代碼來源:calendar.php

示例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 . '"
						}]';
            }
        }
    }
開發者ID:rhertzog,項目名稱:lcs,代碼行數:42,代碼來源:ajaxrequest.php


注:本文中的calendar::getFrontiersPeriods方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。