TYPO3  7.6
NewRecordController.php
Go to the documentation of this file.
1 <?php
2 namespace TYPO3\CMS\Backend\Controller;
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 
30 
35 {
39  public $pageinfo;
40 
44  public $pidInfo;
45 
49  protected $newRecordSortList;
50 
54  public $newPagesInto;
55 
60 
65 
71  protected $newPagesSelectPosition = true;
72 
77 
82 
87 
92 
97 
102 
106  public $code;
107 
111  public $R_URI;
112 
116  public $id;
117 
121  public $returnUrl;
122 
128  public $pagesOnly;
129 
134 
140  public $content;
141 
145  public $tRows;
146 
150  public function __construct()
151  {
152  parent::__construct();
153  $GLOBALS['SOBE'] = $this;
154  $this->getLanguageService()->includeLLFile('EXT:lang/locallang_misc.xlf');
155  $this->init();
156  }
157 
163  protected function init()
164  {
165  $beUser = $this->getBackendUserAuthentication();
166  // Page-selection permission clause (reading)
167  $this->perms_clause = $beUser->getPagePermsClause(1);
168  // This will hide records from display - it has nothing to do with user rights!!
169  if ($pidList = $beUser->getTSConfigVal('options.hideRecords.pages')) {
170  if ($pidList = $this->getDatabaseConnection()->cleanIntList($pidList)) {
171  $this->perms_clause .= ' AND pages.uid NOT IN (' . $pidList . ')';
172  }
173  }
174  // Setting GPvars:
175  // The page id to operate from
176  $this->id = (int)GeneralUtility::_GP('id');
177  $this->returnUrl = GeneralUtility::sanitizeLocalUrl(GeneralUtility::_GP('returnUrl'));
178  $this->pagesOnly = GeneralUtility::_GP('pagesOnly');
179  // Setting up the context sensitive menu:
180  $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/ClickMenu');
181  $this->moduleTemplate->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/Tooltip');
182  // Creating content
183  $this->content = '';
184  $this->content .= '<h1>'
185  . $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.pagetitle')
186  . '</h1>';
187  // Id a positive id is supplied, ask for the page record with permission information contained:
188  if ($this->id > 0) {
189  $this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
190  }
191  // If a page-record was returned, the user had read-access to the page.
192  if ($this->pageinfo['uid']) {
193  // Get record of parent page
194  $this->pidInfo = BackendUtility::getRecord('pages', $this->pageinfo['pid']);
195  // Checking the permissions for the user with regard to the parent page: Can he create new pages, new
196  // content record, new page after?
197  if ($beUser->doesUserHaveAccess($this->pageinfo, 8)) {
198  $this->newPagesInto = 1;
199  }
200  if ($beUser->doesUserHaveAccess($this->pageinfo, 16)) {
201  $this->newContentInto = 1;
202  }
203  if (($beUser->isAdmin() || is_array($this->pidInfo)) && $beUser->doesUserHaveAccess($this->pidInfo, 8)) {
204  $this->newPagesAfter = 1;
205  }
206  } elseif ($beUser->isAdmin()) {
207  // Admins can do it all
208  $this->newPagesInto = 1;
209  $this->newContentInto = 1;
210  $this->newPagesAfter = 0;
211  } else {
212  // People with no permission can do nothing
213  $this->newPagesInto = 0;
214  $this->newContentInto = 0;
215  $this->newPagesAfter = 0;
216  }
217  }
218 
228  {
229  $this->main();
230 
231  $response->getBody()->write($this->moduleTemplate->renderContent());
232  return $response;
233  }
234 
240  public function main()
241  {
242  // If there was a page - or if the user is admin (admins has access to the root) we proceed:
243  if (!empty($this->pageinfo['uid']) || $this->getBackendUserAuthentication()->isAdmin()) {
244  if (empty($this->pageinfo)) {
245  // Explicitly pass an empty array to the docHeader
246  $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation([]);
247  } else {
248  $this->moduleTemplate->getDocHeaderComponent()->setMetaInformation($this->pageinfo);
249  }
250  // Acquiring TSconfig for this module/current page:
251  $this->web_list_modTSconfig = BackendUtility::getModTSconfig($this->pageinfo['uid'], 'mod.web_list');
252  $this->allowedNewTables = GeneralUtility::trimExplode(
253  ',',
254  $this->web_list_modTSconfig['properties']['allowedNewTables'],
255  true
256  );
257  $this->deniedNewTables = GeneralUtility::trimExplode(
258  ',',
259  $this->web_list_modTSconfig['properties']['deniedNewTables'],
260  true
261  );
262  // Acquiring TSconfig for this module/parent page:
263  $this->web_list_modTSconfig_pid = BackendUtility::getModTSconfig($this->pageinfo['pid'], 'mod.web_list');
264  $this->allowedNewTables_pid = GeneralUtility::trimExplode(
265  ',',
266  $this->web_list_modTSconfig_pid['properties']['allowedNewTables'],
267  true
268  );
269  $this->deniedNewTables_pid = GeneralUtility::trimExplode(
270  ',',
271  $this->web_list_modTSconfig_pid['properties']['deniedNewTables'],
272  true
273  );
274  // More init:
275  if (!$this->showNewRecLink('pages')) {
276  $this->newPagesInto = 0;
277  }
278  if (!$this->showNewRecLink('pages', $this->allowedNewTables_pid, $this->deniedNewTables_pid)) {
279  $this->newPagesAfter = 0;
280  }
281  // Set header-HTML and return_url
282  if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
283  $title = strip_tags($this->pageinfo[$GLOBALS['TCA']['pages']['ctrl']['label']]);
284  } else {
285  $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'];
286  }
287  $this->moduleTemplate->setTitle($title);
288  // GENERATE the HTML-output depending on mode (pagesOnly is the page wizard)
289  // Regular new element:
290  if (!$this->pagesOnly) {
291  $this->regularNew();
292  } elseif ($this->showNewRecLink('pages')) {
293  // Pages only wizard
294  $this->pagesOnly();
295  }
296  // Add all the content to an output section
297  $this->content .= '<div>' . $this->code . '</div>';
298  // Setting up the buttons and markers for docheader
299  $this->getButtons();
300  // Build the <body> for the module
301  $this->moduleTemplate->setContent($this->content);
302  }
303  }
304 
308  protected function getButtons()
309  {
310  $lang = $this->getLanguageService();
311  $buttonBar = $this->moduleTemplate->getDocHeaderComponent()->getButtonBar();
312  // Regular new element:
313  if (!$this->pagesOnly) {
314  // New page
315  if ($this->showNewRecLink('pages')) {
316  $newPageButton = $buttonBar->makeLinkButton()
317  ->setHref(GeneralUtility::linkThisScript(array('pagesOnly' => '1')))
318  ->setTitle($lang->sL(
319  'LLL:EXT:backend/Resources/Private/Language/locallang_layout.xlf:newPage',
320  true
321  ))
322  ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-page-new', Icon::SIZE_SMALL));
323  $buttonBar->addButton($newPageButton, ButtonBar::BUTTON_POSITION_LEFT, 20);
324  }
325  // CSH
326  $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('new_regular');
327  $buttonBar->addButton($cshButton);
328  } elseif ($this->showNewRecLink('pages')) {
329  // Pages only wizard
330  // CSH
331  $buttons['csh'] = BackendUtility::cshItem('xMOD_csh_corebe', 'new_pages');
332  $cshButton = $buttonBar->makeHelpButton()->setModuleName('xMOD_csh_corebe')->setFieldName('new_pages');
333  $buttonBar->addButton($cshButton);
334  }
335  // Back
336  if ($this->returnUrl) {
337  $returnButton = $buttonBar->makeLinkButton()
338  ->setHref($this->returnUrl)
339  ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.goBack', true))
340  ->setIcon($this->moduleTemplate->getIconFactory()->getIcon('actions-view-go-back', Icon::SIZE_SMALL));
341  $buttonBar->addButton($returnButton, ButtonBar::BUTTON_POSITION_LEFT, 10);
342  }
343 
344 
345  if (is_array($this->pageinfo) && $this->pageinfo['uid']) {
346  // View
347  $pagesTSconfig = BackendUtility::getPagesTSconfig($this->pageinfo['uid']);
348  if (isset($pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'])) {
349  $excludeDokTypes = GeneralUtility::intExplode(
350  ',',
351  $pagesTSconfig['TCEMAIN.']['preview.']['disableButtonForDokType'],
352  true
353  );
354  } else {
355  // exclude sysfolders and recycler by default
356  $excludeDokTypes = array(
360  );
361  }
362  if (!in_array((int)$this->pageinfo['doktype'], $excludeDokTypes, true)) {
363  $viewButton = $buttonBar->makeLinkButton()
364  ->setHref('#')
365  ->setOnClick(BackendUtility::viewOnClick(
366  $this->pageinfo['uid'],
367  '',
368  BackendUtility::BEgetRootLine($this->pageinfo['uid'])
369  ))
370  ->setTitle($lang->sL('LLL:EXT:lang/locallang_core.xlf:labels.showPage', true))
371  ->setIcon($this->moduleTemplate->getIconFactory()->getIcon(
372  'actions-document-view',
374  ));
375  $buttonBar->addButton($viewButton, ButtonBar::BUTTON_POSITION_LEFT, 30);
376  }
377  }
378  }
379 
385  public function pagesOnly()
386  {
387  $numberOfPages = $this->getDatabaseConnection()->exec_SELECTcountRows(
388  '*',
389  'pages',
390  '1=1' . BackendUtility::deleteClause('pages')
391  );
392  if ($numberOfPages > 0) {
393  $this->code .= '
394  <h3>' . htmlspecialchars($this->getLanguageService()->getLL('selectPosition')) . ':</h3>
395  ';
396  $positionMap = GeneralUtility::makeInstance(PagePositionMap::class, NewRecordPageTreeView::class);
398  $this->code .= $positionMap->positionTree(
399  $this->id,
400  $this->pageinfo,
401  $this->perms_clause,
402  $this->returnUrl
403  );
404  } else {
405  // No pages yet, no need to prompt for position, redirect to page creation.
406  $urlParameters = [
407  'edit' => [
408  'pages' => [
409  0 => 'new'
410  ]
411  ],
412  'returnNewPageId' => 1,
413  'returnUrl' => BackendUtility::getModuleUrl('db_new', array('id' => $this->id, 'pagesOnly' => '1'))
414  ];
415  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
416  @ob_end_clean();
418  }
419  }
420 
426  public function regularNew()
427  {
428  $lang = $this->getLanguageService();
429  // Initialize array for accumulating table rows:
430  $this->tRows = array();
431  // Get TSconfig for current page
432  $pageTS = BackendUtility::getPagesTSconfig($this->id);
433  // Finish initializing new pages options with TSconfig
434  // Each new page option may be hidden by TSconfig
435  // Enabled option for the position of a new page
436  $this->newPagesSelectPosition = !empty(
437  $pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageSelectPosition']
438  );
439  // Pseudo-boolean (0/1) for backward compatibility
440  $displayNewPagesIntoLink = $this->newPagesInto && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageInside']) ? 1 : 0;
441  $displayNewPagesAfterLink = $this->newPagesAfter && !empty($pageTS['mod.']['wizards.']['newRecord.']['pages.']['show.']['pageAfter']) ? 1 : 0;
442  // Slight spacer from header:
443  $this->code .= '';
444  // New Page
445  $table = 'pages';
446  $v = $GLOBALS['TCA'][$table];
447  $pageIcon = $this->moduleTemplate->getIconFactory()->getIconForRecord(
448  $table,
449  array(),
451  )->render();
452  $newPageIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-page-new', Icon::SIZE_SMALL)->render();
453  $rowContent = '';
454  // New pages INSIDE this pages
455  $newPageLinks = array();
456  if ($displayNewPagesIntoLink && $this->isTableAllowedForThisPage($this->pageinfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ?: $this->id), 'pages')) {
457  // Create link to new page inside:
458  $newPageLinks[] = $this->linkWrap($this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . $lang->sL($v['ctrl']['title'], true) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.inside', true) . ')', $table, $this->id);
459  }
460  // New pages AFTER this pages
461  if ($displayNewPagesAfterLink && $this->isTableAllowedForThisPage($this->pidInfo, 'pages') && $this->getBackendUserAuthentication()->check('tables_modify', 'pages') && $this->getBackendUserAuthentication()->workspaceCreateNewRecord($this->pidInfo['uid'], 'pages')) {
462  $newPageLinks[] = $this->linkWrap($pageIcon . $lang->sL($v['ctrl']['title'], true) . ' (' . $lang->sL('LLL:EXT:lang/locallang_core.xlf:db_new.php.after', true) . ')', 'pages', -$this->id);
463  }
464  // New pages at selection position
465  if ($this->newPagesSelectPosition && $this->showNewRecLink('pages')) {
466  // Link to page-wizard:
467  $newPageLinks[] = '<a href="' . htmlspecialchars(GeneralUtility::linkThisScript(array('pagesOnly' => 1))) . '">' . $pageIcon . htmlspecialchars($lang->getLL('pageSelectPosition')) . '</a>';
468  }
469  // Assemble all new page links
470  $numPageLinks = count($newPageLinks);
471  for ($i = 0; $i < $numPageLinks; $i++) {
472  $rowContent .= '<li>' . $newPageLinks[$i] . '</li>';
473  }
474  if ($this->showNewRecLink('pages')) {
475  $rowContent = '<ul class="list-tree"><li>' . $newPageIcon . '<strong>' .
476  $lang->getLL('createNewPage') . '</strong><ul>' . $rowContent . '</ul></li>';
477  } else {
478  $rowContent = '<ul class="list-tree"><li><ul>' . $rowContent . '</li></ul>';
479  }
480  // Compile table row
481  $startRows = array($rowContent);
482  $iconFile = array();
483  // New tables (but not pages) INSIDE this pages
484  $isAdmin = $this->getBackendUserAuthentication()->isAdmin();
485  $newContentIcon = $this->moduleTemplate->getIconFactory()->getIcon('actions-document-new', Icon::SIZE_SMALL)->render();
486  if ($this->newContentInto) {
487  if (is_array($GLOBALS['TCA'])) {
488  $groupName = '';
489  foreach ($GLOBALS['TCA'] as $table => $v) {
490  if ($table != 'pages'
491  && $this->showNewRecLink($table)
492  && $this->isTableAllowedForThisPage($this->pageinfo, $table)
493  && $this->getBackendUserAuthentication()->check('tables_modify', $table)
494  && (($v['ctrl']['rootLevel'] xor $this->id) || $v['ctrl']['rootLevel'] == -1)
495  && $this->getBackendUserAuthentication()->workspaceCreateNewRecord(($this->pageinfo['_ORIG_uid'] ? $this->pageinfo['_ORIG_uid'] : $this->id), $table)
496  ) {
497  $newRecordIcon = $this->moduleTemplate->getIconFactory()->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render();
498  $rowContent = '';
499  $thisTitle = '';
500  // Create new link for record:
501  $newLink = $this->linkWrap($newRecordIcon . $lang->sL($v['ctrl']['title'], true), $table, $this->id);
502  // If the table is 'tt_content', create link to wizard
503  if ($table == 'tt_content') {
504  $groupName = $lang->getLL('createNewContent');
505  $rowContent = $newContentIcon . '<strong>' . $lang->getLL('createNewContent') . '</strong><ul>';
506  // If mod.newContentElementWizard.override is set, use that extension's wizard instead:
507  $tsConfig = BackendUtility::getModTSconfig($this->id, 'mod');
508  $moduleName = $tsConfig['properties']['newContentElementWizard.']['override'] ?: 'new_content_element';
509  $url = BackendUtility::getModuleUrl($moduleName, ['id' => $this->id, 'returnUrl' => GeneralUtility::getIndpEnv('REQUEST_URI')]);
510  $rowContent .= '<li>' . $newLink . ' ' . BackendUtility::wrapInHelp($table, '') . '</li><li><a href="' . htmlspecialchars($url) . '">' . $newContentIcon . htmlspecialchars($lang->getLL('clickForWizard')) . '</a></li></ul>';
511  } else {
512  // Get the title
513  if ($v['ctrl']['readOnly'] || $v['ctrl']['hideTable'] || $v['ctrl']['is_static']) {
514  continue;
515  }
516  if ($v['ctrl']['adminOnly'] && !$isAdmin) {
517  continue;
518  }
519  $nameParts = explode('_', $table);
520  $thisTitle = '';
521  $_EXTKEY = '';
522  if ($nameParts[0] == 'tx' || $nameParts[0] == 'tt') {
523  // Try to extract extension name
524  if (substr($v['ctrl']['title'], 0, 8) == 'LLL:EXT:') {
525  $_EXTKEY = substr($v['ctrl']['title'], 8);
526  $_EXTKEY = substr($_EXTKEY, 0, strpos($_EXTKEY, '/'));
527  if ($_EXTKEY != '') {
528  // First try to get localisation of extension title
529  $temp = explode(':', substr($v['ctrl']['title'], 9 + strlen($_EXTKEY)));
530  $langFile = $temp[0];
531  $thisTitle = $lang->sL('LLL:EXT:' . $_EXTKEY . '/' . $langFile . ':extension.title');
532  // If no localisation available, read title from ext_emconf.php
533  $extEmConfFile = ExtensionManagementUtility::extPath($_EXTKEY) . 'ext_emconf.php';
534  if (!$thisTitle && is_file($extEmConfFile)) {
535  $EM_CONF = array();
536  include $extEmConfFile;
537  $thisTitle = $EM_CONF[$_EXTKEY]['title'];
538  }
539  $iconFile[$_EXTKEY] = '<img ' . 'src="' . ExtensionManagementUtility::extRelPath($_EXTKEY) . $GLOBALS['TYPO3_LOADED_EXT'][$_EXTKEY]['ext_icon'] . '" ' . 'width="16" height="16" ' . 'alt="' . $thisTitle . '" />';
540  }
541  }
542  if (empty($thisTitle)) {
543  $_EXTKEY = $nameParts[1];
544  $thisTitle = $nameParts[1];
545  $iconFile[$_EXTKEY] = '';
546  }
547  } else {
548  if ($table === 'pages_language_overlay' && !$this->checkIfLanguagesExist()) {
549  continue;
550  }
551  $_EXTKEY = 'system';
552  $thisTitle = $lang->getLL('system_records');
553  $iconFile['system'] = $this->moduleTemplate->getIconFactory()->getIcon('apps-pagetree-root', Icon::SIZE_SMALL)->render();
554  }
555  if ($groupName == '' || $groupName != $_EXTKEY) {
556  $groupName = empty($v['ctrl']['groupName']) ? $_EXTKEY : $v['ctrl']['groupName'];
557  }
558  $rowContent .= $newLink;
559  }
560  // Compile table row:
561  if ($table == 'tt_content') {
562  $startRows[] = '<li>' . $rowContent . '</li>';
563  } else {
564  $this->tRows[$groupName]['title'] = $thisTitle;
565  $this->tRows[$groupName]['html'][] = $rowContent;
566  $this->tRows[$groupName]['table'][] = $table;
567  }
568  }
569  }
570  }
571  }
572  // User sort
573  if (isset($pageTS['mod.']['wizards.']['newRecord.']['order'])) {
574  $this->newRecordSortList = GeneralUtility::trimExplode(',', $pageTS['mod.']['wizards.']['newRecord.']['order'], true);
575  }
576  uksort($this->tRows, array($this, 'sortNewRecordsByConfig'));
577  // Compile table row:
578  $finalRows = array();
579  $finalRows[] = implode('', $startRows);
580  foreach ($this->tRows as $key => $value) {
581  $row = '<li>' . $iconFile[$key] . ' <strong>' . $value['title'] . '</strong><ul>';
582  foreach ($value['html'] as $recordKey => $record) {
583  $row .= '<li>' . $record . ' ' . BackendUtility::wrapInHelp($value['table'][$recordKey], '') . '</li>';
584  }
585  $row .= '</ul></li>';
586  $finalRows[] = $row;
587  }
588 
589  $finalRows[] = '</ul>';
590  // Make table:
591  $this->code .= implode('', $finalRows);
592  }
593 
601  public function sortNewRecordsByConfig($a, $b)
602  {
603  if (!empty($this->newRecordSortList)) {
604  if (in_array($a, $this->newRecordSortList) && in_array($b, $this->newRecordSortList)) {
605  // Both are in the list, return relative to position in array
606  $sub = array_search($a, $this->newRecordSortList) - array_search($b, $this->newRecordSortList);
607  $ret = ($sub < 0 ? -1 : $sub == 0) ? 0 : 1;
608  } elseif (in_array($a, $this->newRecordSortList)) {
609  // First element is in array, put to top
610  $ret = -1;
611  } elseif (in_array($b, $this->newRecordSortList)) {
612  // Second element is in array, put first to bottom
613  $ret = 1;
614  } else {
615  // No element is in array, return alphabetic order
616  $ret = strnatcasecmp($this->tRows[$a]['title'], $this->tRows[$b]['title']);
617  }
618  return $ret;
619  } else {
620  // Return alphabetic order
621  return strnatcasecmp($this->tRows[$a]['title'], $this->tRows[$b]['title']);
622  }
623  }
624 
631  public function printContent()
632  {
634  echo $this->content;
635  }
636 
646  public function linkWrap($linkText, $table, $pid, $addContentTable = false)
647  {
648  $urlParameters = [
649  'edit' => [
650  $table => [
651  $pid => 'new'
652  ]
653  ],
654  'returnUrl' => $this->returnUrl
655  ];
656  if ($table == 'pages' && $addContentTable) {
657  $urlParameters['tt_content']['prev'] = 'new';
658  $urlParameters['returnNewPageId'] = 1;
659  } elseif ($table == 'pages_language_overlay') {
660  $urlParameters['overrideVals']['pages_language_overlay']['doktype'] = (int)$this->pageinfo['doktype'];
661  }
662  $url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
663  return '<a href="' . htmlspecialchars($url) . '">' . $linkText . '</a>';
664  }
665 
673  public function isTableAllowedForThisPage($pid_row, $checkTable)
674  {
675  if (!is_array($pid_row)) {
676  return $this->getBackendUserAuthentication()->isAdmin();
677  }
678  // be_users and be_groups may not be created anywhere but in the root.
679  if ($checkTable == 'be_users' || $checkTable == 'be_groups') {
680  return false;
681  }
682  // Checking doktype:
683  $doktype = (int)$pid_row['doktype'];
684  if (!($allowedTableList = $GLOBALS['PAGES_TYPES'][$doktype]['allowedTables'])) {
685  $allowedTableList = $GLOBALS['PAGES_TYPES']['default']['allowedTables'];
686  }
687  // If all tables or the table is listed as an allowed type, return TRUE
688  if (strstr($allowedTableList, '*') || GeneralUtility::inList($allowedTableList, $checkTable)) {
689  return true;
690  }
691 
692  return false;
693  }
694 
710  public function showNewRecLink($table, array $allowedNewTables = array(), array $deniedNewTables = array())
711  {
712  if (!$this->getBackendUserAuthentication()->check('tables_modify', $table)) {
713  return false;
714  }
715 
718  // No deny/allow tables are set:
719  if (empty($allowedNewTables) && empty($deniedNewTables)) {
720  return true;
721  }
722 
723  return !in_array($table, $deniedNewTables) && (empty($allowedNewTables) || in_array($table, $allowedNewTables));
724  }
725 
731  protected function checkIfLanguagesExist()
732  {
733  $languageCount = $this->getDatabaseConnection()->exec_SELECTcountRows('uid', 'sys_language', '1=1');
734  if ($languageCount) {
735  $languageCount = true;
736  }
737  return $languageCount;
738  }
739 
745  protected function getLanguageService()
746  {
747  return $GLOBALS['LANG'];
748  }
749 
755  protected function getBackendUserAuthentication()
756  {
757  return $GLOBALS['BE_USER'];
758  }
759 
765  protected function getDatabaseConnection()
766  {
767  return $GLOBALS['TYPO3_DB'];
768  }
769 }