| @@ 3043-3141 (lines=99) @@ | ||
| 3040 | * The HTML is accumulated in $this->HTMLcode |
|
| 3041 | * Finishes off with a stopper-gif |
|
| 3042 | */ |
|
| 3043 | public function generateList() |
|
| 3044 | { |
|
| 3045 | // Set page record in header |
|
| 3046 | $this->pageRecord = BackendUtility::getRecordWSOL('pages', $this->id); |
|
| 3047 | $hideTablesArray = GeneralUtility::trimExplode(',', $this->hideTables); |
|
| 3048 | ||
| 3049 | $backendUser = $this->getBackendUserAuthentication(); |
|
| 3050 | ||
| 3051 | // pre-process tables and add sorting instructions |
|
| 3052 | $tableNames = array_flip(array_keys($GLOBALS['TCA'])); |
|
| 3053 | foreach ($tableNames as $tableName => &$config) { |
|
| 3054 | $hideTable = false; |
|
| 3055 | ||
| 3056 | // Checking if the table should be rendered: |
|
| 3057 | // Checks that we see only permitted/requested tables: |
|
| 3058 | if ($this->table && $tableName !== $this->table |
|
| 3059 | || $this->tableList && !GeneralUtility::inList($this->tableList, $tableName) |
|
| 3060 | || !$backendUser->check('tables_select', $tableName) |
|
| 3061 | ) { |
|
| 3062 | $hideTable = true; |
|
| 3063 | } |
|
| 3064 | ||
| 3065 | if (!$hideTable) { |
|
| 3066 | // Don't show table if hidden by TCA ctrl section |
|
| 3067 | // Don't show table if hidden by pageTSconfig mod.web_list.hideTables |
|
| 3068 | $hideTable = $hideTable |
|
| 3069 | || !empty($GLOBALS['TCA'][$tableName]['ctrl']['hideTable']) |
|
| 3070 | || in_array($tableName, $hideTablesArray, true) |
|
| 3071 | || in_array('*', $hideTablesArray, true); |
|
| 3072 | // Override previous selection if table is enabled or hidden by TSconfig TCA override mod.web_list.table |
|
| 3073 | if (isset($this->tableTSconfigOverTCA[$tableName . '.']['hideTable'])) { |
|
| 3074 | $hideTable = (bool)$this->tableTSconfigOverTCA[$tableName . '.']['hideTable']; |
|
| 3075 | } |
|
| 3076 | } |
|
| 3077 | if ($hideTable) { |
|
| 3078 | unset($tableNames[$tableName]); |
|
| 3079 | } else { |
|
| 3080 | if (isset($this->tableDisplayOrder[$tableName])) { |
|
| 3081 | // Copy display order information |
|
| 3082 | $tableNames[$tableName] = $this->tableDisplayOrder[$tableName]; |
|
| 3083 | } else { |
|
| 3084 | $tableNames[$tableName] = []; |
|
| 3085 | } |
|
| 3086 | } |
|
| 3087 | } |
|
| 3088 | unset($config); |
|
| 3089 | ||
| 3090 | $orderedTableNames = GeneralUtility::makeInstance(DependencyOrderingService::class) |
|
| 3091 | ->orderByDependencies($tableNames); |
|
| 3092 | ||
| 3093 | foreach ($orderedTableNames as $tableName => $_) { |
|
| 3094 | // check if we are in single- or multi-table mode |
|
| 3095 | if ($this->table) { |
|
| 3096 | $this->iLimit = isset($GLOBALS['TCA'][$tableName]['interface']['maxSingleDBListItems']) |
|
| 3097 | ? (int)$GLOBALS['TCA'][$tableName]['interface']['maxSingleDBListItems'] |
|
| 3098 | : $this->itemsLimitSingleTable; |
|
| 3099 | } else { |
|
| 3100 | // if there are no records in table continue current foreach |
|
| 3101 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 3102 | ->getQueryBuilderForTable($tableName); |
|
| 3103 | $queryBuilder->getRestrictions() |
|
| 3104 | ->removeAll() |
|
| 3105 | ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) |
|
| 3106 | ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); |
|
| 3107 | $queryBuilder = $this->addPageIdConstraint($tableName, $queryBuilder); |
|
| 3108 | $firstRow = $queryBuilder->select('uid') |
|
| 3109 | ->from($tableName) |
|
| 3110 | ->execute() |
|
| 3111 | ->fetch(); |
|
| 3112 | if (!is_array($firstRow)) { |
|
| 3113 | continue; |
|
| 3114 | } |
|
| 3115 | $this->iLimit = isset($GLOBALS['TCA'][$tableName]['interface']['maxDBListItems']) |
|
| 3116 | ? (int)$GLOBALS['TCA'][$tableName]['interface']['maxDBListItems'] |
|
| 3117 | : $this->itemsLimitPerTable; |
|
| 3118 | } |
|
| 3119 | if ($this->showLimit) { |
|
| 3120 | $this->iLimit = $this->showLimit; |
|
| 3121 | } |
|
| 3122 | // Setting fields to select: |
|
| 3123 | if ($this->allFields) { |
|
| 3124 | $fields = $this->makeFieldList($tableName); |
|
| 3125 | $fields[] = 'tstamp'; |
|
| 3126 | $fields[] = 'crdate'; |
|
| 3127 | $fields[] = '_PATH_'; |
|
| 3128 | $fields[] = '_CONTROL_'; |
|
| 3129 | if (is_array($this->setFields[$tableName])) { |
|
| 3130 | $fields = array_intersect($fields, $this->setFields[$tableName]); |
|
| 3131 | } else { |
|
| 3132 | $fields = []; |
|
| 3133 | } |
|
| 3134 | } else { |
|
| 3135 | $fields = []; |
|
| 3136 | } |
|
| 3137 | ||
| 3138 | // Finally, render the list: |
|
| 3139 | $this->HTMLcode .= $this->getTable($tableName, $this->id, implode(',', $fields)); |
|
| 3140 | } |
|
| 3141 | } |
|
| 3142 | ||
| 3143 | /** |
|
| 3144 | * Creates the search box |
|
| @@ 474-572 (lines=99) @@ | ||
| 471 | * Finishes off with a stopper-gif |
|
| 472 | * @deprecated since TYPO3 v9, will be removed in TYPO3 v10 |
|
| 473 | */ |
|
| 474 | public function generateList() |
|
| 475 | { |
|
| 476 | // Set page record in header |
|
| 477 | $this->pageRecord = BackendUtility::getRecordWSOL('pages', $this->id); |
|
| 478 | $hideTablesArray = GeneralUtility::trimExplode(',', $this->hideTables); |
|
| 479 | ||
| 480 | $backendUser = $this->getBackendUserAuthentication(); |
|
| 481 | ||
| 482 | // pre-process tables and add sorting instructions |
|
| 483 | $tableNames = array_flip(array_keys($GLOBALS['TCA'])); |
|
| 484 | foreach ($tableNames as $tableName => &$config) { |
|
| 485 | $hideTable = false; |
|
| 486 | ||
| 487 | // Checking if the table should be rendered: |
|
| 488 | // Checks that we see only permitted/requested tables: |
|
| 489 | if ($this->table && $tableName !== $this->table |
|
| 490 | || $this->tableList && !GeneralUtility::inList($this->tableList, $tableName) |
|
| 491 | || !$backendUser->check('tables_select', $tableName) |
|
| 492 | ) { |
|
| 493 | $hideTable = true; |
|
| 494 | } |
|
| 495 | ||
| 496 | if (!$hideTable) { |
|
| 497 | // Don't show table if hidden by TCA ctrl section |
|
| 498 | // Don't show table if hidden by pageTSconfig mod.web_list.hideTables |
|
| 499 | $hideTable = $hideTable |
|
| 500 | || !empty($GLOBALS['TCA'][$tableName]['ctrl']['hideTable']) |
|
| 501 | || in_array($tableName, $hideTablesArray, true) |
|
| 502 | || in_array('*', $hideTablesArray, true); |
|
| 503 | // Override previous selection if table is enabled or hidden by TSconfig TCA override mod.web_list.table |
|
| 504 | if (isset($this->tableTSconfigOverTCA[$tableName . '.']['hideTable'])) { |
|
| 505 | $hideTable = (bool)$this->tableTSconfigOverTCA[$tableName . '.']['hideTable']; |
|
| 506 | } |
|
| 507 | } |
|
| 508 | if ($hideTable) { |
|
| 509 | unset($tableNames[$tableName]); |
|
| 510 | } else { |
|
| 511 | if (isset($this->tableDisplayOrder[$tableName])) { |
|
| 512 | // Copy display order information |
|
| 513 | $tableNames[$tableName] = $this->tableDisplayOrder[$tableName]; |
|
| 514 | } else { |
|
| 515 | $tableNames[$tableName] = []; |
|
| 516 | } |
|
| 517 | } |
|
| 518 | } |
|
| 519 | unset($config); |
|
| 520 | ||
| 521 | $orderedTableNames = GeneralUtility::makeInstance(DependencyOrderingService::class) |
|
| 522 | ->orderByDependencies($tableNames); |
|
| 523 | ||
| 524 | foreach ($orderedTableNames as $tableName => $_) { |
|
| 525 | // check if we are in single- or multi-table mode |
|
| 526 | if ($this->table) { |
|
| 527 | $this->iLimit = isset($GLOBALS['TCA'][$tableName]['interface']['maxSingleDBListItems']) |
|
| 528 | ? (int)$GLOBALS['TCA'][$tableName]['interface']['maxSingleDBListItems'] |
|
| 529 | : $this->itemsLimitSingleTable; |
|
| 530 | } else { |
|
| 531 | // if there are no records in table continue current foreach |
|
| 532 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 533 | ->getQueryBuilderForTable($tableName); |
|
| 534 | $queryBuilder->getRestrictions() |
|
| 535 | ->removeAll() |
|
| 536 | ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) |
|
| 537 | ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); |
|
| 538 | $queryBuilder = $this->addPageIdConstraint($tableName, $queryBuilder); |
|
| 539 | $firstRow = $queryBuilder->select('uid') |
|
| 540 | ->from($tableName) |
|
| 541 | ->execute() |
|
| 542 | ->fetch(); |
|
| 543 | if (!is_array($firstRow)) { |
|
| 544 | continue; |
|
| 545 | } |
|
| 546 | $this->iLimit = isset($GLOBALS['TCA'][$tableName]['interface']['maxDBListItems']) |
|
| 547 | ? (int)$GLOBALS['TCA'][$tableName]['interface']['maxDBListItems'] |
|
| 548 | : $this->itemsLimitPerTable; |
|
| 549 | } |
|
| 550 | if ($this->showLimit) { |
|
| 551 | $this->iLimit = $this->showLimit; |
|
| 552 | } |
|
| 553 | // Setting fields to select: |
|
| 554 | if ($this->allFields) { |
|
| 555 | $fields = $this->makeFieldList($tableName); |
|
| 556 | $fields[] = 'tstamp'; |
|
| 557 | $fields[] = 'crdate'; |
|
| 558 | $fields[] = '_PATH_'; |
|
| 559 | $fields[] = '_CONTROL_'; |
|
| 560 | if (is_array($this->setFields[$tableName])) { |
|
| 561 | $fields = array_intersect($fields, $this->setFields[$tableName]); |
|
| 562 | } else { |
|
| 563 | $fields = []; |
|
| 564 | } |
|
| 565 | } else { |
|
| 566 | $fields = []; |
|
| 567 | } |
|
| 568 | ||
| 569 | // Finally, render the list: |
|
| 570 | $this->HTMLcode .= $this->getTable($tableName, $this->id, implode(',', $fields)); |
|
| 571 | } |
|
| 572 | } |
|
| 573 | ||
| 574 | /** |
|
| 575 | * To be implemented in extending classes. |
|
| @@ 2903-3001 (lines=99) @@ | ||
| 2900 | * The HTML is accumulated in $this->HTMLcode |
|
| 2901 | * Finishes off with a stopper-gif |
|
| 2902 | */ |
|
| 2903 | public function generateList() |
|
| 2904 | { |
|
| 2905 | // Set page record in header |
|
| 2906 | $this->pageRecord = BackendUtility::getRecordWSOL('pages', $this->id); |
|
| 2907 | $hideTablesArray = GeneralUtility::trimExplode(',', $this->hideTables); |
|
| 2908 | ||
| 2909 | $backendUser = $this->getBackendUserAuthentication(); |
|
| 2910 | ||
| 2911 | // pre-process tables and add sorting instructions |
|
| 2912 | $tableNames = array_flip(array_keys($GLOBALS['TCA'])); |
|
| 2913 | foreach ($tableNames as $tableName => &$config) { |
|
| 2914 | $hideTable = false; |
|
| 2915 | ||
| 2916 | // Checking if the table should be rendered: |
|
| 2917 | // Checks that we see only permitted/requested tables: |
|
| 2918 | if ($this->table && $tableName !== $this->table |
|
| 2919 | || $this->tableList && !GeneralUtility::inList($this->tableList, $tableName) |
|
| 2920 | || !$backendUser->check('tables_select', $tableName) |
|
| 2921 | ) { |
|
| 2922 | $hideTable = true; |
|
| 2923 | } |
|
| 2924 | ||
| 2925 | if (!$hideTable) { |
|
| 2926 | // Don't show table if hidden by TCA ctrl section |
|
| 2927 | // Don't show table if hidden by pageTSconfig mod.web_list.hideTables |
|
| 2928 | $hideTable = $hideTable |
|
| 2929 | || !empty($GLOBALS['TCA'][$tableName]['ctrl']['hideTable']) |
|
| 2930 | || in_array($tableName, $hideTablesArray, true) |
|
| 2931 | || in_array('*', $hideTablesArray, true); |
|
| 2932 | // Override previous selection if table is enabled or hidden by TSconfig TCA override mod.web_list.table |
|
| 2933 | if (isset($this->tableTSconfigOverTCA[$tableName . '.']['hideTable'])) { |
|
| 2934 | $hideTable = (bool)$this->tableTSconfigOverTCA[$tableName . '.']['hideTable']; |
|
| 2935 | } |
|
| 2936 | } |
|
| 2937 | if ($hideTable) { |
|
| 2938 | unset($tableNames[$tableName]); |
|
| 2939 | } else { |
|
| 2940 | if (isset($this->tableDisplayOrder[$tableName])) { |
|
| 2941 | // Copy display order information |
|
| 2942 | $tableNames[$tableName] = $this->tableDisplayOrder[$tableName]; |
|
| 2943 | } else { |
|
| 2944 | $tableNames[$tableName] = []; |
|
| 2945 | } |
|
| 2946 | } |
|
| 2947 | } |
|
| 2948 | unset($config); |
|
| 2949 | ||
| 2950 | $orderedTableNames = GeneralUtility::makeInstance(DependencyOrderingService::class) |
|
| 2951 | ->orderByDependencies($tableNames); |
|
| 2952 | ||
| 2953 | foreach ($orderedTableNames as $tableName => $_) { |
|
| 2954 | // check if we are in single- or multi-table mode |
|
| 2955 | if ($this->table) { |
|
| 2956 | $this->iLimit = isset($GLOBALS['TCA'][$tableName]['interface']['maxSingleDBListItems']) |
|
| 2957 | ? (int)$GLOBALS['TCA'][$tableName]['interface']['maxSingleDBListItems'] |
|
| 2958 | : $this->itemsLimitSingleTable; |
|
| 2959 | } else { |
|
| 2960 | // if there are no records in table continue current foreach |
|
| 2961 | $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) |
|
| 2962 | ->getQueryBuilderForTable($tableName); |
|
| 2963 | $queryBuilder->getRestrictions() |
|
| 2964 | ->removeAll() |
|
| 2965 | ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) |
|
| 2966 | ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); |
|
| 2967 | $queryBuilder = $this->addPageIdConstraint($tableName, $queryBuilder); |
|
| 2968 | $firstRow = $queryBuilder->select('uid') |
|
| 2969 | ->from($tableName) |
|
| 2970 | ->execute() |
|
| 2971 | ->fetch(); |
|
| 2972 | if (!is_array($firstRow)) { |
|
| 2973 | continue; |
|
| 2974 | } |
|
| 2975 | $this->iLimit = isset($GLOBALS['TCA'][$tableName]['interface']['maxDBListItems']) |
|
| 2976 | ? (int)$GLOBALS['TCA'][$tableName]['interface']['maxDBListItems'] |
|
| 2977 | : $this->itemsLimitPerTable; |
|
| 2978 | } |
|
| 2979 | if ($this->showLimit) { |
|
| 2980 | $this->iLimit = $this->showLimit; |
|
| 2981 | } |
|
| 2982 | // Setting fields to select: |
|
| 2983 | if ($this->allFields) { |
|
| 2984 | $fields = $this->makeFieldList($tableName); |
|
| 2985 | $fields[] = 'tstamp'; |
|
| 2986 | $fields[] = 'crdate'; |
|
| 2987 | $fields[] = '_PATH_'; |
|
| 2988 | $fields[] = '_CONTROL_'; |
|
| 2989 | if (is_array($this->setFields[$tableName])) { |
|
| 2990 | $fields = array_intersect($fields, $this->setFields[$tableName]); |
|
| 2991 | } else { |
|
| 2992 | $fields = []; |
|
| 2993 | } |
|
| 2994 | } else { |
|
| 2995 | $fields = []; |
|
| 2996 | } |
|
| 2997 | ||
| 2998 | // Finally, render the list: |
|
| 2999 | $this->HTMLcode .= $this->getTable($tableName, $this->id, implode(',', $fields)); |
|
| 3000 | } |
|
| 3001 | } |
|
| 3002 | ||
| 3003 | /** |
|
| 3004 | * Creates the search box |
|