<?php

/**
 * @author Jilani Jidni
 * @desc XmlRPC user create client library
 *
 */
class Xmlrpc_user_create_client
{

	var $serverUrl;
	var $request = array ( );
	var $method;
	var $CI;

	function Xmlrpc_user_create_client()
	{
		$this->CI = get_instance ();
		$this->CI->load->library ( 'xmlrpc' );
	}

	function setServerUrl($serverUrl)
	{
		$this->serverUrl = $serverUrl;
	}

	function getServerUrl()
	{
		return $this->serverUrl;
	}

	/**
	 * @param String $method
	 */
	function setMethod($method)
	{
		$this->method = $method;
	}

	/**
	 * @return String
	 */
	function getMethod()
	{
		return $this->method;
	}

	/**
	 * @return array
	 */
	function getRequest()
	{
		return $this->request;
	}

	/**
	 * @param array $request
	 */
	function setRequest($request)
	{
		$this->request = $request;
	}

	/**
	 * create premium response user
	 *
	 */
	function premiumResponseUser()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (! $this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			$responseText = $this->CI->xmlrpc->display_response();

			return $responseText;
		}
	}

	/**
	 * pause user access on premium response
	 *
	 * @return unknown
	 */
	function premiumResponseUserPause()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (! $this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			return TRUE;
		}
	}

/**
	 * activate pause user access on premium response
	 *
	 * @return unknown
	 */
	function premiumResponseUserActivate()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (! $this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			return TRUE;
		}
	}

	/**
	 * get premium response user data
	 *
	 */
	function premiumResponseGetUserData()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (!$this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			$responseText = $this->CI->xmlrpc->display_response();

			return $responseText;
		}
	}

	/**
	 * create premium web tracking user
	 *
	 */
	function premiumWebTrackingUser()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (!$this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			$responseText = $this->CI->xmlrpc->display_response();

			return $responseText;
		}
	}

	/**
	 * pause user access on premium response
	 *
	 * @return unknown
	 */
	function premiumWebTrackingUserPause()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (! $this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			return TRUE;
		}
	}

	/**
	 * pause user access on premium response
	 *
	 * @return unknown
	 */
	function premiumWebTrackingUserActivate()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (! $this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			return TRUE;
		}
	}

	/**
	 * get premium web tracking user data
	 *
	 */
	function premiumWebTrackingGetUserData()
	{
		$this->CI->xmlrpc->server ( $this->getServerUrl(), 80 );
		$this->CI->xmlrpc->method ( $this->getMethod() );
		#$this->CI->xmlrpc->set_debug(TRUE);

		$this->CI->xmlrpc->request ( $this->getRequest());

		if (!$this->CI->xmlrpc->send_request())
		{
			#echo $this->CI->xmlrpc->display_error();
			return FALSE;
		}
		else
		{
			$responseText = $this->CI->xmlrpc->display_response();

			return $responseText;
		}
	}
}
?>