$a = [...];
$b = [];
foreach ($a as $item) {
if (!array_key_exists($item['name'], $b)) {
$b[$item['name']] = [];
}
if (!in_array($item['city'], $b[$item['name']])) {
$b[$item['name']][] = $item['city'];
}
}
var dynUp = setInterval(function () {
if (document.getElementById('link').value != document.getElementById('player').getAttribute('src')) {
document.getElementById('player').setAttribute('src', 'document.getElementById(\'link\').value');
document.getElementById('loadicon').innerHTML = '<div class=\'cssload-whirlpool\'></div>';
while (document.getElementById('player').readyState == 0) {
}
document.getElementById('loadicon').innerHTML = ''
}
}, 100);
var dynUp = setInterval("if (document.getElementById('link').value != document.getElementById('player').getAttribute('src'))" +
"{" +
"document.getElementById('player').setAttribute('src','document.getElementById(\'link\').value');" +
"document.getElementById('loadicon').innerHTML = '<div class=\'cssload-whirlpool\'></div>';" +
"while (document.getElementById('player').readyState == 0) {};" +
"document.getElementById('loadicon').innerHTML = ''}", 100);
<?php foreach ($weeks as $k => $v) : ?>
<?php $form = ActiveForm::begin(); ?>
<?= $form->field($model, "times[$k][work_start]")->widget(TimePicker::classname(),
[
'value' => '00:00',
'pluginOptions' => [
'showMeridian' => false,
]
])->label('');
?>
<?= $form->field($model, "times[$k][break_start]")->widget(TimePicker::classname(),
[
'value' => '00:00',
'pluginOptions' => [
'showMeridian' => false,
]
])->label('');
?>
<?php $form = ActiveForm::end() ?>
<?php endforeach; ?>
</table>
class Profile extends ActiveRecord
{
public $times;
// .......
}
if ($model->load(Yii::$app->request->post())) {
// .....
if (is_array($model->times) && count($model->times)) {
foreach ($model->times as $day => $values) {
// .... проверяете, сохраняете в базу
}
}
// ......
}