mainFuncController(); $company = Company::Find($companyID); if (isset($assign_id) && isset($assign_act)) { if (StartProject($assign_act, $assign_id)) TasksAssign('', true, $assign_id); } //echo "sort1 $sorttasks $sort"; if (!isset($sort)) { $sort = $_SESSION['sorttasks']; if (!isset($sort)) { $sort = 1; } } $_SESSION['sorttasks'] = $sort; //echo "scr ".$scroll; echo ""; //echo "sort $sorttasks $sort"; //getAccountList(); //var_dump(getAccountList()); echo "
"; echo "

Сотрудники

"; echo ''; if( count($arResult['accountList']) > 0 ) { foreach($arResult['accountList'] as $acc) { echo ''; } } else { echo ''; } echo '
Сотрудники Должности
'. $acc['name'] .'
Никого не найдено Ничего не найдено
'; echo '
'; echo '
'; //EchoProjects($sort); echo '
'; echo '
'; //PARENT TITLE IN CHILDREN LIST if ($new == 1){ } else if ($activeid) { // $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']); } $depo = $proj->getDepo(); $depos = $proj->getDepoService(); if ($activeid) { echo "

$activeid. $acname

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

Доступные типы задач:


"; 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 "
Созданные задачи:

"; $tasks = GetTasksForProject($activeid); // ПОЛУЧЕНИЕ XML НАЧАЛО $parents = $entityManager->getRepository('Task')->findBy(array('parent_id' => 0), 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]; $sort = GetTaskStatus($id); if ($task['parent_id'] == '0') { $arrayTasksId[] = $id; echo "$id [$sort]. $name
"; http://corp.prmsys.net/index.php?act=tasks&activeid=679&scroll=0 } } echo '

'; } } } echo '

Локомотивы


Новая задача:

'; echo "
'; // ПОЛУЧЕНИЕ XML КОНЕЦ echo '
'; //main__content echo ' '; function mainFuncController(){ $arResult = []; $arResult['accountList'] = getAccountList(); $arResult['locomotiveList'] = getLocomotiveList(); return $arResult; } function getAccountList(){ global $companyID; $result = []; //var_dump($companyID); $accountsEntity = \app\models\entity\Accounts::find()->where(['company' => $companyID])->all(); foreach( $accountsEntity as $item){ $last_seen_mobile = ( null != $item->last_seen_mobile )? new DateTime($item->last_seen_mobile): $item->last_seen_mobile ; $online_mobile = OnlineAccountCheck(TimeString($last_seen_mobile)); if (!$online_mobile) { continue;} foreach($item->jobtype as $it) { $result[] = ['name' => $item->name,'position' => $it->name]; } } return $result; } function getLocomotiveList(){ global $companyID; $result = []; //var_dump($companyID); $projectsLocotechEntity = \app\models\entity\ProjectsLocotech::find()->where(['company' => $companyID,'status' => 2] )->orderBy(['id' => SORT_DESC])->all(); foreach( $projectsLocotechEntity as $item){ //$tempArray = GetTasksForProject($item->id); foreach( GetTasksForProject($item->id) as &$proj) { $proj['name'] = GetTaskNameAndDesc($proj['type'])[0]; } //$tempArray['name'] = GetTaskNameAndDesc($tempArray['type'])[0]; $result[$item->id]['arr'] = GetTasksForProject($item->id); $result[$item->id]['obj'] = $item; } return $result; } ?>