Так же как и в любом другом случае. Ничего не поменяется. Все точно так же.
<?php function day($shop_id, $day){
return Shifts::find()->andWhere(['shop_id' => $shop_id, 'date' => date('Y-m-d 00:00:00', strtotime($day))])->all();
}
function cell($start, $end, $employee){
echo Yii::$app->formatter->asTime($start, 'php:H:i').'-'.Yii::$app->formatter->asTime($end, 'php:H:i').' '.Html::a($employee->user->lastNameEmployee, ['shifts/update', 'id' => $employee->id], ['class' => 'button-editShifts', 'data-pjax' => 0]).'<br>';
}
<table class="table">
<tr>
<th>Магазины</th>
<th>Пн <?= date("d.m", strtotime("last Monday")) ?></th>
<th>Вт <?= date("d.m", strtotime("last Tuesday")); ?></th>
<th>Ср <?= date("d.m", strtotime("last Wednesday")); ?></th>
<th>Чт <?= date("d.m", strtotime("Thursday")); ?></th>
<th>Пт <?= date("d.m", strtotime("Friday")); ?></th>
<th>Сб <?= date("d.m", strtotime("Saturday")); ?></th>
<th>Вс <?= date("d.m", strtotime("Sunday")); ?></th>
</tr>
<?php foreach ($shops as $shop){
echo '<tr>
<td>'.$shop->name.'</td>';
echo '<td>';
foreach (day($shop->id, 'last Monday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
<td>';
foreach (day($shop->id, 'last Tuesday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
<td>';
foreach (day($shop->id, 'last Wednesday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
<td>';
foreach (day($shop->id, 'Thursday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
<td>';
foreach (day($shop->id, 'Friday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
<td>';
foreach (day($shop->id, 'Saturday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
<td>';
foreach (day($shop->id, 'Sunday') as $employee){
cell($employee->start_time, $employee->end_time, $employee);
}
echo '</td>
</tr>';
} ?>
</table>
function shift($shop_id, $day){
$monday = Shifts::find()->andWhere(['shop_id' => $shop_id])->andWhere(['>=', 'start_date', date('Y-m-d 00:00:00', strtotime($day))])->andWhere(['<=', 'start_date', date('Y-m-d 23:59:59', strtotime($day))])->all();
foreach ($monday as $employee){
return Yii::$app->formatter->asTime($employee->start_date, 'php:H:i').'-'.Yii::$app->formatter->asTime($employee->end_date, 'php:H:i').' '.$employee->user->nameEmployee.'<br>';
}
}
echo Yii::$app->formatter->asTime($employee->start_date, 'php:H:i').'-'.Yii::$app->formatter->asTime($employee->end_date, 'php:H:i').' '.$employee->user->nameEmployee.'<br>';
strtotime($arr)
возвращает false как понимаю нужно перевести месяц в число 2018-Мар-9
foreach ($model as $value){
shuffle($value->answear);
}
var_dump($model[0]->answear);
object(app\models\Questions)[148]
private '_attributes' (yii\db\BaseActiveRecord) =>
array (size=6)
'id' => int 56
'name' => string 'Вопрос второй' (length=25)
'answear' =>
array (size=4)
1 => string 'да' (length=4)
2 => string 'Мир' (length=6)
3 => string 'откуда' (length=12)
4 => string 'Эстетика' (length=16)
'correct' =>
array (size=1)
'right' => string 'Мир' (length=6)
'active' => int 1
'id_theme' => int 82
private '_oldAttributes' (yii\db\BaseActiveRecord) =>
array (size=6)
'id' => int 56
'name' => string 'Вопрос второй' (length=25)
'answear' => string '{"1":"да","2":"Мир","3":"откуда","4":"Эстетика"}' (length=67)
'correct' => string '{"right": "Мир"}' (length=19)
'active' => int 1
'id_theme' => int 82
вот примерно что выводит