123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263 |
- <?
- if (!$logged_me_in_successfully234)
- return;
- EchoScriptName(basename(__FILE__, '.php'));
- if (isset($assign_id) && isset($assign_act)) {
- if (StartProject($assign_act, $assign_id))
- TasksAssign('', true);
- }
- if ($new == "2") {
- $subtask_array = FillArrayString("subtask",true);
- $pt = new ProjectType();
- $pt->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 "<span style='color:green'><b>Запись добавлена!</b></span>";
- }
- 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 "<span style='color:red'><b>Тип проекта $del_id, его проекты и задачи удалены!</b></span>";
- }
- }
- else if ($new == "5") {
- //mysqli_query($link, "delete from projects_locotech");
- //echo "<span style='color: green'>Все проекты удалены!</span>";
- echo "<span style='color: green'>Удаление всех проектов временно отключено!</span>";
- }
- //echo "sort1 $sorttasks $sort";
- if (!isset($sort))
- {
- $sort = $_SESSION['sorttasks'];
- if (!isset($sort)) {
- $sort = 1;
- }
- }
- $_SESSION['sorttasks'] = $sort;
- //echo "scr ".$scroll;
- echo "<input type='hidden' id='scroll' value=$scroll>";
- echo "<input type='hidden' id='activeptid' value=$activeid>";
- //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
- "
- <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>";
- echo '<div class="content__menu__list">';
- echo ' <div class="content__menu__newproj content__menu__newproj_active" onclick = "NewListElement(\'project_types\')">
- <div class="content__menu__newproj__plus">
- +
- </div>
- <div class="content__menu__newproj__text">
- Новый тип проекта
- </div>
- </div><br>';
- EchoProjectTypes($sort);
- echo '</div>';
- echo '</div>';
- //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 "<div class='content__main'><h2 class=\"content__title content__main__title\">$activeid. $acname</h2>
- <p class='content__main__form__text'><span style='color: black'>Добавленные типы задач:</span></p>
- <p class='content__main__form__text'>";
- //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] <a href = '?act=tasktypes&activeid=" . $tid . "&sort=0'>" . $tasktype->name . "</a>";
- echo '<br>';
- }
- }
- // echo '<p class="content__main__form__text">
- // Добавить серию локомотива</p>';
- // $series = LocoSeries::GetAllNames();
- // echo' <select id="loco_type" class="form-input content__main__form__series" name="loco_type">';
- // foreach ($series as $serie) {
- // echo "<option value = '$serie' >$serie</option >";
- // }
- // echo '</select>';
- // echo " <input id='addseriestopt' type='button' value='Добавить'>";
- $ptype = ProjectType::Find($activeid);
- if ($ptype)
- {
- echo '<div id="result"></div>';
- }
- echo "<br><span style='color: black'>Созданные проекты:</span><br><br>";
- //echo "projects ".sizeof($projects);
- foreach ($projects as $proj)
- {
- $sort = $proj["status"];
- echo "<a href='?act=projects&activeid=".$proj["id"]."&sort=".$sort."'>№ ".$proj["id"]." от ".$proj["created"]."</a><br>";
- }
- echo "<br><input type='button' onclick='DelProjType($activeid)' value='Удалить тип проекта, проекты данного типа и их задачи'>";
- echo '</p></div>';
- }
- }
- echo '</div>'; //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 "<div onclick='SelectProjectType($data_id)' class='$class'>";
- echo "<div class=\"content__menu__project-title\">";
- echo $data_id.". ".$action_data["name"];
- echo "</div>";
- echo '<div class="content__menu___project-text">';
- echo '<br><br></div>';
- echo '</div>';
- }
- }
- //new project
- function AddNewProjectType()
- {
- echo
- '<div class="content__main">
- <h2 class="content__title content__new__title">
- Введите данные <br>
- для нового типа проекта
- </h2>
- <form action="?act=project_types" method="post" class="content__main__form" onsubmit="ClearTaskCont()">
- <div class="content__main__form__item">
- <p class="content__main__form__text">
- Имя нового типа проекта
-
- <textarea class="form-input content__main__form__depot" name="project_type_name" ></textarea>';
- // echo '<select id="series" style="width: 600px;" class="form-input content__main__form__series" name="loco_type">
- // <option value="0"><Выберите серию локомотива></option>
- // </select>';
- echo "<div style ='line-height: 30px; height: 35px; margin:0px;margin-left:130px;border: solid; border-width:1px;border-color: white'>";
- echo "<div id='alg1' class='round red' onclick='SelectAlg(1)'>1</div>";
- echo "<div id='alg2' class='round deepskyblue' onclick='SelectAlg(2)'>2</div>";
- echo "<div id='alg3' class='round deepskyblue' onclick='SelectAlg(3)'>3</div>";
- echo "<div id='alg4' class='round deepskyblue' onclick='SelectAlg(4)'>4</div>";
- echo "<div id='alg_new' style='font-size: 25px' class='round deepskyblue' onclick='alert(\"Функция в разработке!\")'>+</div>";
- echo '</p></div><p class="content__main__form__text">Добавьте последовательность типов задач:</p>';
- $Subtaskarr = GrabTasktypes("tasks");
- // echo "sublen ".sizeof($Subtaskarr);
- echo "<input id='algsel' type='hidden' name='1'>";
- echo "<div id='taskcont1' style='display: block'>";
- ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask", true);
- echo "</div>";
- echo "<div id='taskcont2' style='display: none'>";
- ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask_1", true);
- echo "</div>";
- echo "<div id='taskcont3' style='display: none'>";
- ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask_2", true);
- echo "</div>";
- echo "<div id='taskcont4' style='display: none'>";
- ShowTasksSelect($Subtaskarr, 0, 'selectstring', "subtask_3", true);
- echo "</div>";
- echo '</div>
- <input type="submit" value="Добавить в новые">
- <input type="hidden" name="new" value="2">
- </form>
- </div>
- ';
- }
- ?>
|