Задача $task_id удалена!"; } else if ($new == '2') { if ($task_id == 'undefined') $task_id = ''; if (!isset($task_id) || $task_id=='') { ; //echo "Все задачи выданы в работу! "; } else echo "Задача ".$task_id." выдана в работу! "; $accsused = TasksAssign($task_id,true); echo "Задачи назначены ".sizeof(reset($accsused[0]))." сотрудникам "; } if ($new == '6')//revoke { Account::ClearTasksFromAccount($task_id); } if ($new == '7')//confirm { TaskConfirm($num, $id, $tid, $confirm_data); } if ($new == '8')//confirm { TaskReopen($tid); } if ($new == '9')//confirm { DeletePic($path); } if ($new == '5') { // echo 'new task type '.$newtasktype; $tasktypesarr = array( GrabTasktype($newtasktype) ); CreateTasks($tasktypesarr); } //echo "sort1 $sorttasks $sort"; if (!isset($sort)) { $sort = $_SESSION['sorttasks']; if (!isset($sort)) { $sort = 1; } } if ($sort == 3) $sort = 2; $_SESSION['sorttasks'] = $sort; //echo "scr ".$scroll; echo ""; //echo "sort $sorttasks $sort"; $active1 = ''; $active234 = ''; $active5 = ''; $sort_status = 0; switch ($sort) { case '1': $active1 = 'control-btn_active'; $sort_status = 1; break; case '2': case '3': case '4': $active234 = 'control-btn_active'; break; case '5': $active5 = 'control-btn_active'; $sort_status = 5; break; } echo "

Задачи

search
"; echo '
'; echo '
+
Новая задача

'; //304 //А 11364783 //Б 11364791 //Заполнение $array_parent парент тасками существующих типов if ($sort_status > 0) //$parents = $entityManager->getRepository('Task')->findBy(array('parent_id' => 0, "status" => $sort_status), array('id' => 'DESC')); $parents = $entityManager->getRepository('Task')->findBy(array('parent_id' => 0, "status" => $sort_status), array('id' => 'DESC'), 200000); else //$parents = $entityManager->getRepository('Task')->findBy(array('parent_id' => 0), array('id' => 'DESC')); $parents = $entityManager->getRepository('Task')->findBy(array('parent_id' => 0), array('id' => 'DESC'), 200000); //\Doctrine\Common\Util\Debug::dump($parents); //if (sizeof($tasktypes)> 0) { // $query = mysqli_query($link, "select * from tasks where parent_id=0 and type in (" . $arrIds . ") ORDER BY id DESC"); // { // while ($res1 = mysqli_fetch_array($query)) { // $status = GetTaskStatus($res1['id']); // if ($status == intval($sort)) { // $array_parent[$res1['id']] = $res1; // } // } // } //Заполнение $array_children сабтасками по адйи тасков из $array_parent $tasktypes = GrabTasktypes(); $tasktypesIds = GrabTasktypesIDs(); foreach ($parents as $parent) { if (!in_array(intval($parent->type), $tasktypesIds)) continue; $status = GetTaskStatus($parent->id); if ($status == intval($sort)) { $array_parent[$parent->id] = $parent; $children = $entityManager->getRepository('Task')->findBy(array('parent_id' => $parent->id)); $array_children[$parent->id] = $children; } } // foreach ($array_parent as $parent_id => $res) { // $children = array(); // $query = mysqli_query($link, "select * from tasks where parent_id=" . $parent_id." ORDER BY priority ASC"); // while ($res1 = mysqli_fetch_array($query)) { // array_push($children, $res1); // } // $array_children[$parent_id] = $children; // } $_SESSION['array_children'] = $array_children; $_SESSION['array_parent'] = $array_parent; $_SESSION['actid'] = $activeid; //MAIN TASKS foreach ($array_children as $parent_id => $children) { EchoTask2($array_parent[$parent_id], $activeid, true); } if (sizeof($parent_id) > 0) { if ($sort != 5 && $sort != 3 && $sort != 2) echo '

'; } echo '
'; //PARENT TITLE IN CHILDREN LIST echo '
'; if (isset($activeid)) { if ($sort == 5) { echo '

'; } } echo '

'; $taskid = 0; echo "

Удалить задачу и подзадачи

"; if (isset($activeid)) { $btntype = 'control-btn_blue'; $txt = 'К исполнению'; switch ($sort) { case '2': case '3': case '4': $btntype = 'control-btn_yellow'; $txt = 'В работе'; break; case '5': $btntype = 'control-btn_green'; $txt = 'Готово'; break; } echo "

$txt
"; } else { if ($new != '4') echo '

Задача не выбрана

'; else { echo '

Создать новую задачу

'; echo "
"; echo ""; echo "

"; echo "
"; } } $array_type = []; $array_id = []; foreach ($array_children as $parent_id => $children) { // var_dump($children); if ($activeid == $parent_id) { foreach ($children as $res1) { EchoTask2($res1, $activeid, false); $array_type[] = $res1->type; $array_id[] = $res1->id; } } } $type = implode(',',$array_type); $id = implode(',',$array_id); if (isset($activeid)) { if ($sort == 5) { echo '

'; echo '

'; } else if ($sort == 1) { echo ""; } } echo '
'; //} ?>