PHP
- 2 ответа
- 0 вопросов
2
Вклад в тег
return $this->render('index', $vars, ['dataProvider' => $dataProvider]);
$this->layout = 'page';
$user = User::find()->where(['username' => $_GET['username']])->one();
if ($user === null) {
throw new NotFoundHttpException();
}
$setting = UserSettingHelper::get($user);
$dataProvider = (new TicketHead())->dataProviderUser();
Url::remember();
return $this->render('index', [
'user' => $user,
'setting' => $setting,
'dataProvider' => $dataProvider
]);
$displayA = $displayB = $displayC = false;
foreach ($res as $row) {
if ($displayA && $displayB && $displayC) {
break;
}
if ($row['a'] > 0) {
$displayA = true;
}
if ($row['b'] > 0) {
$displayB = true;
}
if ($row['c'] > 0) {
$displayC = true;
}
}
echo '<table class="table" style="max-width: 100%; min-width: 75%;"><thead><tr><td>Наименование</td>';
if ($displayA) {
echo '<td>A</td>';
}
if ($displayB) {
echo '<td>B</td>';
}
if ($displayC) {
echo '<td>C</td>';
}
echo '<td>Цена</td></thead><tbody>';
foreach ($res as $row) {
echo '<tr>';
echo '<td>' . $row['item-name'] . '</td>';
if ($displayA) {
echo '<td>' . $row['a'] . '</td>';
}
if ($displayB) {
echo '<td>' . $row['b'] . '</td>';
}
if ($displayC) {
echo '<td>' . $row['c'] . '</td>';
}
echo '<td>' . $row['price-rozn'] . '</td>';
echo '<tr>';
}