company = $companyID; $pt->name = $project_type_name; $priority = 0; // $series = LocoSeries::Find($loco_type); // if ($series != null) { // $pt->addSeries($series); // } foreach($subtask_array as $subtask){ $priority++; $tt = Tasktype::Find($subtask); $pttt = new ProjecttypeTasktype(); $pttt->priority = $priority; $pttt->projecttype = $pt; $pttt->tasktype = $tt; $pt->addTasktype($pttt); $tt->addProjectype($pttt); } $pt->Save(); echo "Запись добавлена!"; } else if ($new == "3") { /** @var ProjectType $pt */ $pt = ProjectType::Find($del_id); if ($pt != null) { $tts = $pt->getProjecttypesTasktypes(); foreach ($tts as $tt) { $pt->removeTasktype($tt); } ProjectType::Delete($del_id); echo "Тип проекта $del_id, его проекты и задачи удалены!"; } } else if ($new == "5") { //mysqli_query($link, "delete from projects_locotech"); //echo "Все проекты удалены!"; echo "Удаление всех проектов временно отключено!"; } //echo "sort1 $sorttasks $sort"; if (!isset($sort)) { $sort = $_SESSION['sorttasks']; if (!isset($sort)) { $sort = 1; } } $_SESSION['sorttasks'] = $sort; //echo "scr ".$scroll; echo ""; echo ""; //echo "sort $sorttasks $sort"; $active1 = ''; $active2 = ''; $active3 = ''; $active4 = ''; $active5 = ''; switch ($sort) { case '1': $active1 = 'control-btn_active'; break; case '2': $active2 = 'control-btn_active'; break; case '3': $active3 = 'control-btn_active'; break; case '4': $active4 = 'control-btn_active'; break; case '5': $active5 = 'control-btn_active'; break; } echo "

Типы проектов

search
"; echo '
'; echo '
+
Новый тип проекта

'; EchoProjectTypes($sort); echo '
'; echo '
'; //PARENT TITLE IN CHILDREN LIST if ($new == 1) AddNewProjectType(); else { $projects = getProjectsByAction($activeid); $action = FindAction($activeid); $acname = $action['name']; if ($activeid != null) $types = ProjectType::GrabTasktypesByProjectType($activeid); if ($activeid) { echo "

$activeid. $acname

Добавленные типы задач:

"; //print_r($types); //echo "types: ".sizeof($types); if (sizeof($types) > 0) { //if (intval($types[0]) > 0) { $num = 0; //foreach ($types as $tid) { foreach ($types as $tasktype) { $num++; $tid = $tasktype->id; echo "$num. [$tid] " . $tasktype->name . ""; echo '
'; } } // echo '

// Добавить серию локомотива

'; // $series = LocoSeries::GetAllNames(); // echo' '; // echo " "; $ptype = ProjectType::Find($activeid); if ($ptype) { echo '
'; } echo "
Созданные проекты:

"; //echo "projects ".sizeof($projects); foreach ($projects as $proj) { $sort = $proj["status"]; echo "№ ".$proj["id"]." от ".$proj["created"]."
"; } echo "
"; echo '

'; } } echo '
'; //main__content function FillProjects() { global $companyID, $link; $query1 = mysqli_query($link, "select * from project_types where company=$companyID"); while ($res1 = mysqli_fetch_array($query1)) { $project = new Project(); $project->id = $res1['id']; } } function EchoProjectTypes($sort) { //echo "sort $sort"; global $companyID, $link, $activeid; $query1 = mysqli_query($link, "select * from projecttypes where company=$companyID order by id desc"); while ($res1 = mysqli_fetch_array($query1)) { $data_id = $res1['id']; $class = 'content__menu__project'; if ($activeid == $data_id) $class .= ' content__menu__project_active'; else $class .= ' list'; $action_data = FindAction($data_id); echo "
"; echo "
"; echo $data_id.". ".$action_data["name"]; echo "
"; echo '
'; echo '

'; echo '
'; } } //new project function AddNewProjectType() { echo '

Введите данные
для нового типа проекта

Имя нового типа проекта '; // echo ''; echo "

"; echo "
1
"; echo "
2
"; echo "
3
"; echo "
4
"; echo "
+
"; echo '

Добавьте последовательность типов задач:

'; $Subtaskarr = GrabTasktypes("tasks"); // echo "sublen ".sizeof($Subtaskarr); echo ""; echo "
"; ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask", true); echo "
"; echo ""; echo ""; echo ""; echo '
'; } ?>