View file upload/src/addons/XenCentral/Feedback/Repository/ImportSource/ImportFeedbackSystem.php

File size: 2.25Kb
<?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 ImportFeedbackSystem extends ImportAbstract {

	public function getImporterTitle() {
		return 'Feedback System 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 xc_trade_feedback
			ORDER BY fb_id ASC
			LIMIT $start, $perpage
		" );
	}

	public function getForUserId( $feedback ) {
			return $feedback['foruserid'];
	}

	public function getFromUserId( $feedback ) {
		return $feedback['fromuserid'];
	}

	public function getAmount( $feedback ) {
		return $feedback['amount'];
	}

	public function getType( $feedback ) {

		return $feedback['type'];
}
	public function getDealUrl( $feedback ) {
		return $feedback['dealurl'];
	}

	public function getThreadId( $feedback ) {
		return $feedback['threadid'];
	}

	public function getDateline( $feedback ) {
		return $feedback['dateline'];
	}

	public function getOriginalId( $feedback ) {
		return $feedback['fb_id'];
	}

	public function getFeedbackText( $feedback ) {
		return $feedback['review'];
	}

	public function getIPAddress( $feedback ) {
		return $feedback['ip_id'];
	}

	public function getAllComments( $originalId ) {
		return $this->_sourceDb->fetchAll( "
			SELECT * FROM xc_trade_comment WHERE fb_id = ?
			ORDER BY comment_id ASC
		", array($originalId) );
	}

	public function getCommentUserId( $comment ) {
		return $comment['user_id'];
	}

	public function getCommentText( $comment ) {
		return $comment['message'];
	}

	public function getCommentDateline( $comment ) {
		return $comment['dateline'];
	}
}