<分区>
您好,我在查询时遇到问题,该查询会绘制空闲位置并占用座位,然后在循环中检查 php 我将繁忙的地方写为禁用复选框
我试过:
foreach ($FreePlaces as $item) {
foreach ($busyPlaces as $items) {
if ($item->id_place == $items->id_place) {
echo Html::checkboxList('items', null, [$items->id_place => $items->number_place], ['class' => 'checkbox-inline no_indent', 'id' => 'idd']);
}
else
echo Html::checkboxList('items', null, [$item->id_place => $item->number_place], ['class' => 'checkbox-inline no_indent', 'id' => 'idd']);
}
如何将繁忙的地方标记为已禁用?
$freePlace= place::find()
->Where(['id_room' => seanse::find()->select('id_room')->
Where(['id_seans' => $id])])->all();
$busyplace=place::find()->where(['in', 'id_place', Reservation::find()->select('id_place')
->where(['id_seans' => $id])])
->andWhere(['id_room' => seanse::find()->select('id_room')->
Where(['id_seans' => $id])])->all();
解决方案
查询
$( "input[name='items[]']:checked").prop("disabled", true);
PHP
$selectedArray = [];
foreach ($zajeteKrzesla as $items) {
$selectedArray[] = $items->id_place;
}
foreach ($WolneKrzesla as $item):?>
echo Html::checkboxList('items', $selectedArray, [$item->id_place => $item->number_place], ['class' => 'checkbox-inline no_indent', 'id' => 'idd']);
<?php endforeach;