Введите данные новой должности:

Название:

Доступные типы команд:
'; echo "

"; ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask"); echo "
"; echo ' '; echo '

Вернуться к списку должностей

'; } else { if ($new == "2") { $subtask_arr = FillArrayString("subtask", true); echo "Запись добавлена!"; $jobtype = new Jobtype(); foreach ($subtask_arr as $tasktype_id) { if ($tasktype_id) { $tasktype = Tasktype::Find($tasktype_id); $jobtype->name = $jobname; $jobtype->setCompany($companyID); $jobtype->addTasktype($tasktype); $tasktype->Save(); } } $jobtype->Save(); } else if ($new == "3") { $pt = Jobtype::Find($del_id); $tts = $pt->getTaskTypes(); foreach ($tts as $tt) { $pt->deleteTasktype($tt); $tt->Save(); } Jobtype::Delete($del_id); echo "Должность $del_id удалена!"; mysqli_query($link, "delete from jobtypes where id =".$del_id); } //CHANGE tasktype of jobtype! if ($new == "5") { $newtask_jobtype = Jobtype::Find($newtask_jobid); UpdateTaskType($newtask_jobtype, $taskvalue, $index, $oldtype); } //add new tasktype to jobtype! else if ($new == "4") { AddTaskType($new_task_jobid, $new_tasktype_id, $tasktypesarr); } echo "

Должности компании ".$companyname.":

"; $jobtypes = $entityManager->getRepository('Jobtype')->findBy(array('company' => $companyID)); foreach ($jobtypes as $jobtype) { //Tasktype::ConvertTasktypes($jobtype); $job_id = $jobtype->id; $jobname = $jobtype->name; echo "
"; echo "

".$jobname." [$job_id]

"; EchoTasks($jobtype); //селект со списком типов команд для данной должности $ttypes = $jobtype->getTaskTypes(); $projecttypes = array(); $ptids = array(); $ptstring = ''; foreach ($ttypes as $ttype) { $parents = FindParentTaskType($ttype->id); foreach ($parents as $parent) { $mytt = Tasktype::Find($parent['id']); $myprojecttypes = FindActions($parent['id']); foreach ($mytt->getProjecttypes() as $pt) { if (!$ptids[$pt->id]) { $ptids[$pt->id] = 1; $ptstring .= "
[$pt->id. $pt->name] "; } } } } echo "
Доступные типы проектов: $ptstring
"; echo "
Доступные типы задач
"; echo "
"; echo " "; echo "
"; echo "
"; } echo "
"; echo "
"; EchoEdit(); } function UpdateTaskType(Jobtype $newtask_jobtype, $taskvalue, $jobindex, $oldtype) { $tasks = $newtask_jobtype->getTaskTypes(); $oldtask = Tasktype::Find($oldtype); $tasks->removeElement($oldtask); if ($taskvalue != 'deletetasktype') { $newtasktype = Tasktype::Find($taskvalue); $newtask_jobtype->addTasktype($newtasktype); $newtasktype->Save(); } $newtask_jobtype->Save(); } function AddTaskType($job_id, $new_tasktype_id, $tasktypes) { //$new_task_jobid - должность //$new_tasktype_id - тип задачи $newtasktype = Tasktype::Find($new_tasktype_id); $jobtype = Jobtype::Find($job_id); $jobtype->addTasktype($newtasktype); $jobtype->Save(); global $link; //echo "AddJob ".$acc_id." job id ".$new_jobtype_id." job_ids ".$job_ids; $tasktypes .= ','.$new_tasktype_id; mysqli_query($link, "update jobtypes set tasktypes='".$tasktypes."' where id=".$job_id); echo "Команда добавлена!

"; } //селект со списком типов команд для данной должности function EchoTasks($jobtype) { $account_jobindex = 0; // $jobtasktypes = $jobtype->getTaskTypes(); $alltasktypes = GrabTasktypes("subs"); //массив id $job_id = $jobtype->id; foreach ($jobtasktypes as $tasktype) { echo " "; $account_jobindex++; } } function EchoEdit()//, $job_ids_account) { $alltasktypes = GrabTasktypes("subs"); //массив id echo "
"; echo "Выберите добавляемую команду:"; echo "
"; echo " "; echo " "; echo "

"; } ?>