本文整理汇总了PHP中t3lib_iconWorks::mapRecordTypeToSpriteIconName方法的典型用法代码示例。如果您正苦于以下问题:PHP t3lib_iconWorks::mapRecordTypeToSpriteIconName方法的具体用法?PHP t3lib_iconWorks::mapRecordTypeToSpriteIconName怎么用?PHP t3lib_iconWorks::mapRecordTypeToSpriteIconName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类t3lib_iconWorks
的用法示例。
在下文中一共展示了t3lib_iconWorks::mapRecordTypeToSpriteIconName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreignTable
/**
* Adds records from a foreign table (for selector boxes)
*
* @param array The array of items (label,value,icon)
* @param array The 'columns' array for the field (from TCA)
* @param array TSconfig for the table/row
* @param string The fieldname
* @param boolean If set, then we are fetching the 'neg_' foreign tables.
* @return array The $items array modified.
* @see addSelectOptionsToItemArray(), t3lib_BEfunc::exec_foreign_table_where_query()
*/
function foreignTable($items, $fieldValue, $TSconfig, $field, $pFFlag = 0)
{
global $TCA;
// Init:
$pF = $pFFlag ? 'neg_' : '';
$f_table = $fieldValue['config'][$pF . 'foreign_table'];
$uidPre = $pFFlag ? '-' : '';
// Get query:
$res = t3lib_BEfunc::exec_foreign_table_where_query($fieldValue, $field, $TSconfig, $pF);
// Perform lookup
if ($GLOBALS['TYPO3_DB']->sql_error()) {
echo $GLOBALS['TYPO3_DB']->sql_error() . "\n\nThis may indicate a table defined in tables.php is not existing in the database!";
return array();
}
// Get label prefix.
$lPrefix = $this->sL($fieldValue['config'][$pF . 'foreign_table_prefix']);
// Get icon field + path if any:
$iField = $TCA[$f_table]['ctrl']['selicon_field'];
$iPath = trim($TCA[$f_table]['ctrl']['selicon_field_path']);
// Traverse the selected rows to add them:
while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) {
t3lib_BEfunc::workspaceOL($f_table, $row);
if (is_array($row)) {
// Prepare the icon if available:
if ($iField && $iPath && $row[$iField]) {
$iParts = t3lib_div::trimExplode(',', $row[$iField], 1);
$icon = '../' . $iPath . '/' . trim($iParts[0]);
} elseif (t3lib_div::inList('singlebox,checkbox', $fieldValue['config']['renderMode'])) {
$icon = t3lib_iconWorks::mapRecordTypeToSpriteIconName($f_table, $row);
} else {
$icon = 'empty-empty';
}
// Add the item:
$items[] = array($lPrefix . htmlspecialchars(t3lib_BEfunc::getRecordTitle($f_table, $row)), $uidPre . $row['uid'], $icon);
}
}
return $items;
}
示例2: getLangSpriteIcon
/**
* returns the sprite icon for the given sys language record.
*
* @param array|int $recordOrUid
* @return Ambigous <string, multitype:>
*/
public static function getLangSpriteIcon($recordOrUid, $options = NULL)
{
tx_rnbase::load('tx_rnbase_model_data');
$options = tx_rnbase_model_data::getInstance($options);
if (!is_array($recordOrUid)) {
$langUid = (int) $recordOrUid;
$record = self::getLangRecord($recordOrUid);
} else {
$langUid = (int) $recordOrUid['uid'];
$record = $recordOrUid;
}
$spriteIconName = 'flags-multiple';
if (!empty($record)) {
$spriteIconName = t3lib_iconWorks::mapRecordTypeToSpriteIconName('sys_language', $record);
}
$out = tx_rnbase_mod_Util::getSpriteIcon($spriteIconName);
// add title per default (typo3 equivalent)!
if ($options->getShowTitle() !== FALSE) {
$langTitle = 'N/A';
if ($langUid === -1) {
$langTitle = 'LLL:EXT:lang/locallang_general.xml:LGL.allLanguages';
} elseif ($langUid === 0) {
$langTitle = 'LLL:EXT:lang/locallang_general.xml:LGL.default_value';
} elseif (!empty($record['title'])) {
$langTitle = $record['title'];
}
$out .= ' ' . htmlspecialchars($GLOBALS['LANG']->sL($langTitle));
}
return $out;
}
示例3: getSystemLanguages
/**
* Returns array of system languages
*
* Since TYPO3 4.5 the flagIcon is not returned as a filename in "gfx/flags/*" anymore,
* but as a string <flags-xx>. The calling party should call
* t3lib_iconWorks::getSpriteIcon(<flags-xx>) to get an HTML which will represent
* the flag of this language.
*
* @param integer page id (only used to get TSconfig configuration setting flag and label for default language)
* @param string Backpath for flags
* @return array Array with languages (title, uid, flagIcon)
*/
function getSystemLanguages($page_id = 0, $backPath = '')
{
global $TCA, $LANG;
$modSharedTSconfig = t3lib_BEfunc::getModTSconfig($page_id, 'mod.SHARED');
$languageIconTitles = array();
// fallback "old iconstyles"
if (preg_match('/\\.gif$/', $modSharedTSconfig['properties']['defaultLanguageFlag'])) {
$modSharedTSconfig['properties']['defaultLanguageFlag'] = str_replace('.gif', '', $modSharedTSconfig['properties']['defaultLanguageFlag']);
}
$languageIconTitles[0] = array('uid' => 0, 'title' => strlen($modSharedTSconfig['properties']['defaultLanguageLabel']) ? $modSharedTSconfig['properties']['defaultLanguageLabel'] . ' (' . $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage') . ')' : $GLOBALS['LANG']->sl('LLL:EXT:lang/locallang_mod_web_list.xml:defaultLanguage'), 'ISOcode' => 'DEF', 'flagIcon' => strlen($modSharedTSconfig['properties']['defaultLanguageFlag']) ? 'flags-' . $modSharedTSconfig['properties']['defaultLanguageFlag'] : 'empty-empty');
// Set "All" language:
$languageIconTitles[-1] = array('uid' => -1, 'title' => $LANG->getLL('multipleLanguages'), 'ISOcode' => 'DEF', 'flagIcon' => 'flags-multiple');
// Find all system languages:
$sys_languages = $GLOBALS['TYPO3_DB']->exec_SELECTgetRows('*', 'sys_language', '');
foreach ($sys_languages as $row) {
$languageIconTitles[$row['uid']] = $row;
if ($row['static_lang_isocode'] && t3lib_extMgm::isLoaded('static_info_tables')) {
$staticLangRow = t3lib_BEfunc::getRecord('static_languages', $row['static_lang_isocode'], 'lg_iso_2');
if ($staticLangRow['lg_iso_2']) {
$languageIconTitles[$row['uid']]['ISOcode'] = $staticLangRow['lg_iso_2'];
}
}
if (strlen($row['flag'])) {
$languageIconTitles[$row['uid']]['flagIcon'] = t3lib_iconWorks::mapRecordTypeToSpriteIconName('sys_language', $row);
}
}
return $languageIconTitles;
}