Feature #22931 » class.t3lib_iconworks.php.0014785-v2.diff
t3lib/class.t3lib_iconworks.php (working copy) | ||
---|---|---|
($shaded ? 's' : '');
|
||
}
|
||
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['getIcon'])) {
|
||
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['getIcon'] as $classRef) {
|
||
$hookObject = t3lib_div::getUserObj($classRef);
|
||
if (method_exists($hookObject, 'getIconHook')) {
|
||
$flags = $hookObject->getIconHook($table, $row, $flags);
|
||
}
|
||
}
|
||
}
|
||
// Create tagged icon file name:
|
||
$iconFileName_stateTagged = preg_replace('/.([[:alnum:]]+)$/', '__'.$flags.'.\1', basename($iconfile));
|
||
... | ... | |
* @access private
|
||
**/
|
||
protected static function mapRecordTypeToSpriteIconClass($table, $row) {
|
||
$iconName = '';
|
||
$recordType = array();
|
||
if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_column'])) {
|
||
$column = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
|
||
if (isset($row[$column])) {
|
||
$recordType[1] = $row[$column];
|
||
} else {
|
||
$recordType[1] = 'default';
|
||
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['mapRecordTypeToSpriteIconClass'])) {
|
||
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['mapRecordTypeToSpriteIconClass'] as $classRef) {
|
||
$hookObject = t3lib_div::getUserObj($classRef);
|
||
if (method_exists($hookObject, 'mapRecordTypeToSpriteIconClassHook')) {
|
||
return $hookObject->mapRecordTypeToSpriteIconClassHook($table, $row);
|
||
}
|
||
}
|
||
} else {
|
||
$iconName = '';
|
||
$recordType = array();
|
||
if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_column'])) {
|
||
$column = $GLOBALS['TCA'][$table]['ctrl']['typeicon_column'];
|
||
// workaround to give nav_hide pages a complete different icon
|
||
// although it's not a separate doctype
|
||
// and to give root-pages an own icon
|
||
if ($table === 'pages') {
|
||
if ($row['nav_hide']) {
|
||
$recordType[2] = $recordType[1] . '-hideinmenu';
|
||
}
|
||
if ($row['is_siteroot']) {
|
||
$recordType[3] = $recordType[1] . '-root';
|
||
}
|
||
if ($row['module']) {
|
||
$recordType[4] = 'contains-' . $row['module'];
|
||
if (isset($row[$column])) {
|
||
$recordType[1] = $row[$column];
|
||
} else {
|
||
$recordType[1] = 'default';
|
||
}
|
||
}
|
||
if (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
|
||
foreach ($recordType AS $key => $type) {
|
||
if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$type])) {
|
||
$recordType[$key] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$type];
|
||
} else {
|
||
unset($recordType[$key]);
|
||
// workaround to give nav_hide pages a complete different icon
|
||
// although it's not a separate doctype
|
||
// and to give root-pages an own icon
|
||
if ($table === 'pages') {
|
||
if ($row['nav_hide']) {
|
||
$recordType[2] = $recordType[1] . '-hideinmenu';
|
||
}
|
||
if ($row['is_siteroot']) {
|
||
$recordType[3] = $recordType[1] . '-root';
|
||
}
|
||
if ($row['module']) {
|
||
$recordType[4] = 'contains-' . $row['module'];
|
||
}
|
||
}
|
||
if (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
|
||
foreach ($recordType AS $key => $type) {
|
||
if (isset($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$type])) {
|
||
$recordType[$key] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'][$type];
|
||
} else {
|
||
unset($recordType[$key]);
|
||
}
|
||
}
|
||
$recordType[0] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
|
||
} else {
|
||
foreach ($recordType AS $key => $type) {
|
||
$recordType[$key] = 'tcarecords-' . $table . '-' . $type;
|
||
}
|
||
$recordType[0] = 'tcarecords-' . $table . '-default';
|
||
}
|
||
$recordType[0] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
|
||
} else {
|
||
foreach ($recordType AS $key => $type) {
|
||
$recordType[$key] = 'tcarecords-' . $table . '-' . $type;
|
||
if (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
|
||
$recordType[0] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
|
||
} else {
|
||
$recordType[0] = 'tcarecords-' . $table . '-default';
|
||
}
|
||
$recordType[0] = 'tcarecords-' . $table . '-default';
|
||
}
|
||
} else {
|
||
if (is_array($GLOBALS['TCA'][$table]['ctrl']['typeicon_classes'])) {
|
||
$recordType[0] = $GLOBALS['TCA'][$table]['ctrl']['typeicon_classes']['default'];
|
||
} else {
|
||
$recordType[0] = 'tcarecords-' . $table . '-default';
|
||
}
|
||
}
|
||
$recordTypeCount = count($recordType);
|
||
for($i = $recordTypeCount; $i >= 0; $i--) {
|
||
if(in_array($recordType[$i], $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
|
||
return self::getSpriteIconClasses($recordType[$i]);
|
||
$recordTypeCount = count($recordType);
|
||
for($i = $recordTypeCount; $i >= 0; $i--) {
|
||
if(in_array($recordType[$i], $GLOBALS['TBE_STYLES']['spriteIconApi']['iconsAvailable'])) {
|
||
return self::getSpriteIconClasses($recordType[$i]);
|
||
}
|
||
}
|
||
return self::getSpriteIconClasses('status-status-icon-missing');
|
||
}
|
||
return self::getSpriteIconClasses('status-status-icon-missing');
|
||
}
|
||
... | ... | |
* @access private
|
||
*/
|
||
protected static function mapRecordOverlayToSpriteIconName($table, $row) {
|
||
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
|
||
if (is_array ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['mapRecordOverlayToSpriteIconName'])) {
|
||
foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_iconworks.php']['mapRecordOverlayToSpriteIconName'] as $classRef) {
|
||
$hookObject = t3lib_div::getUserObj($classRef);
|
||
if (method_exists($hookObject, 'mapRecordOverlayToSpriteIconNameHook')) {
|
||
return $hookObject->mapRecordOverlayToSpriteIconNameHook($table, $row);
|
||
}
|
||
}
|
||
} else {
|
||
$tcaCtrl = $GLOBALS['TCA'][$table]['ctrl'];
|
||
// Calculate for a given record the actual visibility at the moment
|
||
$status = array(
|
||
'hidden' => FALSE,
|
||
'starttime' => FALSE,
|
||
'endtime' => FALSE,
|
||
'futureendtime' => FALSE,
|
||
'fe_group' => FALSE,
|
||
'deleted' => FALSE,
|
||
'protectedSection' => FALSE,
|
||
'nav_hide' => ($row['nav_hide'] ? TRUE : FALSE),
|
||
'noIconFound' => ($row['_NO_ICON_FOUND'] ? TRUE : FALSE),
|
||
);
|
||
// Calculate for a given record the actual visibility at the moment
|
||
$status = array(
|
||
'hidden' => FALSE,
|
||
'starttime' => FALSE,
|
||
'endtime' => FALSE,
|
||
'futureendtime' => FALSE,
|
||
'fe_group' => FALSE,
|
||
'deleted' => FALSE,
|
||
'protectedSection' => FALSE,
|
||
'nav_hide' => ($row['nav_hide'] ? TRUE : FALSE),
|
||
'noIconFound' => ($row['_NO_ICON_FOUND'] ? TRUE : FALSE),
|
||
);
|
||
// Icon state based on "enableFields":
|
||
if (is_array($tcaCtrl['enablecolumns'])) {
|
||
$enCols = $tcaCtrl['enablecolumns'];
|
||
// If "hidden" is enabled:
|
||
if ($tcaCtrl['enablecolumns']['disabled'] && $row[$tcaCtrl['enablecolumns']['disabled']]) {
|
||
$status['hidden'] = TRUE;
|
||
}
|
||
// If a "starttime" is set and higher than current time:
|
||
if ($tcaCtrl['enablecolumns']['starttime'] && $GLOBALS['EXEC_TIME'] < intval($row[$tcaCtrl['enablecolumns']['starttime']])) {
|
||
$status['starttime'] = TRUE;
|
||
}
|
||
// Icon state based on "enableFields":
|
||
if (is_array($tcaCtrl['enablecolumns'])) {
|
||
$enCols = $tcaCtrl['enablecolumns'];
|
||
// If "hidden" is enabled:
|
||
if ($tcaCtrl['enablecolumns']['disabled'] && $row[$tcaCtrl['enablecolumns']['disabled']]) {
|
||
$status['hidden'] = TRUE;
|
||
}
|
||
// If a "starttime" is set and higher than current time:
|
||
if ($tcaCtrl['enablecolumns']['starttime'] && $GLOBALS['EXEC_TIME'] < intval($row[$tcaCtrl['enablecolumns']['starttime']])) {
|
||
$status['starttime'] = TRUE;
|
||
}
|
||
// If an "endtime" is set
|
||
if ($tcaCtrl['enablecolumns']['endtime']) {
|
||
if (intval($row[$tcaCtrl['enablecolumns']['endtime']]) > 0) {
|
||
if (intval($row[$tcaCtrl['enablecolumns']['endtime']]) < $GLOBALS['EXEC_TIME']) {
|
||
// End-timing applies at this point.
|
||
$status['endtime'] = TRUE;
|
||
} else {
|
||
// End-timing WILL apply in the future for this element.
|
||
$status['futureendtime'] = TRUE;
|
||
// If an "endtime" is set
|
||
if ($tcaCtrl['enablecolumns']['endtime']) {
|
||
if (intval($row[$tcaCtrl['enablecolumns']['endtime']]) > 0) {
|
||
if (intval($row[$tcaCtrl['enablecolumns']['endtime']]) < $GLOBALS['EXEC_TIME']) {
|
||
// End-timing applies at this point.
|
||
$status['endtime'] = TRUE;
|
||
} else {
|
||
// End-timing WILL apply in the future for this element.
|
||
$status['futureendtime'] = TRUE;
|
||
}
|
||
}
|
||
}
|
||
// If a user-group field is set
|
||
if ($tcaCtrl['enablecolumns']['fe_group'] && $row[$tcaCtrl['enablecolumns']['fe_group']]) {
|
||
$status['fe_group'] = TRUE;
|
||
}
|
||
}
|
||
// If a user-group field is set
|
||
if ($tcaCtrl['enablecolumns']['fe_group'] && $row[$tcaCtrl['enablecolumns']['fe_group']]) {
|
||
$status['fe_group'] = TRUE;
|
||
}
|
||
}
|
||
// If "deleted" flag is set (only when listing records which are also deleted!)
|
||
if ($row[$tcaCtrl['delete']]) {
|
||
$status['deleted'] = TRUE;
|
||
}
|
||
// If "deleted" flag is set (only when listing records which are also deleted!)
|
||
if ($row[$tcaCtrl['delete']]) {
|
||
$status['deleted'] = TRUE;
|
||
}
|
||
// Detecting extendToSubpages (for pages only)
|
||
if ($table == 'pages' && $row['extendToSubpages']) {
|
||
$status['protectedSection'] = TRUE;
|
||
}
|
||
// Detecting extendToSubpages (for pages only)
|
||
if ($table == 'pages' && $row['extendToSubpages']) {
|
||
$status['protectedSection'] = TRUE;
|
||
}
|
||
// now only show the status with the highest priority
|
||
$priorities = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayPriorities'];
|
||
// now only show the status with the highest priority
|
||
$priorities = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayPriorities'];
|
||
$iconName = '';
|
||
foreach ($priorities as $priority) {
|
||
if ($status[$priority]) {
|
||
$iconName = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayNames'][$priority];
|
||
break;
|
||
$iconName = '';
|
||
foreach ($priorities as $priority) {
|
||
if ($status[$priority]) {
|
||
$iconName = $GLOBALS['TBE_STYLES']['spriteIconApi']['spriteIconRecordOverlayNames'][$priority];
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
return $iconName;
|
||
return $iconName;
|
||
}
|
||
}
|
||
- « Previous
- 1
- 2
- Next »