1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213 |
- <?php
- defined('YII_DEBUG') or define('YII_DEBUG', true);
- defined('YII_ENV') or define('YII_ENV', 'dev');
- require __DIR__ . '/api/vendor/autoload.php';
- require __DIR__ . '/api/vendor/yiisoft/yii2/Yii.php';
- $config = require __DIR__ . '/api/config/web.php';
- (new yii\web\Application($config));
- require_once "doctrine/bootstrap.php";
- include 'CheckPoint.php';
- include 'CheckPointType.php';
- use CheckPoints\CheckPoint;
- use CheckPointTypes\CheckPointType;
- header("Expires: 0");
- header("Content-Type: text/html; charset=utf-8");
- session_start();
- require_once 'PHPExcel-1.8.2/Classes/PHPExcel.php';
- $url = explode('?',$_SERVER["REQUEST_URI"])[0];
- if (isset($_SESSION['LAST_ACTIVITY']) && (time() - $_SESSION['LAST_ACTIVITY'] > 6000)) {
- // last request was more than 30 minutes ago
- session_unset(); // unset $_SESSION variable for the run-time
- session_destroy(); // destroy session data in storage
- }
- $_SESSION['LAST_ACTIVITY'] = time(); // update last activity time stamp
- $add = 'Login Area';
- foreach (array_keys($_REQUEST) as $var) {
- ${$var} = $_REQUEST[$var];
- //if ($name == "Admin12") {
- // echo "<b>$var:</b> ${$var} <br>";
- //}
- }
- if ($act == "exit")
- {
- session_unset();
- session_destroy();
- session_start();
- }
- if ($_SESSION['cmdlevel'])
- $cmdlevel = $_SESSION['cmdlevel'];
- if ($_SESSION['hostid'])
- $agent_id = $_SESSION['hostid'];
- if ($_SESSION['add'])
- $add = $_SESSION['add'];
- if ($_SESSION['id'])
- $id = $_SESSION['id'];
- if ($_SESSION['login'])
- $login = $_SESSION['login'];
- if ($_SESSION['name'])
- $name = $_SESSION['name'];
- foreach (array_keys($_SESSION) as $var) {
- ${$var} = $_SESSION[$var];
- //if ($name == "Admin12") {
- //echo "from session: <b>$var:</b> ${$var} <br>";
- //}
- }
- include 'functions.php';
- include 'auth.php';
- $logged_me_in_successfully234 = 0;
- $incl = '';
- if (!$_SESSION['pass'] && !$_SESSION['login'])
- {
- $table = 'accounts';
- $result=mysqli_query($link, "SELECT id, login, name, cmdlevel FROM $table WHERE login='".$login."' AND password='".md5($pass)."'");
- $res1 = mysqli_fetch_array($result);
- $cmdlevel = $res1['cmdlevel'];
- $name = $res1['name'];
- $id = $res1['id'];
- if ($cmdlevel == '10')
- {
- $add = "Head Administrator";
- }
- else if ($cmdlevel == '1')
- {
- $add = "Company Administrator";
- }
- else if ($cmdlevel == '2')
- {
- $add = "Company Operator";
- }
- if (mysqli_num_rows($result))
- {
- $_SESSION['pass']=$pass;
- $_SESSION['login']=$login;
- $_SESSION['name']=$name;
- $_SESSION['add']=$add;
- $_SESSION['cmdlevel']=$cmdlevel;
- $_SESSION['id']=$id;
- $logged_me_in_successfully234 = 1;
- }
- }
- else
- $logged_me_in_successfully234 = 1;
- $query = mysqli_query($link, "update accounts set last_seen_web =NOW() where id=".$id);
- $getincl = GetInclude($act, intval($cmdlevel));
- $incl = $getincl[0];
- $accnum = $getincl[1];
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <!-- Basic Page Needs
- –––––––––––––––––––––––––––––––––––––––––––––––––– -->
- <meta charset="utf-8">
- <title>ASUSG</title>
- <meta name="description" content="">
- <meta name="author" content="">
- <!-- Mobile Specific Metas
- –––––––––––––––––––––––––––––––––––––––––––––––––– -->
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <!-- FONT
- –––––––––––––––––––––––––––––––––––––––––––––––––– -->
-
-
- <link rel="stylesheet" href="/lte/bower_components/bootstrap/dist/css/bootstrap.min.css">
- <!-- Font Awesome -->
- <link rel="stylesheet" href="/lte/bower_components/font-awesome/css/font-awesome.min.css">
- <!-- Ionicons -->
- <link rel="stylesheet" href="/lte/bower_components/Ionicons/css/ionicons.min.css">
- <!-- Theme style -->
- <link rel="stylesheet" href="/lte/dist/css/AdminLTE.min.css">
- <!-- AdminLTE Skins. Choose a skin from the css/skins
- folder instead of downloading all of them to reduce the load. -->
- <link rel="stylesheet" href="/lte/dist/css/skins/_all-skins.min.css">
- <!-- Morris chart -->
- <link rel="stylesheet" href="/lte/bower_components/morris.js/morris.css">
- <!-- jvectormap -->
- <link rel="stylesheet" href="/lte/bower_components/jvectormap/jquery-jvectormap.css">
- <!-- Date Picker -->
- <link rel="stylesheet" href="/lte/bower_components/bootstrap-datepicker/dist/css/bootstrap-datepicker.min.css">
- <!-- Daterange picker -->
- <link rel="stylesheet" href="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.css">
- <!-- bootstrap wysihtml5 - text editor -->
- <link rel="stylesheet" href="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css">
- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,700,300italic,400italic,600italic">
- <link rel="stylesheet" href="/lte/bower_components/select2/dist/css/select2.min.css">
-
- </head>
- <body onload="accon(<? echo $accnum;?>)" >
- <!--<div style="min-width: 960px; height: 100%;">-->
- <?
- $mycompany = getCompanyByAccount($id);
- if (!isset($companyID))
- {
- // echo "ses com ".$_SESSION['company'];
- if ($_SESSION['company'])
- $companyID = $_SESSION['company'];
- else
- {
- $companyID = $mycompany[0];
- $_SESSION['company'] = $companyID;
- }
- }
- else
- {
- $_SESSION['company'] = $companyID;
- }
- $companyname = getCompanyByID($companyID)[1];
- if ((int)$_POST['appMykey'] == 123465) {$logged_me_in_successfully234 = 1;}
- if ($logged_me_in_successfully234 == 0)
- {
- echo "<center>";
- GetEnterForm();
- echo("<font color='red'><b>Access denied. Incorrect login or password</b><font>");
- echo "</center>";
- return;
- }
- $textlog2 = new \app\models\entity\Textlog();
-
- //$asusgEmployeeEntity = \app\models\entity\AsusgEmployee::find()->orderBy(['name' => SORT_ASC])->all();
- $asusgJobplanEntity = \app\models\entity\AsusgJobplan::find()->orderBy(['name' => SORT_ASC])->all();
- if ( null != $loco && null != $type ) {
- $asusgProjecttypeEntity = \app\models\entity\AsusgProjecttype::findOne(['loco_serie_id' => $loco, 'repair_type' => $type]);
- $asusgJob2CommandEntity = \app\models\entity\AsusgJob2Command::find()->where(['asusg_projecttype_id' => $asusgProjecttypeEntity->id])->orderBy(['cmd_order' => SORT_ASC])->all();
- } else {
- $asusgJob2CommandEntity = \app\models\entity\AsusgJob2Command::find()->orderBy(['cmd_order' => SORT_ASC])->all();
- }
- $tasktypesEntity = \app\models\entity\Tasktypes::find()->where(['main_task' => 0,'company' => $companyID])->orderBy(['name' => SORT_ASC])->all();
- $jobEntity = \app\models\entity\Jobtypes::find()->where(['company' => $companyID])->all();
- $locomotiveSeriesEntity = \app\models\entity\LocomotiveSeries::find()->orderBy(['name' => SORT_ASC])->all();
- $typeFix = \app\models\entity\Repairtypes::find()->all();
- $jobplanEntity = \app\models\entity\AsusgJobplan::findOne(['id'=> Yii::$app->request->get('asusgtask')]);
- //$locomotiveSeriesEntity = \app\models\entity\LocomotiveSeries::find()->orderBy(['name' => SORT_ASC])->all();
- //$projectsLocotechEntity = getLocomotiveList();
- $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(["!=", "uuid" , ''])->all();
- //$series = LocoSeries::GetAllNames();
- //var_dump(\Yii::$app->request->post());
- //var_dump($_FILES);
- //var_dump((!empty($_FILES)));
- $loadFileError = '';
- if(!empty($_FILES) and isset($_FILES["nameXmlFile"]["tmp_name"])) {
- $filePath = $_FILES["nameXmlFile"]["tmp_name"];
- $textlog2->msg = 'user : '. $id .", fileName : " . $_FILES["nameXmlFile"]["name"];
- $textlog2->save();
- $arrayThirdPoints =readXlsFileThirdTbl($filePath);
- $arraySecondCommands = readXlsFileSecondTbl($filePath);
-
- if ( 0 < count($arraySecondCommands)) {
- $loadFileError .= 'Загрузка файла прошла успешно. ';
- }
- //if ( writeInData($arrayCommands)) {
- $idsToItems = writeInDataWide($arraySecondCommands,$arrayThirdPoints); // запись в базу
- $itemsCommand = readXlsFileFirstTbl($filePath,$idsToItems);
- $idsToItems = writeInData($itemsCommand); // запись в базу
- if ( !empty($idsToItems) and $idsToItems) {
- $loadFileError = 'Запись прошла успешно.';
- } else {
- $loadFileError = 'Ошибка записи в базу.';
- }
- $textlog = new \app\models\entity\Textlog();
- $textlog->msg = 'user : '. $id .", loadStatus :" . $loadFileError;
- $textlog->save();
- //$arrayCommands = readXlsFileFirstTbl($filePath,$idsToItems);
-
- // echo "<pre>";
- // var_dump($itemsCommand);
- // echo "</pre>";
- }
- ?>
- <!-- HTML -->
- <div class="wrapper">
- <header class="main-header">
- <!-- Logo -->
- <a href="/asusg_plan.php" class="logo">
- <!-- mini logo for sidebar mini 50x50 pixels -->
- <span class="logo-mini"><b>A</b>LT</span>
- <!-- logo for regular state and mobile devices -->
- <span class="logo-lg"><b>АСУ</b>СГ</span>
- </a>
- <!-- Header Navbar: style can be found in header.less -->
- <nav class="navbar navbar-static-top">
- <!-- Sidebar toggle button-->
- <a href="#" class="sidebar-toggle" data-toggle="push-menu" role="button">
- <span class="sr-only">Toggle navigation</span>
- </a>
-
- </nav>
- </header>
- <!-- Left side column. contains the logo and sidebar -->
- <aside class="main-sidebar">
- <!-- sidebar: style can be found in sidebar.less -->
- <section class="sidebar">
- <!-- Sidebar user panel -->
- <!-- search form -->
- <form action="#" method="get" class="sidebar-form">
- <div class="input-group">
- <input type="text" name="q" class="form-control" placeholder="Search...">
- <span class="input-group-btn">
- <button type="submit" name="search" id="search-btn" class="btn btn-flat">
- <i class="fa fa-search"></i>
- </button>
- </span>
- </div>
- </form>
- <!-- /.search form -->
- <!-- sidebar menu: : style can be found in sidebar.less -->
- <?php require_once 'asusg_menu.php';?>
- </section>
- <!-- /.sidebar -->
- </aside>
- <!-- Content Wrapper. Contains page content -->
- <div class="content-wrapper">
- <!-- Content Header (Page header) -->
- <section class="content-header">
- <h1>Список работ</h1>
- <ol class="breadcrumb">
- <li><a href="#"><i class="fa fa-dashboard"></i> Home</a></li>
- <li class="active">Dashboard</li>
- </ol>
- </section>
- <!-- Main content -->
- <section class="content">
- <div class="row">
- <!-- START CUSTOM TABS -->
- <div class="col-md-12">
- <!-- Custom Tabs -->
- <!-- НАЧАЛО ПЕРВОЙ ВКЛАДКИ -->
- <div class="row">
- <div class="col-xs-5">
- <div class="box">
- <div class="box-header">
- <h3 class="box-title">Список проектов</h3>
- </div>
- <div class="box-body">
-
- <form id="addFileListTaskTypesAsusgForm" method='post' enctype="multipart/form-data">
- <div class="form-group">
- <label for="exampleInputFile">Загрузить список работ.</label>
- <input id="exampleInputFile" type="file" name="nameXmlFile">
- <?php if( '' != $loadFileError):?>
- <p><?php echo $loadFileError;?></p>
- <? endif;?>
- </div>
- <div class="box-footer">
- <button id="addFileListTaskTypesAsusgButton" type="submit" class="btn btn-primary">Загрузить</button>
- </div>
- </form>
-
- <form id="addNewTaskTypesAsusgForm">
- <table id="example2" class="table table-bordered table-hover">
- <tr>
- <td>
- <div class="row">
- <div class="col-xs-6">
- <div class="form-group">
- <label for="exampleInputEmail1">Серия локомотива</label>
- <select id="loco_series_command_h" name="loco_series" class="form-control select2" style="width: 100%;">
- <? foreach( $locomotiveSeriesEntity as $loco):?>
- <option value="<?php echo $loco->id?>"><?php echo $loco->name;?></option>
- <? endforeach;?>
- </select>
- </div>
- </div>
- <div class="col-xs-6">
- <div class="form-group">
- <label for="exampleInputPassword1">Вид ремонта</label>
- <select id="type_fix_id_h" name="typefix" class="form-control select2" style="width: 100%;">
- <? foreach( $typeFix as $type):?>
- <option data_id="1" value="<?php echo $type->id;?>"><?php echo $type->name;?></option>
- <? endforeach;?>
- </select>
- </div>
- </div>
- </div>
- </td>
- <td>
- </td>
- </tr>
- <thead>
- <tr>
- <th>Задача</th>
- <!--<th>Вид ремонта</th>-->
- <th>Действие</th>
- </tr>
- </thead>
- <tbody>
- <tr>
- <td>
- <div class="form-group">
-
- <input class="form-control" id="AAAAA" name="taskName" type="text">
- </div>
- </td>
- <!--<td>
- <div class="form-group">
- <select id="type_fix_id" name="typefix" class="form-control select2" style="width: 100%;">
- <? //foreach( $typeFix as $key => $type):?>
- <option data_id="1" value="<?php //echo $key;?>"><?php //echo $type;?></option>
- <? //endforeach;?>
- </select>
- </div>
- </td>-->
- <td><button id="addNewTaskTypesAsusg" type="button" class="btn btn-block btn-primary " data_id="<?php echo $template->asusg_id;?>">Добавить</button></td>
- </tr>
- <? foreach( $asusgJobplanEntity as $key => $type):?>
- <tr class="param_for_template" data_id='<?php echo $type->id?>' >
- <td><?php echo $type->name;?></td>
- <!--<td><?php //echo $typeFix[$type->repair_type]?></td>-->
- <td>
- <!--<button id="removeProjectTypesAsusg" type="button" class="btn btn-block btn-danger" data_id="<?php //echo $type->loco_serie_id;?>@<?php //echo $type->repair_type;?>">Удалить</button>--></td>
- </tr>
- <? endforeach;?>
- </tbody>
- </table>
- </form>
-
- <div class="box box-default collapsed-box">
- <div class="box-header with-border">
- <h3 class="box-title">Теститка для загрузки файла</h3>
- <div class="box-tools pull-right">
- <button type="button" class="btn btn-box-tool" data-widget="collapse"><i class="fa fa-plus"></i>
- </button>
- </div>
- <!-- /.box-tools -->
- </div>
- <!-- /.box-header -->
- <div class="box-body" style="display: none;">
- <form id="addFileListTaskTypesAsusgForm2" method='post' enctype="multipart/form-data">
- <div class="form-group">
- <label for="exampleInputFile">Загрузить список работ.</label>
- <input id="exampleInputFile" type="file" name="nameXmlFile2">
- <?php if( '' != $loadFileError):?>
- <p><?php echo $loadFileError;?></p>
- <? endif;?>
- </div>
- <div class="box-footer">
- <button id="addFileListTaskTypesAsusgButton2" type="submit" class="btn btn-primary">Загрузить</button>
- </div>
- </form>
- </div>
- <!-- /.box-body -->
- </div>
-
- </div>
- </div>
- </div>
- <div class="col-xs-7">
- <div class="box">
- <div class="box-header">
- <h3 class="box-title">Список проектов</h3>
- </div>
- <? //foreach( $asusgJobplanEntity as $template):?>
- <div class="box box-primary">
- <div class="box-header with-border">
-
- <div class="box-tools pull-right">
- <button type="button" class="btn btn-box-tool" data-widget="collapse">
- <i class="fa fa-minus"></i>
- </button>
- </div>
- </div>
- <div class="box-body">
- <div class="row">
- <div class="col-xs-6">
- <h3 class="box-title">
- <?php echo $jobplanEntity->name?>
- </h3>
- </div>
- <div class="col-xs-3 col-xs-offset-2">
- <div class="form-group">
- <label for="exampleInputPassword1">Сохранить команду</label>
- <button type="button" class="btn btn-block btn-warning saveTaskTypesAsusg" data_id="<?php echo \Yii::$app->request->get('asusgtask');?>" data_projecttype="<?php echo $asusgProjecttypeEntity->id;?>">Сохранить</button>
- </div>
- </div>
- <div class="col-xs-5">
- <div class="form-group">
- <div class="form-group">
- <label for="exampleInputPassword1">Список команд</label>
- <select id="listJobForAsusg" class="form-control select2" style="width: 100%;">
- <?php foreach( $tasktypesEntity as $plan):?>
- <option value="<?php echo $plan->id?>" data_id_option="<?php echo $plan->id?>"><?php echo $plan->name;?></option>
- <?php endforeach;?>
- </select>
- </div>
- </div>
-
-
-
- </div>
- <div class="col-xs-3">
- <label for="exampleInputPassword1">Добавить команду</label>
- <button id="bindNewTaskTypesAsusg" type="button" class="btn btn-block btn-primary" task_id="<?php echo $jobplanEntity->id;?>">Добавить</button>
- </div>
-
-
- <div class="col-xs-8">
- <ul id="sortable" class="list-unstyled list_asusg_command_id sortable">
- <? $i = 100;?>
- <?php foreach ($asusgJob2CommandEntity as $item):?>
- <? //var_dump($item->asusg_job_id .'=='. \Yii::$app->request->get('asusgtask'));?>
- <? if ($item->asusg_job_id == \Yii::$app->request->get('asusgtask')):?>
- <li id="li_<?php echo \Yii::$app->request->get('asusgtask');?>_<?php echo $item->smopp_cmd_id;?>_<?php echo $i;?>" class="ui-state-default" data_id="<?php echo \Yii::$app->request->get('asusgtask');?>_<?php echo $item->smopp_cmd_id;?>_<?php echo $i;?>" select_id="listJobForAsusg_<?php echo $i?>"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
- <div class="box box-warning">
- <div class="box-header with-border">
- <h3 class="box-title"><?php echo $item->tasktypes->name;?></h3>
- <div class="box-tools pull-right">
- <button type="button" class="btn btn-box-tool remove_command_button_asusg" data-widget="remove" data_id="<?php echo \Yii::$app->request->get('asusgtask');?>_<?php echo $item->smopp_cmd_id;?>_<?php echo $i;?>"><i class="fa fa-times"></i></button>
- </div>
- <div class="form-group">
- <label for="exampleInputPassword1">Список должностей</label>
- <select id="listJobForAsusg_<?php echo $i?>" class="form-control select2" style="width: 100%;">
- <?php foreach( $jobEntity as $job):?>
- <option value="<?php echo $job->id?>" data_id_option="<?php echo $job->id?>" <? echo ( $job->id == $item->jobtype_id)?'selected="selected"':'';?>><?php echo $job->name;?></option>
- <?php endforeach;?>
- </select>
- </div>
- </div>
- </div>
- </li>
- <? endif;?>
- <?php $i++;?>
- <?php endforeach;?>
- </ul>
- </div>
-
- </div>
- </div>
-
- <? //endforeach;?>
- <!-- /.box-header -->
-
-
- </div>
- <!-- /.box-body -->
- </div>
- </div>
- </div>
- </div>
- </div>
- </section>
- <!-- /.content -->
- </div>
-
- <!-- Add the sidebar's background. This div must be placed
- immediately after the control sidebar -->
- <div class="control-sidebar-bg"></div>
- </div>
- <!-- HTML -->
- <div class="ASU_select_map0" style="display:none">
- <select class="form-control select hide_field_select_0" style="width: 100%;" name="newListJ_<? echo $i;?>" id="listJobForAsusg_<?php echo $i?>">
- <?php foreach( $jobEntity as $job):?>
- <option value="<?php echo $job->id?>" data_id_option="<?php echo $job->id?>" ><?php echo $job->name;?></option>
- <?php endforeach;?>
- </select>
- </div>
- <!--<select id="listJobForAsusg" class="form-control select2" style="width: 100%;">
-
- </select>-->
- <!-- End Document
- –––––––––––––––––––––––––––––––––––––––––––––––––– -->
-
- <script src="/lte/bower_components/jquery/dist/jquery.min.js"></script>
- <!-- jQuery UI 1.11.4 -->
- <script src="/lte/bower_components/jquery-ui/jquery-ui.min.js"></script>
- <!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip -->
- <script>
- $.widget.bridge('uibutton', $.ui.button);
- </script>
- <!-- Bootstrap 3.3.7 -->
- <script src="/lte/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
- <!-- Morris.js charts -->
- <script src="/lte/bower_components/raphael/raphael.min.js"></script>
- <script src="/lte/bower_components/morris.js/morris.min.js"></script>
- <!-- Sparkline -->
- <script src="/lte/bower_components/jquery-sparkline/dist/jquery.sparkline.min.js"></script>
- <!-- jvectormap -->
- <script src="/lte/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js"></script>
- <script src="/lte/plugins/jvectormap/jquery-jvectormap-world-mill-en.js"></script>
- <!-- jQuery Knob Chart -->
- <script src="/lte/bower_components/jquery-knob/dist/jquery.knob.min.js"></script>
- <!-- daterangepicker -->
- <script src="/lte/bower_components/moment/min/moment.min.js"></script>
- <script src="/lte/bower_components/bootstrap-daterangepicker/daterangepicker.js"></script>
- <!-- datepicker -->
- <script src="/lte/bower_components/bootstrap-datepicker/dist/js/bootstrap-datepicker.min.js"></script>
- <!-- Bootstrap WYSIHTML5 -->
- <script src="/lte/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js"></script>
- <!-- Slimscroll -->
- <script src="/lte/bower_components/jquery-slimscroll/jquery.slimscroll.min.js"></script>
- <!-- FastClick -->
- <script src="/lte/bower_components/fastclick/lib/fastclick.js"></script>
- <!-- AdminLTE App -->
- <script src="/lte/dist/js/adminlte.min.js"></script>
- <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
- <script src="/lte/dist/js/pages/dashboard.js"></script>
- <!-- AdminLTE for demo purposes -->
- <script src="/lte/dist/js/demo.js"></script>
- <script src="/loco.js"></script>
- <script src="/mail.js"></script>
- <script src="/lte/bower_components/select2/dist/js/select2.full.min.js"></script>
- <script>
- $( function() {
- $( ".sortable" ).sortable();
- $( ".sortable" ).disableSelection();
- } );
- </script>
- </body>
- </html>
- <?php
- function GetEnterForm()
- {
- echo "<article>
- <form method='post' action='?login'>
- <table>
- <tr>
- <td width=70>
- <b>Login</b>
- </td>
- <td>
-
- </td>
- <td>
- <input type='text' name=login value=''><br/>
- </td>
- </tr>
- <tr>
- <td>
- <b>Password </b>
- </td>
- <td>
-
- </td>
- <td>
- <input type='password' name=pass value=''>
- </td>
- </tr>
- <tr>
- <td></td>
- <td> </td>
- <td>
- <input type='submit' value='Enter'>
- </td>
- </tr>
- </table>
- </form>
- </article>";
- }
- function getLocomotiveList(){
-
- $result = [];
- //var_dump($companyID);
- $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(['company' => 2] )->orderBy(['id' => SORT_DESC])->all();
- $listArray = [];
- foreach( $projectsLocotechEntity as $item){ //var_dump($item->projecttypes->name);echo "\n";
- //$tempArray = GetTasksForProject($item->id);
- $status = GetProjectStatus($item->id);
- if ($status != 2 && $status != 1) {continue;}
- $countDone = ['done' => 0, 'all' => 0 ];
- foreach( GetTasksForProject($item->id) as $proj) { //var_dump($proj);echo "<br>";
- $countDone['all']++;
- $tempArray = $proj;
- $tempArray['status'] = CheckAcceptedStatus($proj);
- $tempArray['name'] = GetTaskNameAndDesc($proj['type'])[0];
- //$tempArray['listAccounts'] = $this->getAccountListForTask($proj['type']);
- if ( 5 == $tempArray['status'] ) {$countDone['done']++;}
- //$countDone['all'] ." / " . $countDone['done'];
- $listArray[] = $tempArray;
-
- }
- $result[$item->id]['countDone'] = [ 'done' => $countDone['done'], 'all' => $countDone['all'] ];
- //$tempArray['name'] = GetTaskNameAndDesc($tempArray['type'])[0];
-
- $result[$item->id]['arr'] = $listArray;//GetTasksForProject($item->id);
- $result[$item->id]['obj'] = $item;
- $listArray = [];
- }
- //exit;
- return $result;
-
- }
- function CheckAcceptedStatus($task) {
-
- $result = false;
- $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
- from (select count(t.id) as total,
- sum(if(t.accepted_time is not null, 1, 0)) as accepted,
- sum(if(t.finished_time is not null, 1, 0)) as finished,
- sum(if(t.finished_time is null, if(timestampdiff(MINUTE, t.accepted_time, NOW()) > tt.time_to_complete_minutes, 1, 0), 0)) as attention
- from tasks t
- right join tasktypes tt on t.type = tt.id
- where t.parent_id = ".$task['id'].") tx;";
- $result = \Yii::$app->db->createCommand($query)->queryAll();
- $result = $result[0]["taskstatus"];
-
- return $result;
- }
- // ПРОЕКТЫ
- function readXlsFileFirstTbl( $filePath, $arrayIds){
-
- $Excel = \PHPExcel_IOFactory::load($filePath);
- //$maxCell = $Excel->setActiveSheetIndex(0);
- $maxCell = $Excel->setActiveSheetIndexByName('Проект');
- $maxCell = $Excel->getActiveSheet()->getHighestRowAndColumn();
- $data = $Excel->getActiveSheet()->rangeToArray('A6:'. $maxCell['column'].'6'. $maxCell['row']);
-
- $loco_serie = $Excel->getActiveSheet()->getCell('B1')->getValue();
- $repair = $Excel->getActiveSheet()->getCell('B2')->getValue();
- $repair_id = \app\models\entity\Repairtypes::findOne(['name' => $repair]);
- $loco_serie_id = \app\models\entity\locomotiveSeries::findOne(['name' => $loco_serie]);
- $asusgProjecttypeEntity = \app\models\entity\AsusgProjecttype::findOne(['repair_type' => $repair_id,'loco_serie_id' => $loco_serie_id]);
-
- $asusgProjecttypeEntity_id = $asusgProjecttypeEntity->id;
- if ( null == $asusgProjecttypeEntity->id) {
- $asusgProjecttypeEntity2 = new \app\models\entity\AsusgProjecttype();
- $asusgProjecttypeEntity2->repair_type = $repair_id->id;
- $asusgProjecttypeEntity2->loco_serie_id = $loco_serie_id->id;
- $asusgProjecttypeEntity2->save();
- $asusgProjecttypeEntity_id = $asusgProjecttypeEntity2->id;
- }
-
- $data = array_map('array_filter', $data);
- $data = array_filter($data);
- $result = [];
- $temArray = [];
- $arrayIdsTemp = [];
- foreach( $arrayIds as $pre_item){
-
- $arrayIdsTemp[$pre_item['id']][] = $pre_item;
- }
- $eee = 0;
- $point = 0;
- $rrr2 = 1;
- //$namesArrayJobPlan = [];
- $JobPlanCount = '';
-
- $tempArray = [];
- $newData = [];
- foreach($data as $item){
- $count = 0;
- $tempIt = $item[0];
- if (!in_array ($item[0],$tempArray)){
- $newData[] = $item;
- } else {
- foreach ( $tempArray as $tempItem){
- if ($item[0] == $tempItem ){
- $count++;
- }
- }
- $item[0] .= ' ' . $count;
- $newData[] = $item;
- }
- $tempArray[] = $tempIt;
- }
-
- foreach( $newData as $key => $item){
-
- foreach( $item as $key => $i) {
- if ( 0 == $key ){ // такого вы еще невидели ))
- $point = trim($i);
- }
- if ( 0 == $key ){ // такого вы еще невидели ))
-
- $countModel = \app\models\entity\AsusgJobplan::find()->where(['name' => $point])->count();
- if ( 0 == $countModel) {
- $modelJP = new \app\models\entity\AsusgJobplan();
- $modelJP->name = trim($point . $JobPlanCount);
- $modelJP->save();
- }
-
- $asusgJobplanEntity = \app\models\entity\AsusgJobplan::findOne(['name' => $point]);
- $temArray['asusg_id'] = $asusgJobplanEntity->id;
- $temArray['asusg_projecttype_id'] = $asusgProjecttypeEntity_id;
- $temArray['cmd_order'] = $eee;
-
- //$namesArrayJobPlan[] = $point;
-
- }
- if (1 == $key){
- $sectionType = \app\models\HelperModel::clearSectionString($i,\Yii::$app->params['maskArray']);
- $Jobplan = \app\models\entity\AsusgJobplan::findOne($asusgJobplanEntity->id);
- $Jobplan->sections = $sectionType;
- $Jobplan->save();
- }
- foreach( $arrayIdsTemp[$i] as $key2 => $itemId) {
-
- $rrr2++;
- $temArray['smopp_ids'][] = ['id'=>$itemId['id'], 'smop_id' => $itemId['cmd_id'],'job_type_id' => $itemId['job_type_id']];
- }
- $eee++;
- }
- $result[] = $temArray;
- $temArray = [];
- }
-
- //echo "<pre>";
- //var_dump($itemId);
- // var_dump($result);
- //echo "</pre>";
-
- //echo "<hr>";
- //exit;
- return $result;
- }
-
-
-
- /*
- предыдущая версия
- function readXlsFileFirstTbl( $filePath, $arrayIds){
-
- $Excel = \PHPExcel_IOFactory::load($filePath);
- $maxCell = $Excel->getActiveSheet()->getHighestRowAndColumn();
- $data = $Excel->getActiveSheet()->rangeToArray('A6:E6'. $maxCell['row']);
- $loco_serie = $Excel->getActiveSheet()->getCell('B1')->getValue();
- $repair = $Excel->getActiveSheet()->getCell('B2')->getValue();
- $repair_id = \app\models\entity\Repairtypes::findOne(['name' => $repair]);
- $loco_serie_id = \app\models\entity\locomotiveSeries::findOne(['name' => $loco_serie]);
- $asusgProjecttypeEntity = \app\models\entity\AsusgProjecttype::findOne(['repair_type' => $repair_id,'loco_serie_id' => $loco_serie_id]);
-
- $asusgProjecttypeEntity_id = $asusgProjecttypeEntity->id;
- if ( null == $asusgProjecttypeEntity->id) {
- $asusgProjecttypeEntity2 = new \app\models\entity\AsusgProjecttype();
- $asusgProjecttypeEntity2->repair_type = $repair_id->id;
- $asusgProjecttypeEntity2->loco_serie_id = $loco_serie_id->id;
- $asusgProjecttypeEntity2->save();
- $asusgProjecttypeEntity_id = $asusgProjecttypeEntity2->id;
- }
-
- $data = array_map('array_filter', $data);
- $data = array_filter($data);
- $result = [];
- $temArray = [];
- $arrayIdsTemp = [];
- foreach( $arrayIds as $pre_item){
-
- $arrayIdsTemp[$pre_item['id']][] = $pre_item;
- }
-
- $eee = 0;
- $point = 0;
- $rrr2 = 1;
- $namesArrayJobPlan = [];
- $JobPlanCount = '';
-
-
- $tempArray = [];
- $newData = [];
- foreach($data as $item){
- $count = 0;
- $tempIt = $item[0];
- if (!in_array ($item[0],$tempArray)){
- $newData[] = $item;
- } else {
- foreach ( $tempArray as $tempItem){
- if ($item[0] == $tempItem ){
- $count++;
- }
- }
- $item[0] .= ' ' . $count;
- $newData[] = $item;
- }
- $tempArray[] = $tempIt;
- }
- foreach( $newData as $key => $item){
-
- foreach( $item as $key => $i) {
- if ( 0 == $key ){ // такого вы еще невидели ))
- $point = trim($i);
- }
- if ( 0 == $key ){ // такого вы еще невидели ))
-
- $countModel = \app\models\entity\AsusgJobplan::find()->where(['name' => $point])->count();
- if ( 0 == $countModel) {
- $modelJP = new \app\models\entity\AsusgJobplan();
- $modelJP->name = trim($point . $JobPlanCount);
- $modelJP->save();
- }
-
- $asusgJobplanEntity = \app\models\entity\AsusgJobplan::findOne(['name' => $point]);
- $temArray['asusg_id'] = $asusgJobplanEntity->id;
- $temArray['asusg_projecttype_id'] = $asusgProjecttypeEntity_id;
- $temArray['cmd_order'] = $eee;
-
- $namesArrayJobPlan[] = $point;
-
- }
- foreach( $arrayIdsTemp[$i] as $key2 => $itemId) {
-
- // if ( 0 == $key2 ){ //echo $key2; echo "<br>";
-
- //$temArray['smopp_ids'][] = $arrayIds[$i];
-
- //} else {
- $rrr2++;
- //$temArray['smopp_ids'][] = ['smop_id' => $arrayIds['cmd_id'],'job_type_id' => $arrayIds['job_type_id']];
- $temArray['smopp_ids'][] = ['smop_id' => $itemId['cmd_id'],'job_type_id' => $itemId['job_type_id']];
- //$temArray['job_type_id'][] = $arrayIds[$i]['job_type_id'];
- //echo "<pre>@";
- //var_dump($result);
- //echo "<hr>";
- //var_dump($eee);
- //echo "</pre>";
- //}
- }
- $eee++;
-
- }
- $result[] = $temArray;
- $temArray = [];
- }
- //echo "<pre>";
- //var_dump($result);
- //echo "<hr>";
- // var_dump($result);
- //echo "</pre>";
- return $result;
- }
- */
- // КОНТРОЛЬНЫЕ КАРТЫ
- function readXlsFileThirdTbl($filePath){
- $param = ['Множественный выбор' => 2,'Выбор' => 1,'Ввод значения' => 3 ];
- $Excel = \PHPExcel_IOFactory::load($filePath);
- //$maxCell = $Excel->setActiveSheetIndex(2);
- $maxCell = $Excel->setActiveSheetIndexByName('Контрольные карты');
- $maxCell = $Excel->getActiveSheet()->getHighestRowAndColumn();
- $data = $Excel->getActiveSheet()->rangeToArray('A3:H3' . $maxCell['row']);
- $result = [];
- foreach( $data as $item){
- $tempArray = [];
- foreach($item as $key => $points){
- if ( $key > 3 && null != $points){
- $tempArray[] = $points;
- }
- }
- $result[$item[0]][] = [$item[0],$item[1],$item[2],$param[$item[3]],$tempArray];
- }
- //echo "<pre>";
- // var_dump($result);
- //echo "</pre>";
- //exit;
- return $result;
- }
- // СОСТАВ КОМАНД
- function readXlsFileSecondTbl($filePath){
-
- $Excel = \PHPExcel_IOFactory::load($filePath);
- //$maxCell = $Excel->setActiveSheetIndex(1);
- $maxCell = $Excel->setActiveSheetIndexByName('Команды');
- $maxCell = $Excel->getActiveSheet()->getHighestRowAndColumn();
- $data = $Excel->getActiveSheet()->rangeToArray('A3:F3' . $maxCell['row']);
- $paramArray = ['0' => 'initiator','1' => 'command_name', '2' =>'jobtype','3' => 'time_to_finish','4' =>'confirm_type','5' =>'control_map_id'];
- $data = array_map('array_filter', $data);
- $data = array_filter($data);
- $result = [];
- $temArray = [];
- $l = 1;
- foreach( $data as $k => $item){
-
- foreach( $item as $key => $i) {
- if( 0 == $key) {
- global $id;
- $temArray['control_map_id'] = '';
- $temArray[$paramArray[$key]] = $id;
- continue;
- }
- $temArray['control_map_id'] = '';
- $temArray[$paramArray[$key]] = $i;
- }
- $arrTemp = explode(',',$temArray[jobtype]);
- if ( 1 < count($arrTemp) ){
- foreach($arrTemp as $it){
- $temArray['jobtype'] = trim($it);
- $temArray['id'] = $l;
- $result[]= $temArray;
- }
- continue;
- }
- $temArray['id'] = $l;
- $l++;
- $result[]= $temArray;
- }
- //echo "<pre>";
- // var_dump($result);
- //echo "</pre>";
- //exit;
- return $result;
-
- //exit;
- }
- /*
- первоначальная версия
- function readXlsFileSecondTbl($filePath){
-
- $Excel = \PHPExcel_IOFactory::load($filePath);
- $maxCell = $Excel->getActiveSheet()->getHighestRowAndColumn();
- $data = $Excel->getActiveSheet()->rangeToArray('G6:L6' . $maxCell['row']);
- $paramArray = ['0' => 'initiator','1' => 'command_name', '2' =>'jobtype','3' => 'time_to_finish','4' =>'confirm_type','5' =>'control_map_id'];
- $data = array_map('array_filter', $data);
- $data = array_filter($data);
- $result = [];
- $temArray = [];
- $l = 1;
- foreach( $data as $k => $item){
-
- foreach( $item as $key => $i) {
- if( 0 == $key) {
- global $id;
- $temArray['control_map_id'] = '';
- $temArray[$paramArray[$key]] = $id;
- continue;
- }
- $temArray['control_map_id'] = '';
- $temArray[$paramArray[$key]] = $i;
- }
- $arrTemp = explode(',',$temArray[jobtype]);
- if ( 1 < count($arrTemp) ){
- foreach($arrTemp as $it){
- $temArray['jobtype'] = trim($it);
- $temArray['id'] = $l;
- $result[]= $temArray;
- }
- continue;
- }
- $temArray['id'] = $l;
- $l++;
- $result[]= $temArray;
- }
- //echo "<pre>";
- // var_dump($result);
- //echo "</pre>";
- return $result;
-
- //exit;
- }
- */
- function writeInData($arrayCommands) {
- //echo '<pre>';
- //var_dump($arrayCommands);
- //echo '</pre>';
- //return true;
- $result = false;
- if (!empty($arrayCommands)){
- foreach( $arrayCommands as $command){
- \app\models\entity\AsusgJob2Command::deleteAll(['asusg_projecttype_id' => $command['asusg_projecttype_id']]);
- //\app\models\entity\AsusgJob2Project::deleteAll(['asusg_projecttype_id' => $command['asusg_projecttype_id']]);
- break;
-
- }
-
- $k = 0;
- foreach( $arrayCommands as $command){
- //var_dump($command); echo "<br>";
- /*
- $asusgJob2ProjectEntity = new \app\models\entity\AsusgJob2Project();
- $asusgJob2ProjectEntity->asusg_jobplan_id = $command['asusg_id'];
- $asusgJob2ProjectEntity->asusg_projecttype_id = $command['asusg_projecttype_id'];
- $asusgJob2ProjectEntity->job_order = $k;
- $k++;
- try {
- $asusgJob2ProjectEntity->save();
- }
- catch (\yii\db\Exception $exception) {
- $loadFileError .= 'Повторная запись.';
- //return false;
- }
- */
- //echo "<pre>";
- // var_dump($command);
- //echo "</pre>";
- foreach( $command['smopp_ids'] as $key => $com){
- $asusgJob2CommandEntity = new \app\models\entity\AsusgJob2Command();
- $asusgJob2CommandEntity->asusg_job_id = $command['asusg_id'];
- $asusgJob2CommandEntity->asusg_projecttype_id = $command['asusg_projecttype_id'];
- $asusgJob2CommandEntity->smopp_cmd_id = $com["smop_id"];
- $asusgJob2CommandEntity->jobtype_id = $com["job_type_id"];
- $asusgJob2CommandEntity->cmd_order = $command["cmd_order"];//$key;
- $asusgJob2CommandEntity->job_order = $k;
- $asusgJob2CommandEntity->original_order = $com["id"];
- //echo "<pre>";
- // var_dump($com["id"]);
- //echo "</pre>";
- try {
- $asusgJob2CommandEntity->save();
- }
- catch (\yii\db\Exception $exception) {
- $loadFileError .= 'Повторная запись.';
- //return false;
- }
- }
- $k++;
-
- $result = true;
- }
- }
-
- return $result;
- }
-
- function writeInDataWide($arrayCommands,$arrayThirdPoints) {
- global $link;
- $result = false;
- $tempArr = [];
- /*
- if (!empty($arrayCommands)){
- foreach( $arrayCommands as $command){
- foreach( $command['smopp_ids'] as $key => $com){
- $asusgJob2CommandEntity = new \app\models\entity\AsusgJob2Command();
- $asusgJob2CommandEntity->asusg_job_id = $command['asusg_id'];
- $asusgJob2CommandEntity->smopp_cmd_id = $com;
- $asusgJob2CommandEntity->cmd_order = $key;
- try {
- $asusgJob2CommandEntity->save();
- }
- catch (\yii\db\Exception $exception) {
- $loadFileError .= 'Повторная запись.';
- return false;
- }
-
- //var_dump($command['asusg_id'],$com,$key); echo "<br>";
- }
- $result = true;
- }
- }*/
- $i = 1;
- $controlMapTempArray = [];
- foreach( $arrayCommands as $command){
- $command['time_to_finish'] = round($command['time_to_finish']);
- $command['jobtype'] = \app\models\HelperModel::stripWhitespaces($command['jobtype']);
- $query = "call `asusg_add_command_type`( " . $command['initiator'] . ",'" . $command['command_name'] . "','" . $command['jobtype'] . "'," . $command['time_to_finish'] . ",'" . $command['confirm_type'] . "'," . (int)$command['control_map_id'].", @cmd_id, @job_type_id)";
-
- mysqli_query($link, "SET @cmd_id = '', @job_type_id = ''");
- $res = mysqli_query($link, $query);
- $res = mysqli_query($link, "SELECT @cmd_id as _asusg_add_command_type_out, @job_type_id as _asusg_add_command_type_out2");
- $row = $res->fetch_assoc();
- $tempArr[$i] = [ 'cmd_id' => $row['_asusg_add_command_type_out'] , 'job_type_id' => $row['_asusg_add_command_type_out2'],'id' => $command['id']];
-
- $querydel = "delete from checkpoint_types_for_tasks where tasktype_id = " . $row['_asusg_add_command_type_out'] . " and cp_type_id > 0";
- mysqli_query($link, $querydel);
- // CHECKPOINTS
- if ( isset($command['control_map_id']) and null != $command['control_map_id']) {
- foreach ($arrayThirdPoints[$command['control_map_id']] as $checpoint){
- mysqli_query($link, "SET @checkoipt_id = ''");
-
- $query2 = "call asusg_add_checkpoint_type(".$row['_asusg_add_command_type_out'].",'".$checpoint[2]."',".$checpoint[3].", @checkpoint_id)";
- //$query2 = "call asusg_add_checkpoint_type(".$row['_asusg_add_command_type_out'].",'" . $checpoint[0] . ". ".$checpoint[2]."',".$checpoint[3].", @checkpoint_id)";
-
- $res2 = mysqli_query($link, $query2);
- $res2 = mysqli_query($link, "SELECT @checkpoint_id as checkpoint");
- $row2 = $res2->fetch_assoc();
- foreach($checpoint[4] as $p) {
- $query3 = "call asusg_add_checkbox_to_checkpoint(" . $row2['checkpoint'] . ",'" . $p . "')";
-
- mysqli_query($link, $query3);
-
- //echo "<pre>";
- //var_dump("call asusg_add_checkbox_to_checkpoint(" . $row2['checkpoint'] . ",'" . $p . "')");
- //echo "</pre>";
- }
-
-
-
- }
-
-
- }
-
-
-
-
- // CHECKPOINTS
-
- $i++;
- //\Yii::$app->db->createCommand($query)->queryAll();
- }
- //var_dump(gettype($res));
- //echo "<pre>";
- //var_dump($tempArr);
- //echo "</pre>";
- //exit;
- return $tempArr;
- }
- ?>
|