<?php

defined('FULL_PATH') or die('restricted access!');

/**
 * Extends/overrides methods of default ReviewsEventHandler class
 *
 */
class EReviewEventHandler extends ReviewsEventHandler {

	/**
	 * Occurs, when config was parsed, allows to change config data dynamically
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnAfterConfigRead(kEvent $event)
	{
		parent::OnAfterConfigRead($event);

		// 1. add fields
//			$fields = $this->Application->getUnitOption($event->Prefix, 'Fields');
//			$this->Application->setUnitOption($event->Prefix, 'Fields', $fields);

		// 2. calculated fields
//			$calculated_fields = $this->Application->getUnitOption($event->Prefix, 'CalculatedFields');
//			$this->Application->setUnitOption($event->Prefix, 'CalculatedFields', $calculated_fields);
	}

	/**
	 * Prefills all fields on front-end
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnBeforeItemCreate(kEvent $event)
	{
		parent::OnBeforeItemCreate($event);


	}

	/**
	 * Sets correct rating value
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnBeforeItemUpdate(kEvent $event)
	{
		parent::OnBeforeItemUpdate($event);


	}

	/**
	 * Occurs before deleting item, id of item being
	 * deleted is stored as 'id' event param
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnBeforeItemDelete(kEvent $event)
	{
		parent::OnBeforeItemDelete($event);


	}

	/**
	 * Occurs before loading item, 'id' parameter
	 * allows to get id of item being loaded
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnBeforeItemLoad(kEvent $event)
	{
		parent::OnBeforeItemLoad($event);


	}


	/**
	 * Updates item review counter
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnAfterItemCreate(kEvent $event)
	{
		parent::OnAfterItemCreate($event);


	}

	/**
	 * Occurs after updating item
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnAfterItemUpdate(kEvent $event)
	{
		parent::OnAfterItemUpdate($event);


	}

	/**
	 * Occurs after deleting item, id of deleted item
	 * is stored as 'id' param of event
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnAfterItemDelete(kEvent $event)
	{
		parent::OnAfterItemDelete($event);


	}

	/**
	 * Occurs after loading item, 'id' parameter
	 * allows to get id of item that was loaded
	 *
	 * @param kEvent $event
	 * @return void
	 * @access protected
	 */
	protected function OnAfterItemLoad(kEvent $event)
	{
		parent::OnAfterItemLoad($event);


	}

}
