getSectionNumber(); } } else { //буква секции на кириллице CheckSection("А", $loco_type, $loco_number, $А); CheckSection("Б", $loco_type, $loco_number, $Б); CheckSection("В", $loco_type, $loco_number, $В); CheckSection("Г", $loco_type, $loco_number, $Г); } $projs = $entityManager->getRepository('Project')->findBy(array('company' => $companyID, 'loco_number' => $loco_number, 'loco_type' => $loco_type)); $nostart = false; foreach ($projs as $proj) { //родной статус похоже не проставляется при выполнении if (intval(GetProjectStatus($proj->id)) < 5 && $proj->getAction() == $action_num) { $nostart = $proj->id; echo "Ошибка: для данного типа уже запущен проект $nostart с тем же локомотивом"; break; } } if (!$nostart && $loco_type) { $urgent = ($urgent == "on") ? 1 : 0; //$qstr = "insert into projects_locotech (action, company, status, loco_type,loco_number,depo,depo_service, created, tasks ) values (" . $action_num . "," . $companyID . ",1,'$loco_type',$loco_number,'$depo','$depo_service', NOW(),'$task_string' )"; $qstr = "insert into projects_locotech (action, company, status, loco_type,loco_number,depo,depo_service, created, urgent) values (" . $action_num . "," . $companyID . ",1,'$loco_type','$loco_number','$depo','$depo_service', NOW(), $urgent)"; //echo "qstr $qstr "; mysqli_query($link, $qstr); $activeid = mysqli_insert_id($link); $project = Project::Find($activeid); if ($project != null) { /** * @var $project Project */ if ($section) { $project->section = $section; $project->Save(); } } if ($activeid > 0) { echo "Запись добавлена!"; $sort = 1; if (StartProject($action_num, $activeid)) TasksAssign('', true, $assign_id); } else echo "Ошибка ввода данных!"; } } else if ($new == "3") { echo "Проект $del_id и его задачи удалены!"; //CleanTasks($del_id); $textlog = new app\models\entity\Textlog(); $textlog->msg = "Пользователь: ". $id.", Попытка удалить проект (номер): " . $del_id; $textlog->save(); $companyIDfake = (int)$companyID + 1000; echo "UPDATE projects_locotech SET `company`=".$companyIDfake ." WHERE `id` = $del_id"; //die(); OCSremoveproject($del_id); $project = Project::Find($del_id); if (isset($project)) $project->reopenTasks(); mysqli_query($link, "UPDATE projects_locotech SET `company`=".$companyIDfake." WHERE `id`= $del_id"); //mysqli_query($link, "delete from projects_locotech where id = $del_id"); } // else if ($new == "4") { // echo "

Не предоставлен образец входного документа!

"; //} else if ($new == "5") { //echo "Все проекты удалены!"; echo "Удаление всех проектов временно отключено! Обратитесь к разработчику!"; // $projs = $entityManager->getRepository('Project')->findAll(); // foreach ($projs as $proj) { // CleanTasks($proj->id); // mysqli_query($link, "delete from projects_locotech where id = $proj->id"); // } } if (!isset($sort)) { $sort = $_SESSION['sorttasks']; if (!isset($sort)) { $sort = 1; } } $_SESSION['sorttasks'] = $sort; echo ""; $active1 = ''; $active2 = ''; $active3 = ''; $active4 = ''; $active5 = ''; switch ($sort) { case '1': $active1 = 'control-btn_active'; break; case '2': $active2 = 'control-btn_active'; break; case '3': $active2 = 'control-btn_active'; break; case '4': $active4 = 'control-btn_active'; break; case '5': $active5 = 'control-btn_active'; break; } if (!$project_limit) $project_limit = '20'; echo "

Проекты

Показывать на странице:

search
"; echo '
'; echo '
+
Новый проект

'; EchoProjects($sort); echo '
'; echo '
'; //PARENT TITLE IN CHILDREN LIST if ($new == 1) AddNewProject(); else if ($activeid && $activeid != "undefined") { // $proj = GetProject($activeid); /** * @var $proj Project */ $proj = Project::Find($activeid); if ($proj != null) { $action = FindAction($proj->getAction()); $actionid = $action['id']; // $types = ProjectType::GrabTasktypesByProjectType($actionid); $acname = $action['name']; // $section = $proj->section; // if ($section != null) { // $loco_type = $section->locomotive_series;//$proj['loco_type']; // $loco_number = $section->getSectionNumber();//intval($proj['loco_number']); // } $loco_number = $proj->loco_number; $depo = $proj->getDepo(); $depos = $proj->getDepoService(); if ($activeid) { $project_comment = ''; $cmt = $proj->getUuid(); if ('' != $cmt) { $project_comment = "Комментарий: ".$cmt."
"; } echo "

$activeid. $acname

". $project_comment ." Тип проекта: $actionid. $acname
Локомотив серии: $loco_type № $loco_number
Депо приписки: $depo
Депо обслуживания: $depos

"; echo "Созданные задачи:

"; // $tasks = GetTasksForProject($activeid); $tasks = $proj->getTasks(); // ПОЛУЧЕНИЕ XML НАЧАЛО $parents = $entityManager->getRepository('Task')->findBy(array('parent_id' => 0, 'input_id' => $activeid), array('id' => 'DESC')); $tasktypesIds = GrabTasktypesIDs(); $array_children = []; $array_parent = []; foreach ($parents as $parent) { if (!in_array(intval($parent->type), $tasktypesIds)) { continue; } $status = GetTaskStatus($parent->id); if ($status == 5) { $array_parent[$parent->id] = $parent; $children = $entityManager->getRepository('Task')->findBy(array('parent_id' => $parent->id)); $array_children[$parent->id] = $children; } } $array_type = []; $array_id = []; $_SESSION['array_children'] = $array_children; $_SESSION['array_parent'] = $array_parent; $arrayTasksId = []; foreach ($tasks as $task) { $type = $task->type; $id = $task->id; $_SESSION['actid'] = $id; foreach ($array_children as $parent_id => $children) { if ($id == $parent_id) { foreach ($children as $res1) { $array_type[] = $res1->type; $array_id[] = $res1->id; } } } $xmltype = implode(',', $array_type); $xmlid = implode(',', $array_id); $name = GetTaskNameAndDesc($type)[0]; $sortTask = GetTaskStatus($id); if ($task->parent_id == '0') { // echo $task->id; $arrayTasksId[] = $id; //echo "$id [$sort]. $name
"; echo "$id. $name
"; echo $task->text . "
"; // if ($task->getAccount() != null) { if ($sortTask < 5 && $sortTask > 1) { if ($task->status == 2) { $sname = "Выдана"; $ass = "[".TimeString($task->assigned)."]"; } else if ($task->status == 3) { $sname = "Принята"; $ass = "[выдана: ".TimeString($task->assigned)."]";; } $sname = "$sname $ass: "; } else if ($sortTask <= 1) $sname = "Не выдана "; else $sname = "Выполнена: "; if ($task->getAccount() != null) { $assignee_names_parent = $task->getAccount()->name; echo "$sname $assignee_names_parent

"; } else echo "$sname

"; // } } } // echo "
Доступные типы задач:

"; // // foreach ($types as $type) { // //if ($type['main_task']) { // if ($type->main_task) { // echo "[Главная] "; // $sort = '1'; // } // $tid = $type->GetId(); // $tname = $type->name; // echo "$tid. $tname"; // echo '
'; // } echo ""; $sections = $proj->getSections(); $numDM = 0; foreach ($sections as $section) { $dm = $section->diagnostic_map; if ($dm != null && $dm != '00000000-0000-0000-0000-000000000000') { $numDM++; } } $sizes = sizeof($sections); if ($sizes > 0 && $numDM == $sizes) $disabled = ""; else $disabled = "disabled"; if ($disabled) { echo "Нет полных данных от АСУ СГ по секциям локомотива из данного проекта
"; echo "
"; } else { echo "
"; } if (intval($sort) < 5) { echo "
"; } echo ''; echo '

'; echo '

'; } } } $_SESSION['array_tasksid'] = $arrayTasksId; $_SESSION['proj_sort'] = $sort; echo '

'; echo '

'; // ПОЛУЧЕНИЕ XML КОНЕЦ echo '
'; //main__content echo "
"; function EchoProjects($sort) { // echo "sort $sort"; global $companyID, $link, $activeid, $project_limit; if ($project_limit == '20') { $project_limit = "limit 20"; } else $project_limit = 'limit 2500'; $str = "select * from projects_locotech where company=$companyID order by id desc $project_limit"; $query1 = mysqli_query($link, $str); // limit 20 $projects = array(); while ($res1 = mysqli_fetch_array($query1)) { $data_id = $res1['id']; $status = $res1['status']; // $status = GetProjectStatus($data_id); // $status = intval($res1['status']); // echo "id $data_id status $status"; if ($status != $sort){ if ( !(2 == $sort and 3 == $status) ){ continue; } } // $proj = Project::Find($data_id); // if ($proj == null) { //// echo "not found $data_id
"; // continue; // } $loco_number = "Не найден!";//intval($res1['loco_number']); $subnumber = "Не найден!"; /** * @var $section Section */ // $section = $proj->section; // if ($section != null) { // echo "Section not found $data_id
"; // $loco_number = $section->getSectionNumber();//intval($res1['loco_number']); // $subnumber = $section->getSectionSubnumber(); // } $loco_number = intval($res1['loco_number']); $action = $res1['action']; // $status = intval($res1['status']); $loco_type = $res1['loco_type']; $depo = $res1['depo']; $created = $res1['created']; $depo_service = $res1['depo_service']; $class = 'content__menu__project'; if ($activeid == $data_id) $class .= ' content__menu__project_active'; else $class .= ' list'; $action_data = FindAction($action); echo "
"; echo "
"; echo $data_id.". ".$action_data["name"] ."
$loco_type № $loco_number"; echo "
"; echo '
'; if (intval($res1['urgent'])) $urgent = " Срочный"; else $urgent = ""; echo "Поступил: $created.$urgent"; echo '

'; if($status == '1') echo ""; echo " "; echo " "; echo '
'; } } //new project function AddNewProject() { global $action, $company; echo '

Введите данные
для нового проекта

'; $series = LocoSeries::GetAllNames(); // \Doctrine\Common\Util\Debug::dump($series); // $series = $series->toArray(); //foreach ($series as $serie) //{ // echo $serie."
"; //} echo '

Тип проекта

Срочный:

'; include "loco.php"; echo '
'; // echo '

Номер локомотива - ручной ввод:

'; echo '
'; // if ($company != null) // { // foreach ($company->locations as $location) // { // if ($location->type == "sld") // echo ""; // } // } // echo '
'; } ?>