tasksdone.php 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <?
  2. if (!$logged_me_in_successfully234)
  3. return;
  4. //удалить запись из базы
  5. //send task confirm type
  6. //send object type?
  7. //send accept date
  8. //echo "cid ".$companyID;
  9. $taskarr = GrabTasktypes();
  10. if ($new == "3")
  11. {
  12. DeleteTask($task_id);
  13. echo "<span style='color:red'><b>Задача $task_id удалена!</b></span>";
  14. }
  15. else if ($new == '2')
  16. {
  17. if (!isset($task_id) || $task_id=='')
  18. {
  19. echo "Все задачи выданы в работу!";
  20. }
  21. else
  22. echo "Задача ".$task_id." выдана в работу!";
  23. $accsused = TasksAssign($task_id,true);
  24. echo "Задачи назначены ".sizeof($accsused)." сотрудникам: ";
  25. }
  26. if ($new == '6')//revoke
  27. {
  28. Account::ClearTasksFromAccount($task_id);
  29. }
  30. if ($new == '7')//confirm
  31. {
  32. TaskConfirm($num, $id, $tid, $confirm_data);
  33. }
  34. if ($new == '8')//confirm
  35. {
  36. TaskReopen($tid);
  37. }
  38. if ($new == '9')//confirm
  39. {
  40. DeletePic($path);
  41. }
  42. if ($new == '5')
  43. {
  44. // echo 'new task type '.$newtasktype;
  45. $tasktypesarr = array( GrabTasktype($newtasktype) );
  46. CreateTasks($tasktypesarr);
  47. }
  48. if ($new == '4')
  49. {
  50. echo 'Создать новую задачу';
  51. echo "<form method='post' action='?act=tasks&new=5'>";
  52. echo "<select name='newtasktype'>";
  53. foreach ($taskarr as $tasktype)
  54. {
  55. if ($tasktype['main_task'] == '1') {
  56. $ttype = $tasktype['id'];
  57. $ttname = $tasktype['name'];
  58. echo "<option value = '".$ttype."'>[" . $ttype . "] " . $ttname . "</option>";
  59. }
  60. }
  61. echo "</select>";
  62. echo "<input type='submit' value='Создать!'><br>";
  63. echo "</form>";
  64. }
  65. else
  66. {
  67. echo "<form method='post' action='?act=tasks&new=4'>";
  68. echo "<input type='submit' value='Создать новую задачу'><br>";
  69. echo "</form>";
  70. }
  71. echo "<form id='form1' name='form1' method='post'>";
  72. echo "<h3>Выполненные задачи компании $companyname:</h3>";
  73. // echo "taskarr ".sizeof($taskarr);
  74. if (sizeof($taskarr)> 0) {
  75. $keys = array_keys ($taskarr);
  76. $arrIds = implode(',',$keys);
  77. //echo '$arrIds '.$arrIds;
  78. echo " <input type='button' onclick='FindStaff(\"\")' value='Все в работу!'><br>";
  79. $array_parent = array();
  80. $str = "select * from tasks where status=5 and parent_id=0 and type in (".$arrIds.")";
  81. // echo "str $str <br>";
  82. $query = mysqli_query($link, $str);
  83. {
  84. while ($res1 = mysqli_fetch_array($query)) {
  85. $array_parent[$res1['id']] = $res1;
  86. }
  87. }
  88. // echo sizeof($array_parent);
  89. $array_children = array();
  90. foreach ($array_parent as $parent_id => $res) {
  91. $children = array();
  92. // echo $parent_id.' '.$res['name'].'||';
  93. $query = mysqli_query($link, "select * from tasks where parent_id=" . $parent_id);
  94. while ($res1 = mysqli_fetch_array($query)) {
  95. array_push($children, $res1);
  96. }
  97. $array_children[$parent_id] = $children;
  98. //echo sizeof($array_children[$array_parent]);
  99. }
  100. $_SESSION['array_children'] = $array_children;
  101. foreach ($array_children as $parent_id => $children) {
  102. echo '<br>';
  103. echo "<div style='border: solid; border-width: .5px; border-color: #9cb2c4; border-radius: 15px; margin:5px; padding: 5px'>";
  104. EchoTask($array_parent[$parent_id], $taskarr, true);
  105. if (sizeof($children) > 0) {
  106. echo '<br><b>Показать подзадачи и исполнителей:</b> <input type="checkbox" onclick="ShowSubtasks(' . $parent_id . ')" name="subtask' . $parent_id . '"/><br>';
  107. echo '<div id="subtasks_block' . $parent_id . '" style="display: none; margin-left: 40px;">';
  108. foreach ($children as $res1) {
  109. echo "<div style='border-top: solid; border-width: .5px; padding: 0px; margin-top:40px;border-color: #D1D1D1'>";
  110. EchoTask($res1, $taskarr);
  111. echo '</div>';
  112. }
  113. echo '</div>';
  114. }
  115. echo '</div>';
  116. }
  117. }
  118. echo "</form>";
  119. echo '<p><a href = XLSList.php>Скачать XLS отчет</a></p><br>';
  120. ?>