<?php
// WCF includes
require_once(WCF_DIR.'lib/system/event/EventListener.class.php');

/**
 * Adds phone form for donation
 *
 * @author	Torben Brodt
 * @package	de.easy-coding.wcf.donation.phone
 * @license	GNU General Public License <http://opensource.org/licenses/gpl-3.0.html>
 */
class DonationAddFormPhoneListener implements EventListener {
	protected $system = 'phone';
	protected $prefix = 'donation_phone_';
	protected $eventObj;

	/**
	 * @see EventListener::execute()
	 */
	public function execute($eventObj, $className, $eventName) {
		$this->eventObj = $eventObj;
		
		if($this->eventObj->system != '' && $this->eventObj->system != $this->system) {
			return;
		}

		switch($eventName) {
			case 'assignVariables':
				$this->assignVariables();
			break;
		}
	}

	/**
	 * @see Page::assignVariables()
	 */
	protected function assignVariables() {
		switch($this->eventObj->step) {
			case 1:
				WCF::getTPL()->assign(array(
					'donation_system' => $this->system,
					'donation_icon' => RELATIVE_WCF_DIR.'icon/donation_phone.png','',
					'donation_title' => WCF::getLanguage()->get('wcf.donation.category.donation.plugins.phone'),
					'donation_description' => WCF::getLanguage()->get('wcf.donation.category.donation.plugins.phone.description')
				));

				WCF::getTPL()->append('additionalDonationSystems', WCF::getTPL()->fetch('donation_container'));
			break;
		}
	}
}
?>
