asusg_settings_tasknew.php 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741
  1. <?php
  2. defined('YII_DEBUG') or define('YII_DEBUG', true);
  3. defined('YII_ENV') or define('YII_ENV', 'dev');
  4. require __DIR__ . '/api/vendor/autoload.php';
  5. require __DIR__ . '/api/vendor/yiisoft/yii2/Yii.php';
  6. $config = require __DIR__ . '/api/config/web.php';
  7. (new yii\web\Application($config));
  8. require_once "doctrine/bootstrap.php";
  9. include 'CheckPoint.php';
  10. include 'CheckPointType.php';
  11. use CheckPoints\CheckPoint;
  12. use CheckPointTypes\CheckPointType;
  13. header("Expires: 0");
  14. header("Content-Type: text/html; charset=utf-8");
  15. session_start();
  16. if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 6000)) {
  17. // last request was more than 30 minutes ago
  18. session_unset(); // unset $_SESSION variable for the run-time
  19. session_destroy(); // destroy session data in storage
  20. }
  21. $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
  22. $add = 'Login Area';
  23. foreach (array_keys($_REQUEST) as $var) {
  24. ${$var} = $_REQUEST[$var];
  25. //if ($name == "Admin12") {
  26. // echo "<b>$var:</b> ${$var} <br>";
  27. //}
  28. }
  29. if ($act == "exit")
  30. {
  31. session_unset();
  32. session_destroy();
  33. session_start();
  34. }
  35. if ($_SESSION['cmdlevel'])
  36. $cmdlevel = $_SESSION['cmdlevel'];
  37. if ($_SESSION['hostid'])
  38. $agent_id = $_SESSION['hostid'];
  39. if ($_SESSION['add'])
  40. $add = $_SESSION['add'];
  41. if ($_SESSION['id'])
  42. $id = $_SESSION['id'];
  43. if ($_SESSION['login'])
  44. $login = $_SESSION['login'];
  45. if ($_SESSION['name'])
  46. $name = $_SESSION['name'];
  47. foreach (array_keys($_SESSION) as $var) {
  48. ${$var} = $_SESSION[$var];
  49. //if ($name == "Admin12") {
  50. //echo "from session: <b>$var:</b> ${$var} <br>";
  51. //}
  52. }
  53. include 'functions.php';
  54. include 'auth.php';
  55. $logged_me_in_successfully234 = 0;
  56. $incl = '';
  57. if (!$_SESSION['pass'] && !$_SESSION['login'])
  58. {
  59. $table = 'accounts';
  60. $result=mysqli_query($link, "SELECT id, login, name, cmdlevel FROM $table WHERE login='".$login."' AND password='".md5($pass)."'");
  61. $res1 = mysqli_fetch_array($result);
  62. $cmdlevel = $res1['cmdlevel'];
  63. $name = $res1['name'];
  64. $id = $res1['id'];
  65. if ($cmdlevel == '10')
  66. {
  67. $add = "Head Administrator";
  68. }
  69. else if ($cmdlevel == '1')
  70. {
  71. $add = "Company Administrator";
  72. }
  73. else if ($cmdlevel == '2')
  74. {
  75. $add = "Company Operator";
  76. }
  77. if (mysqli_num_rows($result))
  78. {
  79. $_SESSION['pass']=$pass;
  80. $_SESSION['login']=$login;
  81. $_SESSION['name']=$name;
  82. $_SESSION['add']=$add;
  83. $_SESSION['cmdlevel']=$cmdlevel;
  84. $_SESSION['id']=$id;
  85. $logged_me_in_successfully234 = 1;
  86. }
  87. }
  88. else
  89. $logged_me_in_successfully234 = 1;
  90. $query = mysqli_query($link, "update accounts set last_seen_web =NOW() where id=".$id);
  91. $getincl = GetInclude($act, intval($cmdlevel));
  92. $incl = $getincl[0];
  93. $accnum = $getincl[1];
  94. ?>
  95. <!DOCTYPE html>
  96. <html lang="en">
  97. <head>
  98. <!-- Basic Page Needs
  99. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  100. <meta charset="utf-8">
  101. <title>АСУ СГ - запуск проекта</title>
  102. <meta name="description" content="">
  103. <meta name="author" content="">
  104. <!-- Mobile Specific Metas
  105. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  106. <meta name="viewport" content="width=device-width, initial-scale=1">
  107. <!-- FONT
  108. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  109. <link rel="stylesheet" href="/lte/bower_components/bootstrap/dist/css/bootstrap.min.css">
  110. <!-- Font Awesome -->
  111. <link rel="stylesheet" href="/lte/bower_components/font-awesome/css/font-awesome.min.css">
  112. <!-- Ionicons -->
  113. <link rel="stylesheet" href="/lte/bower_components/Ionicons/css/ionicons.min.css">
  114. <!-- Theme style -->
  115. <link rel="stylesheet" href="/lte/dist/css/AdminLTE.min.css">
  116. <!-- AdminLTE Skins. Choose a skin from the css/skins
  117. folder instead of downloading all of them to reduce the load. -->
  118. <link rel="stylesheet" href="/lte/dist/css/skins/_all-skins.min.css">
  119. <!-- Morris chart -->
  120. <link rel="stylesheet" href="/lte/bower_components/morris.js/morris.css">
  121. <!-- jvectormap -->
  122. <link rel="stylesheet" href="/lte/bower_components/jvectormap/jquery-jvectormap.css">
  123. <!-- Date Picker -->
  124. <link rel="stylesheet" href="/lte/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
  125. <!-- Daterange picker -->
  126. <link rel="stylesheet" href="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.css">
  127. <!-- bootstrap wysihtml5 - text editor -->
  128. <link rel="stylesheet" href="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
  129. <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
  130. <link rel="stylesheet" href="/lte/bower_components/select2/dist/css/select2.min.css">
  131. </head>
  132. <body onload="accon(<? echo $accnum;?>)" >
  133. <!--<div style="min-width: 960px; height: 100%;">-->
  134. <?
  135. $post = \Yii::$app->request->post();
  136. $mycompany = getCompanyByAccount($id);
  137. if (!isset($companyID))
  138. {
  139. // echo "ses com ".$_SESSION['company'];
  140. if ($_SESSION['company'])
  141. $companyID = $_SESSION['company'];
  142. else
  143. {
  144. $companyID = $mycompany[0];
  145. $_SESSION['company'] = $companyID;
  146. }
  147. }
  148. else
  149. {
  150. $_SESSION['company'] = $companyID;
  151. }
  152. $companyname = getCompanyByID($companyID)[1];
  153. if ((int)$_POST['appMykey'] == 123465) {$logged_me_in_successfully234 = 1;}
  154. if ($logged_me_in_successfully234 == 0)
  155. {
  156. echo "<center>";
  157. GetEnterForm();
  158. echo("<font color='red'><b>Access denied. Incorrect login or password</b><font>");
  159. echo "</center>";
  160. return;
  161. }
  162. //$asusgEmployeeEntity = \app\models\entity\AsusgEmployee::find()->orderBy(['name' => SORT_ASC])->all();
  163. $asusgEmployeeEntity = \app\models\entity\Accounts::find()->where(['company' => $companyID])->orderBy(['name' => SORT_ASC])->all();
  164. $asusgJobplanEntity = \app\models\entity\AsusgJobplan::find()->orderBy(['name' => SORT_ASC])->all();
  165. if ( null != $post['typefix'] and null != $post['loco_seria']) {
  166. $asusgProjectTypeEntity = \app\models\entity\AsusgProjectType::findOne(['repair_type' => explode('_',$post['typefix'])[0], 'loco_serie_id' => $post['loco_seria']]);
  167. $asusgJobsModel = (new \yii\db\Query())->select(['jobtype_id'])->from('asusg_job2command')->where(['asusg_projecttype_id' => $asusgProjectTypeEntity->id])->groupBy(['jobtype_id'])->all();
  168. $asusgJob2CommandEntity = \app\models\entity\AsusgJob2Command::find()->where(['asusg_projecttype_id' => $asusgProjectTypeEntity->id])->groupBy(['cmd_order'])->all();
  169. //var_dump($asusgProjectTypeEntity->id);
  170. $types = [];
  171. foreach( $asusgJobsModel as $model){
  172. $types[] = $model['jobtype_id'];
  173. }
  174. $jobtypesEntity = \app\models\entity\Jobtypes::find()->where(['id' => $types])->all();
  175. //$asusgJob2ProjectEntity = \app\models\entity\AsusgJob2Project::find()->where(['asusg_projecttype_id' => $post['typefix'], 'asusg_jobplan_id' => $post['loco_seria']])->orderBy(['job_order' => SORT_ASC])->all();
  176. //} else {
  177. //$asusgJob2ProjectEntity = \app\models\entity\AsusgJob2Project::find()->orderBy(['job_order' => SORT_ASC])->all();
  178. }
  179. //echo "<pre>";
  180. //var_dump($asusgProjectTypeEntity->id);
  181. //foreach( $jobtypesEntity as $model){
  182. // var_dump($model->name);
  183. //}
  184. //echo "</pre>";
  185. $tasktypesEntity = \app\models\entity\Tasktypes::find()->where(['main_task' => 0,'company' => $companyID])->orderBy(['name' => SORT_ASC])->all();
  186. $locomotiveSeriesEntity = \app\models\entity\LocomotiveSeries::find()->orderBy(['name' => SORT_ASC])->all();
  187. $typeFix = \app\models\entity\Repairtypes::find()->all();
  188. //$typeFix = ['1' => 'TO-1','2' => 'TO-2','3' => 'TO-3','4' => 'TO-4','5' => 'TO-5',];
  189. //$projectsLocotechEntity = getLocomotiveList();
  190. $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(["!=", "uuid" , ''])->all();
  191. $series = LocoSeries::GetAllNames();
  192. $startPr = \Yii::$app->request->post('startPr');
  193. if( isset($startPr)) {
  194. $asusgProjectEntity = new \app\models\entity\AsusgProject();
  195. $asusgProjectEntity->loco_serie_id = \Yii::$app->request->post('loco_seria');
  196. $asusgProjectEntity->loco_number = \Yii::$app->request->post('loco_number');
  197. $asusgProjectEntity->repair_type = \Yii::$app->request->post('typefix');
  198. $asusgProjectEntity->section_a = \Yii::$app->request->post('section_a');
  199. $asusgProjectEntity->section_b = \Yii::$app->request->post('section_b');
  200. $asusgProjectEntity->section_c = \Yii::$app->request->post('section_c');
  201. try {
  202. $asusgProjectEntity->save();
  203. } catch (\yii\db\Exception $exception) {
  204. $loadFormError = 'Данные не сохранились.';
  205. }
  206. }
  207. ?>
  208. <!-- HTML -->
  209. <div class="wrapper">
  210. <header class="main-header">
  211. <!-- Logo -->
  212. <a href="/asusg_plan.php" class="logo">
  213. <!-- mini logo for sidebar mini 50x50 pixels -->
  214. <span class="logo-mini"><b>A</b>LT</span>
  215. <!-- logo for regular state and mobile devices -->
  216. <span class="logo-lg"><b>АСУ</b>СГ</span>
  217. </a>
  218. <!-- Header Navbar: style can be found in header.less -->
  219. <nav class="navbar navbar-static-top">
  220. <!-- Sidebar toggle button-->
  221. <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
  222. <span class="sr-only">Toggle navigation</span>
  223. </a>
  224. </nav>
  225. </header>
  226. <aside class="main-sidebar">
  227. <section class="sidebar">
  228. <form action="#" method="get" class="sidebar-form">
  229. <div class="input-group">
  230. <input type="text" name="q" class="form-control" placeholder="Search...">
  231. <span class="input-group-btn">
  232. <button type="submit" name="search" id="search-btn" class="btn btn-flat"><i class="fa fa-search"></i>
  233. </button>
  234. </span>
  235. </div>
  236. </form>
  237. <?php require_once 'asusg_menu.php';?>
  238. </section>
  239. </aside>
  240. <div class="content-wrapper">
  241. <section class="content-header">
  242. <h1>Запуск проекта</h1>
  243. </section>
  244. <section class="content">
  245. <div class="row">
  246. <div class="col-md-12">
  247. <div class="nav-tabs-custom">
  248. <div class="tab-content">
  249. <!-- НАЧАЛО ПЕРВОЙ ВКЛАДКИ -->
  250. <div class="tab-pane active" id="tab_1">
  251. <div class="row">
  252. <div class="col-xs-12">
  253. <? //foreach( $asusgJobplanEntity as $template ):?>
  254. <div class="box box-primary">
  255. <div class="box-header with-border">
  256. <h3 class="box-title"><?php// echo $template->name;?></h3>
  257. <div class="box-tools pull-right">
  258. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i>
  259. </button>
  260. </div>
  261. </div>
  262. <div class="box-body">
  263. <?php //var_dump($post);?>
  264. <form id="submit_editor_start_form" active="post" method="post">
  265. <div class="row">
  266. <div class="col-xs-3">
  267. <label for="exampleInputPassword1">&nbsp;</label>
  268. <div class="form-group">
  269. <label for="exampleInputPassword1">Вид ремонта</label>
  270. <select id="type_fix_id" name="typefix" class="form-control select2" style="width: 100%;">
  271. <? foreach( $typeFix as $key => $type):?>
  272. <option data_id="1" value="<?php echo $type->id . "_" . $type->name;?>" <?php echo ( $post['typefix'] == $type->id)?'selected=selected': '';?>><?php echo $type->name;?></option>
  273. <? endforeach;?>
  274. </select>
  275. </div>
  276. </div>
  277. <div class="col-xs-3">
  278. <label for="exampleInputPassword1">&nbsp;</label>
  279. <div class="form-group">
  280. <label for="exampleInputEmail1">Серия локомотива</label>
  281. <select id="loco_series_command" name="loco_seria" class="form-control select2" style="width: 100%;">
  282. <? foreach( $locomotiveSeriesEntity as $loco):?>
  283. <option value="<?php echo $loco->id?>" <?php echo ( $post['loco_seria'] == $loco->id)?'selected=selected': '';?>><?php echo $loco->name;?></option>
  284. <? endforeach;?>
  285. </select>
  286. </div>
  287. </div>
  288. <div class="col-xs-3">
  289. <label for="exampleInputPassword1">&nbsp;</label>
  290. <div id="error_number_input" class="form-group">
  291. <label for="exampleInputPassword1">Номер локомотива</label>
  292. <input type="text" class="form-control" id="loco_number_command" name="loco_number" value="<?php echo $post['loco_number']?>">
  293. <span id="loco_number_massage" class="help-block" style="display:none" >Должно быть четыре цифры</span>
  294. </div>
  295. </div>
  296. <div class="col-xs-3">
  297. <label for="exampleInputPassword1">Порядок запуска секций:</label>
  298. <div class="form-group">
  299. <label for="exampleInputPassword1">Секция А</label>
  300. <input type="text" class="form-control" id="numberA" name="section_a" value="<?php echo $post['section_a']?>">
  301. </div>
  302. <div class="form-group">
  303. <label for="exampleInputPassword1">Секция Б</label>
  304. <input type="text" class="form-control" id="numberB" name="section_b" value="<?php echo $post['section_b']?>">
  305. </div>
  306. <div class="form-group">
  307. <label for="exampleInputPassword1">Секция В</label>
  308. <input type="text" class="form-control" id="numberC" name="section_c" value="<?php echo $post['section_c']?>">
  309. </div>
  310. </div>
  311. <div class="col-xs-3">
  312. <div class="form-group">
  313. <label for="exampleInputPassword1">Состав проекта</label>
  314. <button id="submit_editor_start" type="button" class="btn btn-block btn-primary bindProjectTypes" >Спланировать</button>
  315. </div>
  316. </div>
  317. </div>
  318. <div class="row">
  319. <div class="col-xs-2">
  320. </div>
  321. </div>
  322. </form>
  323. <form id="start_proj" active="post">
  324. <div id="jobs_create_list" class="box-body" >
  325. <div class="row">
  326. <ul id="sortable" class="list-unstyled list_asusg_command_<?php echo $template->asusg_id;?> sortable job_container">
  327. <? $i = 100;?>
  328. <? foreach ($asusgJob2CommandEntity as $item):?>
  329. <? //if ($item->asusg_job_id == $template->asusg_id):?>
  330. <li id="li_<?php echo $item->asusg_projecttype_id;?>_<?php echo $item->asusg_job_id;?>_<? echo $i;?>" class="ui-state-default" data_id="<?php echo $item->asusg_projecttype_id;?>_<?php echo $item->asusg_job_id;?>_<? echo $i;?>">
  331. <span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
  332. <div class="box box-warning">
  333. <div class="box-header with-border">
  334. <h3 class="box-title"><?php //echo $item->tasktypes->name;?></h3>
  335. <div class="box-tools pull-right">
  336. <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-minus"></i></button>
  337. <button type="button" class="btn btn-box-tool remove_command_button" data-widget="remove" data_id="<?php echo $item->asusg_projecttype_id;?>_<?php echo $item->asusg_job_id;?>_<? echo $i;?>"><i class="fa fa-times"></i></button>
  338. <div class="col-xs-3 ">
  339. <div class="form-group">
  340. <label>Работы АСУ СГ</label>
  341. <select class="form-control select2" style="width: 100%;" name="newListJ_<? echo $i;?>">
  342. <? foreach( $asusgJobplanEntity as $plan):?>
  343. <option value="<?php echo $plan->id?>" <? if ( $plan->id == $item->jobplan->id) { echo "selected=selected";}?>><?php echo $plan->name?></option>
  344. <? endforeach;?>
  345. </select>
  346. </div>
  347. </div>
  348. <div class="col-xs-2 col-xs-offset-2">
  349. <div class="form-group">
  350. <label>Сотрудник 1</label>
  351. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  352. <option value='0'>-- Список сотрудников --</option>
  353. <? foreach( $asusgEmployeeEntity as $plan):?>
  354. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  355. <? endforeach;?>
  356. </select>
  357. </div>
  358. <div class="form-group">
  359. <label>Должность 1</label>
  360. <select class="form-control select2" style="width: 100%;" name="newList1_<? echo $i;?>">
  361. <option value='0'>-- Список должностей --</option>
  362. <? foreach( $jobtypesEntity as $job):?>
  363. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  364. <? endforeach;?>
  365. </select>
  366. </div>
  367. </div>
  368. <div class="col-xs-2 ">
  369. <div class="form-group">
  370. <label>Сотрудник 2</label>
  371. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  372. <option value='0'>-- Список сотрудников --</option>
  373. <? foreach( $asusgEmployeeEntity as $plan):?>
  374. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  375. <? endforeach;?>
  376. </select>
  377. </div>
  378. <div class="form-group">
  379. <label>Должность 2</label>
  380. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  381. <option value='0'>-- Список должностей --</option>
  382. <? foreach( $jobtypesEntity as $job):?>
  383. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  384. <? endforeach;?>
  385. </select>
  386. </div>
  387. </div>
  388. <div class="col-xs-2 ">
  389. <div class="form-group">
  390. <label>Сотрудник 3</label>
  391. <select class="form-control select2" style="width: 100%;" name="newList3_<? echo $i;?>">
  392. <option value='0'>-- Список сотрудников --</option>
  393. <? foreach( $asusgEmployeeEntity as $plan):?>
  394. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  395. <? endforeach;?>
  396. </select>
  397. </div>
  398. <div class="form-group">
  399. <label>Должность 3</label>
  400. <select class="form-control select2" style="width: 100%;" name="newList2_<? echo $i;?>">
  401. <option value='0'>-- Список должностей --</option>
  402. <? foreach( $jobtypesEntity as $job):?>
  403. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  404. <? endforeach;?>
  405. </select>
  406. </div>
  407. </div>
  408. </div>
  409. </div>
  410. </div>
  411. </li>
  412. <? //endif;?>
  413. <? $i++;?>
  414. <? endforeach;?>
  415. </ul>
  416. </div>
  417. </div>
  418. <div class="box-body" >
  419. <div class="row">
  420. <div class="col-xs-2">
  421. <div class="form-group">
  422. <button id="add_jobs_part" type="button" class="btn btn-block btn-success " >Добавить работу</button>
  423. </div>
  424. </div>
  425. </div>
  426. <div class="row">
  427. <div class="col-xs-2">
  428. <div class="form-group">
  429. <label for="exampleInputPassword1">Подготовить проект к запуску</label>
  430. <button id="submit_start_proj" type="button" class="btn btn-block btn-danger bindProjectTypes" data="<?php echo \Yii::$app->request->get('id');?>">Подготовить</button>
  431. </div>
  432. <div class="form-group">
  433. <? if ($loadFormError):?>
  434. <p><?php echo $loadFormError;?></p>
  435. <? endif;?>
  436. <label for="exampleInputPassword1">Запустить проект в работу</label>
  437. <button id="submit_go_go_proj" class="btn btn-block btn-primary disabled" user_id="<?php echo $id;?>" data="<?php echo \Yii::$app->request->get('id');?>">Запустить</button>
  438. </div>
  439. </div>
  440. </div>
  441. </div>
  442. </form>
  443. </div>
  444. </div>
  445. <? //endforeach;?>
  446. </div>
  447. </div>
  448. </div>
  449. <!-- КОНЕЦ ПЕРВОЙ ВКЛАДКИ -->
  450. <!-- НАЧАЛО ВТОРОЙ ВКЛАДКИ -->
  451. <div class="tab-pane" id="tab_2">
  452. </div>
  453. <!-- КОНЕЦ ВТОРОЙ ВКЛАДКИ -->
  454. </div>
  455. </div>
  456. </div>
  457. </div>
  458. </section>
  459. <!-- /.content -->
  460. </div>
  461. <!-- /.content-wrapper -->
  462. <footer class="main-footer">
  463. </footer>
  464. <!-- Add the sidebar's background. This div must be placed
  465. immediately after the control sidebar -->
  466. <div class="control-sidebar-bg"></div>
  467. </div>
  468. <!-- HTML -->
  469. <div class="ASU_select0" style="display:none">
  470. <select class="form-control select2 hide_field_select_0" style="width: 100%;" name="newListJ_<? echo $i;?>">
  471. <? foreach( $asusgJobplanEntity as $plan):?>
  472. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  473. <? endforeach;?>
  474. </select>
  475. </div>
  476. <div class="ASU_select1" style="display:none">
  477. <select class="form-control select2 hide_field_select_1" style="width: 100%;" name="newList1_<? echo $i;?>">
  478. <option value='0'>-- Список сотрудников --</option>
  479. <? foreach( $asusgEmployeeEntity as $plan):?>
  480. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  481. <? endforeach;?>
  482. </select>
  483. </div>
  484. <div class="ASU_select1_j" style="display:none">
  485. <select class="form-control select2 hide_field_select_1_j" style="width: 100%;" name="newList1j_<? echo $i;?>">
  486. <option value='0'>-- Список должностей --</option>
  487. <? foreach( $jobtypesEntity as $job):?>
  488. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  489. <? endforeach;?>
  490. </select>
  491. </div>
  492. <div class="ASU_select2" style="display:none">
  493. <select class="form-control select2 hide_field_select_2" style="width: 100%;" name="newList2_<? echo $i;?>">
  494. <option value='0'>-- Список сотрудников --</option>
  495. <? foreach( $asusgEmployeeEntity as $plan):?>
  496. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  497. <? endforeach;?>
  498. </select>
  499. </div>
  500. <div class="ASU_select2_j" style="display:none">
  501. <select class="form-control select2 hide_field_select_2_j" style="width: 100%;" name="newList2j_<? echo $i;?>">
  502. <option value='0'>-- Список должностей --</option>
  503. <? foreach( $jobtypesEntity as $job):?>
  504. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  505. <? endforeach;?>
  506. </select>
  507. </div>
  508. <div class="ASU_select3" style="display:none">
  509. <select class="form-control select2 hide_field_select_3" style="width: 100%;" name="newList3_<? echo $i;?>">
  510. <option value='0'>-- Список сотрудников --</option>
  511. <? foreach( $asusgEmployeeEntity as $plan):?>
  512. <option value="<?php echo $plan->id?>"><?php echo $plan->name?></option>
  513. <? endforeach;?>
  514. </select>
  515. </div>
  516. <div class="ASU_select3_j" style="display:none">
  517. <select class="form-control select2 hide_field_select_3_j" style="width: 100%;" name="newList3j_<? echo $i;?>">
  518. <option value='0'>-- Список должностей --</option>
  519. <? foreach( $jobtypesEntity as $job):?>
  520. <option value="<?php echo $job->id?>"><?php echo $job->name?></option>
  521. <? endforeach;?>
  522. </select>
  523. </div>
  524. <!-- End Document
  525. –––––––––––––––––––––––––––––––––––––––––––––––––– -->
  526. <script src="/lte/bower_components/jquery/dist/jquery.min.js"></script>
  527. <!-- jQuery UI 1.11.4 -->
  528. <script src="/lte/bower_components/jquery-ui/jquery-ui.min.js"></script>
  529. <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
  530. <script>
  531. $.widget.bridge('uibutton', $.ui.button);
  532. </script>
  533. <!-- Bootstrap 3.3.7 -->
  534. <script src="/lte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
  535. <!-- Morris.js charts -->
  536. <script src="/lte/bower_components/raphael/raphael.min.js"></script>
  537. <script src="/lte/bower_components/morris.js/morris.min.js"></script>
  538. <!-- Sparkline -->
  539. <script src="/lte/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
  540. <!-- jvectormap -->
  541. <script src="/lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
  542. <script src="/lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
  543. <!-- jQuery Knob Chart -->
  544. <script src="/lte/bower_components/jquery-knob/dist/jquery.knob.min.js"></script>
  545. <!-- daterangepicker -->
  546. <script src="/lte/bower_components/moment/min/moment.min.js"></script>
  547. <script src="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
  548. <!-- datepicker -->
  549. <script src="/lte/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
  550. <!-- Bootstrap WYSIHTML5 -->
  551. <script src="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
  552. <!-- Slimscroll -->
  553. <script src="/lte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
  554. <!-- FastClick -->
  555. <script src="/lte/bower_components/fastclick/lib/fastclick.js"></script>
  556. <!-- AdminLTE App -->
  557. <script src="/lte/dist/js/adminlte.min.js"></script>
  558. <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
  559. <script src="/lte/dist/js/pages/dashboard.js"></script>
  560. <!-- AdminLTE for demo purposes -->
  561. <script src="/lte/dist/js/demo.js"></script>
  562. <script src="/loco.js"></script>
  563. <script src="/mail.js"></script>
  564. <script src="/lte/bower_components/select2/dist/js/select2.full.min.js"></script>
  565. <script>
  566. $( function() {
  567. $( ".sortable" ).sortable();
  568. $( ".sortable" ).disableSelection();
  569. } );
  570. </script>
  571. </body>
  572. </html>
  573. <?php
  574. function GetEnterForm()
  575. {
  576. echo "<article>
  577. <form method='post' action='?login'>
  578. <table>
  579. <tr>
  580. <td width=70>
  581. <b>Login</b>
  582. </td>
  583. <td>
  584. &nbsp;
  585. </td>
  586. <td>
  587. <input type='text' name=login value=''><br/>
  588. </td>
  589. </tr>
  590. <tr>
  591. <td>
  592. <b>Password </b>
  593. </td>
  594. <td>
  595. &nbsp;
  596. </td>
  597. <td>
  598. <input type='password' name=pass value=''>
  599. </td>
  600. </tr>
  601. <tr>
  602. <td></td>
  603. <td>&nbsp;</td>
  604. <td>
  605. <input type='submit' value='Enter'>
  606. </td>
  607. </tr>
  608. </table>
  609. </form>
  610. </article>";
  611. }
  612. function getLocomotiveList(){
  613. $result = [];
  614. //var_dump($companyID);
  615. $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(['company' => 2] )->orderBy(['id' => SORT_DESC])->all();
  616. $listArray = [];
  617. foreach( $projectsLocotechEntity as $item){ //var_dump($item->projecttypes->name);echo "\n";
  618. //$tempArray = GetTasksForProject($item->id);
  619. $status = GetProjectStatus($item->id);
  620. if ($status != 2 && $status != 1) {continue;}
  621. $countDone = ['done' => 0, 'all' => 0 ];
  622. foreach( GetTasksForProject($item->id) as $proj) { //var_dump($proj);echo "<br>";
  623. $countDone['all']++;
  624. $tempArray = $proj;
  625. $tempArray['status'] = CheckAcceptedStatus($proj);
  626. $tempArray['name'] = GetTaskNameAndDesc($proj['type'])[0];
  627. //$tempArray['listAccounts'] = $this->getAccountListForTask($proj['type']);
  628. if ( 5 == $tempArray['status'] ) {$countDone['done']++;}
  629. //$countDone['all'] ." / " . $countDone['done'];
  630. $listArray[] = $tempArray;
  631. }
  632. $result[$item->id]['countDone'] = [ 'done' => $countDone['done'], 'all' => $countDone['all'] ];
  633. //$tempArray['name'] = GetTaskNameAndDesc($tempArray['type'])[0];
  634. $result[$item->id]['arr'] = $listArray;//GetTasksForProject($item->id);
  635. $result[$item->id]['obj'] = $item;
  636. $listArray = [];
  637. }
  638. //exit;
  639. return $result;
  640. }
  641. function CheckAcceptedStatus($task) {
  642. $result = false;
  643. $query = "select if(tx.total = tx.finished, 5, if (tx.accepted <> tx.finished, if(tx.attention > 0, 7, 2), if (tx.accepted = 0, 1, 3))) as taskstatus
  644. from (select count(t.id) as total,
  645. sum(if(t.accepted_time is not null, 1, 0)) as accepted,
  646. sum(if(t.finished_time is not null, 1, 0)) as finished,
  647. sum(if(t.finished_time is null, if(timestampdiff(MINUTE, t.accepted_time, NOW()) > tt.time_to_complete_minutes, 1, 0), 0)) as attention
  648. from tasks t
  649. right join tasktypes tt on t.type = tt.id
  650. where t.parent_id = ".$task['id'].") tx;";
  651. $result = \Yii::$app->db->createCommand($query)->queryAll();
  652. $result = $result[0]["taskstatus"];
  653. return $result;
  654. }
  655. ?>