duanbeng8872 2019-01-31 13:08
浏览 117

多个bootstrap日历

I made a calendar using this tutorial

https://www.phpzag.com/create-event-calendar-with-jquery-php-and-mysql/#

Now I want to have multiple calenders like this:

preview

I have a query that gets all the data then this is getting converted to JSON.

Code for JSON:

$calendar = array();

while( $rows = $sqlEvents->fetch(PDO::FETCH_ASSOC)) {   
  $start = strtotime($rows['DatumBegin']) * 1000;
  $end = strtotime($rows['DatumEind']) * 1000;  
  $calendar[] = array(
        'id' =>$rows['OpleidingID'],
        'title' => $rows['Onderdeelnaam'],
        'url' => "",
    "class" => 'event-important',
        'start' => "$start",
        'end' => "$end"
    );
}


$calendarData = array(
  "success" => 1,   
  "result"=>$calendar
);

echo json_encode($calendarData);

The problem that I have is that all data goes in all calendars

Right now it goes like this

Data from Person A, Person B, Person C

Calendar A = A B C

Calendar B = A B C

Calendar C = A B C

But what I want is this

Calendar A = A

Calendar B = B

Calendar C = C

How could I seperate the json data so that it's like the example above.

Code for calling in calendar:

$docenten = array();


            while( $rows = $sqlEvents->fetch(PDO::FETCH_ASSOC)) {
              $docenten[] = $rows;
            }

            if(isset($docenten)){
                 foreach ($docenten as $docent)
                  {
             ?>
              <table class="table table-condensed table-bordered">
                <tr>
                  <td class="agenda-date" class="active" rowspan="4" style="height: 125px; width: 12%;">
                    <div class="dayofweek">
                      <b>
                      <?php echo $docent['Docentnaam']; ?>
                    </b>
                    </div>
                    <div class="dayofweek">
                      <?php echo $docent['Email']; ?>
                    </div>
                    <div class="shortdate">
                      <?php echo $docent['Telefoonnummer']; ?>
                    </div>
                    <div class="shortdate">
                      <?php echo $docent['Mobiel']; ?>
                    </div>
                  </td>
                </tr>
                <td style="width: 100%;">
                  <div class="showEventCalendar cal-context"></div>
                </td>
              </table>

The json data is sent to events.js and gets converted so that it can be placed in <div class="showEventCalendar cal-context"></div>

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 Revit2020下载问题
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大
    • ¥15 单片机无法进入HAL_TIM_PWM_PulseFinishedCallback回调函数