//"prices"=>array("name"=>"Цены"),
);
-
-echo'<form action="" method=post>';
-echo '<input type="hidden" name="_csrf" value="' . Yii::$app->request->getCsrfToken() . '" />';
-foreach($items as $name => $ar) {
- echo'<br><input type=checkbox name=in['.$name.']> '.$ar["name"].'';
- echo"<table>";
- foreach($ar["array"] ?? [] as $tip => $val) {
-// if($name=="checks") $type="date"; else $type="text";
- echo'<td> '.$tip.'</td><td> <input type="text" ';
- if(isset($type) && $type=="date") echo' style="width:220px;"';
-
- echo' class="form-control" name=in_in['.$name.']['.$tip.'] value="'.$val.'"></td>';
- }
- echo '</table>';
-}
-echo'<br><button name=save value=1 type=submit class="btn btn-success">Сохранить</button></form>';
-echo'<p><button class="btn"><a href="/cron/1c">Обновить</a></button></p>';
-$m=array();
-$request_id=time();
-$m["request_id"]=$request_id;
-foreach($_POST["in"] ?? [] as $n => $array5) {
- $m3=array();
- foreach($_POST["in_in"][$n] ?? [] as $t => $ar) {
- $m[$n][$t]="".$ar;
+$request_id = time();
+$m = array();
+$m["request_id"] = $request_id;
+
+if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST["save"])) {
+ foreach ($_POST["in"] ?? [] as $n => $array5) {
+ $m3 = array();
+ foreach ($_POST["in_in"][$n] ?? [] as $t => $ar) {
+ $m[$n][$t] = "" . $ar;
+ }
+ if (empty($m[$n])) {
+ $m[$n] = true;
+ }
}
- if(empty($m[$n])) $m[$n]=true;
-}
-
-$json2=json_encode($m,JSON_UNESCAPED_UNICODE);
-echo $json2;
-if(!empty($_POST["in"]) and $json2!="[]") {
+ $json2 = json_encode($m, JSON_UNESCAPED_UNICODE);
+ if (!empty($_POST["in"]) && $json2 != "[]") {
+ $db::sql("INSERT INTO api_cron (date, date_up, status, json_post, request_id) VALUES (NOW(), NOW(), 0, ?, ?)", [$json2, $request_id]);
+ }
-
- $db::sql("INSERT INTO api_cron (date, date_up, status,json_post,request_id) VALUES (NOW(), NOW(), 0, ?, ?)",[$json2,$request_id]);
-
+ header('Location: ' . $_SERVER['PHP_SELF']);
+ exit;
}
-
+?>
+
+<form action="" method="post">
+ <input type="hidden" name="_csrf" value="<?= Yii::$app->request->getCsrfToken() ?>" />
+
+ <?php foreach($items as $name => $ar): ?>
+ <br><input type="checkbox" name="in[<?= $name ?>]"> <?= $ar["name"] ?>
+ <table>
+ <?php foreach($ar["array"] ?? [] as $tip => $val): ?>
+ <tr>
+ <td><?= $tip ?></td>
+ <td><input type="text" class="form-control" name="in_in[<?= $name ?>][<?= $tip ?>]" value="<?= $val ?>"></td>
+ </tr>
+ <?php endforeach; ?>
+ </table>
+ <?php endforeach; ?>
+
+ <br><button name="save" value="1" type="submit" class="btn btn-success">Сохранить</button>
+</form>
+
+<p><button class="btn"><a href="/cron/1c">Обновить</a></button></p>
+<?php
$status_arr=[0=>"ожидает выполнения",1=>"выполнено"];
$data = $db::getRows("SELECT * FROM api_cron WHERE 1=1 order by date DESC LIMIT 30 ");
echo"<h3>Здания для 1с</h3><table class=\"table table-hover table-sm\"><tbody>";
<?= DetailView::widget([
'model' => $model,
'attributes' => [
- 'id',
'guid',
[
'format' => 'raw',
}
],
'number',
- 'number_1c',
+ [
+ 'attribute' => 'number_1c',
+ 'value' => function ($model) {
+ return $model->number_1c ?? '';
+ }
+ ],
[
'attribute' => 'status',
'value' => function ($model) {
],
[
'attribute' => 'date',
- 'format' => 'datetime',
],
[
'label' => 'Текст ошибки',
'attribute' => 'error_text',
+ 'value' => function ($model) {
+ return $model->error_text ?? '';
+ }
+ ],
+ [
+ 'attribute' => 'comment',
+ 'value' => function ($model) {
+ return $model->comment ?? '';
+ }
],
- 'comment',
[
'attribute' => 'created_at',
- 'format' => 'datetime',
],
[
'format' => 'raw',
return $model->summ_self_cost ?? 'N/A';
},
],
- 'updated_at:datetime',
+ 'updated_at',
[
'attribute' => 'updated_admin_id',
'value' => function ($model) {