for ($i = 0; $i < $count; $i++) { $fileID = CTaskFiles::saveFileTemporary($curUserId, $_FILES["task-attachments"]["name"][$i], $_FILES["task-attachments"]["size"][$i], $_FILES["task-attachments"]["tmp_name"][$i], $_FILES["task-attachments"]["type"][$i]); $tmp = array("name" => $_FILES["task-attachments"]["name"][$i], "fileID" => $fileID); if ($fileID) { $tmp["fileULR"] = "/bitrix/components/bitrix/tasks.task.detail/show_file.php?fid=" . (int) $fileID; } $arResult[] = $tmp; } } $APPLICATION->RestartBuffer(); Header('Content-Type: text/html; charset=' . LANG_CHARSET); ?> <script type="text/javascript"> <?php echo CUtil::JSEscape($callbackFunctionName); ?> (<?php echo CUtil::PhpToJsObject($arResult); ?> , <?php echo intval($_POST["uniqueID"]); ?> ); </script> <?php } elseif ($_POST["mode"] == "delete") { if (check_bitrix_sessid()) { CTaskFiles::removeTemporaryFile($curUserId, (int) $_POST['fileID']); } } die;
$items[$id] = $data; } else { $items[] = $data; } } } $_POST['CHECKLIST_ITEMS'] = $items; // too bad } $arResult["ERRORS"] = $template->GetErrors(); if (sizeof($arResult["ERRORS"]) == 0) { $arUploadedFils = unserialize($arFields["FILES"]); if (is_array($arUploadedFils) && count($arUploadedFils)) { $userId = (int) $USER->GetID(); foreach ($arUploadedFils as $fileId) { CTaskFiles::removeTemporaryFile($userId, (int) $fileId); } } // add\update check list items here try { \Bitrix\Tasks\Template\CheckListItemTable::updateForTemplate($templateID, $_POST['CHECKLIST_ITEMS']); } catch (\Bitrix\Main\ArgumentException $e) { } if (strlen($_POST["save"]) > 0) { if ((string) $arParams['PATH_TO_TEMPLATES_TEMPLATE'] !== '' && intval($templateID)) { $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TEMPLATES_TEMPLATE"], array('template_id' => $templateID, 'action' => 'view')); } else { $redirectPath = $arResult["RETURN_URL"]; } } else { $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TEMPLATES"], array());
// If multistep supported and multitask creation in process, store data in $_SESSION $responsiblesCount = count($_POST['RESPONSIBLES']); if (isset($_POST['_JS_STEPPER_SUPPORTED']) && $_POST['_JS_STEPPER_SUPPORTED'] === 'Y' && isset($_POST['FORM_GUID']) && $responsiblesCount) { $_SESSION['TASKS']['EDIT_COMPONENT']['STEPPER'][$_POST['FORM_GUID']] = array('arFields' => $arFields, 'RESPONSIBLES' => $_POST['RESPONSIBLES'], 'index' => 0); list($arResult['needStep'], $arResult['stepIndex'], $arResult['stepIndexesTotal']) = lambda_sgkrg455d_funcCreateSubtasks($arFields, $_POST['RESPONSIBLES'], 0, $loggedInUserId, false, array('COPY_PARAMS' => $arResult['COPY_PARAMS'])); $_SESSION['TASKS']['EDIT_COMPONENT']['STEPPER'][$_POST['FORM_GUID']]['index'] = $arResult['stepIndex']; } else { lambda_sgkrg455d_funcCreateSubtasks($arFields, $_POST['RESPONSIBLES'], 0, $loggedInUserId, $woStepper = true, array('COPY_PARAMS' => $arResult['COPY_PARAMS'])); } } } } if (sizeof($arResult["ERRORS"]) == 0) { if (is_array($arFields["FILES"]) && count($arFields["FILES"])) { foreach ($arFields["FILES"] as $fileId) { CTaskFiles::removeTemporaryFile($loggedInUserId, (int) $fileId); } } if (sizeof($_POST["REMINDERS"])) { if ($arResult["ACTION"] == "edit") { CTaskReminders::Delete(array("TASK_ID" => $taskID, "USER_ID" => $loggedInUserId)); } $obReminder = new CTaskReminders(); foreach ($_POST["REMINDERS"] as $reminder) { $arReminderFields = array("TASK_ID" => $taskID, "USER_ID" => $loggedInUserId, "REMIND_DATE" => $reminder["date"], "TYPE" => $reminder["type"], "TRANSPORT" => $reminder["transport"]); $obReminder->Add($arReminderFields); } } if ($arResult["ACTION"] == "create" && $_POST["apply"] == "save_and_back") { $redirectPath = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TASK"], array("task_id" => 0, "action" => "edit")); if ($arResult["IS_IFRAME"]) {