Exemplo n.º 1
0
 public static function SaveTask($tasksData)
 {
     $rc = false;
     if (!$GLOBALS['USER']->IsAuthorized()) {
         return false;
     }
     $delegateToUser = false;
     if (isset($tasksData['META::DELEGATE_TO_USER'])) {
         $delegateToUser = (int) $tasksData['META::DELEGATE_TO_USER'];
     }
     $bDelegate = false;
     if ($delegateToUser > 0) {
         $bDelegate = true;
     }
     $curUserId = (int) $GLOBALS['USER']->GetID();
     if (!CModule::IncludeModule('socialnetwork')) {
         return false;
     }
     $arNewTaskFields = false;
     $bErrorOccuredOnTaskCreation = false;
     if (isset($tasksData['TASK_ID']) && check_bitrix_sessid()) {
         $bCreateMode = true;
         if ($tasksData['TASK_ID'] > 0) {
             $bCreateMode = false;
         }
         // We are in edit mode
         if ($bCreateMode && $bDelegate) {
             throw new Exception('$bCreateMode && $bDelegate');
         }
         if (!$bCreateMode && $bDelegate) {
             $arNewTaskFields = array();
             if (intval($delegateToUser) !== $curUserId) {
                 $arNewTaskFields['RESPONSIBLE_ID'] = $delegateToUser;
                 $arNewTaskFields['STATUS'] = CTasks::STATE_PENDING;
                 $rsTask = CTasks::GetByID($tasksData['TASK_ID']);
                 $arTask = $rsTask->Fetch();
                 if (!$arTask || !isset($arTask['ID'])) {
                     return false;
                 }
                 if (sizeof($arTask['AUDITORS'] > 0)) {
                     if (!in_array($curUserId, $arTask['AUDITORS'])) {
                         $arNewTaskFields['AUDITORS'] = $arTask['AUDITORS'];
                         $arNewTaskFields['AUDITORS'][] = $curUserId;
                     }
                 } else {
                     $arNewTaskFields['AUDITORS'] = array($curUserId);
                 }
             } else {
                 return false;
             }
         } else {
             $arNewTaskFields = array('TITLE' => $tasksData['TITLE'], 'DESCRIPTION' => $tasksData['DESCRIPTION'], 'RESPONSIBLE_ID' => $tasksData['RESPONSIBLE_ID'], 'PRIORITY' => $tasksData['PRIORITY'], 'DEADLINE' => CAllDatabase::FormatDate(str_replace('T', ' ', $tasksData['DEADLINE']), 'YYYY-MM-DD HH:MI:SS', FORMAT_DATETIME));
             if (isset($tasksData['ACCOMPLICES'])) {
                 if ($tasksData['ACCOMPLICES'] == -1) {
                     $arNewTaskFields['ACCOMPLICES'] = array();
                 } else {
                     $arNewTaskFields['ACCOMPLICES'] = $tasksData['ACCOMPLICES'];
                 }
             }
             if (isset($tasksData['AUDITORS'])) {
                 if ($tasksData['AUDITORS'] == -1) {
                     $arNewTaskFields['AUDITORS'] = array();
                 } else {
                     $arNewTaskFields['AUDITORS'] = $tasksData['AUDITORS'];
                 }
             }
             $arNewTaskFields['GROUP_ID'] = 0;
             if (isset($tasksData['GROUP_ID']) && intval($tasksData['GROUP_ID']) > 0) {
                 if (CSocNetFeaturesPerms::CurrentUserCanPerformOperation(SONET_ENTITY_GROUP, (int) $tasksData['GROUP_ID'], 'tasks', 'create_tasks')) {
                     $arNewTaskFields['GROUP_ID'] = (int) $tasksData['GROUP_ID'];
                 } else {
                     unset($arNewTaskFields['GROUP_ID']);
                 }
             }
             if ($bCreateMode) {
                 $arNewTaskFields['CREATED_BY'] = $curUserId;
             }
         }
         if (isset($tasksData['META::EVENT_GUID'])) {
             $arNewTaskFields['META::EVENT_GUID'] = $tasksData['META::EVENT_GUID'];
         }
         if ($bCreateMode) {
             $arNewTaskFields['ID'] = 0;
         } else {
             $arNewTaskFields['ID'] = (int) $tasksData['TASK_ID'];
         }
         $oTask = new CTasks();
         if (!$bCreateMode) {
             $rc = $oTask->Update($arNewTaskFields['ID'], $arNewTaskFields);
         } else {
             $arNewTaskFields['MULTITASK'] = 'N';
             $arNewTaskFields['DESCRIPTION_IN_BBCODE'] = 'Y';
             // Only creator or priveleged user can set responsible person.
             $arNewTaskFields['RESPONSIBLE_ID'] = $curUserId;
             if ($arNewTaskFields['CREATED_BY'] === $curUserId || $GLOBALS['USER']->IsAdmin() || CTasksTools::IsPortalB24Admin()) {
                 $arNewTaskFields['RESPONSIBLE_ID'] = (int) $tasksData['RESPONSIBLE_ID'];
             }
             $arNewTaskFields['SITE_ID'] = SITE_ID;
             $rc = $oTask->Add($arNewTaskFields);
             if ($rc > 0) {
                 $arNewTaskFields['ID'] = $rc;
             } else {
                 $bErrorOccuredOnTaskCreation = true;
             }
         }
         $rc = $arNewTaskFields['ID'];
     }
     if ($bErrorOccuredOnTaskCreation) {
         return false;
     }
     return $rc;
 }
Exemplo n.º 2
0
if ($arResult['TASK']['DEADLINE']) {
    echo CAllDatabase::FormatDate($arResult['TASK']['DEADLINE'], FORMAT_DATETIME, 'YYYY-MM-DD HH:MI:SS');
} else {
    echo date('Y') . '-' . date('m') . '-' . date('d') . ' ' . date('H') . ':' . date('i') . ':00';
}
?>
',
							format: 'y-M-d H:m:s',
							type: 'datetime',
							callback: function(res)
							{
								BX('DEADLINE').innerHTML = res;
							}
						});"><?php 
if ($arResult['TASK']['DEADLINE']) {
    echo CAllDatabase::FormatDate($arResult['TASK']['DEADLINE'], FORMAT_DATETIME, 'YYYY-MM-DD HH:MI:SS');
} else {
    echo GetMessage('MB_TASKS_TASK_EDIT_BTN_SELECT');
}
?>
</span>
					</span>
			</div>
			<div class="task-form-row">
				<span class="task-form-row-left"><?php 
echo GetMessage('MB_TASKS_TASK_EDIT_PRIORITY');
?>
</span><span class="task-form-row-right">
					<select id="PRIORITY" name="PRIORITY">
						<?php 
$arPriorities = array(CTasks::PRIORITY_LOW => GetMessage('MB_TASKS_TASK_EDIT_PRIORITY_LOW'), CTasks::PRIORITY_AVERAGE => GetMessage('MB_TASKS_TASK_EDIT_PRIORITY_AVERAGE'), CTasks::PRIORITY_HIGH => GetMessage('MB_TASKS_TASK_EDIT_PRIORITY_HIGH'));
Exemplo n.º 3
0
    private function getGridData($gridId, $showDeleted = false)
    {
        $grid = array('ID' => $gridId);
        $gridOptions = new CGridOptions($grid['ID']);
        $gridSort = $gridOptions->getSorting(array('sort' => array('NAME' => 'ASC'), 'vars' => array('by' => 'by', 'order' => 'order')));
        $filter = array();
        $grid['SORT'] = $gridSort['sort'];
        $grid['SORT_VARS'] = $gridSort['vars'];
        $grid['MODE'] = $this->getViewMode();
        $possibleColumnForSorting = array('UPDATE_TIME' => array('ALIAS' => 'UPDATE_TIME', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_UPDATE_TIME')), 'NAME' => array('ALIAS' => 'NAME', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_NAME')), 'FORMATTED_SIZE' => array('ALIAS' => 'SIZE', 'LABEL' => Loc::getMessage('DISK_FOLDER_LIST_SORT_BY_FORMATTED_SIZE')));
        $byColumn = key($grid['SORT']);
        if (!isset($possibleColumnForSorting[$byColumn]) || strtolower($grid['SORT'][$byColumn]) !== 'desc' && strtolower($grid['SORT'][$byColumn]) !== 'asc') {
            $grid['SORT'] = array();
        }
        $order = $grid['SORT'];
        $byColumn = key($order);
        $sortingColumns = array('TYPE' => array(SORT_NUMERIC, SORT_ASC), $possibleColumnForSorting[$byColumn]['ALIAS'] => strtolower($order[$byColumn]) === 'asc' ? SORT_ASC : SORT_DESC);
        if ($byColumn !== 'NAME') {
            $sortingColumns[$possibleColumnForSorting['NAME']['ALIAS']] = SORT_ASC;
        }
        $securityContext = $this->storage->getCurrentUserSecurityContext();
        $proxyType = $this->storage->getProxyType();
        $isStorageCurrentUser = $proxyType instanceof ProxyType\User && $proxyType->getTitleForCurrentUser() != $proxyType->getTitle();
        $parameters = array('with' => array('CREATE_USER'), 'filter' => array('PARENT_ID' => $this->folder->getRealObjectId(), 'DELETED_TYPE' => ObjectTable::DELETED_TYPE_NONE));
        $parameters = Driver::getInstance()->getRightsManager()->addRightsCheck($securityContext, $parameters, array('ID', 'CREATED_BY'));
        $needPagination = $this->needPagination();
        $pageNumber = (int) $this->request->getQuery('pageNumber');
        if ($pageNumber <= 0) {
            $pageNumber = 1;
        }
        if ($needPagination) {
            $parameters['order'] = array();
            foreach ($sortingColumns as $columnName => $columnData) {
                if (is_array($columnData)) {
                    $parameters['order'][$columnName] = in_array(SORT_DESC, $columnData, true) ? 'DESC' : 'ASC';
                } else {
                    $parameters['order'][$columnName] = SORT_DESC === $columnData ? 'DESC' : 'ASC';
                }
            }
            unset($columnName, $columnData);
            $parameters['limit'] = self::COUNT_ON_PAGE + 1;
            // +1 because we want to know about existence next page
            $parameters['offset'] = self::COUNT_ON_PAGE * ($pageNumber - 1);
        }
        $this->folder->preloadOperationsForChildren($securityContext);
        $sharedObjectIds = $this->getUserShareObjectIds();
        $isDesktopDiskInstall = \Bitrix\Disk\Desktop::isDesktopDiskInstall();
        $nowTime = time() + CTimeZone::getOffset();
        $fullFormatWithoutSec = preg_replace('/:s$/', '', CAllDatabase::dateFormatToPHP(CSite::GetDateFormat("FULL")));
        $urlManager = Driver::getInstance()->getUrlManager();
        $rows = array();
        $storageTitle = $proxyType->getTitle();
        $isEnabledShowExtendedRights = $this->storage->isEnabledShowExtendedRights();
        $result = $this->folder->getList($parameters);
        $countObjectsOnPage = 0;
        $needShowNextPagePagination = false;
        while ($row = $result->fetch()) {
            $countObjectsOnPage++;
            if ($needPagination && $countObjectsOnPage > self::COUNT_ON_PAGE) {
                $needShowNextPagePagination = true;
                break;
            }
            $object = BaseObject::buildFromArray($row);
            /** @var File|Folder $object */
            $name = $object->getName();
            $objectId = $object->getId();
            $exportData = array('TYPE' => $object->getType(), 'NAME' => $name, 'ID' => $objectId);
            $relativePath = trim($this->arParams['RELATIVE_PATH'], '/');
            $detailPageFile = CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FILE_VIEW'], array('FILE_ID' => $objectId, 'FILE_PATH' => ltrim($relativePath . '/' . $name, '/')));
            $listingPage = rtrim(CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_FOLDER_LIST'], array('PATH' => $relativePath)), '/');
            $isFolder = $object instanceof Folder;
            $actions = $tileActions = $columns = array();
            if ($object->canRead($securityContext)) {
                $exportData['OPEN_URL'] = $urlManager->encodeUrn($isFolder ? $listingPage . '/' . $name . '/' : $detailPageFile);
                $actions[] = array("PSEUDO_NAME" => "open", "DEFAULT" => true, "ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_OPEN'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "')");
                if (!$object->canChangeRights($securityContext) && !$object->canShare($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk.showSharingDetailWithoutEdit({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->canChangeRights($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showSharingDetailWithChangeRights({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->canShare($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "share", "ICONCLASS" => "share", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_SHARING_DETAIL_2'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showSharingDetailWithSharing({\n\t\t\t\t\t\t\t\tajaxUrl: '/bitrix/components/bitrix/disk.folder.list/ajax.php',\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                }
                if ($isEnabledShowExtendedRights && !$object->isLink() && $object->canChangeRights($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "rights", "ICONCLASS" => "rights", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RIGHTS_SETTINGS'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showRightsOnObjectDetail({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                }
                if (!$isFolder) {
                    $actions[] = array("PSEUDO_NAME" => "download", "ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_DOWNLOAD'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadFile($object) . "')");
                }
                $actions[] = array("PSEUDO_NAME" => "copy", "ICONCLASS" => "copy", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openCopyModalWindow({\n\t\t\t\t\t\tid: {$this->storage->getRootObjectId()},\n\t\t\t\t\t\tname: '" . CUtil::JSEscape($storageTitle) . "'\n\t\t\t\t\t}, {\n\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "'\n\t\t\t\t\t});");
                if ($object->canDelete($securityContext)) {
                    $actions[] = array("PSEUDO_NAME" => "move", "ICONCLASS" => "move", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MOVE'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openMoveModalWindow({\n\t\t\t\t\t\t\tid: {$this->storage->getRootObjectId()},\n\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($storageTitle) . "'\n\t\t\t\t\t\t}, {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "'\n\t\t\t\t\t\t});");
                }
                if (!$isStorageCurrentUser && (!isset($sharedObjectIds[$object->getRealObjectId()]) || $sharedObjectIds[$object->getRealObjectId()]['TO_ENTITY'] != Sharing::CODE_USER . $this->getUser()->getId())) {
                    $actions[] = array("PSEUDO_NAME" => "connect", "ICONCLASS" => "connect", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_CONNECT'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].connectObjectToDisk({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\tname: '" . CUtil::JSEscape($name) . "',\n\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});");
                }
                if (!$isFolder) {
                    $actions[] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_GET_EXT_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getExternalLink({$objectId});");
                    $downloadLink = $urlManager->getUrlForShowFile($object, array(), true);
                    $actions[] = array("ICONCLASS" => "show", 'PSEUDO_NAME' => 'internal_link', 'PSEUDO_VALUE' => $downloadLink, "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_COPY_INTERNAL_LINK'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].getInternalLink('{$downloadLink}');");
                    $actions[] = array("ICONCLASS" => "history", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_SHOW_HISTORY'), "ONCLICK" => "jsUtils.Redirect(arguments, '" . $exportData['OPEN_URL'] . "#tab-history')");
                }
            }
            if ($object->canRename($securityContext)) {
                $actions[] = array("TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_RENAME'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].renameInline({$objectId})");
            }
            if ((!empty($sharedObjectIds[$objectId]) || $object->isLink()) && $object->canRead($securityContext)) {
                $tileActions['SHARE_INFO'] = array("ICONCLASS" => "show", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETAIL_SHARE_INFO'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].showShareInfoSmallView({\n\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t }\n\t\t\t\t\t})");
            }
            $columnsBizProc = array('BIZPROC' => '');
            $bizprocIcon = array('BIZPROC' => '');
            if ($this->arParams['STATUS_BIZPROC'] && !$isFolder) {
                list($actions, $columnsBizProc, $bizprocIcon) = $this->getBizProcData($object, $securityContext, $actions, $columnsBizProc, $bizprocIcon, $exportData);
            }
            if ($object->canDelete($securityContext)) {
                if ($object->isLink()) {
                    $actions[] = array("PSEUDO_NAME" => "detach", "ICONCLASS" => "detach", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_DETACH_BUTTON'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDetach({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t }\n\t\t\t\t\t\t\t})");
                } elseif ($object->getCode() !== Folder::CODE_FOR_UPLOADED_FILES) {
                    $actions[] = array("PSEUDO_NAME" => "delete", "ICONCLASS" => "delete", "TEXT" => Loc::getMessage('DISK_FOLDER_LIST_ACT_MARK_DELETED'), "ONCLICK" => "BX.Disk['FolderListClass_{$this->componentId}'].openConfirmDelete({\n\t\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\t\tid: {$objectId},\n\t\t\t\t\t\t\t\t\tname: '{$name}',\n\t\t\t\t\t\t\t\t\tisFolder: " . ($isFolder ? 'true' : 'false') . "\n\t\t\t\t\t\t\t\t },\n\t\t\t\t\t\t\t\tcanDelete: {$object->canDelete($securityContext)}\n\t\t\t\t\t\t\t})");
                }
            }
            $iconClass = Ui\Icon::getIconClassByObject($object, !empty($sharedObjectIds[$objectId]));
            $dataAttributesForViewer = '';
            if ($isFolder) {
                $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object);
                if ($grid['MODE'] === 'tile') {
                    $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer;
                    $dataAttributesForViewer = '';
                }
                $nameSpecialChars = htmlspecialcharsbx($name);
                $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t";
            } else {
                $externalId = '';
                if ($isDesktopDiskInstall && $isStorageCurrentUser) {
                    $externalId = "st{$this->storage->getId()}|{$this->storage->getRootObjectId()}|f{$objectId}";
                }
                $dataAttributesForViewer = Ui\Viewer::getAttributesByObject($object, array('canUpdate' => $object->canUpdate($securityContext), 'relativePath' => $relativePath . '/' . $name, 'externalId' => $externalId));
                if ($grid['MODE'] === 'tile') {
                    $exportData['VIEWER_ATTRS'] = $dataAttributesForViewer;
                    $dataAttributesForViewer = '';
                }
                $nameSpecialChars = htmlspecialcharsbx($name);
                $columnName = "\n\t\t\t\t\t<table class=\"bx-disk-object-name\"><tr>\n\t\t\t\t\t\t<td style=\"width: 45px;\"><div data-object-id=\"{$objectId}\" class=\"draggable bx-file-icon-container-small {$iconClass}\"></div></td>\n\t\t\t\t\t\t<td><a class=\"bx-disk-folder-title\" id=\"disk_obj_{$objectId}\" href=\"{$exportData['OPEN_URL']}\" {$dataAttributesForViewer}>{$nameSpecialChars}</a></td>\n\t\t\t\t\t\t<td>{$bizprocIcon['BIZPROC']}</td>\n\t\t\t\t\t</tr></table>\n\t\t\t\t";
            }
            $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $object->getCreatedBy()));
            $timestampCreate = $object->getCreateTime()->toUserTime()->getTimestamp();
            $timestampUpdate = $object->getUpdateTime()->toUserTime()->getTimestamp();
            $columns = array('CREATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampCreate, $nowTime) : formatDate('x', $timestampCreate, $nowTime), 'UPDATE_TIME' => $nowTime - $timestampCreate > 158400 ? formatDate($fullFormatWithoutSec, $timestampUpdate, $nowTime) : formatDate('x', $timestampUpdate, $nowTime), 'NAME' => $columnName, 'FORMATTED_SIZE' => $isFolder ? '' : CFile::formatSize($object->getSize()), 'CREATE_USER' => "\n\t\t\t\t\t<div class=\"bx-disk-user-link\"><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($object->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t");
            if ($this->arParams['STATUS_BIZPROC']) {
                $columns['BIZPROC'] = $columnsBizProc["BIZPROC"];
            }
            $exportData['ICON_CLASS'] = $iconClass;
            if ($grid['MODE'] === 'tile') {
                $exportData['IS_IMAGE'] = $isFolder ? false : \Bitrix\Disk\TypeFile::isImage($object);
                if ($exportData['IS_IMAGE']) {
                    $exportData['SRC_IMAGE'] = $urlManager->getUrlForShowFile($object, array('exact' => 'Y', 'width' => 64, 'height' => 64));
                }
                $exportData['UPDATE_TIME'] = $columns['UPDATE_TIME'];
            }
            $exportData['IS_SHARED'] = !empty($sharedObjectIds[$objectId]);
            $exportData['IS_LINK'] = $object->isLink();
            $tildaExportData = array();
            foreach ($exportData as $exportName => $exportValue) {
                $tildaExportData['~' . $exportName] = $exportValue;
            }
            unset($exportRow);
            $rows[] = array('data' => array_merge($exportData, $tildaExportData), 'columns' => $columns, 'actions' => $actions, 'tileActions' => $tileActions, 'TYPE' => $exportData['TYPE'], 'NAME' => $exportData['NAME'], 'UPDATE_TIME' => $object->getUpdateTime()->getTimestamp(), 'SIZE' => $isFolder ? 0 : $object->getSize());
        }
        unset($object);
        if (!$needPagination) {
            Collection::sortByColumn($rows, $sortingColumns);
        }
        $grid['HEADERS'] = array(array('id' => 'ID', 'name' => 'ID', 'sort' => isset($possibleColumnForSorting['ID']) ? 'ID' : false, 'default' => false), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_NAME'), 'sort' => isset($possibleColumnForSorting['NAME']) ? 'NAME' : false, 'default' => true, 'editable' => array('size' => 45)), array('id' => 'CREATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_TIME'), 'sort' => isset($possibleColumnForSorting['CREATE_TIME']) ? 'CREATE_TIME' : false, 'default' => false), array('id' => 'UPDATE_TIME', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_UPDATE_TIME'), 'sort' => isset($possibleColumnForSorting['UPDATE_TIME']) ? 'UPDATE_TIME' : false, 'default' => true), array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_CREATE_USER'), 'sort' => isset($possibleColumnForSorting['CREATE_USER']) ? 'CREATE_USER' : false, 'default' => false), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_FORMATTED_SIZE'), 'sort' => isset($possibleColumnForSorting['FORMATTED_SIZE']) ? 'FORMATTED_SIZE' : false, 'default' => true));
        if ($this->arParams['STATUS_BIZPROC']) {
            $grid['HEADERS'][] = array('id' => 'BIZPROC', 'name' => Loc::getMessage('DISK_FOLDER_LIST_COLUMN_BIZPROC'), 'default' => false);
        }
        $grid['DATA_FOR_PAGINATION'] = array('ENABLED' => $needPagination);
        if ($needPagination) {
            $grid['DATA_FOR_PAGINATION']['SHOW_NEXT_PAGE'] = $needShowNextPagePagination;
            $grid['DATA_FOR_PAGINATION']['CURRENT_PAGE'] = $pageNumber;
        }
        $grid['COLUMN_FOR_SORTING'] = $possibleColumnForSorting;
        $grid['ROWS'] = $rows;
        $grid['ROWS_COUNT'] = count($rows);
        $grid['FOOTER'] = array();
        if (isModuleInstalled('bitrix24')) {
            list($freeSpace, $diskSize) = $this->getDiskSpace();
            $freeSpace = CFile::formatSize($freeSpace);
            $diskSize = CFile::formatSize($diskSize);
            $grid['FOOTER'] = array(array('custom_html' => '
						<td class="tar" style="width: 100%;">' . Loc::getMessage('DISK_FOLDER_LIST_B24_LABEL_DISK_SPACE', array('#FREE_SPACE#' => '<span>' . $freeSpace, '#DISK_SIZE#' => $diskSize . '</span>')) . '</span></td>
					'), array('custom_html' => '
						<td class="tar"><a class="bx-disk-mp-link-addhdd" href="' . Loc::getMessage('DISK_FOLDER_LIST_B24_URL_DISK_SPACE') . '" target="_blank">+ <span>' . Loc::getMessage('DISK_FOLDER_LIST_B24_APPEND_DISK_SPACE') . '</span></a></td>
					'));
        }
        return $grid;
    }
Exemplo n.º 4
0
}
$rsUser = CUser::GetByID($arParams['USER_ID']);
if (!(is_object($rsUser) && ($arUser = $rsUser->GetNext()))) {
    return false;
}
$arResult['USER'] = $arUser;
unset($rsUser, $arUser);
$arNewTaskFields = false;
$bErrorOccuredOnTaskCreation = false;
if (isset($_POST['TASK_ID']) && check_bitrix_sessid()) {
    $bCreateMode = true;
    if ($_POST['TASK_ID'] > 0) {
        $bCreateMode = false;
    }
    // We are in edit mode
    $arNewTaskFields = array('TITLE' => $_POST['TITLE'], 'DESCRIPTION' => $_POST['DESCRIPTION'], 'RESPONSIBLE_ID' => $_POST['RESPONSIBLE_ID'], 'PRIORITY' => $_POST['PRIORITY'], 'DEADLINE' => CAllDatabase::FormatDate(str_replace('T', ' ', $_POST['DEADLINE']), 'YYYY-MM-DD HH:MI:SS', FORMAT_DATETIME));
    if ($bCreateMode) {
        $arNewTaskFields['ID'] = 0;
    } else {
        $arNewTaskFields['ID'] = (int) $_POST['TASK_ID'];
    }
    $arNewTaskFields['GROUP_ID'] = 0;
    if (isset($_POST['GROUP_ID']) && intval($_POST['GROUP_ID']) > 0) {
        if (CSocNetFeaturesPerms::CurrentUserCanPerformOperation(SONET_ENTITY_GROUP, (int) $_POST['GROUP_ID'], 'tasks', 'create_tasks')) {
            $arNewTaskFields['GROUP_ID'] = (int) $_POST['GROUP_ID'];
        } else {
            unset($arNewTaskFields['GROUP_ID']);
        }
    }
    $oTask = new CTasks();
    if (!$bCreateMode) {