示例#1
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
/**
 * Bitrix vars
 *
 * @var array $arParams
 * @var array $arResult
 * @var string $templateFolder
 * @global CMain $APPLICATION
 */
CUtil::InitJSCore(array('window', 'ajax'));
$APPLICATION->AddHeadScript('/bitrix/js/main/utils.js');
$APPLICATION->AddHeadScript('/bitrix/js/main/popup_menu.js');
$APPLICATION->AddHeadScript('/bitrix/js/main/dd.js');
$APPLICATION->SetAdditionalCSS('/bitrix/themes/.default/pubstyles.css');
$theme = '';
if (isset($arResult["OPTIONS"])) {
    $theme = $arResult["OPTIONS"]["theme"];
} elseif (CPageOption::GetOptionString("main.interface", "use_themes", "Y") !== "N") {
    $theme = CGridOptions::GetTheme($arParams["GRID_ID"]);
}
if ($theme != '') {
    $APPLICATION->SetAdditionalCSS($templateFolder . '/themes/' . $theme . '/style.css');
}
$currentBodyClass = $APPLICATION->GetPageProperty("BodyClass", false);
$APPLICATION->SetPageProperty("BodyClass", ($currentBodyClass ? $currentBodyClass . " " : "") . "flexible-layout");
示例#2
0
$GLOBALS["APPLICATION"]->ResetException();
$path = str_replace(array("\\", "//"), "/", dirname(__FILE__) . "/action.php");
$result = (include $path);
if ($result !== true) {
    $oError = $GLOBALS["APPLICATION"]->GetException();
    if ($oError) {
        $arResult["ERROR_MESSAGE"] = $oError->GetString();
    }
}
/********************************************************************
				/ACTIONS
********************************************************************/
/********************************************************************
				FILTER
********************************************************************/
$grid_options = new CGridOptions($arParams["GRID_ID"]);
$arFilter = array();
if (isset($_REQUEST["clear_filter"]) && $_REQUEST["clear_filter"] == "Y") {
    $urlParams = array();
    foreach ($arResult["FILTER"] as $id => $arFilter) {
        $urlParams[] = $arFilter["id"];
    }
    $urlParams[] = "clear_filter";
    $grid_filter = $grid_options->GetFilter(array());
    LocalRedirect($APPLICATION->GetCurPageParam("", $urlParams));
}
$grid_filter = $grid_options->GetFilter($arResult["FILTER"]);
$arResult["FILTER_VALUE"] = $grid_filter;
/********************************************************************
				/FILTER
********************************************************************/
示例#3
0
             }
             $result = $varCache[$v][$user];
         }
     } elseif ($matches[1] == "group") {
         $v = implode(",", $documentType);
         if (!array_key_exists($v, $varCache)) {
             $varCache[$v] = CBPDocument::GetAllowableUserGroups($documentType);
         }
         $result = $varCache[$v][$matches[2]];
     } else {
         $result = $matches[0];
     }
     return $result;
 }
 $arResult["H_GRID_ID"] = "bizproc_tasksListH_" . $arParams["USER_ID"];
 $hgridOptions = new CGridOptions($arResult["H_GRID_ID"]);
 $hgridColumns = $hgridOptions->GetVisibleColumns();
 $hgridSort = $hgridOptions->GetSorting(array("sort" => array("ID" => "desc")));
 $arResult["H_HEADERS"] = array(array("id" => "MODIFIED", "name" => GetMessage("BPATL_MODIFIED"), "default" => true, "sort" => ""), array("id" => "ACTION_NOTE", "name" => GetMessage("BPATL_DESCRIPTION"), "default" => true, "sort" => ""));
 $arResult["H_SORT"] = $hgridSort["sort"];
 $arResult["H_RECORDS"] = array();
 $arFilter = array("MODIFIED_BY" => $arParams["USER_ID"]);
 if (!empty($arParams["WORKFLOW_ID"])) {
     $arFilter["WORKFLOW_ID"] = $arParams["WORKFLOW_ID"];
 }
 $runtime = CBPRuntime::GetRuntime();
 $runtime->StartRuntime();
 $documentService = $runtime->GetService("DocumentService");
 $dbRecordsList = CBPTrackingService::GetList($hgridSort["sort"], $arFilter);
 while ($arRecord = $dbRecordsList->GetNext()) {
     if (strlen($arRecord["WORKFLOW_ID"]) > 0) {
示例#4
0
    }
}
//Show error message if required
if ($_SERVER['REQUEST_METHOD'] === 'GET' && isset($_GET['error'])) {
    if ($_GET['error'] === $errorID) {
        if (!isset($_SESSION[$errorID])) {
            LocalRedirect(CHTTP::urlDeleteParams($APPLICATION->GetCurPage(), array('error')));
        }
        $strError = strval($_SESSION[$errorID]);
        unset($_SESSION[$errorID]);
        if ($strError !== '') {
            ShowError(htmlspecialcharsbx($strError));
        }
    }
}
$grid_options = new CGridOptions($arResult["GRID_ID"]);
$grid_columns = $grid_options->GetVisibleColumns();
$grid_sort = $grid_options->GetSorting(array("sort" => array("name" => "asc")));
if ($arResult["IBLOCK"]["BIZPROC"] == "Y" && CModule::IncludeModule('bizproc')) {
    $arDocumentTemplates = CBPDocument::GetWorkflowTemplatesForDocumentType(BizProcDocument::generateDocumentComplexType($arParams["IBLOCK_TYPE_ID"], $arResult["IBLOCK_ID"]));
    $arResult["BIZPROC"] = "Y";
} else {
    $arDocumentTemplates = array();
    $arResult["BIZPROC"] = "N";
}
/* FIELDS */
$arResult["ELEMENTS_HEADERS"] = array();
$arSelect = array("ID", "IBLOCK_ID");
$arProperties = array();
$arResult["FIELDS"] = $arListFields = $obList->GetFields();
foreach ($arListFields as $FIELD_ID => $arField) {
示例#5
0
 protected function createDataExcel()
 {
     $obList = new CList($this->arIBlock["ID"]);
     $gridOptions = new CGridOptions($this->arResult["GRID_ID"]);
     $gridColumns = $gridOptions->GetVisibleColumns();
     $gridSort = $gridOptions->GetSorting(array("sort" => array("name" => "asc")));
     $this->arResult["ELEMENTS_HEADERS"] = array();
     $arSelect = array("ID", "IBLOCK_ID");
     $arProperties = array();
     $this->arResult["FIELDS"] = $arListFields = $obList->GetFields();
     foreach ($arListFields as $fieldId => $arField) {
         if (!count($gridColumns) || in_array($fieldId, $gridColumns)) {
             if (substr($fieldId, 0, 9) == "PROPERTY_") {
                 $arProperties[] = $fieldId;
             } else {
                 $arSelect[] = $fieldId;
             }
         }
         if ($fieldId == "CREATED_BY") {
             $arSelect[] = "CREATED_USER_NAME";
         }
         if ($fieldId == "MODIFIED_BY") {
             $arSelect[] = "USER_NAME";
         }
         $this->arResult["ELEMENTS_HEADERS"][$fieldId] = array("name" => htmlspecialcharsex($arField["NAME"]), "default" => true, "sort" => $arField["MULTIPLE"] == "Y" ? "" : $fieldId);
     }
     if (!count($gridColumns) || in_array("IBLOCK_SECTION_ID", $gridColumns)) {
         $arSelect[] = "IBLOCK_SECTION_ID";
     }
     $this->arResult["ELEMENTS_HEADERS"]["IBLOCK_SECTION_ID"] = array("name" => Loc::getMessage("CC_BLL_COLUMN_SECTION"), "default" => true, "sort" => false);
     /* FILTER */
     $sections = array();
     foreach ($this->arResult["LIST_SECTIONS"] as $id => $name) {
         $sections[$id] = $name;
     }
     $this->arResult["FILTER"] = array(array("id" => "list_section_id", "type" => "list", "items" => $sections, "filtered" => $this->arResult["SECTION_ID"] !== false, "filter_value" => $this->arResult["SECTION_ID"], "value" => $this->arResult["SECTION_ID"]));
     $i = 1;
     $arFilterable = array();
     $arDateFilter = array();
     foreach ($arListFields as $fieldId => $arField) {
         if ($arField["TYPE"] == "ACTIVE_FROM" || $arField["TYPE"] == "ACTIVE_TO") {
             $this->arResult["FILTER"][$i] = array("id" => "DATE_" . $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
             $arFilterable["DATE_" . $fieldId] = "";
             $arDateFilter["DATE_" . $fieldId] = true;
         } elseif ($arField["TYPE"] == "DATE_CREATE" || $arField["TYPE"] == "TIMESTAMP_X") {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
             $arFilterable[$fieldId] = "";
             $arDateFilter[$fieldId] = true;
         } elseif (is_array($arField["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicFilterHTML", $arField["PROPERTY_USER_TYPE"])) {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "custom", "enable_settings" => false, "value" => call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicFilterHTML"], array($arField, array("VALUE" => $fieldId, "FORM_NAME" => "filter_" . $this->arResult["GRID_ID"], "GRID_ID" => $this->arResult["GRID_ID"]))));
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "SORT" || $arField["TYPE"] == "N") {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "number");
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "G") {
             $items = array();
             $prop_secs = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arField["LINK_IBLOCK_ID"]));
             while ($ar_sec = $prop_secs->Fetch()) {
                 $items[$ar_sec["ID"]] = str_repeat(". ", $ar_sec["DEPTH_LEVEL"] - 1) . $ar_sec["NAME"];
             }
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "E") {
             //Should be handled in template
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "E", "value" => $arField);
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "L") {
             $items = array();
             $propEnums = CIBlockProperty::GetPropertyEnum($arField["ID"]);
             while ($arEnum = $propEnums->Fetch()) {
                 $items[$arEnum["ID"]] = $arEnum["VALUE"];
             }
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
             $arFilterable[$fieldId] = "";
         } elseif (in_array($arField["TYPE"], array("S", "S:HTML", "NAME", "DETAIL_TEXT", "PREVIEW_TEXT"))) {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
             $arFilterable[$fieldId] = "?";
         } else {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
             $arFilterable[$fieldId] = "";
         }
         $i++;
     }
     $arFilter = array();
     $gridFilter = $gridOptions->GetFilter($this->arResult["FILTER"]);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (array_key_exists($newKey, $arDateFilter)) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
         }
         if (array_key_exists($newKey, $arFilterable)) {
             if ($op == "") {
                 $op = $arFilterable[$newKey];
             }
             $arFilter[$op . $newKey] = $value;
         }
     }
     $arFilter["IBLOCK_ID"] = $this->arIBlock["ID"];
     if (!$this->arResult["ANY_SECTION"]) {
         $arFilter["SECTION_ID"] = $this->arResult["SECTION_ID"];
     }
     $rsElements = CIBlockElement::GetList($gridSort["sort"], $arFilter, false, false, $arSelect);
     $this->arResult["EXCEL_COLUMN_NAME"] = array();
     $this->arResult["EXCEL_CELL_VALUE"] = array();
     $count = 0;
     while ($obElement = $rsElements->GetNextElement()) {
         $data = $obElement->GetFields();
         $propertyArray = $obElement->GetProperties();
         if (!empty($arProperties)) {
             foreach ($propertyArray as $arProp) {
                 $fieldId = "PROPERTY_" . $arProp["ID"];
                 if (in_array($fieldId, $arProperties)) {
                     $arField = $this->arResult["FIELDS"][$fieldId];
                     if (is_array($arField["PROPERTY_USER_TYPE"]) && is_array($arField["PROPERTY_USER_TYPE"]["GetPublicViewHTML"])) {
                         if (is_array($arProp["~VALUE"])) {
                             foreach ($arProp["~VALUE"] as $propValue) {
                                 $data[$fieldId][] = call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicViewHTML"], array($arField, array("VALUE" => $propValue), array()));
                             }
                         } else {
                             $data[$fieldId] = call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicViewHTML"], array($arField, array("VALUE" => $arProp["~VALUE"]), array()));
                         }
                     } elseif ($arField["PROPERTY_TYPE"] == "L") {
                         $data[$fieldId] = htmlspecialcharsex($arProp["VALUE_ENUM"]);
                     } elseif ($arField["PROPERTY_TYPE"] == "F") {
                         $files = is_array($arProp["VALUE"]) ? $arProp["VALUE"] : array($arProp["VALUE"]);
                         foreach ($files as $file) {
                             $value = CFile::MakeFileArray($file);
                             $data[$fieldId] .= $value["name"] . "\r\n";
                         }
                     } else {
                         $data[$fieldId] = htmlspecialcharsex($arProp["VALUE"]);
                     }
                 }
             }
             if (!empty($data["IBLOCK_SECTION_ID"])) {
                 if (array_key_exists($data["IBLOCK_SECTION_ID"], $this->arResult["SECTIONS"])) {
                     $data["IBLOCK_SECTION_ID"] = $this->arResult["SECTIONS"][$data["IBLOCK_SECTION_ID"]]["NAME"];
                 }
             }
             if (in_array("BIZPROC", $gridColumns)) {
                 $data["BIZPROC"] = $this->getArrayBizproc($data);
             }
         }
         if (isset($data["CREATED_BY"])) {
             $data["CREATED_BY"] = "[" . $data["CREATED_BY"] . "] " . $data["CREATED_USER_NAME"];
         }
         if (isset($data["MODIFIED_BY"])) {
             $data["MODIFIED_BY"] = "[" . $data["MODIFIED_BY"] . "] " . $data["USER_NAME"];
         }
         if (isset($data["ACTIVE_FROM"])) {
             $data['ACTIVE_FROM'] = FormatDateFromDB($data['ACTIVE_FROM']);
         }
         if (isset($data["ACTIVE_TO"])) {
             $data['ACTIVE_TO'] = FormatDateFromDB($data['ACTIVE_TO']);
         }
         if (isset($data["DATE_CREATE"])) {
             $data['DATE_CREATE'] = FormatDateFromDB($data['DATE_CREATE']);
         }
         if (isset($data["TIMESTAMP_X"])) {
             $data['TIMESTAMP_X'] = FormatDateFromDB($data['TIMESTAMP_X']);
         }
         foreach ($gridColumns as $position => $id) {
             $this->arResult["EXCEL_CELL_VALUE"][$count][$position] = is_array($data[$id]) ? implode('/', $data[$id]) : $data[$id];
             $this->arResult["EXCEL_COLUMN_NAME"][$position] = $this->arResult["ELEMENTS_HEADERS"][$id]["name"];
         }
         $count++;
     }
 }
示例#6
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;
    }
示例#7
0
         if ($arParams["CACHE_TIME"] > 0 && $cache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path_main)) {
             $arTemplates = $cache->GetVars();
         } else {
             $db_res = CBPWorkflowTemplateLoader::GetList(array(), array("DOCUMENT_TYPE" => $arParams["DOCUMENT_TYPE"]), false, false, array("ID", "AUTO_EXECUTE", "NAME", "DESCRIPTION", "MODIFIED", "USER_ID", "PARAMETERS", "TEMPLATE"));
             while ($arWorkflowTemplate = $db_res->GetNext()) {
                 $arTemplates[$arWorkflowTemplate["ID"]] = $arWorkflowTemplate;
             }
             if ($arParams["CACHE_TIME"] > 0) {
                 $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path_main);
                 $cache->EndDataCache($arTemplates);
             }
         }
     }
     $arParams["TEMPLATES"] = $arTemplates;
 }
 $grid_options = new CGridOptions($arParams["GRID_ID"]);
 $gridSort = $grid_options->GetSorting(array("sort" => array("NAME" => "desc")));
 global $by, $order;
 if (is_array($gridSort["sort"])) {
     $by = key($gridSort["sort"]);
     $order = $gridSort["sort"][$by];
 }
 $arFilter = array();
 if (isset($_REQUEST["clear_filter"]) && $_REQUEST["clear_filter"] == "Y") {
     $urlParams = array();
     foreach ($arResult["FILTER"] as $id => $arFilter) {
         if ($arFilter['id'] == 'FILE_SIZE') {
             $urlParams[] = $arFilter["id"] . "_from";
             $urlParams[] = $arFilter["id"] . "_to";
             $urlParams[] = $arFilter["id"] . "_multiply";
         } elseif ($arFilter["type"] == "user") {
示例#8
0
                $obSection->Delete($ID, false);
            }
        }
    } elseif ($_POST["action_button_" . $arResult["GRID_ID"]] == "edit" && isset($_POST["FIELDS"]) && is_array($_POST["FIELDS"]) && !$arResult["IS_SOCNET_GROUP_CLOSED"]) {
        foreach ($_POST["FIELDS"] as $ID => $arField) {
            if ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($arIBlock["ID"], $ID, "section_edit")) {
                $arFields = array("NAME" => $arField["NAME"], "CHECK_PERMISSIONS" => "N");
                $obSection->Update($ID, $arFields);
            }
        }
    }
    if (!isset($_POST["AJAX_CALL"])) {
        LocalRedirect($arResult["LIST_SECTION_URL"]);
    }
}
$grid_options = new CGridOptions($arResult["GRID_ID"]);
$rsSections = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arResult["IBLOCK_ID"], "GLOBAL_ACTIVE" => "Y", "SECTION_ID" => $arResult["SECTION_ID"], "CHECK_PERMISSIONS" => $lists_perm >= CListPermissions::IS_ADMIN ? "N" : "Y"));
$rsSections->NavStart($grid_options->GetNavParams(), false);
$arResult["SECTIONS_ROWS"] = array();
while ($data = $rsSections->GetNext()) {
    $aCols = array("NAME" => '<a href="' . str_replace(array("#list_id#", "#section_id#", "#group_id#"), array($data["IBLOCK_ID"], $data["ID"], $arParams["SOCNET_GROUP_ID"]), $arParams['LIST_SECTIONS_URL']) . '">' . $data["NAME"] . '</a>');
    $aActions = array();
    if (!$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($data["IBLOCK_ID"], $data["ID"], "section_edit"))) {
        $aActions[] = array("ICONCLASS" => "edit", "TEXT" => GetMessage("CC_BLS_SECTION_ACTION_MENU_RENAME"), "ONCLICK" => "renameSection('form_section_add', '" . CUtil::JSEscape(GetMessage("CC_BLS_NEW_SECTION_NAME_PROMPT")) . "', " . $data["ID"] . ", '" . CUtil::JSEscape($data["NAME"]) . "');", "DEFAULT" => true);
    }
    if (!$arResult["IS_SOCNET_GROUP_CLOSED"] && ($lists_perm >= CListPermissions::CAN_WRITE || CIBlockSectionRights::UserHasRightTo($data["IBLOCK_ID"], $data["ID"], "section_delete"))) {
        $aActions[] = array("ICONCLASS" => "delete", "TEXT" => GetMessage("CC_BLS_SECTION_ACTION_MENU_DELETE"), "ONCLICK" => "bxGrid_" . $arResult["GRID_ID"] . ".DeleteItem('" . $data["ID"] . "', '" . GetMessage("CC_BLS_SECTION_DELETE_PROPMT") . "')");
        $canDelete = true;
    } else {
        $canDelete = false;
    }
示例#9
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
if (!CModule::IncludeModule("voximplant")) {
    die;
}
use Bitrix\Voximplant as VI;
$arResult["GRID_ID"] = "voximpant_statistic_detail";
/*$arResult["FILTER"] = array(
	array("id"=>"PHONE_NUMBER", "name"=>"Phone"),
	array("id"=>"CALL_DURATION", "name"=>"Time"),
	array("id"=>"CALL_START_DATE", "name"=>"Date", "type"=>"date", "default"=>"Y"),
);*/
$gridOptions = new CGridOptions($arResult["GRID_ID"]);
$gridNav = $gridOptions->GetNavParams();
$limit = $gridNav["nPageSize"];
if (!intval($limit)) {
    $limit = 30;
}
$page = $_GET['PAGEN_1'] ? $_GET['PAGEN_1'] : 1;
$filter = array();
$filterByUser = '';
if (isset($_GET['USER_ID']) && intval($_GET['USER_ID'])) {
    $filterByUser = intval($_GET['USER_ID']);
    $filter["PORTAL_USER_ID"] = $filterByUser;
}
$filterByCode = '';
if (isset($_GET['CODE']) && preg_match('#^[[:alnum:]\\-]+$#D', $_GET['CODE'])) {
    $filterByCode = $_GET['CODE'];
示例#10
0
        if (!empty($arIDs)) {
            $dbSection = CIBlockSection::GetList(array(), array('IBLOCK_ID' => $catalogID, 'ID' => $arIDs, 'GLOBAL_ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N'), false, array('ID'));
            $section = new CIBlockSection();
            while ($arSection = $dbSection->Fetch()) {
                $sectionID = $arSection['ID'];
                $arSectionFields = isset($arFields[$sectionID]) ? $arFields[$sectionID] : null;
                // Is only one field allowed: 'NAME'.
                if (!(is_array($arSectionFields) && isset($arSectionFields['NAME']))) {
                    continue;
                }
                $section->Update($sectionID, array('NAME' => $arSectionFields['NAME'], 'CHECK_PERMISSIONS' => 'N'));
            }
        }
        if (!isset($_GET['AJAX_CALL'])) {
            LocalRedirect($arResult['SECTION_LIST_URL']);
        }
    }
}
// Preparing of grid data
$gridOptions = new CGridOptions($arResult['GRID_ID']);
$arFilter = array('IBLOCK_ID' => $catalogID, 'GLOBAL_ACTIVE' => 'Y', 'CHECK_PERMISSIONS' => 'N', 'SECTION_ID' => $sectionID);
$rsSections = CIBlockSection::GetList(array('left_margin' => 'asc'), $arFilter);
$arNav = $gridOptions->GetNavParams(array('nPageSize' => isset($arParams['SECTION_COUNT']) ? intval($arParams['SECTION_COUNT']) : 20));
$rsSections->NavStart($arNav['nPageSize']);
$arResult['SECTIONS'] = array();
while ($arSection = $rsSections->GetNext()) {
    $arResult['SECTIONS'][] = $arSection;
}
$rsSections->bShowAll = false;
$arResult['NAV_OBJECT'] = $rsSections;
$this->IncludeComponentTemplate();
示例#11
0
    private function executeManagePage()
    {
        global $USER, $APPLICATION;
        $APPLICATION->setTitle(GetMessage('INTR_MAIL_MANAGE_PAGE_TITLE'));
        CJSCore::Init(array('admin_interface'));
        if (!$USER->isAdmin() && !$USER->canDoOperation('bitrix24_config')) {
            $APPLICATION->AuthForm(GetMessage('ACCESS_DENIED'));
            return;
        }
        $this->arParams['SERVICES'] = array();
        $services = CIntranetMailSetupHelper::getMailServices();
        foreach ($services as $service) {
            if ($service['type'] == 'controller') {
                $crDomains = CControllerClient::ExecuteEvent('OnMailControllerGetDomains', array());
                if (!empty($crDomains['result']) && is_array($crDomains['result'])) {
                    $service['domains'] = $crDomains['result'];
                    $service['users'] = array();
                    foreach ($service['domains'] as $domain) {
                        $service['users'][$domain] = array();
                    }
                    $crUsers = CControllerClient::ExecuteEvent('OnMailControllerGetUsers', array());
                    if (!empty($crUsers['result']) && is_array($crUsers['result'])) {
                        foreach ($crUsers['result'] as $email) {
                            list($login, $domain) = explode('@', $email, 2);
                            if (isset($service['users'][$domain])) {
                                $service['users'][$domain][] = $login;
                            }
                        }
                        $dbMailboxes = CMailbox::getList(array('TIMESTAMP_X' => 'ASC'), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $service['id']));
                        while ($mailbox = $dbMailboxes->fetch()) {
                            list($login, $domain) = explode('@', $mailbox['LOGIN'], 2);
                            if (!empty($service['users'][$domain]) && ($key = array_search($login, $service['users'][$domain])) !== false) {
                                array_splice($service['users'][$domain], $key, 1);
                            }
                        }
                    }
                    $this->arParams['SERVICES'][] = $service;
                }
            }
            if (in_array($service['type'], array('domain', 'crdomain'))) {
                $result = self::checkDomainStatus(array('type' => $service['type'], 'domain' => $service['server'], 'token' => $service['token']), $error);
                if (!empty($result['stage']) && $result['stage'] == 'added') {
                    $service['domains'] = array($service['server']);
                    $service['users'] = array($service['server'] => array());
                    if ($service['type'] == 'domain') {
                        $users = CMailDomain2::getDomainUsers($service['token'], $service['server'], $error);
                        if (!empty($users) && is_array($users)) {
                            $service['users'][$service['server']] = $users;
                        }
                    } else {
                        if ($service['type'] == 'crdomain') {
                            $crUsers = CControllerClient::ExecuteEvent('OnMailControllerGetMemberUsers', array('DOMAIN' => $service['server']));
                            if (!empty($crUsers['result']) && is_array($crUsers['result'])) {
                                $service['users'][$service['server']] = $crUsers['result'];
                            }
                        }
                    }
                    $dbMailboxes = CMailbox::getList(array('TIMESTAMP_X' => 'ASC'), array('ACTIVE' => 'Y', '!USER_ID' => 0, 'SERVICE_ID' => $service['id']));
                    while ($mailbox = $dbMailboxes->fetch()) {
                        list($login, $domain) = explode('@', $mailbox['LOGIN'], 2);
                        if (!empty($service['users'][$domain]) && ($key = array_search($login, $service['users'][$domain])) !== false) {
                            array_splice($service['users'][$domain], $key, 1);
                        }
                    }
                    $this->arParams['SERVICES'][] = $service;
                }
            }
        }
        $this->arResult['GRID_ID'] = 'manage_domain_grid';
        $gridOptions = new CGridOptions($this->arResult['GRID_ID']);
        $arSort = $gridOptions->getSorting(array('sort' => array('ID' => 'ASC'), 'vars' => array('by' => 'by', 'order' => 'order')));
        $arNav = $gridOptions->getNavParams(array('nPageSize' => 50));
        $arSortArg = each($arSort['sort']);
        $arFilter = array('ACTIVE' => 'Y', '!UF_DEPARTMENT' => false);
        if (isset($_REQUEST['act']) && $_REQUEST['act'] == 'search' && !empty($_REQUEST['FILTER'])) {
            $this->arResult['FILTER'] = $_REQUEST['FILTER'];
            $userIds = array();
            $dbMailboxes = CMailbox::getList(array('TIMESTAMP_X' => 'ASC'), array('LID' => SITE_ID, 'ACTIVE' => 'Y', '!USER_ID' => 0, 'LOGIN' => $_REQUEST['FILTER']));
            while ($mailbox = $dbMailboxes->fetch()) {
                if (in_array($mailbox['SERVER_TYPE'], array('imap', 'controller', 'domain'))) {
                    $userIds[] = $mailbox['USER_ID'];
                }
            }
            $arFilter['ID'] = empty($userIds) ? 0 : join('|', $userIds);
        }
        $dbUsers = CUser::GetList($arSortArg['key'], $arSortArg['value'], $arFilter, array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PERSONAL_PHOTO', 'WORK_POSITION')));
        $dbUsers->navStart($arNav['nPageSize']);
        $arRows = array();
        while ($user = $dbUsers->fetch()) {
            $user['DETAIL_URL'] = COption::getOptionString('intranet', 'search_user_url', '/user/#ID#/');
            $user['DETAIL_URL'] = str_replace(array('#ID#', '#USER_ID#'), array($user['ID'], $user['ID']), $user['DETAIL_URL']);
            $user['PHOTO_THUMB'] = '<img src="/bitrix/components/bitrix/main.user.link/templates/.default/images/nopic_30x30.gif" border="0" alt="" width="32" height="32">';
            if (intval($user['PERSONAL_PHOTO']) > 0) {
                $imageFile = CFile::getFileArray($user['PERSONAL_PHOTO']);
                if ($imageFile !== false) {
                    $arFileTmp = CFile::resizeImageGet($imageFile, array('width' => 42, 'height' => 42), BX_RESIZE_IMAGE_EXACT, false);
                    $user['PHOTO_THUMB'] = CFile::showImage($arFileTmp['src'], 32, 32);
                }
            }
            $anchor_id = RandString(8);
            $arCols = array('NAME' => '<table id="user_' . $user['ID'] . '" style="border-collapse: collapse; border: none; ">
					<tr>
						<td style="border: none !important; padding: 0px !important; ">
							<div style="width: 32px; height: 32px; margin:2px; padding: 2px; box-shadow:0 0 2px 1px rgba(0, 0, 0, 0.1);">
								<a href="' . $user['DETAIL_URL'] . '">' . $user['PHOTO_THUMB'] . '</a>
							</div>
						</td>
						<td style="border: none !important; padding: 0px 0px 0px 7px !important; vertical-align: top; ">
							<a href="' . $user['DETAIL_URL'] . '"><b>' . CUser::formatName(CSite::getNameFormat(), $user, true, true) . '</b></a><br>
							' . htmlspecialcharsbx($user['WORK_POSITION']) . '
						</td>
					</tr>
				</table>', 'EMAIL' => '', 'ADD' => '', 'DELETE' => '');
            if ($mailbox = CIntranetMailSetupHelper::getUserMailbox($user['ID'])) {
                switch ($mailbox['SERVER_TYPE']) {
                    case 'imap':
                        $arCols['EMAIL'] = $mailbox['LOGIN'];
                        if (strpos($mailbox['LOGIN'], '@') === false) {
                            $arCols['EMAIL'] .= '<br><span style="font-weight: normal; ">imap://' . $mailbox['SERVER'] . ':' . $mailbox['PORT'] . '</span>';
                        }
                        $arCols['ADD'] = '<a href="#" onclick="mb.create(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CHANGE') . '</a>';
                        break;
                    case 'controller':
                    case 'domain':
                    case 'crdomain':
                        $arCols['EMAIL'] = $mailbox['LOGIN'];
                        $arCols['ADD'] = '<a href="#" onclick="mb.create(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CHANGE') . '</a><br><a href="#" onclick="mb.changePassword(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_PASSWORD') . '</a>';
                        $arCols['DELETE'] = '<a href="#" onclick="mb.remove(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_DELETE') . '</a>';
                        break;
                }
            } else {
                $arCols['ADD'] = '<a href="#" onclick="mb.create(' . $user['ID'] . '); return false; ">' . GetMessage('INTR_MAIL_MANAGE_CREATE') . '</a>';
            }
            if (empty($this->arParams['SERVICES'])) {
                $arCols['ADD'] = '';
                $arCols['DELETE'] = '';
            }
            $arCols['EMAIL'] = '<span id="email_' . $user['ID'] . '" style="font-weight: bold; white-space: nowrap; ">' . $arCols['EMAIL'] . '</span>';
            $arCols['ADD'] = '<span id="create_' . $user['ID'] . '" style="white-space: nowrap; ">' . $arCols['ADD'] . '</span>';
            $arCols['DELETE'] = '<span id="delete_' . $user['ID'] . '" style="white-space: nowrap; ">' . $arCols['DELETE'] . '</span>';
            $arRows[$user['ID']] = array('data' => $user, 'columns' => $arCols);
        }
        $this->arResult['ROWS'] = $arRows;
        $this->arResult['ROWS_COUNT'] = $dbUsers->selectedRowsCount();
        $this->arResult['NAV_OBJECT'] = $dbUsers;
        $this->arResult['NAV_OBJECT']->bShowAll = false;
        $this->includeComponentTemplate('manage');
    }
示例#12
0
}
/********************************************************************
				Default falues
********************************************************************/
$arResult["NAV_STRING"] = "";
$arResult["NAV_RESULT"] = "";
$arResult["TEMPLATES"] = array();
$arResult["GRID_TEMPLATES"] = array();
/********************************************************************
				/Default falues
********************************************************************/
/********************************************************************
				Data
********************************************************************/
$arResult["GRID_ID"] = "bizproc_wflist_" . $arParams["MODULE_ID"];
$gridOptions = new CGridOptions($arResult["GRID_ID"]);
$gridSort = $gridOptions->GetSorting(array("sort" => array("NAME" => "ASC")));
$db_res = CBPWorkflowTemplateLoader::GetList($gridSort["sort"], array("DOCUMENT_TYPE" => $documentType), false, false, array("ID", "NAME", "DESCRIPTION", "MODIFIED", "USER_ID", "AUTO_EXECUTE", "USER_NAME", "USER_LAST_NAME", "USER_LOGIN", "ACTIVE", "USER_SECOND_NAME"));
if ($db_res) {
    $db_res->NavStart(25, false);
    $arResult["NAV_RESULT"] = $db_res;
    $arResult["NAV_STRING"] = $db_res->GetPageNavStringEx($navComponentObject, GetMessage("BPATT_NAV"), "");
    $adminPage = $APPLICATION->GetCurPageParam('back_url=' . urlencode($back_url) . '&action=delete&' . bitrix_sessid_get(), array('back_url', 'action', 'ID', 'sessid'));
    while ($res = $db_res->GetNext()) {
        $res["URL"] = array("EDIT" => CComponentEngine::MakePathFromTemplate($arParams["~EDIT_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "DOCUMENT_ID" => $arParams["DOCUMENT_ID"])), "DELETE" => $adminPage . "&ID=" . $res["ID"]);
        if (isset($arParams["~EDIT_VARS_URL"]) && strlen($arParams["~EDIT_VARS_URL"]) > 0) {
            $res["URL"]["VARS"] = CComponentEngine::MakePathFromTemplate($arParams["~EDIT_VARS_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "DOCUMENT_ID" => $arParams["DOCUMENT_ID"]));
        }
        if (isset($arParams["~EDIT_CONSTANTS_URL"]) && strlen($arParams["~EDIT_CONSTANTS_URL"]) > 0) {
            $res["URL"]["CONSTANTS"] = CComponentEngine::MakePathFromTemplate($arParams["~EDIT_CONSTANTS_URL"], array("ID" => $res["ID"], "MODULE_ID" => $arParams["MODULE_ID"], "ENTITY" => $arParams["ENTITY"], "DOCUMENT_ID" => $arParams["DOCUMENT_ID"]));
        }
示例#13
0
                }
            } elseif ($response["STATUS"]["CODE"] != 200) {
                $errorMessage .= sprintf(GetMessage("CRM_EXT_SALE_C1STATUS") . "<br>", $response["STATUS"]["CODE"], $response["STATUS"]["PHRASE"]);
            } elseif (strpos($response["BODY"], "form_auth") !== false) {
                $errorMessage .= GetMessage("CRM_EXT_SALE_C1NO_AUTH") . "<br>";
            }
        }
        $arResult["ErrorMessage"] .= $errorMessage;
        if (strlen($errorMessage) <= 0) {
            $arResult["SuccessMessage"] = GetMessage("CRM_EXT_SALE_C1SUCCESS") . "<br>";
        }
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $arResult["GRID_ID"] = "crm_config_external_sale";
    $gridOptions = new CGridOptions($arResult["GRID_ID"]);
    $gridColumns = $gridOptions->GetVisibleColumns();
    $gridSort = $gridOptions->GetSorting(array("sort" => array("DATE_UPDATE" => "desc")));
    $arResult["HEADERS"] = array(array("id" => "NAME", "name" => GetMessage("BPWC_WLC_NAME"), "default" => true, "sort" => "NAME"), array("id" => "ACTIVE", "name" => GetMessage("BPWC_WLC_ACTIVE"), "default" => true, "sort" => "ACTIVE"), array("id" => "IMPORT_AGENT", "name" => GetMessage("BPWC_WLC_IMPORT_AGENT"), "default" => true, "sort" => ""), array("id" => "MESSAGE", "name" => GetMessage("BPWC_WLC_MESSAGE"), "default" => true, "sort" => ""), array("id" => "URL", "name" => GetMessage("BPWC_WLC_URL"), "default" => true, "sort" => ""), array("id" => "LAST_STATUS_DATE", "name" => GetMessage("BPWC_WLC_LAST_STATUS_DATE"), "default" => true, "sort" => "LAST_STATUS_DATE"), array("id" => "LAST_STATUS", "name" => GetMessage("BPWC_WLC_STATUS"), "default" => false, "sort" => "LAST_STATUS"), array("id" => "DATE_UPDATE", "name" => GetMessage("BPWC_WLC_DATE_UPDATE"), "default" => false, "sort" => "DATE_UPDATE"), array("id" => "IMPORT_PREFIX", "name" => GetMessage("BPWC_WLC_IMPORT_PREFIX"), "default" => false, "sort" => "IMPORT_PREFIX"), array("id" => "ID", "name" => "ID", "default" => false, "sort" => "ID"), array("id" => "DATE_CREATE", "name" => GetMessage("BPWC_WLC_DATE_CREATE"), "default" => false, "sort" => "DATE_CREATE"), array("id" => "IMPORT_SIZE", "name" => GetMessage("BPWC_WLC_SIZE"), "default" => false, "sort" => "IMPORT_SIZE"), array("id" => "IMPORT_PERIOD", "name" => GetMessage("BPWC_WLC_IMPORT_PERIOD"), "default" => false, "sort" => "IMPORT_PERIOD"), array("id" => "IMPORT_PROBABILITY", "name" => GetMessage("BPWC_WLC_IMPORT_PROBABILITY"), "default" => false, "sort" => "IMPORT_PROBABILITY"), array("id" => "IMPORT_PUBLIC", "name" => GetMessage("BPWC_WLC_IMPORT_PUBLIC"), "default" => false, "sort" => "IMPORT_PUBLIC"));
    $arResult["SORT"] = $gridSort["sort"];
    $arResult["RECORDS"] = array();
    $dbRecordsList = CCrmExternalSale::GetList($gridSort["sort"], array());
    while ($arRecord = $dbRecordsList->GetNext()) {
        $path2Edit = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_EDIT"], array("id" => $arRecord["ID"]));
        $path2Sync = CComponentEngine::MakePathFromTemplate($arParams["PATH_TO_SYNC"], array("id" => $arRecord["ID"]));
        $agentInterval = 0;
        $dbAgents = CAgent::GetList(array(), array("NAME" => "CCrmExternalSaleImport::DataSync(" . $arRecord["ID"] . ");", "MODULE_ID" => "crm", "ACTIVE" => "Y"));
        if ($arAgent = $dbAgents->Fetch()) {
            $agentInterval = intval($arAgent["AGENT_INTERVAL"] / 60);
        }
        $v = htmlspecialcharsbx($arRecord["SCHEME"] . "://" . $arRecord["SERVER"] . (intval($arRecord["PORT"]) > 0 ? ":" . $arRecord["PORT"] : ""));
示例#14
0
 public function executeComponent()
 {
     if (!empty($this->arParams['ERROR'])) {
         ShowError(array_shift($this->arParams['ERROR']));
         return;
     }
     $this->arResult['USER_ID'] = $this->arParams['USER_ID'];
     $this->arResult['GRID_ID'] = 'lists_processes';
     $selectFields = array('ID', 'IBLOCK_TYPE_ID', 'IBLOCK_ID', 'NAME');
     $gridOptions = new CGridOptions($this->arResult['GRID_ID']);
     $gridColumns = $gridOptions->getVisibleColumns();
     $gridSort = $gridOptions->getSorting(array('sort' => array('ID' => 'desc')));
     $this->arResult['HEADERS'] = array(array("id" => "ID", "name" => "ID", "default" => false, "sort" => "ID"), array('id' => 'DOCUMENT_NAME', 'name' => Loc::getMessage('CC_BLL_DOCUMENT_NAME'), 'default' => true, 'sort' => 'DOCUMENT_NAME'), array('id' => 'COMMENTS', 'name' => Loc::getMessage('CC_BLL_COMMENTS'), 'default' => true, 'sort' => '', 'hideName' => true, 'iconCls' => 'bp-comments-icon'), array('id' => 'WORKFLOW_PROGRESS', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_PROGRESS'), 'default' => true, 'sort' => ''), array('id' => 'WORKFLOW_STATE', 'name' => Loc::getMessage('CC_BLL_WORKFLOW_STATE'), 'default' => false, 'sort' => ''));
     $this->arResult['FILTER'] = array(array("id" => "NAME", "name" => GetMessage("BPATL_NAME"), "type" => "string"), array('id' => 'TIMESTAMP_X', 'name' => Loc::getMessage('CC_BLL_MODIFIED'), 'type' => 'date'), array('id' => 'DATE_CREATE', 'name' => Loc::getMessage('CC_BLL_CREATED'), 'type' => 'date', 'default' => true));
     $gridFilter = $gridOptions->getFilter($this->arResult['FILTER']);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (in_array($newKey, array("TIMESTAMP_X", 'DATE_CREATE'))) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
         }
         $filter[$op . $newKey] = $value;
     }
     $this->arResult['SORT'] = $gridSort['sort'];
     $useComments = (bool) CModule::includeModule("forum");
     $workflows = array();
     $this->arResult['DATA'] = array();
     $this->arResult["COMMENTS_COUNT"] = array();
     $filter['CREATED_BY'] = $this->arParams['USER_ID'];
     $iblockTypeId = COption::GetOptionString("lists", "livefeed_iblock_type_id");
     $filter['IBLOCK_TYPE'] = $iblockTypeId;
     $filter['CHECK_PERMISSIONS'] = $this->arParams['LIST_PERM'] >= CListPermissions::CAN_READ ? "N" : "Y";
     $elementObject = CIBlockElement::getList($gridSort['sort'], $filter, false, $gridOptions->getNavParams(), $selectFields);
     $documentState = true;
     $path = rtrim(SITE_DIR, '/');
     while ($element = $elementObject->fetch()) {
         $documentState = CBPDocument::GetDocumentStates(BizprocDocument::generateDocumentComplexType($iblockTypeId, $element['IBLOCK_ID']), BizprocDocument::getDocumentComplexId($iblockTypeId, $element['ID']));
         $this->arResult['DATA'][$element['ID']]['ID'] = $element['ID'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_NAME'] = $element['NAME'];
         $this->arResult['DATA'][$element['ID']]['DOCUMENT_URL'] = $path . COption::GetOptionString('lists', 'livefeed_url') . '?livefeed=y&list_id=' . $element["IBLOCK_ID"] . '&element_id=' . $element['ID'];
         if (!empty($documentState)) {
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = true;
             $documentState = current($documentState);
             $this->arResult['DATA'][$element['ID']]['WORKFLOW_ID'] = $documentState['ID'];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_NAME"] = $documentState["TEMPLATE_NAME"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STATE"] = $documentState["STATE_TITLE"];
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED"] = FormatDateFromDB($documentState["STARTED_FORMATTED"]);
             $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = "";
             if (intval($documentState["STARTED_BY"]) > 0) {
                 $dbUserTmp = CUser::getByID($documentState["STARTED_BY"]);
                 $arUserTmp = $dbUserTmp->fetch();
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] = CUser::FormatName($this->arParams["NAME_TEMPLATE"], $arUserTmp, true);
                 $this->arResult['DATA'][$element['ID']]["WORKFLOW_STARTED_BY"] .= " [" . $documentState["STARTED_BY"] . "]";
             }
             $this->arResult['DATA'][$element['ID']]['MODULE_ID'] = $documentState["DOCUMENT_ID"][0];
             $this->arResult['DATA'][$element['ID']]['ENTITY'] = $documentState["DOCUMENT_ID"][1];
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_ID'] = $documentState["DOCUMENT_ID"][2];
         } else {
             $documentState = false;
             $this->arResult['DATA'][$element['ID']]['DOCUMENT_STATE'] = false;
         }
     }
     foreach ($this->arResult['DATA'] as $data) {
         if ($documentState) {
             if ($useComments) {
                 $workflows[] = 'WF_' . $data['WORKFLOW_ID'];
             }
         }
         $actions = array();
         if (strlen($data["DOCUMENT_URL"]) > 0) {
             $actions[] = array('ICONCLASS' => '', 'DEFAULT' => false, 'TEXT' => Loc::getMessage('CC_BLL_C_DOCUMENT'), 'ONCLICK' => 'window.open("' . $data["DOCUMENT_URL"] . '");');
         }
         $this->arResult['RECORDS'][] = array('data' => $data, 'actions' => $actions);
     }
     if ($useComments && $documentState) {
         $workflows = array_unique($workflows);
         if ($workflows) {
             $iterator = CForumTopic::getList(array(), array("@XML_ID" => $workflows));
             while ($row = $iterator->fetch()) {
                 $this->arResult["COMMENTS_COUNT"][$row['XML_ID']] = $row['POSTS'];
             }
         }
     }
     $this->arResult['COUNTERS'] = array('all' => 0);
     $this->arResult["ROWS_COUNT"] = $elementObject->selectedRowsCount();
     $this->arResult["NAV_RESULT"] = $elementObject;
     if ($this->arParams['SET_TITLE'] == 'Y') {
         $this->getApplication()->setTitle(Loc::getMessage('CC_BLL_TITLE'));
     }
     $this->includeComponentTemplate();
 }
示例#15
0
{
    $res = CFileInput::Show('NO_FIELDS[' . $property_value_id . ']', $property_value, array('IMAGE' => 'Y', 'PATH' => false, 'FILE_SIZE' => false, 'DIMENSIONS' => false, 'IMAGE_POPUP' => false, 'MAX_SIZE' => array('W' => 50, 'H' => 50), 'MIN_SIZE' => array('W' => 1, 'H' => 1)), array('upload' => false, 'medialib' => false, 'file_dialog' => false, 'cloud' => false, 'del' => false, 'description' => false));
    $res = preg_replace('!<script[^>]*>.*</script>!isU', '', $res);
    return $res;
}
/*$arSKUProps = $arResult['SKU_PROPS'];*/
$arFilter = $arResult['FILTER'];
$arHeaders = $arResult['HEADERS'];
$arPrices = $arResult['PRICES'];
$tableId = $arResult['TABLE_ID'];
$leftContainerId = $tableId . '_left_container';
$splitterBtnId = $tableId . '_splitter_btn';
$jsEventsManagerId = isset($_GET['JS_EVENTS_MANAGER_ID']) ? strval($_GET['JS_EVENTS_MANAGER_ID']) : '';
// START TEMPLATE
// Grid options
$gridOptions = new CGridOptions($arResult['TABLE_ID']);
$arSort = $gridOptions->GetSorting(array('sort' => array('name' => 'asc'), 'vars' => array('by' => 'by', 'order' => 'order')));
$arResult['SORT'] = $arSort['sort'];
$arResult['SORT_VARS'] = $arSort['SORT']['vars'];
unset($arSort);
$arResult['ROWS_COUNT'] = $arResult['DB_RESULT_LIST'] instanceof \CDBResult ? $arResult['DB_RESULT_LIST']->SelectedRowsCount() : 0;
$arResult['GRID_DATA'] = array();
foreach ($arResult['PRODUCTS'] as $productId => $arItems) {
    $arActions = array();
    if ($arItems['TYPE'] === 'S') {
        $arActions[] = array('ICONCLASS' => 'select', 'TEXT' => GetMessage('SPS_SELECT'), 'ONCLICK' => $tableId . '_helper.onSectionChange(' . $arItems['ID'] . ',"' . CUtil::JSEscape($arItems['NAME']) . '");', 'DEFAULT' => true);
    } else {
        $params = array('id' => $productId, 'type' => $arItems['TYPE']);
        $arActions[] = array('TEXT' => GetMessage('SPS_SELECT'), 'ONCLICK' => $tableId . '_helper.SelEl(' . CUtil::PhpToJSObject($params) . ', this);', 'DEFAULT' => true);
    }
    $gridDataRecord = array('id' => $arItems['TYPE'] . $arItems['ID'], 'actions' => $arActions, 'data' => $arItems, 'editable' => false, 'columns' => array('NAME' => '<a class="crm-gds-item' . ($arItems['TYPE'] === 'S' ? ' crm-gds-item-section' : ' crm-gds-item-gds') . '">' . $arItems['NAME'] . '</a>', 'ACTIVE' => $arItems['ACTIVE'] === 'Y' ? GetMEssage('SPS_PRODUCT_ACTIVE') : GetMEssage('SPS_PRODUCT_NO_ACTIVE'), 'PREVIEW_PICTURE' => getImageField('NO_FIELDS[' . $arItems['ID'] . '][PREVIEW_PICTURE]', $arItems['PREVIEW_PICTURE']), 'DETAIL_PICTURE' => getImageField('NO_FIELDS[' . $arItems['ID'] . '][DETAIL_PICTURE]', $arItems['DETAIL_PICTURE'])));
示例#16
0
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
/**
 * @var $arParams array
 * @var $arResult array
 * @var $this CBitrixComponent
 * @var $APPLICATION CMain
 * @var $USER CUser
 */
if (!CModule::IncludeModule('voximplant')) {
    return;
}
$arResult = array("GRID_ID" => $this->__name, "USERS" => array());
$gridOptions = new CGridOptions($arResult['GRID_ID']);
$arSort = $gridOptions->getSorting(array('sort' => array('ID' => 'ASC'), 'vars' => array('by' => 'by', 'order' => 'order')));
$arSortArg = each($arSort['sort']);
$arFilter = array('ACTIVE' => 'Y', '!UF_DEPARTMENT' => false);
$arParams = array('FIELDS' => array('ID', 'LOGIN', 'NAME', 'SECOND_NAME', 'LAST_NAME', 'PERSONAL_PHOTO', 'WORK_POSITION'), 'SELECT' => array("UF_PHONE_INNER", "UF_VI_BACKPHONE", "UF_VI_PHONE"), 'NAV_PARAMS' => $gridOptions->getNavParams(array('nPageSize' => 20)));
if ($_REQUEST['act'] == 'search' && !empty($_REQUEST['FILTER'])) {
    $arFilter["NAME"] = $arResult['FILTER'] = $_REQUEST['FILTER'];
}
$dbUsers = CUser::GetList($arSortArg['key'], $arSortArg['value'], $arFilter, $arParams);
while ($user = $dbUsers->fetch()) {
    $arResult['USERS'][$user["ID"]] = prepareUserData($user);
}
if ($_REQUEST['act'] == 'search' && !empty($_REQUEST['FILTER'])) {
    $arFilter = array("UF_PHONE_INNER" => $_REQUEST['FILTER'], 'ACTIVE' => 'Y');
    $dbUsers = CUser::GetList($arSortArg['key'], $arSortArg['value'], $arFilter, $arParams);
    while ($user = $dbUsers->fetch()) {
示例#17
0
 $arFieldsTmp = array();
 foreach ($arResult["DocumentFields"] as $key => $value) {
     if (count($arResult["Block"]["VISIBLE_FIELDS"]) > 0 && !in_array($key, $arResult["Block"]["VISIBLE_FIELDS"])) {
         continue;
     }
     if (in_array($key, array("NAME", "CREATED_BY_PRINTABLE", "TIMESTAMP_X"))) {
         continue;
     }
     if (in_array($value["BaseType"], array("user"))) {
         continue;
     }
     $arFieldsTmp[] = array("id" => $key, "name" => $value["Name"], "type" => "label");
 }
 $arTabs[] = array("id" => "tab2", "name" => GetMessage("BPWC_WNCT_TAB2"), "title" => GetMessage("BPWC_WNCT_TAB2"), "icon" => "", "fields" => $arFieldsTmp);
 $arResultGrid["GRID_ID"] = "form_bp_grid_" . implode("_", $arResult["DocumentType"]);
 $gridOptions = new CGridOptions($arResultGrid["GRID_ID"]);
 $arSort = $gridOptions->GetSorting(array("sort" => array("id" => "desc"), "vars" => array("by" => "by", "order" => "order")));
 $arNav = $gridOptions->GetNavParams(array("nPageSize" => 20));
 $arSortArg = each($arSort["sort"]);
 $dbTrack = CBPTrackingService::GetList($arSort["sort"], array("WORKFLOW_ID" => $arResult["BP"]["DOCUMENT_STATE"]["ID"], "TYPE" => array(CBPTrackingType::Custom, CBPTrackingType::FaultActivity, CBPTrackingType::Report)));
 $dbTrack->NavStart($arNav["nPageSize"]);
 $GLOBALS["__bwl_ParseStringParameterTmp1_arAllowableUserGroups"] = CBPDocument::GetAllowableUserGroups($arResult["DocumentType"]);
 function __bwl_ParseStringParameterTmp1($matches)
 {
     $result = "";
     if ($matches[1] == "user") {
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
示例#18
0
            }
        } else {
            $arResult["ErrorMessage"] .= GetMessage("BPWC_WLC_MISSING_BP") . ". ";
        }
        if (strlen($arResult["ErrorMessage"]) <= 0) {
            LocalRedirect($APPLICATION->GetCurPageParam("", array("sessid", "stop_bizproc_id", "delete_bizproc_id")));
        }
    }
}
if (strlen($arResult["FatalErrorMessage"]) <= 0) {
    $arTypeMap = array("string" => "string", "text" => "text", "double" => "number", "select" => "list", "bool" => "checkbox", "datetime" => "date");
    // $timeZoneOffset for datetime fields formatting
    $timeZoneOffset = CTimeZone::GetOffset();
    $arSelectFields = array("ID", "CREATED_BY");
    $arResult["GRID_ID"] = "bizproc_CBPVirtualDocument_" . $arParams["BLOCK_ID"];
    $gridOptions = new CGridOptions($arResult["GRID_ID"]);
    $gridColumns = $gridOptions->GetVisibleColumns();
    $gridSort = $gridOptions->GetSorting(array("sort" => array("ID" => "desc")));
    $arResult["HEADERS"] = array();
    $arResult["FILTER"] = array();
    $runtime = CBPRuntime::GetRuntime();
    $runtime->StartRuntime();
    $documentService = $runtime->GetService("DocumentService");
    $idx = 0;
    $arDocumentFields = $documentService->GetDocumentFields($documentType);
    foreach ($arDocumentFields as $key => $value) {
        $idx++;
        if ($idx > 50) {
            break;
        }
        if (count($arResult["Block"]["VISIBLE_FIELDS"]) <= 0 || in_array($key, $arResult["Block"]["VISIBLE_FIELDS"])) {
示例#19
0
                    if ($_REQUEST["ENTITY_TYPE"] == \Bitrix\Idea\NotifyEmailTable::ENTITY_TYPE_CATEGORY) {
                        $notifyEmail->deleteCategory($_REQUEST["ENTITY_CODE"]);
                    } else {
                        $notifyEmail->deleteIdea($_REQUEST["ENTITY_CODE"]);
                    }
                }
            }
            LocalRedirect($APPLICATION->GetCurPageParam("", array("ACTION", "ID", "ENTITY_TYPE", "ENTITY_CODE", "sessid")));
            break;
    }
}
$arResult = array("USER_ID" => $USER->GetID(), "IDEA" => array(), "SUBSCRIBE" => array(), "IDEA_STATUS" => array(), "GRID" => array());
//Get Idea subscribtion
if ($arResult["USER_ID"] > 0) {
    //InitGrid
    $GridOptions = new CGridOptions($arResult["GRID_ID"]);
    //Grid Sort
    $arSort = $GridOptions->GetSorting(array("sort" => array("DATE_PUBLISH" => "DESC"), "vars" => array("by" => "by", "order" => "order")));
    $arResult["GRID"]["SORT"] = $arSort["sort"];
    $arResult["GRID"]["SORT_VARS"] = $arSort["vars"];
    $arNav = $GridOptions->GetNavParams(array("nPageSize" => 25));
    $db_res = \Bitrix\Idea\NotifyEmailTable::getList(array('filter' => array("USER_ID" => $arResult["USER_ID"]), 'select' => array("ID" => "RUNTIME_ID", "SUBSCRIBE_TYPE", "ENTITY_TYPE", "ENTITY_CODE", "CATEGORY_NAME" => "ASCENDED_CATEGORIES.NAME"), 'order' => array("ENTITY_TYPE" => "ASC", "ENTITY_CODE" => "ASC"), 'runtime' => array(new \Bitrix\Main\Entity\ExpressionField('RUNTIME_ID', \Bitrix\Main\Application::getConnection()->getSqlHelper()->getConcatFunction("CASE " . "WHEN %s='" . \Bitrix\Idea\NotifyEmailTable::ENTITY_TYPE_IDEA . "' AND %s='' THEN '" . CIdeaManagmentEmailNotify::SUBSCRIBE_ALL . "' " . "WHEN %s='" . \Bitrix\Idea\NotifyEmailTable::ENTITY_TYPE_IDEA . "' THEN '" . CIdeaManagmentEmailNotify::SUBSCRIBE_IDEA_COMMENT . "' " . "WHEN %s='" . \Bitrix\Idea\NotifyEmailTable::ENTITY_TYPE_CATEGORY . "' AND %s='' THEN '" . CIdeaManagmentEmailNotify::SUBSCRIBE_ALL_IDEA . "' " . "WHEN %s='" . \Bitrix\Idea\NotifyEmailTable::ENTITY_TYPE_CATEGORY . "' THEN '" . \Bitrix\Idea\NotifyEmailTable::ENTITY_TYPE_CATEGORY . "' " . "ELSE 'UNK' END", "%s"), array("ENTITY_TYPE", "ENTITY_CODE", "ENTITY_TYPE", "ENTITY_TYPE", "ENTITY_CODE", "ENTITY_TYPE", "ENTITY_CODE")))));
    $oIdeaSubscribe = new CDBResult($db_res);
    $oIdeaSubscribe->NavStart($arNav["nPageSize"], false);
    //Select Subscribe
    $arBlogPostId = array();
    while ($r = $oIdeaSubscribe->Fetch()) {
        $arResult["SUBSCRIBE"][] = $r["ID"];
        if ($r["ID"] == CIdeaManagmentEmailNotify::SUBSCRIBE_ALL) {
            $arResult["IDEA"] = array(CIdeaManagmentEmailNotify::SUBSCRIBE_ALL => $r + array("TITLE" => GetMessage("IDEA_SUBSCRIBE_ALL_SUBSCRIBED"), "ID" => CIdeaManagmentEmailNotify::SUBSCRIBE_ALL)) + $arResult["IDEA"];
        } else {
示例#20
0
 function __construct($grid_id, array $filterPresets = array())
 {
     parent::__construct($grid_id, $filterPresets);
 }
示例#21
0
 * @package bitrix
 * @subpackage main
 * @copyright 2001-2014 Bitrix
 */
/**
 * Bitrix vars
 *
 * @global CUser $USER
 */
define("NO_KEEP_STATISTIC", true);
define("NO_AGENT_STATISTIC", true);
define("NOT_CHECK_PERMISSIONS", true);
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php";
if ($USER->IsAuthorized() && check_bitrix_sessid()) {
    //get saved columns and sorting from user settings
    $gridOptions = new CGridOptions($_REQUEST["GRID_ID"]);
    if ($_REQUEST["action"] == "showcolumns") {
        $gridOptions->SetColumns($_REQUEST["columns"]);
    } elseif ($_REQUEST["action"] == "settheme") {
        $gridOptions->SetTheme($_REQUEST["theme"]);
    } elseif ($_REQUEST["action"] == "savesettings") {
        CUtil::decodeURIComponent($_POST);
        $gridOptions->SetViewSettings($_POST['view_id'], $_POST);
        if ($_REQUEST["set_default_settings"] == "Y" && $USER->CanDoOperation('edit_other_settings')) {
            $gridOptions->SetDefaultView($_POST);
            if ($_REQUEST["delete_users_settings"] == "Y") {
                $gridOptions->ResetDefaultView();
            }
        }
    } elseif ($_REQUEST["action"] == "delview") {
        $gridOptions->DeleteView($_REQUEST['view_id']);
示例#22
0
/**
 * Bitrix vars
 *
 * @var array $arParams
 * @var array $arResult
 * @var CBitrixComponentTemplate $this
 * @var CBitrixComponent $component
 * @global CMain $APPLICATION
 * @global CUser $USER
 */
if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
//color schemes
if ($arParams["USE_THEMES"]) {
    $arThemes = CGridOptions::GetThemes($this->GetFolder());
} else {
    $arThemes = array();
}
?>

<?php 
if (!empty($arParams["FILTER"])) {
    ?>

<?php 
    $APPLICATION->IncludeComponent("bitrix:main.interface.filter", $arParams["FILTER_TEMPLATE_NAME"], array("GRID_ID" => $arParams["~GRID_ID"], "FILTER" => $arParams["~FILTER"], "FILTER_ROWS" => $arResult["FILTER_ROWS"], "FILTER_FIELDS" => $arResult["FILTER"], "OPTIONS" => $arResult["OPTIONS"]), $component, array("HIDE_ICONS" => true));
    ?>

<?php 
}
示例#23
0
 protected function createDataExcel()
 {
     $obList = new CList($this->arIBlock["ID"]);
     $gridOptions = new CGridOptions($this->arResult["GRID_ID"]);
     $gridColumns = $gridOptions->GetVisibleColumns();
     $gridSort = $gridOptions->GetSorting(array("sort" => array("name" => "asc")));
     $this->arResult["ELEMENTS_HEADERS"] = array();
     $arSelect = array("ID", "IBLOCK_ID");
     $arProperties = array();
     $this->arResult["FIELDS"] = $arListFields = $obList->GetFields();
     foreach ($arListFields as $fieldId => $arField) {
         if (!count($gridColumns) || in_array($fieldId, $gridColumns)) {
             if (substr($fieldId, 0, 9) == "PROPERTY_") {
                 $arProperties[] = $fieldId;
             } else {
                 $arSelect[] = $fieldId;
             }
         }
         if ($fieldId == "CREATED_BY") {
             $arSelect[] = "CREATED_USER_NAME";
         }
         if ($fieldId == "MODIFIED_BY") {
             $arSelect[] = "USER_NAME";
         }
         $this->arResult["ELEMENTS_HEADERS"][$fieldId] = $arField["NAME"];
     }
     if (!count($gridColumns) || in_array("IBLOCK_SECTION_ID", $gridColumns)) {
         $arSelect[] = "IBLOCK_SECTION_ID";
     }
     $this->arResult["ELEMENTS_HEADERS"]["IBLOCK_SECTION_ID"] = Loc::getMessage("CC_BLL_COLUMN_SECTION");
     /* FILTER */
     $sections = array();
     foreach ($this->arResult["LIST_SECTIONS"] as $id => $name) {
         $sections[$id] = $name;
     }
     $this->arResult["FILTER"] = array(array("id" => "list_section_id", "type" => "list", "items" => $sections, "filtered" => $this->arResult["SECTION_ID"] !== false, "filter_value" => $this->arResult["SECTION_ID"], "value" => $this->arResult["SECTION_ID"]));
     $i = 1;
     $arFilterable = array();
     $arCustomFilter = array();
     $arDateFilter = array();
     foreach ($arListFields as $fieldId => $arField) {
         if ($arField["TYPE"] == "ACTIVE_FROM" || $arField["TYPE"] == "ACTIVE_TO") {
             $this->arResult["FILTER"][$i] = array("id" => "DATE_" . $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
             $arFilterable["DATE_" . $fieldId] = "";
             $arDateFilter["DATE_" . $fieldId] = true;
         } elseif ($arField["TYPE"] == "DATE_CREATE" || $arField["TYPE"] == "TIMESTAMP_X") {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "date");
             $arFilterable[$fieldId] = "";
             $arDateFilter[$fieldId] = true;
         } elseif (is_array($arField["PROPERTY_USER_TYPE"]) && array_key_exists("GetPublicFilterHTML", $arField["PROPERTY_USER_TYPE"])) {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "custom", "fieldsType" => $arField["TYPE"], "enable_settings" => false, "value" => call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicFilterHTML"], array($arField, array("VALUE" => $fieldId, "FORM_NAME" => "filter_" . $this->arResult["GRID_ID"], "GRID_ID" => $this->arResult["GRID_ID"]))));
             $arFilterable[$fieldId] = "";
             if (array_key_exists("AddFilterFields", $arField["PROPERTY_USER_TYPE"])) {
                 $arCustomFilter[$fieldId] = array("callback" => $arField["PROPERTY_USER_TYPE"]["AddFilterFields"], "filter" => &$this->arResult["FILTER"][$i]);
             }
         } elseif ($arField["TYPE"] == "SORT" || $arField["TYPE"] == "N") {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "number");
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "G") {
             $items = array();
             $prop_secs = CIBlockSection::GetList(array("left_margin" => "asc"), array("IBLOCK_ID" => $arField["LINK_IBLOCK_ID"]));
             while ($ar_sec = $prop_secs->Fetch()) {
                 $items[$ar_sec["ID"]] = str_repeat(". ", $ar_sec["DEPTH_LEVEL"] - 1) . $ar_sec["NAME"];
             }
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "E") {
             //Should be handled in template
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "E", "value" => $arField);
             $arFilterable[$fieldId] = "";
         } elseif ($arField["TYPE"] == "L") {
             $items = array();
             $propEnums = CIBlockProperty::GetPropertyEnum($arField["ID"]);
             while ($arEnum = $propEnums->Fetch()) {
                 $items[$arEnum["ID"]] = $arEnum["VALUE"];
             }
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "type" => "list", "items" => $items, "params" => array("size" => 5, "multiple" => "multiple"), "valign" => "top");
             $arFilterable[$fieldId] = "";
         } elseif (in_array($arField["TYPE"], array("S", "S:HTML", "NAME", "DETAIL_TEXT", "PREVIEW_TEXT"))) {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]));
             $arFilterable[$fieldId] = "?";
         } else {
             $this->arResult["FILTER"][$i] = array("id" => $fieldId, "name" => htmlspecialcharsex($arField["NAME"]), "fieldsType" => $arField["TYPE"]);
             $arFilterable[$fieldId] = "";
         }
         $i++;
     }
     $arFilter = array();
     $gridFilter = $gridOptions->GetFilter($this->arResult["FILTER"]);
     foreach ($gridFilter as $key => $value) {
         if (substr($key, -5) == "_from") {
             $op = ">=";
             $newKey = substr($key, 0, -5);
         } elseif (substr($key, -3) == "_to") {
             $op = "<=";
             $newKey = substr($key, 0, -3);
             if (array_key_exists($newKey, $arDateFilter)) {
                 if (!preg_match("/\\d\\d:\\d\\d:\\d\\d\$/", $value)) {
                     $value .= " 23:59:59";
                 }
             }
         } else {
             $op = "";
             $newKey = $key;
         }
         if (array_key_exists($newKey, $arFilterable)) {
             if ($op == "") {
                 $op = $arFilterable[$newKey];
             }
             $arFilter[$op . $newKey] = $value;
         }
     }
     foreach ($arCustomFilter as $fieldId => $arCallback) {
         $filtered = false;
         call_user_func_array($arCallback["callback"], array($arListFields[$fieldId], array("VALUE" => $fieldId, "GRID_ID" => $this->arResult["GRID_ID"]), &$arFilter, &$filtered));
     }
     $arFilter["IBLOCK_ID"] = $this->arIBlock["ID"];
     $arFilter["CHECK_PERMISSIONS"] = $this->listsPerm >= CListPermissions::CAN_READ ? "N" : "Y";
     if (!$this->arResult["ANY_SECTION"]) {
         $arFilter["SECTION_ID"] = $this->arResult["SECTION_ID"];
     }
     $rsElements = CIBlockElement::GetList($gridSort["sort"], $arFilter, false, false, $arSelect);
     $this->arResult["EXCEL_COLUMN_NAME"] = array();
     $this->arResult["EXCEL_CELL_VALUE"] = array();
     $count = 0;
     $comments = false;
     if (in_array("COMMENTS", $gridColumns) && CModule::includeModule("forum")) {
         $comments = true;
     }
     while ($obElement = $rsElements->GetNextElement()) {
         $data = $obElement->GetFields();
         $propertyArray = $obElement->GetProperties();
         if (!empty($arProperties)) {
             foreach ($propertyArray as $arProp) {
                 $fieldId = "PROPERTY_" . $arProp["ID"];
                 if (in_array($fieldId, $arProperties)) {
                     $arField = $this->arResult["FIELDS"][$fieldId];
                     if (is_array($arField["PROPERTY_USER_TYPE"]) && is_array($arField["PROPERTY_USER_TYPE"]["GetPublicViewHTML"])) {
                         if ($arProp["USER_TYPE"] == "map_yandex") {
                             $data[$fieldId] = !empty($arProp["VALUE"]) ? $arProp["VALUE"] : '';
                             continue;
                         } elseif ($arProp["USER_TYPE"] == "DiskFile") {
                             if (!empty($arProp["VALUE"]) && $this->arResult["DISK"]) {
                                 $listValue = current($arProp["VALUE"]);
                                 if (!is_array($listValue)) {
                                     $listValue = $arProp["VALUE"];
                                 }
                                 $number = 0;
                                 $countFiles = count($listValue);
                                 foreach ($listValue as $idAttached) {
                                     $number++;
                                     list($type, $realId) = Bitrix\Disk\Uf\FileUserType::detectType($idAttached);
                                     if ($type == Bitrix\Disk\Uf\FileUserType::TYPE_ALREADY_ATTACHED) {
                                         $attachedModel = Bitrix\Disk\AttachedObject::loadById($realId);
                                         if (!$attachedModel) {
                                             continue;
                                         }
                                         $fileModel = Bitrix\Disk\File::loadById($attachedModel->getObjectId(), array('STORAGE'));
                                         if (!$fileModel) {
                                             continue;
                                         }
                                         $data[$fieldId] .= $fileModel->getName();
                                         $data[$fieldId] .= $countFiles != $number ? ', ' : '';
                                     }
                                 }
                             }
                             continue;
                         }
                         if (is_array($arProp["~VALUE"])) {
                             foreach ($arProp["~VALUE"] as $propValue) {
                                 $data[$fieldId][] = call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicViewHTML"], array($arField, array("VALUE" => $propValue), array()));
                             }
                         } else {
                             $data[$fieldId] = call_user_func_array($arField["PROPERTY_USER_TYPE"]["GetPublicViewHTML"], array($arField, array("VALUE" => $arProp["~VALUE"]), array()));
                         }
                     } elseif ($arField["PROPERTY_TYPE"] == "E") {
                         if (empty($arProp['VALUE'])) {
                             continue;
                         }
                         if (!is_array($arProp['VALUE'])) {
                             $arProp['VALUE'] = array($arProp['VALUE']);
                         }
                         $elementQuery = CIBlockElement::getList(array(), array("=ID" => $arProp['VALUE']), false, false, array("NAME"));
                         while ($element = $elementQuery->fetch()) {
                             $data[$fieldId][] = $element['NAME'];
                         }
                     } elseif ($arField["PROPERTY_TYPE"] == "G") {
                         if (empty($arProp['VALUE'])) {
                             continue;
                         }
                         if (!is_array($arProp['VALUE'])) {
                             $arProp['VALUE'] = array($arProp['VALUE']);
                         }
                         $sectionQuery = CIBlockSection::getList(array(), array("=ID" => $arProp['VALUE']));
                         while ($section = $sectionQuery->fetch()) {
                             $data[$fieldId][] = $section['NAME'];
                         }
                     } elseif ($arField["PROPERTY_TYPE"] == "L") {
                         $data[$fieldId] = htmlspecialcharsex($arProp["VALUE_ENUM"]);
                     } elseif ($arField["PROPERTY_TYPE"] == "F") {
                         $files = is_array($arProp["VALUE"]) ? $arProp["VALUE"] : array($arProp["VALUE"]);
                         $number = 1;
                         $countFiles = count($files);
                         foreach ($files as $file) {
                             $value = CFile::MakeFileArray($file);
                             $data[$fieldId] .= $value["name"];
                             $data[$fieldId] .= $countFiles != $number ? ', ' : '';
                             $number++;
                         }
                     } else {
                         $data[$fieldId] = htmlspecialcharsex($arProp["VALUE"]);
                     }
                 }
             }
             if (!empty($data["IBLOCK_SECTION_ID"])) {
                 if (array_key_exists($data["IBLOCK_SECTION_ID"], $this->arResult["SECTIONS"])) {
                     $data["IBLOCK_SECTION_ID"] = $this->arResult["SECTIONS"][$data["IBLOCK_SECTION_ID"]]["NAME"];
                 }
             }
             if (in_array("BIZPROC", $gridColumns)) {
                 $data["BIZPROC"] = $this->getArrayBizproc($data);
             }
         }
         if ($comments) {
             $countComments = $this->getCommentsProcess($data["ID"]);
         }
         if (isset($data["CREATED_BY"])) {
             $data["CREATED_BY"] = "[" . $data["CREATED_BY"] . "] " . $data["CREATED_USER_NAME"];
         }
         if (isset($data["MODIFIED_BY"])) {
             $data["MODIFIED_BY"] = "[" . $data["MODIFIED_BY"] . "] " . $data["USER_NAME"];
         }
         if (isset($data["ACTIVE_FROM"])) {
             $data['ACTIVE_FROM'] = FormatDateFromDB($data['ACTIVE_FROM']);
         }
         if (isset($data["ACTIVE_TO"])) {
             $data['ACTIVE_TO'] = FormatDateFromDB($data['ACTIVE_TO']);
         }
         if (isset($data["DATE_CREATE"])) {
             $data['DATE_CREATE'] = FormatDateFromDB($data['DATE_CREATE']);
         }
         if (isset($data["TIMESTAMP_X"])) {
             $data['TIMESTAMP_X'] = FormatDateFromDB($data['TIMESTAMP_X']);
         }
         foreach ($gridColumns as $position => $id) {
             if ($id == "COMMENTS") {
                 if ($comments) {
                     $data[$id] = $countComments;
                 } else {
                     continue;
                 }
             }
             $this->arResult["EXCEL_CELL_VALUE"][$count][$position] = is_array($data[$id]) ? implode('/', $data[$id]) : $data[$id];
             $this->arResult["EXCEL_COLUMN_NAME"][$position] = $this->arResult["ELEMENTS_HEADERS"][$id];
         }
         $count++;
     }
 }
示例#24
0
    if ($arResult["GLOBAL_OPTIONS"]["theme_template"][SITE_TEMPLATE_ID] != '') {
        $arResult["GLOBAL_OPTIONS"]["theme"] = $arResult["GLOBAL_OPTIONS"]["theme_template"][SITE_TEMPLATE_ID];
    }
    if ($arResult["OPTIONS"]["theme"] == '') {
        $arResult["OPTIONS"]["theme"] = $arResult["GLOBAL_OPTIONS"]["theme"];
    }
} else {
    $arResult["OPTIONS"]["theme"] = '';
}
//*********************
// Filter
//*********************
if (is_array($arParams["FILTER_PRESETS"]) && !empty($arParams["FILTER_PRESETS"])) {
    $arResult["OPTIONS"]["filters"] = array_merge($arParams["FILTER_PRESETS"], $aOptions["filters"]);
}
$grid_options = new CGridOptions($arParams["GRID_ID"]);
$arResult["FILTER"] = $grid_options->GetFilter($arParams["FILTER"]);
$aVisRows = array();
$aFilterTmp = explode(",", $aOptions["filter_rows"]);
foreach ($aFilterTmp as $field) {
    if (($f = trim($field)) != "") {
        $aVisRows[$f] = $f;
    }
}
$arResult["FILTER_ROWS"] = array();
foreach ($arParams["FILTER"] as $field) {
    if ($field["filtered"] == true) {
        $arResult["FILTER_ROWS"][$field["id"]] = true;
        continue;
    }
    if (isset($arResult["FILTER"][$field["id"] . "_from"])) {
示例#25
0

$arResult["FILTER"] = array(
	array("id"=>"ID", "name"=>GetMessage('SUP_F_ID')),
	array("id"=>"LAMP", "name"=>GetMessage('SUP_F_LAMP'), "type"=>"list", "params"=>array("size"=>4, "multiple"=>"multiple"), "valign"=>"top", "items"=>array(
		'red' => GetMessage('SUP_RED'), 'green' => GetMessage('SUP_GREEN'), 'grey' => GetMessage('SUP_GREY')
	)),
	array("id"=>"CLOSE", "name"=>GetMessage('SUP_F_CLOSE'), "type" => "list", "items" => array(
		"" => GetMessage('SUP_ALL'), 'Y' => GetMessage('SUP_CLOSED'),'N' => GetMessage('SUP_OPENED')
	)),
	array("id"=>"MESSAGE", "name"=>GetMessage('SUP_F_MESSAGE_TITLE'))
);

$arParams["TICKETS_PER_PAGE"] = (intval($arParams["TICKETS_PER_PAGE"]) <= 0 ? 50 : intval($arParams["TICKETS_PER_PAGE"]));

$grid_options = new CGridOptions($arResult["GRID_ID"]);
$aSort = $grid_options->GetSorting(array("sort"=>array("id"=>"desc"), "vars"=>array("by"=>"by", "order"=>"order")));
$aNav = $grid_options->GetNavParams(array("nPageSize"=>$arParams["TICKETS_PER_PAGE"]));
$aSortArg = each($aSort["sort"]);
$aFilter = $grid_options->GetFilter($arResult["FILTER"]);

$aSortVal = $aSort['sort'];
$sort_order = current($aSortVal);
$sort_by = key($aSortVal);


if (strlen($arParams["SITE_ID"]) > 0)
	$aFilter["LID"] = $arParams["SITE_ID"];

$rsTickets = CTicket::GetList(
	$sort_by,
示例#26
0
         $user = $matches[2];
         $l = strlen("user_");
         if (substr($user, 0, $l) == "user_") {
             $result = htmlspecialcharsbx(CBPHelper::ConvertUserToPrintableForm(intval(substr($user, $l))));
         } else {
             $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$user];
         }
     } elseif ($matches[1] == "group") {
         $result = $GLOBALS["__bwl1_ParseStringParameterTmp_arAllowableUserGroups"][$matches[2]];
     } else {
         $result = $matches[0];
     }
     return $result;
 }
 $arResult["GRID_ID"] = "bizproc_loggrid_" . $arWorkflowState["WORKFLOW_TEMPLATE_ID"];
 $gridOptions = new CGridOptions($arResult["GRID_ID"]);
 $gridColumns = $gridOptions->GetVisibleColumns();
 $gridSort = $gridOptions->GetSorting(array("sort" => array("ID" => "desc")));
 $arResult["SORT"] = $gridSort["sort"];
 $arResult["FILTER"] = array();
 if ($arParams["INLINE_MODE"] != "Y") {
     $arResult["FILTER"] = array(array("id" => "MODIFIED", "name" => GetMessage("CBBWL_C_MODIFIED"), "type" => "date"), array("id" => "TYPE", "name" => GetMessage("CBBWL_C_TYPE"), "type" => "list", "items" => array("" => GetMessage("BPWC_WLC_NOT_SET"), 6 => GetMessage("BPABL_TYPE_7"), 5 => GetMessage("BPABL_TYPE_5"), 1 => GetMessage("BPABL_TYPE_1"), 2 => GetMessage("BPABL_TYPE_2"), 3 => GetMessage("BPABL_TYPE_3"), 4 => GetMessage("BPABL_TYPE_4"))), array("id" => "ADMIN_MODE", "name" => GetMessage("CBBWL_C_ADMIN_MODE"), "type" => "checkbox"));
 }
 $arResult["AdminMode"] = false;
 $arFilter = array("WORKFLOW_ID" => $arWorkflowState["ID"]);
 $gridFilter = $gridOptions->GetFilter($arResult["FILTER"]);
 foreach ($gridFilter as $key => $value) {
     if ($key == "ADMIN_MODE") {
         $arResult["AdminMode"] = $value == "Y" ? true : false;
         continue;
     }
示例#27
0
 $campaignId = intval($_REQUEST['campaign']);
 $loadingSession = $_REQUEST['loading_session'];
 $gaps = array();
 if ($loadingSession) {
     if (isset($_SESSION[$loadingSession]) && $_SESSION[$loadingSession]['CAMPAIGN_ID'] == $campaignId) {
         $dateStart = new Date($_SESSION[$loadingSession]['DATE_START']);
         $dateFinish = new Date($_SESSION[$loadingSession]['DATE_FINISH']);
         $gaps = $_SESSION[$loadingSession]['GAPS'];
     } else {
         $res = array('error' => array('message' => 'loading session broken'));
         break;
     }
 } else {
     if (in_array($_REQUEST["type"], array("week_ago", "month_ago", "interval"))) {
         $period = array();
         \CGridOptions::CalcDates("", array("_datesel" => $_REQUEST["type"], "_days" => 1, "_from" => $_REQUEST["date_from"], "_to" => $_REQUEST["date_to"]), $period);
         if (Date::isCorrect($period['_from'])) {
             $dateStart = new Date($period['_from']);
         } else {
             $res = array('error' => array('message' => Loc::getMessage('SEO_ERROR_INCORRECT_DATE') . ': ' . $period['_from']));
             break;
         }
         if (Date::isCorrect($period['_to'])) {
             $dateFinish = new Date($period['_to']);
         } else {
             $res = array('error' => array('message' => Loc::getMessage('SEO_ERROR_INCORRECT_DATE') . ': ' . $period['_to']));
             break;
         }
         $statsData = Adv\YandexStatTable::getCampaignStat($campaignId, $dateStart, $dateFinish);
         $gaps = Adv\YandexStatTable::getMissedPeriods($statsData, $dateStart, $dateFinish);
     } else {
示例#28
0
 public function GetFilter($arFilter)
 {
     $aRes = array();
     foreach ($arFilter as $field) {
         //date
         if (isset($_REQUEST[$field["id"] . "_datesel"])) {
             if ($_REQUEST[$field["id"] . "_datesel"] != '') {
                 $aRes[$field["id"] . "_datesel"] = $_REQUEST[$field["id"] . "_datesel"];
                 CGridOptions::CalcDates($field["id"], $_REQUEST, $aRes);
             } else {
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"] . "_datesel"]);
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"] . "_from"]);
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"] . "_to"]);
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"] . "_days"]);
             }
             continue;
         }
         //quick
         if ($_REQUEST[$field["id"] . "_list"] != '' && $_REQUEST[$field["id"]] != '') {
             $aRes[$field["id"] . "_list"] = $_REQUEST[$field["id"] . "_list"];
         }
         //number interval
         if (isset($_REQUEST[$field["id"] . "_from"])) {
             if ($_REQUEST[$field["id"] . "_from"] != '') {
                 $aRes[$field["id"] . "_from"] = $_REQUEST[$field["id"] . "_from"];
             } else {
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"] . "_from"]);
             }
         }
         if (isset($_REQUEST[$field["id"] . "_to"])) {
             if ($_REQUEST[$field["id"] . "_to"] != '') {
                 $aRes[$field["id"] . "_to"] = $_REQUEST[$field["id"] . "_to"];
             } else {
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"] . "_to"]);
             }
         }
         //filtered outside, we don't control the filter field value
         if ($field["filtered"] == true) {
             if (isset($field["filter_value"])) {
                 $aRes[$field["id"]] = $field["filter_value"];
             } else {
                 $aRes[$field["id"]] = true;
             }
             continue;
         }
         //list or string
         if (isset($_REQUEST[$field["id"]])) {
             if (is_array($_REQUEST[$field["id"]]) && !empty($_REQUEST[$field["id"]]) && reset($_REQUEST[$field["id"]]) != '' || !is_array($_REQUEST[$field["id"]]) && $_REQUEST[$field["id"]] != '') {
                 $aRes[$field["id"]] = $_REQUEST[$field["id"]];
             } else {
                 unset($_SESSION["main.interface.grid"][$this->grid_id]["filter"][$field["id"]]);
             }
         }
     }
     //Check for filter ID -->
     if (isset($_REQUEST["apply_filter"]) && $_REQUEST["apply_filter"] === 'Y' && isset($_REQUEST["grid_filter_id"])) {
         $aRes["GRID_FILTER_APPLIED"] = true;
         $aRes["GRID_FILTER_ID"] = $_REQUEST["grid_filter_id"];
     }
     //<-- Check for filter ID
     if (!empty($aRes)) {
         $_SESSION["main.interface.grid"][$this->grid_id]["filter"] = $aRes;
     } elseif ($_REQUEST["clear_filter"] != '') {
         $_SESSION["main.interface.grid"][$this->grid_id]["filter"] = array();
     } elseif (is_array($_SESSION["main.interface.grid"][$this->grid_id]["filter"])) {
         return $_SESSION["main.interface.grid"][$this->grid_id]["filter"];
     } else {
         $this->InitFilter();
         if (!empty($this->filter)) {
             foreach ($arFilter as $field) {
                 if ($this->filter[$field["id"] . "_datesel"] != '') {
                     $aRes[$field["id"] . "_datesel"] = $this->filter[$field["id"] . "_datesel"];
                     CGridOptions::CalcDates($field["id"], $this->filter, $aRes);
                     continue;
                 }
                 if ($this->filter[$field["id"] . "_list"] != '' && $this->filter[$field["id"]] != '') {
                     $aRes[$field["id"] . "_list"] = $this->filter[$field["id"] . "_list"];
                 }
                 if ($this->filter[$field["id"] . "_from"] != '') {
                     $aRes[$field["id"] . "_from"] = $this->filter[$field["id"] . "_from"];
                 }
                 if ($this->filter[$field["id"] . "_to"] != '') {
                     $aRes[$field["id"] . "_to"] = $this->filter[$field["id"] . "_to"];
                 }
                 if (is_array($this->filter[$field["id"]]) && !empty($this->filter[$field["id"]]) && reset($this->filter[$field["id"]]) != '' || !is_array($this->filter[$field["id"]]) && $this->filter[$field["id"]] != '') {
                     $aRes[$field["id"]] = $this->filter[$field["id"]];
                 }
             }
             if (!empty($aRes)) {
                 $_SESSION["main.interface.grid"][$this->grid_id]["filter"] = $aRes;
             }
         }
     }
     return $aRes;
 }
示例#29
0
 private function getVersionGridData($gridId)
 {
     $grid = array('ID' => $gridId);
     $gridOptions = new CGridOptions($grid['ID']);
     $gridSort = $gridOptions->getSorting(array('sort' => array('ID' => 'desc'), 'vars' => array('by' => 'by', 'order' => 'order')));
     $grid['SORT'] = $gridSort['sort'];
     $grid['SORT_VARS'] = $gridSort['vars'];
     $this->arResult['ITEMS'] = $this->file->getVersions(array('with' => array('CREATE_USER'), 'order' => $gridSort['sort']));
     $urlManager = \Bitrix\Disk\Driver::getInstance()->getUrlManager();
     $rows = array();
     foreach ($this->arResult['ITEMS'] as $version) {
         /** @var $version Version */
         $objectArray = $version->toArray();
         $actions = array(array("ICONCLASS" => "download", "TEXT" => Loc::getMessage('DISK_FILE_VIEW_HISTORY_ACT_DOWNLOAD'), "DEFAULT" => true, "ONCLICK" => "jsUtils.Redirect(arguments, '" . $urlManager->getUrlForDownloadVersion($version) . "')"));
         $securityContext = $this->storage->getCurrentUserSecurityContext();
         if ($this->file->canRestore($securityContext)) {
             $actions[] = array("ICONCLASS" => "restore", "TEXT" => Loc::getMessage('DISK_FILE_VIEW_HISTORY_ACT_RESTORE'), "DEFAULT" => true, "ONCLICK" => "BX.Disk['FileViewClass_{$this->getComponentId()}'].openConfirmRestore({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$this->file->getId()},\n\t\t\t\t\t\t\t\tname: '{$this->file->getName()}'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tversion: {\n\t\t\t\t\t\t\t\tid: {$version->getId()}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})");
         }
         if ($this->file->canRestore($securityContext) && $this->file->canDelete($securityContext)) {
             $actions[] = array("ICONCLASS" => "delete", "TEXT" => Loc::getMessage('DISK_FILE_VIEW_HISTORY_ACT_DELETE'), "DEFAULT" => true, "ONCLICK" => "BX.Disk['FileViewClass_{$this->getComponentId()}'].openConfirmDeleteVersion({\n\t\t\t\t\t\t\tobject: {\n\t\t\t\t\t\t\t\tid: {$this->file->getId()},\n\t\t\t\t\t\t\t\tname: '{$this->file->getName()}'\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tversion: {\n\t\t\t\t\t\t\t\tid: {$version->getId()}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})");
         }
         $createdByLink = \CComponentEngine::makePathFromTemplate($this->arParams['PATH_TO_USER'], array("user_id" => $version->getCreatedBy()));
         $dataAttributesForViewer = Ui\Viewer::getAttributesByVersion($version);
         $rows[] = array('data' => $objectArray, 'columns' => array('FORMATTED_SIZE' => CFile::formatSize($version->getSize()), 'NAME' => "<a href='' {$dataAttributesForViewer}>" . $version->getName() . "</a>", 'CREATE_USER' => "\n\t\t\t\t\t\t<div class=\"bx-disk-user-link\"><span class=\"bx-disk-filepage-fileinfo-ownner-avatar\" style=\"background-image: url({$version->getCreateUser()->getAvatarSrc()});\"></span><a target='_blank' href=\"{$createdByLink}\" id=\"\">" . htmlspecialcharsbx($version->getCreateUser()->getFormattedName()) . "</a></div>\n\t\t\t\t\t", 'CREATE_TIME_VERSION' => $version->getCreateTime(), 'CREATE_TIME_FILE' => $version->getObjectCreateTime(), 'UPDATE_TIME_FILE' => $version->getObjectUpdateTime()), 'actions' => $actions);
     }
     unset($version);
     $grid['ROWS'] = $rows;
     $grid['ROWS_COUNT'] = count($rows);
     $grid['HEADERS'] = array(array('id' => 'CREATE_USER', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_CREATE_USER_2'), 'default' => true), array('id' => 'NAME', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_NAME'), 'default' => true), array('id' => 'CREATE_TIME_VERSION', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_CREATE_TIME_2'), 'default' => true), array('id' => 'FORMATTED_SIZE', 'name' => Loc::getMessage('DISK_FILE_VIEW_VERSION_COLUMN_FORMATTED_SIZE'), 'default' => true), array('id' => 'ID', 'name' => 'ID', 'default' => false, 'show_checkbox' => true));
     return $grid;
 }