<?php defined('SYSPATH') or die('No direct access allowed.');

/**
 * This class is able to interact with TPP
 *
 * @package    OSB
 * @subpackage Service
 * @category   Helpers
 * @author     Deon George
 * @copyright  (c) 2010 Open Source Billing
 * @license    http://dev.osbill.net/license.html
 */
class Service_Domain_TPP extends Service_Domain {
	private $login_acnt_field = '';
	private $login_user_field = 'login';
	private $login_pass_field = 'password';

	// Our required abstract classes
	public function manage_button(Model_Service_Plugin_Domain $spdo,$t) {
		$debug = FALSE;
		$output = '';

		$output .= Form::open(
			$debug ? 'debug/site' : sprintf('%s/%s',$this->so->whitelabel_url,'execute/logon'),
			array('target'=>'tpp','method'=>'post','id'=>sprintf('id_%s_%s',$spdo->service_id,$t))
		);
		$output .= Form::input($this->login_user_field,$spdo->username_value(),array('type'=>'hidden','id'=>sprintf('u_%s_%s',$spdo->service_id,$t)));
		$output .= Form::input($this->login_pass_field,substr(md5($spdo->password_value()),0,8),array('type'=>'hidden','id'=>sprintf('p_%s_%s',$spdo->service_id,$t)));
		$output .= Form::close();
		$output .= Form::button('submit',_('Manage'),array('class'=>'form_button','value'=>sprintf('%s:%s',$spdo->service_id,$t)));

		return $output;
	}
}
?>
