コード例 #1
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
     }
     $_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());
     }
     LocalRedirect($redirectPath);
 } else {
     $arData = $_POST;
     // specially for USER FIELDS
コード例 #2
0
ファイル: taskitem.php プロジェクト: DarneoStudio/bitrix
 protected function getChildTemplateData($templateId)
 {
     $templateId = (int) $templateId;
     if (!$templateId) {
         return array();
     }
     // template id not set
     $subTasksToCreate = array();
     $res = CTaskTemplates::GetList(array('BASE_TEMPLATE_ID' => 'asc'), array('BASE_TEMPLATE_ID' => $templateId), false, array('INCLUDE_TEMPLATE_SUBTREE' => true), array('*', 'UF_*', 'BASE_TEMPLATE_ID'));
     while ($item = $res->fetch()) {
         if ($item['ID'] == $templateId) {
             continue;
         }
         $subTasksToCreate[$item['ID']] = $item;
     }
     // get check lists
     $res = \Bitrix\Tasks\Template\CheckListItemTable::getListByTemplateDependency($templateId, array('order' => array('SORT' => 'ASC'), 'select' => array('ID', 'TEMPLATE_ID', 'IS_COMPLETE', 'SORT_INDEX', 'TITLE')));
     while ($item = $res->fetch()) {
         if (isset($subTasksToCreate[$item['TEMPLATE_ID']])) {
             $clId = $item['ID'];
             $tmpId = $item['TEMPLATE_ID'];
             unset($item['ID']);
             unset($item['TEMPLATE_ID']);
             $subTasksToCreate[$tmpId]['CHECK_LIST'][$clId] = $item;
         }
     }
     return $subTasksToCreate;
 }
コード例 #3
0
ファイル: component.php プロジェクト: mrdeadmouse/u136006
             $arTemplate["FILES"][$key] = $newFile;
         }
     }
 }
 $arTemplate["REPLICATE_PARAMS"] = unserialize($arTemplate["~REPLICATE_PARAMS"]);
 if (is_array($arTemplate["REPLICATE_PARAMS"])) {
     foreach ($arTemplate["REPLICATE_PARAMS"] as $field => $value) {
         $arTemplate["REPLICATE_" . $field] = $value;
     }
 }
 if ($arTemplate["DEADLINE_AFTER"]) {
     $deadlineAfter = $arTemplate["DEADLINE_AFTER"] / (24 * 60 * 60);
     $arTemplate["DEADLINE"] = date($DB->DateFormatToPHP(CSite::GetDateFormat("SHORT")), strtotime(date("Y-m-d 00:00") . " +" . $deadlineAfter . " days"));
 }
 // check list items
 $res = \Bitrix\Tasks\Template\CheckListItemTable::getList(array('filter' => array('=TEMPLATE_ID' => intval($_GET["TEMPLATE"])), 'select' => array('ID', 'TITLE', 'SORT', 'IS_COMPLETE'), 'order' => array('SORT' => 'asc')));
 while ($item = $res->fetch()) {
     unset($item['ID']);
     $arTemplate['CHECKLIST_ITEMS'][] = $item;
 }
 $arResult['COPY_PARAMS']['ORIGIN_TEMPLATE'] = intval($_GET["TEMPLATE"]);
 // get template.php to know task being copied
 $arData = $arTemplate;
 $arData['REPLICATE'] = 'N';
 $arData['~REPLICATE'] = 'N';
 $arData['REPLICATE_PARAMS'] = array();
 $arData['~REPLICATE_PARAMS'] = array();
 foreach ($arData as $key => $value) {
     if (substr($key, 0, 10) === 'REPLICATE_') {
         unset($arData[$key]);
     }