Esempio n. 1
0
        $arResult['TASKS'][$key]['META::RESPONSIBLE_PHOTO_SRC'] = $arUsersPhotos[$value['RESPONSIBLE_ID']];
    }
}
if (!$bSkipFiles) {
    if (count($arTasksIDs)) {
        $rsTaskFiles = CTaskFiles::GetList(array(), array('TASK_ID' => $arTasksIDs));
        while ($arTaskFile = $rsTaskFiles->Fetch()) {
            $rsFile = CFile::GetByID($arTaskFile['FILE_ID']);
            if ($arFile = $rsFile->Fetch()) {
                $arResult['TASKS'][$arTaskFile['TASK_ID']]['FILES'][] = $arFile;
            }
        }
    }
}
if (!$bSkipUpdatesCount) {
    $arResult['UPDATES_COUNT'] = CTasks::GetUpdatesCount($arViewedDates);
}
if (!$bSkipGroupsDataFetch) {
    // collect groups with tasks
    $arResult['GROUPS'] = array(0 => array('ID' => 0, 'NAME' => GetMessage('MB_TASKS_TASKS_LIST_PSEUDO_GROUP_NAME'), 'META:TASKS_IN_GROUP' => $arGroupsStat[0]['TASKS_IN_GROUP'], 'META:TASKS_STATUSES' => $arGroupsStat[0]['STATUSES'], 'META:TASKS_PRIORITIES' => $arGroupsStat[0]['PRIORITIES']));
    // List of groups to be fetched from DB
    $arGroupsIdsToBeFetched = array();
    // Fetch data about all needed groups only if we show list of groups
    if (count($arGroupsStat)) {
        $arGroupsIdsToBeFetched = array_keys($arGroupsStat);
    }
    if (!empty($arGroupsIdsToBeFetched)) {
        $rsGroups = CSocNetGroup::GetList(array(), array('ID' => $arGroupsIdsToBeFetched));
        while ($arGroup = $rsGroups->Fetch()) {
            $arGroup['META:TASKS_IN_GROUP'] = $arGroupsStat[(int) $arGroup['ID']]['TASKS_IN_GROUP'];
            $arGroup['META:TASKS_STATUSES'] = $arGroupsStat[(int) $arGroup['ID']]['STATUSES'];
Esempio n. 2
0
     while ($arTaskFile = $rsTaskFiles->Fetch()) {
         $rsFile = CFile::GetByID($arTaskFile["FILE_ID"]);
         if ($arFile = $rsFile->Fetch()) {
             $task["FILES"][] = $arFile;
         }
     }
     $arTasks[$task["ID"]] = $task;
 }
 unset($arFilter["PARENT_ID"]);
 $rsChildrenCount = CTasks::GetChildrenCount($arFilter, $arTasksIDs);
 if ($rsChildrenCount) {
     while ($arChildrens = $rsChildrenCount->Fetch()) {
         $arChildrenCount["PARENT_" . $arChildrens["PARENT_ID"]] = $arChildrens["CNT"];
     }
 }
 $arUpdatesCount = CTasks::GetUpdatesCount($arViewed);
 $APPLICATION->RestartBuffer();
 Header('Content-Type: text/html; charset=' . LANG_CHARSET);
 $arGroups = array();
 $i = 0;
 $iMax = count($arTasks);
 $bIsJSON = $_POST["type"] === "json";
 if ($bIsJSON) {
     echo "[";
 }
 foreach ($arTasks as $task) {
     ++$i;
     if ($task["GROUP_ID"]) {
         if (!isset($arGroups[$task["GROUP_ID"]])) {
             $arGroups[$task["GROUP_ID"]] = CSocNetGroup::GetByID($task["GROUP_ID"]);
         }
Esempio n. 3
0
$arOpenedProjects = CUserOptions::GetOption("tasks", "opened_projects", array());
if (!empty($arGroupsIDs)) {
    $rsGroups = CSocNetGroup::GetList(array("ID" => "ASC"), array("ID" => $arGroupsIDs));
    while ($arGroup = $rsGroups->GetNext()) {
        $arGroup["EXPANDED"] = array_key_exists($arGroup["ID"], $arOpenedProjects) && $arOpenedProjects[$arGroup["ID"]] == "false" ? false : true;
        $arResult["GROUPS"][$arGroup["ID"]] = $arGroup;
    }
}
$arResult["CHILDREN_COUNT"] = array();
$rsChildrenCount = CTasks::GetChildrenCount($arFilter, $arTasksIDs);
if ($rsChildrenCount) {
    while ($arChildrenCount = $rsChildrenCount->Fetch()) {
        $arResult["CHILDREN_COUNT"]["PARENT_" . $arChildrenCount["PARENT_ID"]] = $arChildrenCount["CNT"];
    }
}
$arResult["UPDATES_COUNT"] = CTasks::GetUpdatesCount($arViewed);
$rsTemplates = CTaskTemplates::GetList(array("ID" => "DESC"), array("CREATED_BY" => $USER->GetID(), 'BASE_TEMPLATE_ID' => false, '!TPARAM_TYPE' => CTaskTemplates::TYPE_FOR_NEW_USER), array('NAV_PARAMS' => array('nTopCount' => 10)));
$arResult["TEMPLATES"] = array();
while ($template = $rsTemplates->GetNext()) {
    $arResult["TEMPLATES"][] = $template;
}
$sTitle = "";
if ($taskType == "group") {
    $sTitle = $sTitleShort = GetMessage("TASKS_TITLE_GROUP_TASKS");
} else {
    if ($arParams["USER_ID"] == $USER->GetID()) {
        $sTitle = $sTitleShort = GetMessage("TASKS_TITLE_MY_TASKS");
    } else {
        $sTitle = CUser::FormatName($arParams["NAME_TEMPLATE"], $arResult["USER"], true, false) . ": " . GetMessage("TASKS_TITLE_TASKS");
        $sTitleShort = GetMessage("TASKS_TITLE_TASKS");
    }