Тип задачи добавлен!"; $names = 'creator_id, name, description, company, subtasks, main_task, confirmtype, time_to_complete_minutes, object_name, control_map, letter'; $values = $id.",'$taskname','$description',$companyID,'$subtask_string',$main_task,$confirmtype,$timecomplete,'$object_name','$control','$letter'"; if (strlen($action)>0) { $names .= ', action'; $values .= ",".$action; } $str = "insert into tasktypes (".$names.") values (".$values.")"; mysqli_query($link, $str); $lastid = mysqli_insert_id($link); $taskarr = GrabTasktypes(); if ( $_FILES ) { // var_dump($_FILES); $file = $_FILES['filename']; $rootPath = $_SERVER['DOCUMENT_ROOT']; $videoPath = $rootPath."/guides/$lastid/"; if(!is_dir($videoPath)) { mkdir($videoPath); } //Временно!!! // echo "fname ".$file['name']; // echo "tmp_name ".$file['tmp_name']; $namearr = explode(".", $file['name'][0]); $ext = end($namearr); if ($ext == "mp4" || $ext == "pdf" || $ext == "jpg" || $ext == "jpeg" || $ext == "avi") $file['name'][0] = "video.mp4"; $target = $videoPath.$file['name'][0]; move_uploaded_file( $file['tmp_name'][0], $target); } } else if ($new == "3") { echo "Тип задач $task_id удален!"; DeleteTasksByType($task_id); ClearTaskTypeFromJobs($task_id); mysqli_query($link, "delete from tasktypes where id =".$task_id); mysqli_query($link, "delete from checkpoint_types_for_tasks where tasktype_id=$task_id"); $taskarr = GrabTasktypes(); } echo ""; $active1 = ''; $active0 = ''; switch ($sort) { case '0': $active0 = 'control-btn_active'; break; case '1': $active1 = 'control-btn_active'; break; default: $active1 = 'control-btn_active'; $sort = '1'; } $taskword = "задач"; if ($sort == '0') $taskword = "команд"; echo "

Типы задач

search
"; echo '
'; echo "
+
Новый тип $taskword

"; EchoTasktypes($sort, $taskarr); echo '
'; echo '
'; //PARENT TITLE IN CHILDREN LIST if ($new == 1) AddNewTaskType(); else { $ttype = GrabTasktype($activeid); $ttypend = GetTaskNameAndDesc($activeid); $acttname = $ttypend[0]; $ttdesc = $ttypend[1]; $actionid = $ttype['ProjectType']; $action = FindAction($actionid); $acname = $action['name']; $main = $ttype['main_task']; $control = $ttype['control_map']; $subs = explode(',',$ttype['subtasks']); if ($activeid) { echo "

$activeid. $acttname

$ttdesc

"; if ($main) { $mytt = Tasktype::Find($activeid); $letter = $mytt->letter; if ($letter) $lettername = "[Секция $letter]"; echo "

$lettername

"; echo "

Типы проекта с данным типом задач:

"; foreach ($mytt->getProjecttypes() as $ptype) { $actionid = $ptype->id; $acname = $ptype->name; echo "

$actionid. $acname

"; } echo "
"; } // switch ($letter) // { // case "А": $selectedA = "selected"; break; // case "Б": $selectedB = "selected"; break; // case "В": $selectedV = "selected"; break; // case "Г": $selectedG = "selected"; break; // } // echo "Буква секции: // "; if (!$main) { EchoCheckPoints($activeid); } $confirmtype = $ttype['confirmtype']; $confirmtypename = getConfirmTypeName($confirmtype); $zone = $ttype['zone_required_id']; echo "

Способ подтверждения задачи: $confirmtypename
"; echo "

Выполнить в зоне: $zone (".GetZoneName($zone).")
"; $time = intval($ttype['time_to_complete_minutes']); echo "

"; echo "

Время на выполнение: $time минут
"; if ($main) { echo "

Добавленные типы команд:

"; echo "

"; $num = 0; foreach ($subs as $typeid) { $type = GrabTasktype($typeid); $tid = $type['id']; $taction = $type['ProjectType']; $num++; if ($type['main_task']) echo "[Главная] "; echo "$num. " . $type['name'] . " [" . $type['id'] . "]"; echo '
'; } echo "

"; } if (!$main) { $addcmd = " для данной команды"; } echo "

Активные задачи$addcmd:
"; $tasks = GrabTasksByType($activeid); foreach ($tasks as $task) { $type = $task['type']; $id = $task['id']; $ttname = GetTaskNameAndDesc($type)[0]; //$sort = $task['status']; $sort = GetTaskStatus($id); if ($task['parent_id'] == '0') { echo "".$id.". $ttname
"; } else { echo "" . $task['parent_id'].". $acttname
"; } } echo "

"; $imgpath = GetVideoPathFromTasktype($activeid); $files1 = scandir($imgpath); if (sizeof($files1) > 2) { echo "
"; foreach ($files1 as $file ) { $x = pathinfo($file)['extension']; if($file === '.' || $file === '..') {continue;} echo '
'; if ($x == 'mp4' || $x == 'jpg' || $x == 'jpeg' || $x == 'pdf' || $x == 'avi') { echo "

$file

"; // echo "$file"; } echo '
'; } echo '

'; } echo "
"; echo '
'; } } echo '
'; //main__content function EchoCheckPoints($activeid) { include "checkpoints.php"; \CheckPoints\CheckPoint::EchoTypes($activeid); } function GetCheckListTypes($task_id) { global $link; $query = mysqli_query($link, "select * from checkpoint_types where parent_task_type = $task_id"); $arr = array(); while ($res = mysqli_fetch_array($query)) { array_push($arr, $res); } return $arr; } function EchoTaskTypes($sort, $arr, $chooseSubtasks = false) { global $activeid; foreach ($arr as $tasktype) { $tasktype_id = $tasktype->id; $taskname = $tasktype->name; $description = $tasktype->description; $main = $tasktype->main_task; $letter = $tasktype->letter; if ($letter) $letter = "[Секция $letter]"; if ($main != $sort) continue; $completeTime = intval($tasktype->time_to_complete_minutes); $class = 'content__menu__project'; if ($activeid == $tasktype_id) $class .= ' content__menu__project_active'; else $class .= ' list'; $myid = " id='active'"; echo "
"; echo "
"; echo $tasktype_id.". $taskname $letter
"; echo "
"; echo ""; echo '
'; if ($description != '') echo " [$description]
"; if (!$main) echo "На выполнение: ".$completeTime." минут"; echo '

'; } } //new project function AddNewTaskType() { global $companyID, $sort, $taskword, $Subtaskarr, $c_action, $numsel; if (!isset($c_action)) $c_action = 2; $confirmtypes = GrabConfirmTypes(intval($companyID)); echo "

Введите данные
нового типа $taskword

"; echo '
'; // echo '

// Тип объекта //

'; // echo // ' // '; echo '
'; if ($sort == '0') //КОМАНДЫ { echo "

Способ подтверджения выполнения команды:


Время на выполнение (минуты)

"; echo ""; } //ЗАДАЧИ else { // echo '

Буква секции: // //

'; echo '

Команды (подзадачи):

'; if (!isset($numsel)) $numsel = 1; $Subtaskarr = GrabTasktypes(true); $sublen = sizeof($Subtaskarr); echo "
"; ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask"); echo "
"; } echo '

Имя:

Описание

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