45 if ($this->_sCacheKey) {
46 $this->_sCacheKey .=
"_i18n";
59 $this->_iLanguage = (int) $iLang;
61 $this->_sViewTable =
false;
71 if ( $this->_iLanguage === null ) {
87 if ($this->_blEmployMultilanguage != $blEmployMultilanguage) {
88 $this->_blEmployMultilanguage = $blEmployMultilanguage;
89 if (!$blEmployMultilanguage) {
94 $this->_sViewTable =
false;
95 if (count($this->_aFieldNames) > 1) {
111 $sFieldName = strtolower( $sFieldName );
112 if ( isset( $this->_aFieldNames[$sFieldName] ) ) {
113 return (
bool) $this->_aFieldNames[$sFieldName];
118 startProfile(
'!__CACHABLE2__!');
120 stopProfile(
'!__CACHABLE2__!');
121 return (
bool) $blIsMultilang;
148 $this->_sViewTable =
false;
149 return $this->
load( $sOxid );
163 $this->_sCacheKey = $sCacheKey.
"|i18n";
165 $this->_sCacheKey .= $sCacheKey;
169 $this->_sCacheKey = null;
187 $aMultiLangFields = array();
190 foreach ($aObjFields as $sKey => $sValue ) {
193 if ( preg_match(
'/^oxactive(_(\d{1,2}))?$/', $sKey) ) {
201 $sNewKey = preg_replace(
'/_(\d{1,2})$/',
'', $sKey);
202 $aMultiLangFields[$sNewKey][] = (int) $iFieldLang;
207 if ( count($aMultiLangFields) < 1 ) {
213 $query =
"select * from ".getViewName($this->_sCoreTable, -1, -1).
" where oxid = " . $oDb->quote( $this->
getId() );
214 $rs = $oDb->getAll($query);
220 if ( is_array($rs) && count($rs[0]) ) {
221 foreach ( $aMultiLangFields as $sFieldId => $aMultiLangIds ) {
223 foreach ( $aMultiLangIds as $sMultiLangId ) {
224 $sFieldName = ( $sMultiLangId == 0 ) ? $sFieldId : $sFieldId.
'_'.$sMultiLangId;
225 if ( $rs[
'0'][strtoupper($sFieldName)] ) {
226 unset( $aNotInLang[$sMultiLangId] );
233 $aIsInLang = array_diff(
$aLanguages, $aNotInLang );
249 if ( isset( $aAllField[strtolower( $sFieldName ) .
"_1"] ) ) {
272 if (!$this->_blEmployMultilanguage) {
279 $aWorkingFields = &$aFields;
286 foreach ($aWorkingFields as $sName => $sVal) {
288 unset($aWorkingFields[$sName]);
294 return $aWorkingFields;
306 if (
false === strpos($sFieldName,
'_')) {
309 if (preg_match(
'/_(\d{1,2})$/', $sFieldName, $aRegs)) {
327 $sField .=
"_" . $iLang;
359 $blSkipMultilingual =
false;
360 $blSkipCoreFields =
false;
362 if ($sTable != $sCoreTable ) {
363 $blSkipCoreFields =
true;
365 if ($this->_blEmployMultilanguage) {
366 if ( $sTable != getLangTableName($sCoreTable, $this->
getLanguage() ) ) {
367 $blSkipMultilingual =
true;
373 foreach (array_keys($this->_aFieldNames) as $sKey) {
374 $sKeyLowercase = strtolower($sKey);
375 if ($sKeyLowercase !=
'oxid') {
376 if ($this->_blEmployMultilanguage) {
387 if ($sTable != getLangTableName($sCoreTable, $iFieldLang)) {
390 } elseif ($blSkipCoreFields) {
397 $oField = $this->$sLongName;
399 if ( !$blUseSkipSaveFields || ($blUseSkipSaveFields && !in_array($sKeyLowercase, $this->_aSkipSaveFields)) ) {
439 $aUpdateTables = array();
440 if ($this->_blEmployMultilanguage) {
442 $sLangTable = getLangTableName($sCoreTable, $this->
getLanguage() );
443 if ($sCoreTable != $sLangTable) {
444 $aUpdateTables[] = $sLangTable;
449 foreach ($aUpdateTables as $sLangTable) {
450 $sUpdate=
"insert into $sLangTable set ".$this->_getUpdateFieldsForTable( $sLangTable, $this->
getUseSkipSaveFields() ) .
451 " on duplicate key update ".$this->_getUpdateFieldsForTable( $sLangTable );
476 $sCoreTableName = $sCoreTableName ? $sCoreTableName : $this->
getCoreTableName();
477 return oxNew(
'oxDbMetaDataHandler')->getAllMultiTables( $sCoreTableName );
494 $sSq =
"insert into $sTable set ".$this->_getUpdateFieldsForTable( $sTable, $this->
getUseSkipSaveFields() );
495 $blRet = $blRet && (bool)
oxDb::getDb()->execute( $sSq );
512 if (!$this->_blEmployMultilanguage) {
531 if ( $this->_blEmployMultilanguage ) {
552 protected function _addField($sName, $sStatus, $sType = null, $sLength = null)
554 if ($this->_blEmployMultilanguage && $this->
_getFieldLang($sName)) {
574 $sFieldName = preg_replace(
'/_\d{1,2}$/',
'', $sFieldName );
585 public function delete( $sOXID = null )
590 $sOXID = $oDB->quote( $sOXID );
594 $oDB->execute(
"delete from {$sSetTbl} where oxid = {$sOXID}" );