本文整理汇总了PHP中TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause方法的典型用法代码示例。如果您正苦于以下问题:PHP BackendUtility::versioningPlaceholderClause方法的具体用法?PHP BackendUtility::versioningPlaceholderClause怎么用?PHP BackendUtility::versioningPlaceholderClause使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TYPO3\CMS\Backend\Utility\BackendUtility
的用法示例。
在下文中一共展示了BackendUtility::versioningPlaceholderClause方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addData
/**
* Fetch available page overlay records of page
*
* @param array $result
* @return array
*/
public function addData(array $result)
{
if ($result['effectivePid'] === 0) {
// No overlays for records on pid 0 and not for new pages below root
return $result;
}
$database = $this->getDatabase();
$dbRows = $database->exec_SELECTgetRows('*', 'pages_language_overlay', 'pid=' . (int) $result['effectivePid'] . BackendUtility::deleteClause('pages_language_overlay') . BackendUtility::versioningPlaceholderClause('pages_language_overlay'));
if ($dbRows === null) {
throw new \UnexpectedValueException('Database query error ' . $database->sql_error(), 1440777705);
}
$result['pageLanguageOverlayRows'] = $dbRows;
return $result;
}
示例2: getReferenceObjects
/**
* Try to retrieve all reference objects
*
* @param integer $uid
* @param string $table
* @param string $field
* @return array<\TYPO3\CMS\Core\Resource\FileReference>
*/
public static function getReferenceObjects($uid, $table, $field)
{
$fileReferenceObjects = array();
/** @var \TYPO3\CMS\Core\Database\DatabaseConnection $database */
$database =& $GLOBALS['TYPO3_DB'];
$references = $database->exec_SELECTgetRows('uid', 'sys_file_reference', 'tablenames = ' . $database->fullQuoteStr($table, 'sys_file_reference') . ' AND fieldname=' . $database->fullQuoteStr($field, 'sys_file_reference') . ' AND uid_foreign=' . intval($uid) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('sys_file_reference') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('sys_file_reference'));
if (!empty($references)) {
foreach ($references as $reference) {
$referenceUid = (int) $reference['uid'];
if ($referenceUid > 0) {
try {
$referenceObject = \TYPO3\CMS\Core\Resource\ResourceFactory::getInstance()->getFileReferenceObject($referenceUid);
if ($referenceObject instanceof \TYPO3\CMS\Core\Resource\FileReference) {
$fileReferenceObjects[] = $referenceObject;
}
} catch (\Exception $e) {
}
}
}
}
return $fileReferenceObjects;
}
示例3: makeQuerySearchByTable
/**
* Build the MySql where clause by table.
*
* @param string $tableName Record table name
* @param array $fieldsToSearchWithin User right based visible fields where we can search within.
* @return string
*/
protected function makeQuerySearchByTable($tableName, array $fieldsToSearchWithin)
{
$queryPart = '';
$whereParts = array();
// Load the full TCA for the table, as we need to access column configuration
\TYPO3\CMS\Core\Utility\GeneralUtility::loadTCA($tableName);
// If the search string is a simple integer, assemble an equality comparison
if (\TYPO3\CMS\Core\Utility\MathUtility::canBeInterpretedAsInteger($this->queryString)) {
foreach ($fieldsToSearchWithin as $fieldName) {
if ($fieldName == 'uid' || $fieldName == 'pid' || isset($GLOBALS['TCA'][$tableName]['columns'][$fieldName])) {
$fieldConfig =& $GLOBALS['TCA'][$tableName]['columns'][$fieldName]['config'];
// Assemble the search condition only if the field is an integer, or is uid or pid
if ($fieldName == 'uid' || $fieldName == 'pid' || $fieldConfig['type'] == 'input' && $fieldConfig['eval'] && \TYPO3\CMS\Core\Utility\GeneralUtility::inList($fieldConfig['eval'], 'int')) {
$whereParts[] = $fieldName . '=' . $this->queryString;
}
}
}
} else {
$like = '\'%' . $GLOBALS['TYPO3_DB']->escapeStrForLike($GLOBALS['TYPO3_DB']->quoteStr($this->queryString, $tableName), $tableName) . '%\'';
foreach ($fieldsToSearchWithin as $fieldName) {
if (isset($GLOBALS['TCA'][$tableName]['columns'][$fieldName])) {
$fieldConfig =& $GLOBALS['TCA'][$tableName]['columns'][$fieldName]['config'];
// Check whether search should be case-sensitive or not
$format = 'LCASE(%s) LIKE LCASE(%s)';
if (is_array($fieldConfig['search'])) {
if (in_array('case', $fieldConfig['search'])) {
$format = '%s LIKE %s';
}
// Apply additional condition, if any
if ($fieldConfig['search']['andWhere']) {
$format = '((' . $fieldConfig['search']['andWhere'] . ') AND (' . $format . '))';
}
}
// Assemble the search condition only if the field makes sense to be searched
if ($fieldConfig['type'] == 'text' || $fieldConfig['type'] == 'flex' || $fieldConfig['type'] == 'input' && (!$fieldConfig['eval'] || !preg_match('/date|time|int/', $fieldConfig['eval']))) {
$whereParts[] = sprintf($format, $fieldName, $like);
}
}
}
}
// If at least one condition was defined, create the search query
if (count($whereParts) > 0) {
$queryPart = ' AND (' . implode(' OR ', $whereParts) . ')';
// And the relevant conditions for deleted and versioned records
$queryPart .= \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($tableName);
$queryPart .= \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause($tableName);
} else {
$queryPart = ' AND 0 = 1';
}
return $queryPart;
}
示例4: makeQueryArray
/**
* Returns the SQL-query array to select the records
* from a table $table with pid = $id
*
* @param string $table Table name
* @param int $id Page id (NOT USED! $this->pidSelect is used instead)
* @param string $addWhere Additional part for where clause
* @param string $fieldList Field list to select,
* for all (for "SELECT [fieldlist] FROM ...")
*
* @return array Returns query array
*/
public function makeQueryArray($table, $id, $addWhere = '', $fieldList = '*')
{
$database = $this->getDatabaseConnection();
$hookObjectsArr = array();
if (is_array($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list.inc']['makeQueryArray'])) {
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['typo3/class.db_list.inc']['makeQueryArray'] as $classRef) {
$hookObjectsArr[] = GeneralUtility::getUserObj($classRef);
}
}
// Set ORDER BY:
$orderBy = $GLOBALS['TCA'][$table]['ctrl']['sortby'] ? 'ORDER BY ' . $table . '.' . $GLOBALS['TCA'][$table]['ctrl']['sortby'] : $GLOBALS['TCA'][$table]['ctrl']['default_sortby'];
if ($this->sortField) {
if (in_array($this->sortField, $this->makeFieldList($table, 1))) {
$orderBy = 'ORDER BY ' . $table . '.' . $this->sortField;
if ($this->sortRev) {
$orderBy .= ' DESC';
}
}
}
// Set LIMIT:
$limit = '';
if ($this->iLimit) {
$limit = ($this->firstElementNumber ? $this->firstElementNumber . ',' : '') . ($this->iLimit + 1);
}
// Filtering on displayable tx_commerce_categories (permissions):
$pC = $table == 'tx_commerce_categories' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
$categoryWhere = sprintf($this->addWhere[$table], $this->parentUid);
// Adding search constraints:
$search = $this->makeSearchString($table);
// Compiling query array:
$queryParts = array('SELECT' => $fieldList, 'FROM' => $table . $this->joinTables[$table], 'WHERE' => $this->pidSelect . ' ' . $pC . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table) . ' ' . $addWhere . $categoryWhere . ' ' . $search, 'GROUPBY' => '', 'ORDERBY' => $database->stripOrderBy($orderBy), 'LIMIT' => $limit);
// Apply hook as requested in http://bugs.typo3.org/view.php?id=4361
foreach ($hookObjectsArr as $hookObj) {
if (method_exists($hookObj, 'makeQueryArray_post')) {
$parameter = array('orderBy' => $orderBy, 'limit' => $limit, 'pC' => $pC, 'search' => $search);
$hookObj->makeQueryArray_post($queryParts, $this, $table, $id, $addWhere, $fieldList, $parameter);
}
}
// Return query:
return $queryParts;
}
示例5: getOverviewOfPagesUsingTSConfig
/**
* Renders table rows of all pages containing TSConfig together with its rootline
*
* @return array
*/
protected function getOverviewOfPagesUsingTSConfig()
{
$db = $this->getDatabaseConnection();
$res = $db->exec_SELECTquery('uid, TSconfig', 'pages', 'TSconfig != \'\'' . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages'), 'pages.uid');
$pageArray = array();
while ($row = $db->sql_fetch_assoc($res)) {
$this->setInPageArray($pageArray, BackendUtility::BEgetRootLine($row['uid'], 'AND 1=1'), $row);
}
return $this->getList($pageArray);
}
示例6: main
/**
* Main
*
* @return void
* @todo Define visibility
*/
public function main()
{
// Template markers
$markers = array('CSH' => '', 'FUNC_MENU' => '', 'CONTENT' => '');
// Access check...
// The page will show only if there is a valid page and if this page may be viewed by the user
$this->pageinfo = BackendUtility::readPageAccess($this->id, $this->perms_clause);
$this->access = is_array($this->pageinfo) ? 1 : 0;
$this->doc = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Template\\DocumentTemplate');
$this->doc->backPath = $GLOBALS['BACK_PATH'];
$this->doc->setModuleTemplate('EXT:tstemplate/Resources/Private/Templates/tstemplate.html');
if ($this->id && $this->access) {
$urlParameters = array('id' => $this->id, 'template' => 'all');
$aHref = BackendUtility::getModuleUrl('web_ts', $urlParameters);
$this->doc->form = '<form action="' . htmlspecialchars($aHref) . '" method="post" enctype="' . $GLOBALS['TYPO3_CONF_VARS']['SYS']['form_enctype'] . '" name="editForm">';
// JavaScript
$this->doc->JScode = '
<script language="javascript" type="text/javascript">
function uFormUrl(aname) {
document.forms[0].action = ' . GeneralUtility::quoteJSvalue($aHref . '#', TRUE) . '+aname;
}
function brPoint(lnumber,t) {
window.location.href = ' . GeneralUtility::quoteJSvalue($aHref . '&SET[function]=TYPO3\\CMS\\Tstemplate\\Controller\\TypoScriptTemplateObjectBrowserModuleFunctionController&SET[ts_browser_type]=', TRUE) . '+(t?"setup":"const")+"&breakPointLN="+lnumber;
return false;
}
</script>
';
$this->doc->postCode = '
<script language="javascript" type="text/javascript">
if (top.fsMod) top.fsMod.recentIds["web"] = ' . $this->id . ';
</script>
';
$this->doc->inDocStylesArray[] = '
TABLE#typo3-objectBrowser { width: 100%; margin-bottom: 24px; }
TABLE#typo3-objectBrowser A { text-decoration: none; }
TABLE#typo3-objectBrowser .comment { color: maroon; font-weight: bold; }
.ts-typoscript { width: 100%; }
.tsob-menu label, .tsob-menu-row2 label, .tsob-conditions label { padding: 0 5px 0 0; vertical-align: text-top;}
.tsob-menu-row2 {margin-top: 10px;}
.tsob-conditions {padding: 1px 2px;}
.tsob-search-submit {margin-left: 3px; margin-right: 3px;}
.tst-analyzer-options { margin:5px 0; }
.tst-analyzer-options label {padding-left:5px; vertical-align:text-top; }
';
// Setting up the context sensitive menu:
$this->doc->getContextMenuCode();
// Build the modulle content
$this->content = $this->doc->header($GLOBALS['LANG']->getLL('moduleTitle'));
$this->extObjContent();
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['FUNC_MENU'] = BackendUtility::getFuncMenu($this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function']);
$markers['CONTENT'] = $this->content;
} else {
// Template pages:
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('pages.uid, count(*) AS count, max(sys_template.root) AS root_max_val, min(sys_template.root) AS root_min_val', 'pages,sys_template', 'pages.uid=sys_template.pid' . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages') . BackendUtility::deleteClause('sys_template') . BackendUtility::versioningPlaceholderClause('sys_template'), 'pages.uid');
$templateArray = array();
$pArray = array();
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
$this->setInPageArray($pArray, BackendUtility::BEgetRootLine($row['uid'], 'AND 1=1'), $row);
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
$table = '<table class="t3-table" id="ts-overview">' . '<thead>' . '<tr>' . '<th>' . $GLOBALS['LANG']->getLL('pageName') . '</th>' . '<th>' . $GLOBALS['LANG']->getLL('templates') . '</th>' . '<th>' . $GLOBALS['LANG']->getLL('isRoot') . '</th>' . '<th>' . $GLOBALS['LANG']->getLL('isExt') . '</th>' . '</tr>' . '</thead>' . '<tbody>' . implode('', $this->renderList($pArray)) . '</tbody>' . '</table>';
$this->content = $this->doc->header($GLOBALS['LANG']->getLL('moduleTitle'));
$this->content .= $this->doc->section('', '<p class="lead">' . $GLOBALS['LANG']->getLL('overview') . '</p>' . $table);
// RENDER LIST of pages with templates, END
// Setting up the buttons and markers for docheader
$docHeaderButtons = $this->getButtons();
$markers['CONTENT'] = $this->content;
}
// Build the <body> for the module
$this->content = $this->doc->moduleBody($this->pageinfo, $docHeaderButtons, $markers);
// Renders the module page
$this->content = $this->doc->render('Template Tools', $this->content);
}
示例7: printContentElementColumns
/**
* Creates HTML for inserting/moving content elements.
*
* @param int $pid page id onto which to insert content element.
* @param int $moveUid Move-uid (tt_content element uid?)
* @param string $colPosList List of columns to show
* @param bool $showHidden If not set, then hidden/starttime/endtime records are filtered out.
* @param string $R_URI Request URI
* @return string HTML
*/
public function printContentElementColumns($pid, $moveUid, $colPosList, $showHidden, $R_URI)
{
$this->R_URI = $R_URI;
$this->moveUid = $moveUid;
$colPosArray = GeneralUtility::trimExplode(',', $colPosList, TRUE);
$lines = array();
foreach ($colPosArray as $kk => $vv) {
$res = $GLOBALS['TYPO3_DB']->exec_SELECTquery('*', 'tt_content', 'pid=' . (int) $pid . ($showHidden ? '' : BackendUtility::BEenableFields('tt_content')) . ' AND colPos=' . (int) $vv . ((string) $this->cur_sys_language !== '' ? ' AND sys_language_uid=' . (int) $this->cur_sys_language : '') . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'), '', 'sorting');
$lines[$vv] = array();
$lines[$vv][] = $this->insertPositionIcon('', $vv, $kk, $moveUid, $pid);
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
BackendUtility::workspaceOL('tt_content', $row);
if (is_array($row)) {
$lines[$vv][] = $this->wrapRecordHeader($this->getRecordHeader($row), $row);
$lines[$vv][] = $this->insertPositionIcon($row, $vv, $kk, $moveUid, $pid);
}
}
$GLOBALS['TYPO3_DB']->sql_free_result($res);
}
return $this->printRecordMap($lines, $colPosArray, $pid);
}
示例8: getContentElementCount
/**
* Counting content elements for a single language on a page.
*
* @param integer $pageId Page id to select for.
* @param integer $sysLang Sys language uid
* @return integer Number of content elements from the PID where the language is set to a certain value.
* @todo Define visibility
*/
public function getContentElementCount($pageId, $sysLang)
{
$count = $GLOBALS['TYPO3_DB']->exec_SELECTcountRows('uid', 'tt_content', 'pid=' . (int) $pageId . ' AND sys_language_uid=' . (int) $sysLang . BackendUtility::deleteClause('tt_content') . BackendUtility::versioningPlaceholderClause('tt_content'));
return $count ?: '-';
}
示例9: exec_languageQuery
/**
* Returns a SQL query for selecting sys_language records.
*
* @param integer $id Page id: If zero, the query will select all sys_language records from root level which are NOT hidden. If set to another value, the query will select all sys_language records that has a pages_language_overlay record on that page (and is not hidden, unless you are admin user)
* @return string Return query string.
* @todo Define visibility
*/
public function exec_languageQuery($id)
{
if ($id) {
$exQ = \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('pages_language_overlay') . ($GLOBALS['BE_USER']->isAdmin() ? '' : ' AND sys_language.hidden=0');
return $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.*', 'pages_language_overlay,sys_language', 'pages_language_overlay.sys_language_uid=sys_language.uid AND pages_language_overlay.pid=' . intval($id) . $exQ . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('pages_language_overlay'), 'pages_language_overlay.sys_language_uid,sys_language.uid,sys_language.pid,sys_language.tstamp,sys_language.hidden,sys_language.title,sys_language.static_lang_isocode,sys_language.flag', 'sys_language.title');
} else {
return $GLOBALS['TYPO3_DB']->exec_SELECTquery('sys_language.*', 'sys_language', 'sys_language.hidden=0', '', 'sys_language.title');
}
}
示例10: getWhereClause
/**
* Returns the where clause for fetching pages
*
* @param integer $id
* @param string $searchFilter
* @return string
*/
protected function getWhereClause($id, $searchFilter = '')
{
$where = $GLOBALS['BE_USER']->getPagePermsClause(1) . BackendUtility::deleteClause('pages') . BackendUtility::versioningPlaceholderClause('pages');
if (is_numeric($id) && $id >= 0) {
$where .= ' AND pid= ' . $GLOBALS['TYPO3_DB']->fullQuoteStr((int) $id, 'pages');
}
$excludedDoktypes = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.excludeDoktypes');
if (!empty($excludedDoktypes)) {
$excludedDoktypes = $GLOBALS['TYPO3_DB']->fullQuoteArray(GeneralUtility::intExplode(',', $excludedDoktypes), 'pages');
$where .= ' AND doktype NOT IN (' . implode(',', $excludedDoktypes) . ')';
}
if ($searchFilter !== '') {
if (is_numeric($searchFilter) && $searchFilter > 0) {
$searchWhere .= 'uid = ' . (int) $searchFilter . ' OR ';
}
$searchFilter = $GLOBALS['TYPO3_DB']->fullQuoteStr('%' . $searchFilter . '%', 'pages');
$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle');
$useAlias = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.searchInAlias');
$searchWhereAlias = '';
if ($useAlias) {
$searchWhereAlias = ' OR alias LIKE ' . $searchFilter;
}
if ($useNavTitle) {
$searchWhere .= '(nav_title LIKE ' . $searchFilter . ' OR (nav_title = "" AND title LIKE ' . $searchFilter . ')' . $searchWhereAlias . ')';
} else {
$searchWhere .= 'title LIKE ' . $searchFilter . $searchWhereAlias;
}
$where .= ' AND (' . $searchWhere . ')';
}
return $where;
}
示例11: localizationRedirect
/**
* Redirects to TCEforms (alt_doc) if a record is just localized.
*
* @param string $justLocalized String with table, orig uid and language separated by ":
* @return void
* @todo Define visibility
*/
public function localizationRedirect($justLocalized)
{
list($table, $orig_uid, $language) = explode(':', $justLocalized);
if ($GLOBALS['TCA'][$table] && $GLOBALS['TCA'][$table]['ctrl']['languageField'] && $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']) {
$localizedRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('uid', $table, $GLOBALS['TCA'][$table]['ctrl']['languageField'] . '=' . intval($language) . ' AND ' . $GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField'] . '=' . intval($orig_uid) . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($table) . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause($table));
if (is_array($localizedRecord)) {
// Create parameters and finally run the classic page module for creating a new page translation
$url = substr($this->listURL(), strlen($this->backPath));
$params = '&edit[' . $table . '][' . $localizedRecord['uid'] . ']=edit';
$returnUrl = '&returnUrl=' . rawurlencode($url);
$location = $GLOBALS['BACK_PATH'] . 'alt_doc.php?' . $params . $returnUrl;
\TYPO3\CMS\Core\Utility\HttpUtility::redirect($location);
}
}
}
示例12: getShortcutIcon
/**
* Gets the icon for the shortcut
*
* @param array $row
* @param array $shortcut
* @return string Shortcut icon as img tag
*/
protected function getShortcutIcon($row, $shortcut)
{
$databaseConnection = $this->getDatabaseConnection();
$languageService = $this->getLanguageService();
$titleAttribute = htmlspecialchars($languageService->sL('LLL:EXT:lang/locallang_core.xlf:toolbarItems.shortcut'));
switch ($row['module_name']) {
case 'xMOD_alt_doc.php':
$table = $shortcut['table'];
$recordid = $shortcut['recordid'];
$icon = '';
if ($shortcut['type'] == 'edit') {
// Creating the list of fields to include in the SQL query:
$selectFields = $this->fieldArray;
$selectFields[] = 'uid';
$selectFields[] = 'pid';
if ($table == 'pages') {
$selectFields[] = 'module';
$selectFields[] = 'extendToSubpages';
$selectFields[] = 'doktype';
}
if (is_array($GLOBALS['TCA'][$table]['ctrl']['enablecolumns'])) {
$selectFields = array_merge($selectFields, $GLOBALS['TCA'][$table]['ctrl']['enablecolumns']);
}
if ($GLOBALS['TCA'][$table]['ctrl']['type']) {
$selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['type'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['typeicon_column']) {
$selectFields[] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
}
if ($GLOBALS['TCA'][$table]['ctrl']['versioningWS']) {
$selectFields[] = 't3ver_state';
}
// Unique list!
$selectFields = array_unique($selectFields);
$permissionClause = $table === 'pages' && $this->perms_clause ? ' AND ' . $this->perms_clause : '';
$sqlQueryParts = array('SELECT' => implode(',', $selectFields), 'FROM' => $table, 'WHERE' => 'uid IN (' . $recordid . ') ' . $permissionClause . BackendUtility::deleteClause($table) . BackendUtility::versioningPlaceholderClause($table));
$result = $databaseConnection->exec_SELECT_queryArray($sqlQueryParts);
$row = $databaseConnection->sql_fetch_assoc($result);
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, (array) $row, Icon::SIZE_SMALL)->render() . '</span>';
} elseif ($shortcut['type'] == 'new') {
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIconForRecord($table, array(), Icon::SIZE_SMALL)->render() . '</span>';
}
break;
case 'file_edit':
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIcon('mimetypes-text-html', Icon::SIZE_SMALL)->render() . '</span>';
break;
case 'wizard_rte':
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIcon('mimetypes-word', Icon::SIZE_SMALL)->render() . '</span>';
break;
default:
$iconIdentifier = '';
$moduleName = $row['module_name'];
if (strpos($moduleName, '_') !== false) {
list($mainModule, $subModule) = explode('_', $moduleName, 2);
$iconIdentifier = $this->moduleLoader->modules[$mainModule]['sub'][$subModule]['iconIdentifier'];
} elseif (!empty($moduleName)) {
$iconIdentifier = $this->moduleLoader->modules[$moduleName]['iconIdentifier'];
}
if (!$iconIdentifier) {
$iconIdentifier = 'empty-empty';
}
$icon = '<span title="' . $titleAttribute . '">' . $this->iconFactory->getIcon($iconIdentifier, Icon::SIZE_SMALL)->render() . '</span>';
}
return $icon;
}
示例13: getConfigurationsForBranch
function getConfigurationsForBranch($rootid, $depth)
{
$configurationsForBranch = array();
$pageTSconfig = $this->getPageTSconfigForId($rootid);
if (is_array($pageTSconfig) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']) && is_array($pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'])) {
$sets = $pageTSconfig['tx_crawler.']['crawlerCfg.']['paramSets.'];
if (is_array($sets)) {
foreach ($sets as $key => $value) {
if (!is_array($value)) {
continue;
}
$configurationsForBranch[] = substr($key, -1) == '.' ? substr($key, 0, -1) : $key;
}
}
}
$pids = array();
$rootLine = \TYPO3\CMS\Backend\Utility\BackendUtility::BEgetRootLine($rootid);
foreach ($rootLine as $node) {
$pids[] = $node['uid'];
}
/* @var \TYPO3\CMS\Backend\Tree\View\PageTreeView */
$tree = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PageTreeView');
$perms_clause = $GLOBALS['BE_USER']->getPagePermsClause(1);
$tree->init('AND ' . $perms_clause);
$tree->getTree($rootid, $depth, '');
foreach ($tree->tree as $node) {
$pids[] = $node['row']['uid'];
}
$res = $this->db->exec_SELECTquery('*', 'tx_crawler_configuration', 'pid IN (' . implode(',', $pids) . ') ' . \TYPO3\CMS\Backend\Utility\BackendUtility::BEenableFields('tx_crawler_configuration') . \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause('tx_crawler_configuration') . ' ' . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause('tx_crawler_configuration') . ' ');
while ($row = $this->db->sql_fetch_assoc($res)) {
$configurationsForBranch[] = $row['name'];
}
$this->db->sql_free_result($res);
return $configurationsForBranch;
}
示例14: translationInfo
/**
* Information about translation for an element
* Will overlay workspace version of record too!
*
* @param string $table Table name
* @param int $uid Record uid
* @param int $languageUid Language uid. If 0, then all languages are selected.
* @param array $row The record to be translated
* @param string $selFieldList Select fields for the query which fetches the translations of the current record
* @return mixed Array with information or error message as a string.
*/
public function translationInfo($table, $uid, $languageUid = 0, array $row = null, $selFieldList = '')
{
if (!$GLOBALS['TCA'][$table] || !$uid) {
return 'No table "' . $table . '" or no UID value';
}
if ($row === null) {
$row = BackendUtility::getRecordWSOL($table, $uid);
}
if (!is_array($row)) {
return 'Record "' . $table . '_' . $uid . '" was not found';
}
$translationTable = $this->getTranslationTable($table);
if ($translationTable === '') {
return 'Translation is not supported for this table!';
}
if ($translationTable === $table && $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] > 0) {
return 'Record "' . $table . '_' . $uid . '" seems to be a translation already (has a language value "' . $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']] . '", relation to record "' . $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] . '")';
}
if ($translationTable === $table && $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] != 0) {
return 'Record "' . $table . '_' . $uid . '" seems to be a translation already (has a relation to record "' . $row[$GLOBALS['TCA'][$table]['ctrl']['transOrigPointerField']] . '")';
}
// Look for translations of this record, index by language field value:
if (!$selFieldList) {
$selFieldList = 'uid,' . $GLOBALS['TCA'][$translationTable]['ctrl']['languageField'];
}
$where = $GLOBALS['TCA'][$translationTable]['ctrl']['transOrigPointerField'] . '=' . (int) $uid . ' AND pid=' . (int) ($table === 'pages' ? $row['uid'] : $row['pid']) . ' AND ' . $GLOBALS['TCA'][$translationTable]['ctrl']['languageField'] . (!$languageUid ? '>0' : '=' . (int) $languageUid) . BackendUtility::deleteClause($translationTable) . BackendUtility::versioningPlaceholderClause($translationTable);
$translationRecords = $this->getDatabaseConnection()->exec_SELECTgetRows($selFieldList, $translationTable, $where);
$translations = array();
$translationsErrors = array();
foreach ($translationRecords as $translationRecord) {
if (!isset($translations[$translationRecord[$GLOBALS['TCA'][$translationTable]['ctrl']['languageField']]])) {
$translations[$translationRecord[$GLOBALS['TCA'][$translationTable]['ctrl']['languageField']]] = $translationRecord;
} else {
$translationsErrors[$translationRecord[$GLOBALS['TCA'][$translationTable]['ctrl']['languageField']]][] = $translationRecord;
}
}
return array('table' => $table, 'uid' => $uid, 'CType' => $row['CType'], 'sys_language_uid' => $row[$GLOBALS['TCA'][$table]['ctrl']['languageField']], 'translation_table' => $translationTable, 'translations' => $translations, 'excessive_translations' => $translationsErrors);
}
示例15: getRecordsByField
/**
* Based on t3lib_Befunc::getRecordsByField
*
* @param string $theTable
* @param string $theField
* @param string $theValue
* @param string $whereClause
* @param string $groupBy
* @param string $orderBy
* @param string $limit
* @param bool $useDeleteClause
*
* @return array
*/
public function getRecordsByField($theTable, $theField, $theValue, $whereClause = '', $groupBy = '', $orderBy = '', $limit = '', $useDeleteClause = TRUE)
{
if (is_array($GLOBALS['TCA'][$theTable])) {
$database = $this->getDatabaseConnection();
$res = $database->exec_SELECTquery('*', $theTable, $theField . ' IN (' . $theValue . ')' . ($useDeleteClause ? \TYPO3\CMS\Backend\Utility\BackendUtility::deleteClause($theTable) . ' ' : '') . \TYPO3\CMS\Backend\Utility\BackendUtility::versioningPlaceholderClause($theTable) . ' ' . $whereClause, $groupBy, $orderBy, $limit);
$rows = array();
while ($row = $database->sql_fetch_assoc($res)) {
$rows[] = $row;
}
$database->sql_free_result($res);
if (count($rows)) {
return $rows;
}
}
return array();
}