123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241 |
- <?
- if (!$logged_me_in_successfully234)
- return;
- $array_children = array();
- $array_parent = array();
- if ($new == "3")
- {
- DeleteTask($task_id);
- echo "<span style='color:red'><b>Задача $task_id удалена!</b></span>";
- }
- else if ($new == '2')
- {
- if ($task_id == 'undefined')
- $task_id = '';
- if (!isset($task_id) || $task_id=='')
- {
- ;
- //echo "<span style='color: blue'>Все задачи выданы в работу! ";
- }
- else
- echo "<span style='color: blue'>Задача <b>".$task_id."</b> выдана в работу! ";
- $accsused = TasksAssign($task_id,true);
- echo "<span style='color: blue'>Задачи назначены <b>".sizeof(reset($accsused[0]))."</b> сотрудникам </span> ";
- }
- 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 "<input type='hidden' id='scroll' value=$scroll>";
- //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
- "
- <div class='main__content'>
- <div class='content__menu'>
- <h2 class='content__title content__menu__title'>
- Задачи
- </h2>
- <div class='content__filter'>
- <img src='ProSysNew/search.svg' alt='search' class='content__search'>
- <div class='content__controls'>
- <button class='control-btn control-btn_blue content__filter__btn $active1' onclick='SortElements(1, \"tasks\")'>К исполнению</button>
- <button class='control-btn control-btn_yellow content__filter__btn $active234' onclick='SortElements(2, \"tasks\")'>В работе</button>
- <button class='control-btn control-btn_green content__filter__btn $active5' onclick='SortElements(5, \"tasks\")'>Готово</button>
- </div>
- </div>";
- echo '<div class="content__menu__list">';
- echo ' <div class="content__menu__newproj content__menu__newproj_active" onclick = "NewTask()">
- <div class="content__menu__newproj__plus">
- +
- </div>
- <div class="content__menu__newproj__text">
- Новая задача
- </div>
- </div><br>';
- //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 '<br><p><button class="control-bigbtn content__main__toexec-btn" onclick="FindStaff()">Все в работу!</button></p>';
- }
- echo '</div></div>';
- //PARENT TITLE IN CHILDREN LIST
- echo '<div class="content__main">';
- if (isset($activeid)) {
- if ($sort == 5) {
- echo '<p><a class="xlsbuttontop"href ="#"><button class="control-bigbtn content__main__toexec-btn" >Скачать XLS акт</button></a></p>';
- }
- }
- echo '<h2 class="content__title content__main__title">';
- $taskid = 0;
- echo "<br><p class='content__menu__task-text'><span class='content__main__item__del' onclick='DelTask($activeid)'>Удалить задачу и подзадачи</span></p>";
- 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 "</h2><div class='control-btn $btntype content__main__state'>$txt</div>";
- }
- else {
- if ($new != '4')
- echo '<p class="content__menu__task-text">Задача не выбрана</p>';
- else
- {
- echo '<p>Создать новую задачу</p>';
- echo "<form method='post' action='?act=tasks&new=5'>";
- echo "<select class='form-input content__main__form__goal' name='newtasktype'>";
- // var_dump($tasktypes);
- foreach ($tasktypes as $tasktype)
- {
- if ($tasktype->main_task == '1') {
- $ttype = $tasktype->id;
- $ttname = $tasktype->name;
- echo "<p class='content__menu__task-text'><option value = '".$ttype."'>[" . $ttype . "] " . $ttname . "</option></p>";
- }
- }
- echo "</select>";
- echo "<br><input type='submit' value='Создать!'><br>";
- echo "</form>";
- }
- }
- $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 '<p><a class="xlsbutton" href = XLSList.php?activeid='.$activeid.'&type='.$type.'&id='.$id.'><button class="control-bigbtn content__main__toexec-btn" >Скачать XLS акт</button></a></p>';
- echo '<p><a href = XLSdef.php><button class="control-bigbtn content__main__toexec-btn" >Скачать XLS отчет</button></a></p>';
- }
- else if ($sort == 1) {
- echo "<button class='control-bigbtn content__main__toexec-btn' onclick='FindStaff($taskid)'>
- Отправить в работу</button>";
- }
- }
- echo '</div></div>';
- //}
- ?>
|