<?php
//require_once SGL_MOD_DIR . '/default/classes/DA_Default.php';
/**
* Billing Setting
*
* @package rvglobalsoft
* @author amarin - 20060714
*/
class BillingSettingMgr extends SGL_Manager
{
function BillingSettingMgr()
{
parent::SGL_Manager();
$this->pageTitle = 'Billing Setting';
$this->template = 'billingSetting.html';
//$this->da = DA_Default::singleton();
$this->_aActionsMapping = array(
'list' => array('list'),
'add' => array('add'),
'edit' => array('edit'),
);
}
function validate($req, &$input)
{
//SGL_CORE_DIR SGL_VAR_DIR SGL_MOD_DIR
SGL::logMessage(null, PEAR_LOG_DEBUG);
$this->validated = true;
$input->pageTitle = $this->pageTitle;
$input->masterTemplate = $this->masterTemplate;
$input->template = $this->template;
$input->Save = $req->get('Save');
// HTML tag $allowTags = true
$input->action = ($req->get('action'))? $req->get('action'): 'list';
$funcValidate = "_validate_" . $input->action;
eval("\$this->$funcValidate(\$req, \$input);");
if ($input->Save) {
$input->action = 'add';
}
if (isset($aErrors) && count($aErrors)) {
SGL::raiseMsg('Please fill in the indicated fields');
$input->error = $aErrors;
$this->validated = false;
}
}
function _validate_list($req, &$input)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$this->Contactemail = $req->get('contactemail') ? $req->get('contactemail') : '';
}
function _cmd_list(&$input, &$output)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aSetting = parse_ini_file(SGL_Config::get('path.webRoot') . '/tryout/tryout_config.ini.php');
$output->billingUrl = $aSetting['billing_url'];
$output->Username = $aSetting['billing_username'];
$output->FirstName = $aSetting['billing_firstname'];
$output->LastName = $aSetting['billing_lastname'];
$output->Address1 = $aSetting['billing_address1'];
$output->Address2 = $aSetting['billing_address2'];
$output->Address3 = $aSetting['billing_address3'];
$output->City = $aSetting['billing_city'];
$output->CountyStateProvince = $aSetting['billing_country_state_province'];
$output->ZIPCode = $aSetting['billing_zipcode'];
$output->Country = $aSetting['billing_country'];
$output->Contact = $aSetting['billing_contact'];
$output->Telephone = $aSetting['billing_telephone'];
$output->Mobile = $aSetting['billing_mobile'];
$output->config['field_billing_username'] = $aSetting['field_billing_username'];
$output->config['field_billing_firstname'] = $aSetting['field_billing_firstname'];
$output->config['field_billing_lastname'] = $aSetting['field_billing_lastname'];
$output->config['field_billing_address1'] = $aSetting['field_billing_address1'];
$output->config['field_billing_address2'] = $aSetting['field_billing_address2'];
$output->config['field_billing_address3'] = $aSetting['field_billing_address3'];
$output->config['field_billing_city'] = $aSetting['field_billing_city'];
$output->config['field_billing_country_state_province'] = $aSetting['field_billing_country_state_province'];
$output->config['field_billing_zipcode'] = $aSetting['field_billing_zipcode'];
$output->config['field_billing_country'] = $aSetting['field_billing_country'];
$output->config['field_billing_contact'] = $aSetting['field_billing_contact'];
$output->config['field_billing_telephone'] = $aSetting['field_billing_telephone'];
$output->config['field_billing_mobile'] = $aSetting['field_billing_mobile'];
}
function _validate_add($req, &$input)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$input->billingUrl = $req->get('billingUrl');
$input->Username = $req->get('Username');
$input->FirstName = $req->get('FirstName');
$input->LastName = $req->get('LastName');
$input->Address1 = $req->get('Address1');
$input->Address2 = $req->get('Address2');
$input->Address3 = $req->get('Address3');
$input->City = $req->get('City');
$input->CountyStateProvince = $req->get('CountyStateProvince');
$input->ZIPCode = $req->get('ZIPCode');
$input->Country = $req->get('Country');
$input->Contact = $req->get('Contact');
$input->Telephone = $req->get('Telephone');
$input->Mobile = $req->get('Mobile');
$input->config = $req->get('config');
if ($input->billingUrl == '') {
$aErrors['billing_url'] = 'Billing Url is null.';
}
if (isset($aErrors) && count($aErrors)) {
SGL::raiseMsg(SGL_String::translate('Please fill in the indicated fields'), false, PEAR_ERROR_DIE);
$input->error = $aErrors;
$this->validated = false;
$this->_validate_list($req,$input);
}
}
function _cmd_add(&$input, &$output)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
$aSetting = parse_ini_file(SGL_Config::get('path.webRoot') . '/tryout/tryout_config.ini.php');
$aSetting['billing_url'] = $input->billingUrl;
$aSetting['billing_username'] = $input->Username;
$aSetting['billing_firstname'] = $input->FirstName;
$aSetting['billing_lastname'] = $input->LastName;
$aSetting['billing_address1'] = $input->Address1;
$aSetting['billing_address2'] = $input->Address2;
$aSetting['billing_address3'] = $input->Address3;
$aSetting['billing_city'] = $input->City;
$aSetting['billing_country_state_province'] = $input->CountyStateProvince;
$aSetting['billing_zipcode'] = $input->ZIPCode;
$aSetting['billing_country'] = $input->Country;
$aSetting['billing_contact'] = $input->Contact;
$aSetting['billing_telephone'] = $input->Telephone;
$aSetting['billing_mobile'] = $input->Mobile;
$aSetting['field_billing_username'] = $input->config['field_billing_username'];
$aSetting['field_billing_firstname'] = $input->config['field_billing_firstname'];
$aSetting['field_billing_lastname'] = $input->config['field_billing_lastname'];
$aSetting['field_billing_address1'] = $input->config['field_billing_address1'];
$aSetting['field_billing_address2'] = $input->config['field_billing_address2'];
$aSetting['field_billing_address3'] = $input->config['field_billing_address3'];
$aSetting['field_billing_city'] = $input->config['field_billing_city'];
$aSetting['field_billing_country_state_province'] = $input->config['field_billing_country_state_province'];
$aSetting['field_billing_zipcode'] = $input->config['field_billing_zipcode'];
$aSetting['field_billing_country'] = $input->config['field_billing_country'];
$aSetting['field_billing_contact'] = $input->config['field_billing_contact'];
$aSetting['field_billing_telephone'] = $input->config['field_billing_telephone'];
$aSetting['field_billing_mobile'] = $input->config['field_billing_mobile'];
$settingFile = SGL_Config::get('path.webRoot') . '/tryout/tryout_config.ini.php';
require_once 'Config.php';
$c = new Config();
$c->parseConfig($aSetting, 'phparray');
$ok = $c->writeConfig($settingFile, 'inifile');
}
function _cmd_edit(&$input, &$output)
{
SGL::logMessage(null, PEAR_LOG_DEBUG);
}
}
?>
Copyright 2K16 - 2K18 Indonesian Hacker Rulez