File size: 2.78Kb
<?php
/**
* @package XenCentral Feedback System
* @author DNF Technology
* @copyright Drnoyan & Nalyan LDA, Portugal, EU
* @license http://dnf.technology/terms/
* @link http://customers.dnf.technology
* @version 2.0.0 Beta 10
* @revision 12
*/
namespace XenCentral\Feedback\Repository\ImportSource;
class ImportTrader extends ImportAbstract {
public function getImporterTitle() {
return 'Trader (XenForo 1.x)';
}
/**
* @param $db Zend_Db
* @param $prefix String
* Throws exception if table prefix is not valid for the system
*/
public function assertTablePrefix( $db, $prefix ) {
// nothing to do here
}
/**
* @param $db
* @param $config
* @param $errors
* Allows modification of configuration values and additional errors to be shown from importer
*/
public function preImport( $db, &$config, &$errors ) {
// nothing to do here
}
public function getAllFeedback( $start, $perpage ) {
return $this->_sourceDb->fetchAll( "
SELECT * FROM xf_trader
ORDER BY trader_id ASC
LIMIT $start, $perpage
" );
}
public function getForUserId( $feedback ) {
if ( empty( $feedback['seller_comment'] ) ) {
return $feedback['seller_id'];
}
if ( empty( $feedback['buyer_comment'] ) ) {
return $feedback['buyer_id'];
}
}
public function getFromUserId( $feedback ) {
if ( ! empty( $feedback['seller_comment'] ) ) {
return $feedback['seller_id'];
}
if ( ! empty( $feedback['buyer_comment'] ) ) {
return $feedback['buyer_id'];
}
}
public function getAmount( $feedback ) {
if ( intval( $feedback['rating'] ) == 0 ) {
return 1;
}
if ( intval( $feedback['rating'] ) == 1 ) {
return 0;
} else {
return - 1;
}
}
public function getType( $feedback ) {
if ( ! empty( $feedback['seller_comment'] ) ) {
return 'sell';
}
if ( ! empty( $feedback['buyer_comment'] ) ) {
return 'buy';
} else {
return 'trade';
}
}
public function getDealUrl( $feedback ) {
return '';
}
public function getThreadId( $feedback ) {
return '';
}
public function getDateline( $feedback ) {
return $feedback['timestamp'];
}
public function getOriginalId( $feedback ) {
return $feedback['trader_id'];
}
public function getFeedbackText( $feedback ) {
if ( ! empty( $feedback['seller_comment'] ) ) {
return $feedback['seller_comment'];
}
if ( ! empty( $feedback['buyer_comment'] ) ) {
return $feedback['buyer_comment'];
} else {
return '';
}
}
public function getIPAddress( $feedback ) {
return '';
}
public function getAllComments( $originalId ) {
// no comments in Trader
return array();
}
public function getCommentUserId( $comment ) {
return false;
}
public function getCommentText( $comment ) {
return false;
}
public function getCommentDateline( $comment ) {
return $comment['dateline'];
}
}