src/ShopBundle/objects/TCMSTableEditor/TCMSShopTableEditor_ShopVoucherSeries.class.php
public function ExportVoucherCodes()
    {
        $sReturn = '';

        if ($this->AllowExportingVoucherCodes()) {
            $oVouchers = TdbShopVoucherList::GetList("SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'");
            $oVouchers->GoToStart();
            $count = 0;
            while ($oVoucher = $oVouchers->Next()) {
                $aCsvVouchers[$count][0] = str_replace('"', '""', $oVoucher->fieldCode);
                if ('0000-00-00 00:00:00' != $oVoucher->fieldDatecreated) {
                    $aCsvVouchers[$count][1] = date('d.m.Y H:i', strtotime($oVoucher->fieldDatecreated));
                } else {
                    $aCsvVouchers[$count][3] = '';
                }
                $aCsvVouchers[$count][2] = $oVoucher->fieldIsUsedUp;
                if ('0000-00-00 00:00:00' != $oVoucher->fieldDateUsedUp) {
                    $aCsvVouchers[$count][3] = date('d.m.Y H:i', strtotime($oVoucher->fieldDateUsedUp));
                } else {
                    $aCsvVouchers[$count][3] = '';
                }
                ++$count;
            }

            $sCsv = '';
            for ($i = 0; $i < count($aCsvVouchers); ++$i) {
                $sCsv .= '"'.implode('";"', $aCsvVouchers[$i])."\"\n";
            }
            $sCsv = '"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_code')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_created')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent_date'))."\"\n".$sCsv;

            while (@ob_end_clean()) {
            }
            header('Cache-Control: must-revalidate');
            header('Pragma: must-revalidate');
            header('Content-type: application/csv');
            header('Content-disposition: attachment; filename=ShopVouchers.csv');

            echo $sCsv;

            exit(0);
        } else {
            echo 'Keine Berechtigung';
        }
    }
public function ExportVoucherCodes()
    {
        $sReturn = '';

        if ($this->AllowExportingVoucherCodes()) {
            $oVouchers = TdbShopVoucherList::GetList("SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='".MySqlLegacySupport::getInstance()->real_escape_string($this->sId)."'");
            $oVouchers->GoToStart();
            $count = 0;
            while ($oVoucher = $oVouchers->Next()) {
                $aCsvVouchers[$count][0] = str_replace('"', '""', $oVoucher->fieldCode);
                if ('0000-00-00 00:00:00' != $oVoucher->fieldDatecreated) {
                    $aCsvVouchers[$count][1] = date('d.m.Y H:i', strtotime($oVoucher->fieldDatecreated));
                } else {
                    $aCsvVouchers[$count][3] = '';
                }
                $aCsvVouchers[$count][2] = $oVoucher->fieldIsUsedUp;
                if ('0000-00-00 00:00:00' != $oVoucher->fieldDateUsedUp) {
                    $aCsvVouchers[$count][3] = date('d.m.Y H:i', strtotime($oVoucher->fieldDateUsedUp));
                } else {
                    $aCsvVouchers[$count][3] = '';
                }
                ++$count;
            }

            $sCsv = '';
            for ($i = 0; $i < count($aCsvVouchers); ++$i) {
                $sCsv .= '"'.implode('";"', $aCsvVouchers[$i])."\"\n";
            }
            $sCsv = '"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_code')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_created')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent')).'";"'.TGlobal::OutHTML(TGlobal::Translate('chameleon_system_shop.voucher.export_column_spent_date'))."\"\n".$sCsv;

            while (@ob_end_clean()) {
            }
            header('Cache-Control: must-revalidate');
            header('Pragma: must-revalidate');
            header('Content-type: application/csv');
            header('Content-disposition: attachment; filename=ShopVouchers.csv');

            echo $sCsv;

            exit(0);
        } else {
            echo 'Keine Berechtigung';
        }
    }
public function ExportVoucherCodes ( ) { $ sReturn = '' ; if ( $ this -> AllowExportingVoucherCodes ( ) ) { $ oVouchers = TdbShopVoucherList :: GetList ( "SELECT * FROM `shop_voucher` WHERE `shop_voucher_series_id`='" . MySqlLegacySupport :: getInstance ( ) -> real_escape_string ( $ this -> sId ) . "'" ) ; $ oVouchers -> GoToStart ( ) ; $ count = 0 ; while ( $ oVoucher = $ oVouchers -> Next ( ) ) { $ aCsvVouchers [ $ count ] [ 0 ] = str_replace ( '"' , '""' , $ oVoucher -> fieldCode ) ; if ( '0000-00-00 00:00:00' != $ oVoucher -> fieldDatecreated ) { $ aCsvVouchers [ $ count ] [ 1 ] = date ( 'd.m.Y H:i' , strtotime ( $ oVoucher -> fieldDatecreated ) ) ; } else { $ aCsvVouchers [ $ count ] [ 3 ] = '' ; } $ aCsvVouchers [ $ count ] [ 2 ] = $ oVoucher -> fieldIsUsedUp ; if ( '0000-00-00 00:00:00' != $ oVoucher -> fieldDateUsedUp ) { $ aCsvVouchers [ $ count ] [ 3 ] = date ( 'd.m.Y H:i' , strtotime ( $ oVoucher -> fieldDateUsedUp ) ) ; } else { $ aCsvVouchers [ $ count ] [ 3 ] = '' ; } ++ $ count ; } $ sCsv = '' ; for ( $ i = 0 ; $ i < count ( $ aCsvVouchers ) ; ++ $ i ) { $ sCsv .= '"' . implode ( '";"' , $ aCsvVouchers [ $ i ] ) . "\"\n" ; } $ sCsv = '"' . TGlobal :: OutHTML ( TGlobal :: Translate ( 'chameleon_system_shop.voucher.export_column_code' ) ) . '";"' . TGlobal :: OutHTML ( TGlobal :: Translate ( 'chameleon_system_shop.voucher.export_column_created' ) ) . '";"' . TGlobal :: OutHTML ( TGlobal :: Translate ( 'chameleon_system_shop.voucher.export_column_spent' ) ) . '";"' . TGlobal :: OutHTML ( TGlobal :: Translate ( 'chameleon_system_shop.voucher.export_column_spent_date' ) ) . "\"\n" . $ sCsv ; while ( @ ob_end_clean ( ) ) { } header ( 'Cache-Control: must-revalidate' ) ; header ( 'Pragma: must-revalidate' ) ; header ( 'Content-type: application/csv' ) ; header ( 'Content-disposition: attachment; filename=ShopVouchers.csv' ) ; echo $ sCsv ; exit ( 0 ) ; } else { echo 'Keine Berechtigung' ; } }
export all vouchers from a voucher series as csv-file with Code, Datecreated and UsedUp-Information.
export all vouchers from a voucher series as csv - file with Code Datecreated and UsedUp - Information .