?> </div> </div> <?php $relatives = Relatives::findAll(['cemetery_id' => $model->id]); if (count($relatives)) { ?> <div class="panel panel-default panel-info"> <div class="panel-heading"> <h3 class="panel-title">Список захороненых</h3> </div> <div class="panel-body"> <table class="table table-striped table-bordered detail-view"> <?php foreach ($relatives as $relative) { echo Relatives::renderRow($relative->id); } ?> </table> </div> <div class="panel-footer"> <?php echo 'Итого в списке: ' . count($relatives); ?> </div> </div> <?php } ?> </div>
function renderRelativesTable($children, $level, &$common) { $nextLevelChildren = []; $count = 0; if ($level == 1) { $title = $level . ' Дети'; } elseif ($level == 2) { $title = $level . ' Внуки'; } elseif ($level == 3) { $title = $level . ' Правнуки'; } else { $title = $level . ' уровень'; } echo Html::beginTag('table', ['class' => 'table table-striped table-bordered detail-view']); echo Html::beginTag('tr', ['class' => 'info']); echo Html::tag('th', $title, ['colspan' => COL_SPAN]); echo Html::endTag('tr'); foreach ($children as $child) { echo Relatives::renderRow($child->id); $count++; if ($child->gender) { $field = 'mother_id'; } else { $field = 'father_id'; } $nextChildren = Relatives::findAll([$field => $child->id]); if (count($nextChildren) > 0) { foreach ($nextChildren as $nextChild) { $nextLevelChildren[] = $nextChild; } } } echo Html::beginTag('tr', ['class' => 'info']); echo Html::tag('th', 'Итого: ' . $count, ['colspan' => COL_SPAN]); echo Html::endTag('tr'); echo Html::endTag('table'); $common += $count; if (count($nextLevelChildren) > 0) { renderRelativesTable($nextLevelChildren, ++$level, $common); } }
$this->params['breadcrumbs'][] = $this->title; ?> <div class="relatives-index"> <?php if (isset($_POST['search'])) { $searchString = $_POST['search']; } else { $searchString = $_REQUEST['search']; } $searchString = trim($searchString); // $searchString = Html::encode($searchString); // $searchString = Html::decode($searchString); echo Html::tag('p', 'Поисковая строка: ' . $searchString); echo Html::beginTag('div', ['class' => 'panel panel-info']); $content = Html::tag('h3', '<i class="glyphicon glyphicon-calendar"></i> Результаты поиска', ['class' => "panel-title"]); echo Html::tag('div', $content, ['class' => "panel-heading"]); echo Html::endTag('div'); $result = Search::getComplitMatch($searchString, "full"); if (count($result)) { echo Html::beginTag('table', ['class' => 'table table-striped table-bordered detail-view']); foreach ($result as $record) { echo Relatives::renderRow($record->id); } echo Html::endTag('table'); } else { echo 'нет данных'; } ?> </div>