TYPO3 CMS  TYPO3_7-6
CategoryBasedFileCollection.php
Go to the documentation of this file.
1 <?php
3 
4 /*
5  * This file is part of the TYPO3 CMS project.
6  *
7  * It is free software; you can redistribute it and/or modify it under
8  * the terms of the GNU General Public License, either version 2
9  * of the License, or any later version.
10  *
11  * For the full copyright and license information, please read the
12  * LICENSE.txt file that was distributed with this source code.
13  *
14  * The TYPO3 project - inspiring people to share!
15  */
16 
22 {
26  protected static $storageTableName = 'sys_file_collection';
27 
31  protected static $type = 'categories';
32 
36  protected static $itemsCriteriaField = 'category';
37 
41  protected $itemTableName = 'sys_category';
42 
48  public function loadContents()
49  {
50  $resource = $this->getDatabaseConnection()->exec_SELECT_mm_query(
51  'sys_file_metadata.file',
52  'sys_category',
53  'sys_category_record_mm',
54  'sys_file_metadata',
55  'AND sys_category.uid=' . (int)$this->getItemsCriteria() .
56  ' AND sys_category_record_mm.tablenames = \'sys_file_metadata\''
57  );
58 
60  if ($resource) {
61  while (($record = $this->getDatabaseConnection()->sql_fetch_assoc($resource)) !== false) {
62  $this->add($resourceFactory->getFileObject((int)$record['file']));
63  }
64  $this->getDatabaseConnection()->sql_free_result($resource);
65  }
66  }
67 
73  protected function getDatabaseConnection()
74  {
75  return $GLOBALS['TYPO3_DB'];
76  }
77 }
add(\TYPO3\CMS\Core\Resource\FileInterface $data)
if(TYPO3_MODE==='BE') $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tsfebeuserauth.php']['frontendEditingController']['default']