Пример #1
0
             $arFilter = array('CREATED_BY' => $loggedInUserId, 'ID' => $unfilteredTaskIds);
         }
         // Select templates choosen
         $templateIds = array();
         $res = CTaskTemplates::GetList(array(), $arFilter, array('ID'));
         while ($template = $res->fetch()) {
             $templateIds[] = (int) $template['ID'];
         }
         //$value = null;
         $processedItems = $notProcessedItems = 0;
         switch ($_POST['subaction']) {
             case 'remove':
                 foreach ($templateIds as $templateId) {
                     // ka-boom!
                     $templateInstance = new CTaskTemplates();
                     if ($templateInstance->Delete($templateId)) {
                         ++$processedItems;
                     } else {
                         ++$notProcessedItems;
                     }
                 }
                 break;
             default:
                 CTaskAssert::logError('[0x8a1747a5] unknown subaction: ' . $_POST['subaction']);
                 break;
         }
         break;
     default:
         CTaskAssert::logError('[0x8b300a99] unknown action: ' . $_POST['action']);
         break;
 }
Пример #2
0
        } else {
            $arData = $_POST;
            // specially for USER FIELDS
            if (is_array($arResult['USER_FIELDS'])) {
                foreach ($arResult['USER_FIELDS'] as $fld => &$fldData) {
                    if (isset($arData[$fld])) {
                        $fldData['VALUE'] = $arData[$fld];
                    }
                }
            }
        }
    }
} elseif (check_bitrix_sessid() && $arResult["ACTION"] == "delete") {
    if (is_array($arData) && intval($arData['ID'])) {
        $templateInstance = new CTaskTemplates();
        if ($templateInstance->Delete($arData['ID'])) {
            LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TASKS_TEMPLATES"], array()));
        } else {
            LocalRedirect(CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_TEMPLATES_TEMPLATE"], array('action' => 'view', 'template_id' => $arData['ID'])));
        }
    }
} else {
    // some pre-sets for new template
    if ($arResult["ACTION"] == "create") {
        $arData['DESCRIPTION_IN_BBCODE'] = 'Y';
        // create all new tasks in BB-code
        // set base template id, if it came from GET request
        if (intval($_REQUEST['BASE_TEMPLATE'])) {
            $arData['BASE_TEMPLATE_ID'] = intval($_REQUEST['BASE_TEMPLATE']);
        }
    }
Пример #3
0
define('STOP_STATISTICS', true);
define('NO_AGENT_CHECK', true);
define('DisableEventsCheck', true);
define('BX_SECURITY_SHOW_MESSAGE', true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
CUtil::JSPostUnescape();
CModule::IncludeModule('tasks');
__IncludeLang(dirname(__FILE__) . '/lang/' . LANGUAGE_ID . '/' . basename(__FILE__));
__IncludeLang(dirname(__FILE__) . '/templates/.default/lang/' . LANGUAGE_ID . '/template.php');
if (check_bitrix_sessid()) {
    if (intval($_POST["id"]) > 0) {
        $rsTemplate = CTaskTemplates::GetByID((int) $_POST["id"], array('USER_ID' => $USER->getId()));
        if ($arTemplate = $rsTemplate->Fetch()) {
            if ($_POST["mode"] == "delete") {
                $template = new CTaskTemplates();
                $rc = $template->Delete(intval($_POST["id"]));
                if ($rc === false) {
                    $strError = 'Error';
                    if ($ex = $APPLICATION->GetException()) {
                        $strError = $ex->GetString();
                    }
                    if ($_POST["type"] == "json") {
                        echo "['strError' : '" . CUtil::JSEscape(htmlspecialcharsbx($strError)) . "']";
                    } else {
                        echo htmlspecialcharsbx($strError);
                    }
                }
            } elseif ($_POST["mode"] == "load") {
                $arPaths = array('PATH_TO_TASKS_TASK' => null, 'PATH_TO_USER_PROFILE' => null, 'PATH_TO_USER_TASKS_TASK' => null, 'PATH_TO_TEMPLATES_TEMPLATE' => null);
                if (isset($_POST['path_to_task'])) {
                    $arPaths['PATH_TO_TASKS_TASK'] = $_POST['path_to_task'];