<?php

/******************************************************************************
 *
 *	PROJECT: Flynax Classifieds Software
 *	VERSION: 4.X
 *	LICENSE: FL4HLD2A8696 - http://www.flynax.com/license-agreement.html
 *	PRODUCT: Real Estate Agency
 *	DOMAIN: gevimmo.com
 *	FILE: CCBILL.INC.PHP
 *
 *	The software is a commercial product delivered under single, non-exclusive,
 *	non-transferable license for one domain or IP address. Therefore distribution,
 *	sale or transfer of the file in whole or in part without permission of Flynax
 *	respective owners is considered to be illegal and breach of Flynax License End
 *	User Agreement.
 *
 *	You are not allowed to remove this information from the file without permission
 *	of Flynax respective owners.
 *
 *	Flynax Classifieds Software 2017 |  All copyrights reserved.
 *
 *	http://www.flynax.com/
 *
 ******************************************************************************/

// include abstract gateway class
require_once(RL_CLASSES . 'rlGateway.class.php');

$reefless->loadClass('Plan');
$reefless->loadClass('Ccbill', null, 'ccbill');
if ($GLOBALS['membership_module']) {
	$reefless->loadClass('MembershipPlansAdmin', 'admin');
}
if ($rlCcbill->isPluginInstalled('banners')) {
	$reefless->loadClass('Banners', null, 'banners');
}
if ($rlCcbill->isPluginInstalled('payAsYouGoCredits')) {
	$reefless->loadClass('Credits', null, 'payAsYouGoCredits');
}

// prepare object plans by group
$listing_plans = $rlPlan->getPlans();
$groups = array(
	'listing_plans' => array(
		'name' => $lang['ccbill_listing_plans'],
		'Key' => 'listing_plans',
		'items' => $listing_plans 
	)
);

if ($GLOBALS['membership_module']) {
	$membership_plans = $rlMembershipPlansAdmin->getPlans();
	$groups['membership_plans'] = array(
		'name' => $lang['ccbill_membership_plans'],
		'Key' => 'membership_plans',
		'items' => $membership_plans,
		'service' => 'membership'
	);           
}
if ($rlCcbill->isPluginInstalled('banners')) {
	$banner_plans = $rlBanners->getBannerPlans();
	$groups['banner_plans'] = array(
		'name' => $lang['ccbill_banner_plans'],
		'Key' => 'banner_plans',
		'items' => $banner_plans,
		'service' => 'banners'
	);
}
if ($rlCcbill->isPluginInstalled('payAsYouGoCredits')) {
	$credit_packages = $rlCredits->get();
	$groups['credit_packages'] = array(
		'name' => $lang['ccbill_credit_packages'],
		'Key' => 'credit_packages',
		'items' => $credit_packages,
		'service' => 'credits'
	);
}

if ($_POST['f']) {
	$rlCcbill->setObjectItems($groups);
	$rlCcbill->saveSettings($_POST['f']);
}

$rlCcbill->getSettings($groups);
$rlSmarty->assign_by_ref('ccbill_groups', $groups);