54 public function init( $aColumns = null )
56 if ( !is_null( $aColumns ) ) {
80 $this->_aColumns = $aColumns;
95 foreach ( $aColumns as $iPos => $aCol ) {
96 if ( isset($aCol[4]) && $aCol[4] == 1 && $sId == $aCol[1].
'.'.$aCol[0] ) {
111 $this->_sContainer = $sName;
145 return 'select count( * ) ' . $sQ;
181 $iCol = $iCol?( ( int ) str_replace(
'_',
'', $iCol )):0;
182 $iCol = ( !isset( $aVisibleNames[$iCol] ) )?0:$iCol;
198 if ( $sId === null ) {
202 if ( $sId && isset( $this->_aColumns[$sId] ) ) {
203 return $this->_aColumns[$sId];
219 foreach ( $aColNames as $iKey => $aCol ) {
221 $aCols[$iKey] = $aCol;
235 $aVisibleCols = array();
238 if ( is_array( $aUserCols ) ) {
239 foreach ( $aUserCols as $iKey => $sCol ) {
240 $iCol = ( int ) str_replace(
'_',
'', $sCol );
241 if ( isset( $aColNames[$iCol] ) && !$aColNames[$iCol][4] ) {
242 $aVisibleCols[$iCol] = $aColNames[$iCol];
248 if ( !count( $aVisibleCols ) ) {
249 foreach ( $aColNames as $sName => $aCol ) {
250 if ( $aCol[1] && !$aColNames[$sName][4] )
251 $aVisibleCols[$sName] = $aCol;
255 return $aVisibleCols;
283 foreach ( $aIdentCols as $iCnt => $aCol ) {
292 $sQ .= $sViewTable.
'.' . $aCol[0] .
' as _' . $iCnt;
310 if ( $this->_blAllowExtColumns &&
oxRegistry::getConfig()->getConfigParam(
'blVariantsSelection' ) && $sColumn ==
'oxtitle' ) {
330 $sVarSelect =
"$sViewTable.oxvarselect";
331 return " IF( {$sViewTable}.{$sColumn} != '', {$sViewTable}.{$sColumn}, CONCAT((select oxart.{$sColumn} from {$sViewTable} as oxart where oxart.oxid = {$sViewTable}.oxparentid),', ',{$sVarSelect})) as _{$iCnt}";
341 return ' order by _' . $this->
_getSortCol() .
' '.$this->_getSortDir().
' ';
356 return " limit $iStart, $iLimit ";
368 $aFilter = $oConfig->getRequestParameter(
'aFilter' );
369 if ( is_array( $aFilter ) && count( $aFilter ) ) {
375 $blIsUtf = $oConfig->isUtf();
376 $sCharset = $oLang->translateString(
"charset" );
378 foreach ( $aFilter as $sCol => $sValue ) {
381 if ( $sValue ==
'' && $sValue !== 0 && $sValue !==
'0' ) {
385 $iCol = (int) str_replace(
'_',
'', $sCol );
386 if ( isset( $aCols[ $iCol ] ) ) {
391 $sValue = iconv(
'UTF-8', $sCharset, $sValue );
395 $sValue = str_replace( array(
'%',
'_' ), array(
'\%',
'\_' ), $sValue );
398 $sValue = $oStr->preg_replace(
'/^\*/',
'%', $sValue );
400 $sQ .= $this->
_getViewName( $aCols[ $iCol ][1] ) .
'.' . $aCols[ $iCol ][0];
401 $sQ .=
' like ' . $oDb->Quote( $sValue .
'%' ).
' ';
418 if ( $sQ && ( $sFilter = $this->
_getFilter() ) ) {
419 $sQ .= ( ( stristr( $sQ,
'where' ) === false )?
'where':
' and ' ) . $sFilter;
435 if ($rs !=
false && $rs->recordCount() > 0) {
437 $aReturn[] = $rs->fields[0];
452 if ( !in_array( $sDir, $this->_aPosDir ) ) {
453 $sDir = $this->_aPosDir[0];
484 return (
int)
oxDb::getDb()->getOne( $sQ,
false,
false );
496 return oxDb::getDb( oxDB::FETCH_MODE_ASSOC )->getArray( $sQ,
false,
false );
510 if ( is_array( $aData[
'records'] ) && ( $iRecSize = count( $aData[
'records'] ) ) ) {
511 $aKeys = array_keys( current( $aData[
'records'] ) );
512 $iKeySize = count( $aKeys );
514 for ( $i = 0; $i < $iRecSize; $i++ ) {
515 for ( $c = 0; $c < $iKeySize; $c++ ) {
516 $aData[
'records'][$i][$aKeys[$c]] = iconv( $sCharset,
"UTF-8", $aData[
'records'][$i][$aKeys[$c]] );
522 $this->
_output( json_encode( $aData ) );
566 $iDebug = $this->
getConfig()->getConfigParam(
'iDebug' );
568 $aResponse[
'countsql'] = $sCountQ;
571 $aResponse[
'records'] = array();
579 $aResponse[
'datasql'] = $sQ;
585 $aResponse[
'totalRecords'] = $iTotal;
600 if ( empty( $aArtIds ) ) {
604 if ( !is_array( $aArtIds ) ) {
605 $aArtIds = array( $aArtIds );
608 $blCleanCats =
false;
610 if ( !is_array( $aCatIds ) ) {
611 $aCatIds = array( $aCatIds );
613 $sShopId = $this->
getConfig()->getShopId();
614 $sQ =
"delete from oxseo where oxtype='oxarticle' and oxobjectid='%s' and
615 oxshopid='{$sShopId}' and oxparams in (" . implode(
",",
oxDb::getInstance()->quoteArray( $aCatIds ) ) .
")";
620 $sShopId = $this->
getConfig()->getShopId();
621 foreach ( $aArtIds as $sArtId ) {
622 oxRegistry::get(
"oxSeoEncoder")->markAsExpired( $sArtId, $sShopId, 1, null,
"oxtype='oxarticle'" );
623 if ( $blCleanCats ) {
624 $oDb->execute( sprintf( $sQ, $sArtId ) );
636 $blDeleteCacheOnLogout = $this->
getConfig()->getConfigParam(
'blClearCacheOnLogout' );
639 if ( !$blDeleteCacheOnLogout ) {
655 $blDeleteCacheOnLogout = $this->
getConfig()->getConfigParam(
'blClearCacheOnLogout' );
657 if ( !$blDeleteCacheOnLogout ) {
659 switch ( $sCounterType ) {
660 case 'priceCatArticle':
661 $myUtilsCount->resetPriceCatArticleCount( $sValue );
664 $myUtilsCount->resetCatArticleCount( $sValue );
666 case 'vendorArticle':
667 $myUtilsCount->resetVendorArticleCount( $sValue );
669 case 'manufacturerArticle':
670 $myUtilsCount->resetManufacturerArticleCount( $sValue );