/** * * @param integer $uid */ public function __construct($uid) { $this->row = t3lib_beFunc::getRecordWSOL('tx_templavoila_tmplobj', $uid); $this->setLabel($this->row['title']); $this->setDescription($this->row['description']); $this->setIcon($this->row['previewicon']); $this->setFileref($this->row['fileref']); $this->setFilerefMtime($this->row['fileref_mtime']); $this->setFilerefMD5($this->row['fileref_md5']); $this->setSortbyField($GLOBALS['TCA']['tx_templavoila_tmplobj']['ctrl']['sortby']); $this->setParent($this->row['parent']); }
/** * * @param integer $uid */ public function __construct($uid) { // getting the DS for the DB and make sure the workspace-overlay is performed (done internally) if (TYPO3_MODE == 'FE') { $this->row = $GLOBALS['TSFE']->sys_page->checkRecord('tx_templavoila_datastructure', $uid); } else { $this->row = t3lib_beFunc::getRecordWSOL('tx_templavoila_datastructure', $uid); } $this->setLabel($this->row['title']); $this->setScope($this->row['scope']); // path relative to typo3 maindir $this->setIcon('../uploads/tx_templavoila/' . $this->row['previewicon']); $this->setSortbyField($GLOBALS['TCA']['tx_templavoila_datastructure']['ctrl']['sortby']); }
/** * Displays the edit page screen if the currently selected page is of the doktype "Mount Point" * * @param array $pageRecord: The current page record * @return mixed HTML output from this submodule or FALSE if this submodule doesn't feel responsible * @access protected */ function renderDoktype_7($pageRecord) { global $LANG, $BE_USER, $TYPO3_CONF_VARS; if (!$pageRecord['mount_pid_ol']) { return FALSE; } // Put together the records icon including content sensitive menu link wrapped around it: $recordIcon = t3lib_iconWorks::getSpriteIconForRecord('pages', $pageRecord); $recordIcon = $this->doc->wrapClickMenuOnIcon($recordIcon, 'pages', $this->id, 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID)); $iconEdit = t3lib_iconWorks::getSpriteIcon('actions-document-open', array('title' => htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage')))); $editButton = $this->pObj->link_edit($iconEdit, 'pages', $pageRecord['uid']); $mountSourcePageRecord = t3lib_beFunc::getRecordWSOL('pages', $pageRecord['mount_pid']); $mountSourceIcon = t3lib_iconWorks::getSpriteIconForRecord('pages', $mountSourcePageRecord); $mountSourceButton = $this->doc->wrapClickMenuOnIcon($mountSourceIcon, 'pages', $mountSourcePageRecord['uid'], 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete'); $mountSourceLink = '<br /><br /> <a href="index.php?id=' . $pageRecord['mount_pid'] . '">' . htmlspecialchars($LANG->getLL('jumptomountsourcepage')) . '</a> '; $flashMessage = t3lib_div::makeInstance('t3lib_FlashMessage', sprintf($LANG->getLL('cannotedit_doktypemountpoint'), $mountSourceButton . $mountSourcePageRecord['title']), '', t3lib_FlashMessage::INFO); $content = $flashMessage->render() . '<strong>' . $mountSourceLink . '</strong>'; return $content; }
/** * Finds the currently selected template object by climbing up the root line. * * @param array $row: A page record * @return mixed The template object record or FALSE if none was found * @access protected */ function getContentTree_fetchPageTemplateObject($row) { $templateObjectUid = $row['tx_templavoila_ds'] ? intval($row['tx_templavoila_to']) : 0; if (!$templateObjectUid) { $rootLine = t3lib_beFunc::BEgetRootLine($row['uid'], '', TRUE); foreach ($rootLine as $rootLineRecord) { $pageRecord = t3lib_beFunc::getRecord('pages', $rootLineRecord['uid']); if ($row['uid'] != $pageRecord['uid'] && $pageRecord['tx_templavoila_next_ds'] && $pageRecord['tx_templavoila_next_to']) { // If there is a next-level TO: $templateObjectUid = $pageRecord['tx_templavoila_next_to']; break; } elseif ($pageRecord['tx_templavoila_ds'] && $pageRecord['tx_templavoila_to']) { // Otherwise try the NORMAL TO: $templateObjectUid = $pageRecord['tx_templavoila_to']; break; } } } return t3lib_beFunc::getRecordWSOL('tx_templavoila_tmplobj', $templateObjectUid); }
/** * Returns the uid of the TemplaVoila page template for the given page uid * * @param $pageUid * @return int */ public function getTvPageTemplateUid($pageUid) { $pageRecord = $this->getPage($pageUid); $tvTemplateObjectUid = 0; if ($pageRecord['tx_templavoila_to'] != '' && $pageRecord['tx_templavoila_to'] != 0) { $tvTemplateObjectUid = $pageRecord['tx_templavoila_to']; } else { $rootLine = t3lib_beFunc::BEgetRootLine($pageRecord['uid'], '', TRUE); foreach ($rootLine as $rootLineRecord) { $myPageRecord = t3lib_beFunc::getRecordWSOL('pages', $rootLineRecord['uid']); if ($myPageRecord['tx_templavoila_next_to']) { $tvTemplateObjectUid = $myPageRecord['tx_templavoila_next_to']; break; } } } return $tvTemplateObjectUid; }
public function test_localizeElement_workspaces() { global $TYPO3_DB, $BE_USER; $BE_USER->setWorkspace(1); $this->fixture_createTestPage(); $this->fixture_createTestPageDSTO(); $this->fixture_createTestSysLanguage(); $this->fixture_createTestAlternativePageHeader($this->testPageUID, 'DE'); // Create new content elements: $elementUids = array(); for ($i = 0; $i < 3; $i++) { $row = $this->fixture_getContentElementRow_TEXT(); $row['bodytext'] = 'localize test element #' . $i; $destinationPointer = array('table' => 'pages', 'uid' => $this->testPageUID, 'sheet' => 'sDEF', 'sLang' => 'lDEF', 'field' => 'field_content', 'vLang' => 'vDEF', 'position' => $i); $elementUids[$i + 1] = $this->apiObj->insertElement($destinationPointer, $row); } // Copy second element and paste it after the third: $sourcePointer = array('table' => 'pages', 'uid' => $this->testPageUID, 'sheet' => 'sDEF', 'sLang' => 'lDEF', 'field' => 'field_content', 'vLang' => 'vDEF', 'position' => 2); $destinationPointer = array('table' => 'pages', 'uid' => $this->testPageUID, 'sheet' => 'sDEF', 'sLang' => 'lDEF', 'field' => 'field_content', 'vLang' => 'vDE', 'position' => 0); $result = $this->apiObj->localizeElement($sourcePointer, 'DE'); self::assertTrue($result !== FALSE, 'localizeElement()returned FALSE!'); // Check if the localized element has been referenced correctly: $localizedUid = intval($result); $testPageRecord = t3lib_beFunc::getRecordWSOL('pages', $this->testPageUID, 'uid,pid,tx_templavoila_flex,t3ver_swapmode'); $flexform = simplexml_load_string($testPageRecord['tx_templavoila_flex']); $xpathResArr = $flexform->xpath("//data/sheet[@index='sDEF']/language[@index='lDEF']/field[@index='field_content']/value[@index='vDE']"); self::assertEquals((string) $xpathResArr[0], (string) $localizedUid, 'The reference list is not as expected after localizing the second element to German!'); // Check if the record has been modified correctly: $localizedRecord = t3lib_beFunc::getRecordWSOL('tt_content', $localizedUid, '*'); $isOkay = $localizedRecord['l18n_parent'] == $elementUids[2] && $localizedRecord['sys_language_uid'] == $this->currentAlternativePageHeaderSysLanguageUid; self::assertTrue($isOkay, 'The localized record has not the expected content!'); }
/** * Displays the edit page screen if the currently selected page is of the doktype "Mount Point" * * @param array $pageRecord: The current page record * @return mixed HTML output from this submodule or FALSE if this submodule doesn't feel responsible * @access protected */ function renderDoktype_7($pageRecord) { global $LANG, $BE_USER, $TYPO3_CONF_VARS; if (!$pageRecord['mount_pid_ol']) { return FALSE; } // Put together the records icon including content sensitive menu link wrapped around it: $recordIcon = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/i/pages_mountpoint.gif', '') . ' style="text-align: center; vertical-align: middle;" width="18" height="16" border="0" title="' . htmlspecialchars('[pages]') . '" alt="" />'; $recordIcon = $this->doc->wrapClickMenuOnIcon($recordIcon, 'pages', $this->id, 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID)); $editButton = $this->pObj->link_edit('<img' . t3lib_iconWorks::skinImg($this->doc->backPath, 'gfx/edit2.gif', '') . ' title="' . htmlspecialchars($LANG->sL('LLL:EXT:lang/locallang_mod_web_list.xml:editPage')) . '" alt="" style="text-align: center; vertical-align: middle; border:0;" />', 'pages', $pageRecord['uid']); $mountSourcePageRecord = t3lib_beFunc::getRecordWSOL('pages', $pageRecord['mount_pid']); $mountSourceIcon = '<img' . t3lib_iconWorks::skinImg($this->doc->backPath, t3lib_iconWorks::getIcon('pages', $mountSourcePageRecord), '') . ' style="text-align: center; vertical-align: middle;" width="18" height="16" border="0" title="' . $mountSourcePageRecord['title'] . '" alt="" />'; $mountSourceButton = $this->doc->wrapClickMenuOnIcon($mountSourceIcon, 'pages', $mountSourcePageRecord['uid'], 1, '&callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete'); $mountSourceLink = '<br /><br /> <a href="index.php?id=' . $pageRecord['mount_pid'] . '">' . htmlspecialchars($LANG->getLL('jumptomountsourcepage')) . '</a> '; $content = $this->doc->icons(1) . htmlspecialchars(sprintf($LANG->getLL('cannotedit_doktypemountpoint'), $mountSourcePageRecord['title'])) . $mountSourceButton . '<strong>' . $mountSourceLink . '</strong> '; return $content; }