Esempio n. 1
0
     }
 }
 if ($arResult['SHOW_SECTION_MANAGE'] === 'Y' && $arParams['GROUP_ID'] > 0) {
     $arResult['SHOW_SECTION_MANAGE'] = 'N';
 }
 if ($arResult['SHOW_SECTION_MANAGE'] === 'Y') {
     $arResult['SECTION_MANAGE_COUNTER'] = 0;
     if ($arEmployees = CTaskIntranetTools::getImmediateEmployees($arParams['USER_ID'])) {
         foreach ($arEmployees as $employeeId) {
             $employeeId = (int) $employeeId;
             $arResult['SECTION_MANAGE_COUNTER'] += CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_RESPONSIBLE) + CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_ACCOMPLICE) + CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_ORIGINATOR) + CTaskListCtrl::getUserRoleCounterForUser($employeeId, CTaskListState::VIEW_ROLE_AUDITOR);
         }
     }
 }
 // get states description
 $oListState = CTaskListState::getInstance($loggedInUserId);
 $arResult['VIEW_STATE'] = $oListState->getState();
 $arResult['VIEW_STATE_RAW'] = $oListState->getRawState();
 $oListCtrl = CTaskListCtrl::getInstance($arParams['USER_ID']);
 $oListCtrl->useState($oListState);
 if ($arParams["GROUP_ID"] > 0) {
     $oListCtrl->setFilterByGroupId((int) $arParams["GROUP_ID"]);
 } else {
     $oListCtrl->setFilterByGroupId(null);
 }
 $selectedRoleId = $arResult['VIEW_STATE']['ROLE_SELECTED']['ID'];
 $selectedRoleName = $arResult['VIEW_STATE']['ROLE_SELECTED']['CODENAME'];
 $arResult['F_CREATED_BY'] = $arResult['F_RESPONSIBLE_ID'] = null;
 if ($arResult['VIEW_STATE']['SECTION_SELECTED']['CODENAME'] === 'VIEW_SECTION_ROLES') {
     /*
     if (
Esempio n. 2
0
        ShowError(GetMessage('TASKS_ACCESS_TO_GROUP_DENIED'));
        return;
    }
}
$bAttachUserFields = false;
if (isset($arParams['ATTACH_USER_FIELDS']) && $arParams['ATTACH_USER_FIELDS'] === 'Y') {
    $bAttachUserFields = true;
}
if ($bAttachUserFields) {
    $arResult['USER_FIELDS'] = array();
} else {
    $arResult['USER_FIELDS'] = false;
}
$arResult["TASK_TYPE"] = $taskType = $arParams["GROUP_ID"] > 0 ? "group" : "user";
$bExcel = isset($_GET["EXCEL"]) && $_GET["EXCEL"] == "Y";
$oListState = CTaskListState::getInstance($USER->getId());
$viewType = "tree";
if (isset($_GET["VIEW"]) && $_GET["VIEW"] == "1" || $bExcel) {
    $viewType = "list";
    try {
        $oListState->setSection(CTaskListState::VIEW_SECTION_ROLES);
        $oListState->setUserRole(CTaskListState::VIEW_ROLE_RESPONSIBLE);
        $oListState->setViewMode(CTaskListState::VIEW_MODE_LIST);
        $oListState->switchOffSubmode(CTaskListState::VIEW_SUBMODE_WITH_SUBTASKS);
        $oListState->switchOnSubmode(CTaskListState::VIEW_SUBMODE_WITH_GROUPS);
        $oListState->saveState();
    } catch (TasksException $e) {
        CTaskAssert::logError('[0xe9474b52] ');
    }
} elseif (isset($_GET["VIEW"]) && $_GET["VIEW"] == "2") {
    $viewType = "gantt";
Esempio n. 3
0
 /**
  * prevent creating through "new"
  *
  * @param $userId
  */
 private function __construct($userId)
 {
     global $USER;
     CTaskAssert::assertLaxIntegers($userId);
     CTaskAssert::assert($userId > 0);
     $this->userId = $userId;
     if (isset($GLOBALS['USER']) && is_object($GLOBALS['USER']) && $USER->IsAuthorized()) {
         $this->loggedInUserId = (int) $USER->getId();
     }
     $this->oListState = CTaskListState::getInstance($userId);
 }
Esempio n. 4
0
$arParams['GROUP_ID'] = intval($arParams['GROUP_ID']);
$arParams['NAME_TEMPLATE'] = empty($arParams['NAME_TEMPLATE']) ? CSite::GetNameFormat(false) : str_replace(array("#NOBR#", "#/NOBR#"), array("", ""), $arParams["NAME_TEMPLATE"]);
$bSkipCounter = false;
if (isset($arParams['HIDE_COUNTERS'])) {
    if ($arParams['HIDE_COUNTERS'] === 'Y') {
        $bSkipCounter = true;
    }
}
$arResult['HIDE_COUNTERS'] = $bSkipCounter;
$arResult["TASK_TYPE"] = $taskType = $arParams["GROUP_ID"] > 0 ? "group" : "user";
$arResult['LOGGED_IN_USER'] = (int) $USER->GetID();
if ($bUseRoleFilter) {
    $arResult['USE_ROLE_FILTER'] = 'Y';
    $arResult['SELECTED_PRESET_ID'] = null;
    $arResult['SELECTED_PRESET_NAME'] = null;
    $oListState = CTaskListState::getInstance($arParams['USER_ID']);
    $viewState = $oListState->getState();
    $arResult['COUNTS'] = array();
    $arCountsAll = array();
    $obCache = new CPHPCache();
    $lifeTime = CTasksTools::CACHE_TTL_UNLIM;
    $cacheID = md5($arResult['LOGGED_IN_USER'] . "user" . $arParams["USER_ID"]);
    $cacheDir = "/tasks/filter_tt_v2roles_" . '/' . substr($cacheID, -4, 2) . '/' . substr($cacheID, -2) . '/' . $cacheID;
    $bNeedCacheData = false;
    if (defined('BX_COMP_MANAGED_CACHE') && $obCache->InitCache($lifeTime, $cacheID, $cacheDir)) {
        $arCountsAll = $obCache->GetVars();
    } else {
        $arCountsAll = array();
    }
    $arResult['ROLES_LIST'] = array();
    foreach ($viewState['ROLES'] as $roleCodename => $arRoleData) {