/**
     * Renders the HTML code for a selectorbox for selecting a new translation language for the current
     * page (create a new "Alternative Page Header".
     *
     * @return	mixed		HTML code for the selectorbox or FALSE if no new translation can be created.
     * @access	protected
     */
    function sidebar_renderItem_renderNewTranslationSelectorbox()
    {
        global $LANG, $BE_USER;
        if (!$GLOBALS['BE_USER']->isPSet($this->pObj->calcPerms, 'pages', 'edit')) {
            return false;
        }
        $newLanguagesArr = $this->pObj->getAvailableLanguages(0, true, false);
        if (count($newLanguagesArr) < 1) {
            return FALSE;
        }
        $translatedLanguagesArr = $this->pObj->getAvailableLanguages($this->pObj->id);
        $optionsArr = array('<option value=""></option>');
        foreach ($newLanguagesArr as $language) {
            if ($BE_USER->checkLanguageAccess($language['uid']) && !isset($translatedLanguagesArr[$language['uid']])) {
                $flag = tx_templavoila_icons::getFlagIconFileForLanguage($language['flagIcon']);
                $style = isset($language['flagIcon']) ? 'background-image: url(' . $flag . '); background-repeat: no-repeat; padding-top: 0px; padding-left: 22px;' : '';
                $optionsArr[] = '<option style="' . $style . '" name="createNewPageTranslation" value="' . $language['uid'] . '">' . htmlspecialchars($language['title']) . '</option>';
            }
        }
        if (count($optionsArr) > 1) {
            $linkParam = $this->pObj->rootElementTable == 'pages' ? '&doktype=' . $this->pObj->rootElementRecord['doktype'] : '';
            $link = 'index.php?' . $this->pObj->link_getParameters() . '&createNewPageTranslation=\'+this.options[this.selectedIndex].value+\'&pid=' . $this->pObj->id . $linkParam;
            $output = '
				<tr class="bgColor4">
					<td width="20">
						' . t3lib_BEfunc::cshItem('_MOD_web_txtemplavoilaM1', 'createnewtranslation', $this->doc->backPath) . '
					</td><td width="200" style="vertical-align:middle;">
						' . $LANG->getLL('createnewtranslation', 1) . ':
					</td>
					<td style="vertical-align:middle;"><select onChange="document.location=\'' . htmlspecialchars($link) . '\'">' . implode('', $optionsArr) . '</select></td>
				</tr>
			';
        }
        return $output;
    }
Example #2
0
 /**
  * Renders localized elements of a record
  *
  * @param	array		$contentTreeArr: Part of the contentTreeArr for the element
  * @param	array		$entries: Entries accumulated in this array (passed by reference)
  * @param	integer		$indentLevel: Indentation level
  * @return	string		HTML
  * @access protected
  * @see 	render_framework_singleSheet()
  */
 function render_outline_localizations($contentTreeArr, &$entries, $indentLevel)
 {
     global $LANG, $BE_USER;
     if ($contentTreeArr['el']['table'] == 'tt_content' && $contentTreeArr['el']['sys_language_uid'] <= 0) {
         // Traverse the available languages of the page (not default and [All])
         foreach ($this->translatedLanguagesArr as $sys_language_uid => $sLInfo) {
             if ($sys_language_uid > 0 && $BE_USER->checkLanguageAccess($sys_language_uid)) {
                 switch ((string) $contentTreeArr['localizationInfo'][$sys_language_uid]['mode']) {
                     case 'exists':
                         // Get localized record:
                         $olrow = t3lib_BEfunc::getRecordWSOL('tt_content', $contentTreeArr['localizationInfo'][$sys_language_uid]['localization_uid']);
                         // Put together the records icon including content sensitive menu link wrapped around it:
                         $recordIcon_l10n = $this->getRecordStatHookValue('tt_content', $olrow['uid']) . t3lib_iconWorks::getSpriteIconForRecord('tt_content', $olrow);
                         if (!$this->translatorMode) {
                             $recordIcon_l10n = $this->doc->wrapClickMenuOnIcon($recordIcon_l10n, 'tt_content', $olrow['uid'], 1, '&amp;callingScriptId=' . rawurlencode($this->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter');
                         }
                         list($flagLink_begin, $flagLink_end) = explode('|*|', $this->link_edit('|*|', 'tt_content', $olrow['uid'], TRUE));
                         // Create entry for this element:
                         $entries[] = array('indentLevel' => $indentLevel, 'icon' => $recordIcon_l10n, 'title' => t3lib_BEfunc::getRecordTitle('tt_content', $olrow), 'table' => 'tt_content', 'uid' => $olrow['uid'], 'flag' => $flagLink_begin . tx_templavoila_icons::getFlagIconForLanguage($sLInfo['flagIcon'], array('title' => $sLInfo['title'], 'alt' => $sLInfo['title'])) . $flagLink_end, 'isNewVersion' => $olrow['_ORIG_uid'] ? TRUE : FALSE);
                         break;
                 }
             }
         }
     }
 }
    /**
     * Displays a list of local content elements on the page which were NOT used in the hierarchical structure of the page.
     *
     * @param	$pObj:		Reference to the parent object ($this)
     * @return	string		HTML output
     * @access	protected
     */
    function sidebar_renderNonUsedElements()
    {
        global $LANG, $TYPO3_DB, $BE_USER;
        $output = '';
        $elementRows = array();
        $usedUids = array_keys($this->pObj->global_tt_content_elementRegister);
        $usedUids[] = 0;
        $pid = $this->pObj->id;
        // If workspaces should evaluated non-used elements it must consider the id: For "element" and "branch" versions it should accept the incoming id, for "page" type versions it must be remapped (because content elements are then related to the id of the offline version)
        $res = $TYPO3_DB->exec_SELECTquery(t3lib_BEfunc::getCommonSelectFields('tt_content', '', array('uid', 'header', 'bodytext', 'sys_language_uid')), 'tt_content', 'pid=' . intval($pid) . ' ' . 'AND uid NOT IN (' . implode(',', $usedUids) . ') ' . 'AND ( t3ver_state NOT IN (1,3) OR (t3ver_wsid > 0 AND t3ver_wsid = ' . intval($GLOBALS['BE_USER']->workspace) . ') )' . t3lib_BEfunc::deleteClause('tt_content') . t3lib_BEfunc::versioningPlaceholderClause('tt_content'), '', 'uid');
        $this->deleteUids = array();
        // Used to collect all those tt_content uids with no references which can be deleted
        while (false !== ($row = $TYPO3_DB->sql_fetch_assoc($res))) {
            $elementPointerString = 'tt_content:' . $row['uid'];
            // Prepare the language icon:
            $languageLabel = htmlspecialchars($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['title']);
            if ($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon']) {
                $languageIcon = tx_templavoila_icons::getFlagIconForLanguage($this->pObj->allAvailableLanguages[$row['sys_language_uid']]['flagIcon'], array('title' => $languageLabel, 'alt' => $languageLabel));
            } else {
                $languageIcon = $languageLabel && $row['sys_language_uid'] ? '[' . $languageLabel . ']' : '';
            }
            // Prepare buttons:
            $cutButton = $this->element_getSelectButtons($elementPointerString, 'ref');
            $recordIcon = t3lib_iconWorks::getSpriteIconForRecord('tt_content', $row);
            $recordButton = $this->pObj->doc->wrapClickMenuOnIcon($recordIcon, 'tt_content', $row['uid'], 1, '&callingScriptId=' . rawurlencode($this->pObj->doc->scriptID), 'new,copy,cut,pasteinto,pasteafter,delete');
            if ($GLOBALS['BE_USER']->workspace) {
                $wsRow = t3lib_BEfunc::getRecordWSOL('tt_content', $row['uid']);
                $isDeletedInWorkspace = $wsRow['t3ver_state'] == 2;
            } else {
                $isDeletedInWorkspace = FALSE;
            }
            if (!$isDeletedInWorkspace) {
                $elementRows[] = '
					<tr id="' . $elementPointerString . '" class="tpm-nonused-element">
						<td class="tpm-nonused-controls">' . $cutButton . $languageIcon . '</td>
						<td class="tpm-nonused-ref">' . $this->renderReferenceCount($row['uid']) . '</td>
						<td class="tpm-nonused-preview">' . $recordButton . htmlspecialchars(t3lib_BEfunc::getRecordTitle('tt_content', $row)) . '</td>
					</tr>
				';
            }
        }
        if (count($elementRows)) {
            // Control for deleting all deleteable records:
            $deleteAll = '';
            if (count($this->deleteUids)) {
                $params = '';
                foreach ($this->deleteUids as $deleteUid) {
                    $params .= '&cmd[tt_content][' . $deleteUid . '][delete]=1';
                }
                $label = $LANG->getLL('rendernonusedelements_deleteall');
                $deleteAll = '<a href="#" onclick="' . htmlspecialchars('jumpToUrl(\'' . $this->doc->issueCommand($params, -1) . '\');') . '">' . t3lib_iconWorks::getSpriteIcon('actions-edit-delete', array('title' => htmlspecialchars($label))) . htmlspecialchars($label) . '</a>';
            }
            // Create table and header cell:
            $output = '
				<table class="tpm-nonused-elements lrPadding" border="0" cellpadding="0" cellspacing="1" width="100%">
					<tr class="bgColor4-20">
						<td colspan="3">' . $LANG->getLL('inititemno_elementsNotBeingUsed', '1') . ':</td>
					</tr>
					' . implode('', $elementRows) . '
					<tr class="bgColor4">
						<td colspan="3" class="tpm-nonused-deleteall">' . $deleteAll . '</td>
					</tr>
				</table>
			';
        }
        return $output;
    }