enableFields.patch

Administrator Admin, 2009-04-01 08:06

Download (3.5 kB)

 
t3lib/class.t3lib_page.php (working copy)
1014 1014
		if ($show_hidden==-1)	$show_hidden=0;	// If show_hidden was not changed during the previous evaluation, do it here.
1015 1015

  
1016 1016
		$ctrl = $GLOBALS['TCA'][$table]['ctrl'];
1017
		$query='';
1017
		$query = array();
1018 1018
		if (is_array($ctrl))	{
1019 1019

  
1020 1020
				// Delete field check:
1021 1021
			if ($ctrl['delete'])	{
1022
				$query.=' AND '.$table.'.'.$ctrl['delete'].'=0';
1022
				$query['delete'] = ' AND '.$table.'.'.$ctrl['delete'].'=0';
1023 1023
			}
1024 1024

  
1025 1025
				// Filter out new place-holder records in case we are NOT in a versioning preview (that means we are online!)
1026 1026
			if ($ctrl['versioningWS'] && !$this->versioningPreview)	{
1027
				$query.=' AND '.$table.'.t3ver_state<=0';	// Shadow state for new items MUST be ignored!
1027
				$query['versioningWS'] = ' AND '.$table.'.t3ver_state<=0';	// Shadow state for new items MUST be ignored!
1028 1028
			}
1029 1029

  
1030 1030
				// Enable fields:
......
1032 1032
				if (!$this->versioningPreview || !$ctrl['versioningWS'] || $noVersionPreview) { // In case of versioning-preview, enableFields are ignored (checked in versionOL())
1033 1033
					if ($ctrl['enablecolumns']['disabled'] && !$show_hidden && !$ignore_array['disabled']) {
1034 1034
						$field = $table.'.'.$ctrl['enablecolumns']['disabled'];
1035
						$query.=' AND '.$field.'=0';
1035
						$query['disabled'] =' AND '.$field.'=0';
1036 1036
					}
1037 1037
					if ($ctrl['enablecolumns']['starttime'] && !$ignore_array['starttime']) {
1038 1038
						$field = $table.'.'.$ctrl['enablecolumns']['starttime'];
1039
						$query.=' AND ('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
1039
						$query['starttime'] = ' AND ('.$field.'<='.$GLOBALS['SIM_ACCESS_TIME'].')';
1040 1040
					}
1041 1041
					if ($ctrl['enablecolumns']['endtime'] && !$ignore_array['endtime']) {
1042 1042
						$field = $table.'.'.$ctrl['enablecolumns']['endtime'];
1043
						$query.=' AND ('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
1043
						$query['endtime'] = ' AND ('.$field.'=0 OR '.$field.'>'.$GLOBALS['SIM_ACCESS_TIME'].')';
1044 1044
					}
1045 1045
					if ($ctrl['enablecolumns']['fe_group'] && !$ignore_array['fe_group']) {
1046 1046
						$field = $table.'.'.$ctrl['enablecolumns']['fe_group'];
1047
						$query.= $this->getMultipleGroupsWhereClause($field, $table);
1047
						$query['fe_group'] = $this->getMultipleGroupsWhereClause($field, $table);
1048 1048
					}
1049 1049

  
1050 1050
					// Call hook functions for additional enableColumns
......
1057 1057
							'ctrl' => $ctrl
1058 1058
						);
1059 1059
						foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['addEnableColumns'] as $_funcRef)    {
1060
							$query .= t3lib_div::callUserFunction($_funcRef,$_params,$this);
1060
							$query[$_funcRef] = t3lib_div::callUserFunction($_funcRef,$_params,$this);
1061 1061
						}
1062 1062
					}
1063
					
1064
					// Call hook functions for manipulating query 
1065
					if (is_array($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['changeEnableColumns']))    {
1066
						$_params = array(
1067
							'table' => $table,
1068
							'show_hidden' => $show_hidden,
1069
							'ignore_array' => $ignore_array,
1070
							'query'	=> $query,
1071
							'ctrl' => $ctrl
1072
						);
1073
						foreach($TYPO3_CONF_VARS['SC_OPTIONS']['t3lib/class.t3lib_page.php']['changeEnableColumns'] as $_funcRef)    {
1074
							$query = t3lib_div::callUserFunction($_funcRef,$_params,$this);
1075
						}
1076
					}
1077
					
1078
					$query = implode(' ', $query);
1063 1079
				}
1064 1080
			}
1065 1081
		} else {
......
1397 1413
	include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['t3lib/class.t3lib_page.php']);
1398 1414
}
1399 1415

  
1400
?>
1416
?>