/** * Returns a "create new record" image tag that is linked to the new record view. * * @param int $pid the page ID where the record should be stored, must be > 0 * * @return string the HTML source code to return */ public function getNewIcon($pid) { global $BACK_PATH, $LANG, $BE_USER; $result = ''; $newRecordPid = $this->getNewRecordPid(); $pid = $newRecordPid > 0 ? $newRecordPid : $pid; $pageData = $this->page->getPageData(); if ($BE_USER->check('tables_modify', $this->tableName) && $this->doesUserHaveAccess($pid) && $pageData['doktype'] == self::SYSFOLDER_TYPE) { $params = '&edit[' . $this->tableName . ']['; if ($pageData['uid'] == $pid) { $params .= $pageData['uid']; $storageLabel = sprintf($LANG->getLL('label_create_record_in_current_folder'), $pageData['title'], $pageData['uid']); } else { $storagePageData = t3lib_befunc::readPageAccess($pid, ''); $params .= $pid; $storageLabel = sprintf($LANG->getLL('label_create_record_in_foreign_folder'), $storagePageData['title'], $pid); } $params .= ']=new'; $editOnClick = $this->editNewUrl($params, $BACK_PATH); $langNew = $LANG->getLL('newRecordGeneral'); $result = TAB . TAB . '<div id="typo3-newRecordLink">' . LF . TAB . TAB . TAB . '<a href="' . htmlspecialchars($editOnClick) . '">' . LF . TAB . TAB . TAB . TAB . '<img' . t3lib_iconWorks::skinImg($BACK_PATH, 'gfx/new_record.gif', 'width="7" height="4"') . ' title="' . $langNew . '" alt="" />' . LF . TAB . TAB . TAB . TAB . $langNew . LF . TAB . TAB . TAB . '</a>' . LF . TAB . TAB . '</div>' . LF; /** @var t3lib_FlashMessage $message */ $message = t3lib_div::makeInstance('t3lib_FlashMessage', $storageLabel, '', t3lib_FlashMessage::INFO); $this->addFlashMessage($message); if (class_exists('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService', TRUE)) { /** @var \TYPO3\CMS\Core\Messaging\FlashMessageService $flashMessageService */ $flashMessageService = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Core\\Messaging\\FlashMessageService'); /** @var \TYPO3\CMS\Core\Messaging\FlashMessageQueue $defaultFlashMessageQueue */ $defaultFlashMessageQueue = $flashMessageService->getMessageQueueByIdentifier(); $renderedFlashMessages = $defaultFlashMessageQueue->renderFlashMessages(); } else { $renderedFlashMessages = t3lib_FlashMessageQueue::renderFlashMessages(); } $result .= '<div id="eventsList-clear"></div>' . $renderedFlashMessages; } return $result; }