View file upload/src/addons/XenCentral/Feedback/NotificationQueue/AbstractNotify.php

File size: 1.34Kb
<?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\NotificationQueue;

/**
 * @package XenCentral Feedback System
 * @author DNF Technology
 * @copyright Drnoyan & Nalyan LDA, Portugal, EU
 * @license http://dnf.technology/terms/
 * @link http://customers.dnf.technology
 * @version 1.7.1
 * @revision 98
 */

abstract class AbstractNotify
{
	public function __construct()
	{

	}

	abstract public function checkSendDate($notification, $preferences);

    abstract public function checkSendAdminDate($notification, $preferences);

    abstract public function send($user, $items, $postfix='');

	/**
	 * Makes sure only unique items are left in $items array
	 * @param $items
	 * @param $indexName
	 * @return array
	 */
	protected function _makeUnique($items, $indexName)
	{
		$newItems=array();

		foreach($items AS $item)
		{
			if(!isset($newItems[$item[$indexName]]))
			{
				$newItems[$item[$indexName]]=$item;
			}
		}

		return $newItems;
	}

	protected function _populateFeedbackLink($feedback)
	{
		$feedback['feedbackUrl']=\XF::app()->router('public')->buildLink('full:feedback/feedback/view', $feedback);

		return $feedback;
	}
}