289 lines
5.5 KiB
PHP
289 lines
5.5 KiB
PHP
<?php
|
|
/**
|
|
* AgileBill - Open Billing Software
|
|
*
|
|
* This body of work is free software; you can redistribute it and/or
|
|
* modify it under the terms of the Open AgileBill License
|
|
* License as published at http://www.agileco.com/agilebill/license1-4.txt
|
|
*
|
|
* Originally authored by Tony Landis, AgileBill LLC
|
|
*
|
|
* Recent modifications by Deon George
|
|
*
|
|
* @author Deon George <deonATleenooksDOTnet>
|
|
* @copyright 2009 Deon George
|
|
* @link http://osb.leenooks.net
|
|
*
|
|
* @link http://www.agileco.com/
|
|
* @copyright 2004-2008 Agileco, LLC.
|
|
* @license http://www.agileco.com/agilebill/license1-4.txt
|
|
* @author Tony Landis <tony@agileco.com>
|
|
* @package AgileBill
|
|
* @subpackage Core
|
|
*/
|
|
|
|
/**
|
|
* The main AgileBill Static Lists Method
|
|
*
|
|
* @package AgileBill
|
|
* @subpackage List
|
|
*/
|
|
|
|
/**
|
|
* Generate a list of frequently used selections in OSB
|
|
*
|
|
* @param string $type List type
|
|
* @param string $input_id HTML id="" value.
|
|
* @param string $name HTML name="" value.
|
|
* @param string $default Default Value to pre-select (if it exists)
|
|
* @param string $class CSS class for the select list
|
|
* @param bool $all If true, then a blank item will be included.
|
|
*/
|
|
function list_menu_staticlist($type,$input_id,$name,$default,$class,$all=false) {
|
|
global $C_list;
|
|
|
|
# Whether the values are also keys.
|
|
$nokeys = false;
|
|
$list = array();
|
|
|
|
switch ($type) {
|
|
case 'assoc_grant_type':
|
|
$list = array(
|
|
0=>_('Grant access for specified amount of days'),
|
|
1=>_('Grant access while associated subscription is active'),
|
|
2=>_('Grant access forerver')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'assoc_prod_type':
|
|
$list = array(
|
|
0=>_('Require All Selected Products'),
|
|
1=>_('Require Any One Selected Product')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'charge_sweep':
|
|
$list = array(
|
|
0=>_('Daily'),
|
|
1=>_('Weekly'),
|
|
2=>_('Monthly'),
|
|
3=>_('Quarterly'),
|
|
4=>_('Semi-Annually'),
|
|
5=>_('Annually'),
|
|
6=>_('Service Rebill')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'commissiontype':
|
|
$list = array(
|
|
0=>_('None'),
|
|
1=>_('Percentage Based'),
|
|
2=>('Flat Rate')
|
|
);
|
|
|
|
break;
|
|
|
|
# @todo To deprecate this and standardise with commissiontype
|
|
case 'discounttype':
|
|
$list = array(
|
|
0=>_('Percentage Based'),
|
|
1=>_('Flat Rate')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'copluginmode':
|
|
$list = array(
|
|
0=>_('Test'),
|
|
1=>_('Live')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'domaintype':
|
|
$list = array(
|
|
'register'=>_('Register'),
|
|
'transfer'=>_('Transfer'),
|
|
'park'=>_('Park')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'email_piping':
|
|
$list = array(
|
|
0=>' ',
|
|
1=>'POP',
|
|
2=>'IMAP'
|
|
);
|
|
|
|
break;
|
|
|
|
case 'email_piping_action':
|
|
$list = array(
|
|
0=>_('Leave message in mailbox'),
|
|
1=>_('Delete message from mailbox')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'invoice_delivery':
|
|
$list = array(
|
|
0=>_('None'),
|
|
1=>_('E-Mail'),
|
|
2=>_('Print')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'invoice_show_itemized':
|
|
$list = array(
|
|
0=>_('Overview Only'),
|
|
1=>_('Full Detail')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'nametitle':
|
|
$list = array(
|
|
_('Mr'),
|
|
_('Ms'),
|
|
_('Mrs'),
|
|
_('Miss'),
|
|
_('Dr'),
|
|
_('Prof')
|
|
);
|
|
$nokeys = true;
|
|
|
|
break;
|
|
|
|
case 'os':
|
|
$list = array(
|
|
0=>'Linux',
|
|
1=>'Windows'
|
|
);
|
|
|
|
break;
|
|
|
|
case 'recur_schedule':
|
|
$list = array(
|
|
0=>_('Weekly'),
|
|
1=>_('Monthly'),
|
|
2=>_('Quarterly'),
|
|
3=>_('Semi-Annually'),
|
|
4=>_('Annually'),
|
|
5=>_('Two years'),
|
|
6=>_('Three Years')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'recur_type':
|
|
$list = array(
|
|
0=>_('Bill on Aniversary Date of Subscription'),
|
|
1=>_('Bill on Fixed Schedule')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'pricetype':
|
|
$list = array(
|
|
0=>_('One-time Charge'),
|
|
1=>_('Recurring Membership/Subscription'),
|
|
2=>_('Trial for Membership/Subscription')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'servicetype':
|
|
if ($C_list->is_installed('host_server')) {
|
|
$list['host'] = _('Hosting');
|
|
$list['host_group'] = _('Hosting & Group Access');
|
|
$list['domain'] = _('Domain Name');
|
|
}
|
|
$list['none'] = _('Recurring Only');
|
|
|
|
break;
|
|
|
|
case 'servicequeue':
|
|
$list = array(
|
|
'new'=>_('Add New'),
|
|
'active'=>_('Activate'),
|
|
'inactive'=>_('Deactivate'),
|
|
'delete'=>_('Delete'),
|
|
'edit'=>_('Edit/Update'),
|
|
'queue_none'=>_('None')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'statictype':
|
|
$list = array(
|
|
'small_text'=>_('Small Text'),
|
|
'medium_text'=>_('Medium Text'),
|
|
'large_text'=>_('Large Text'),
|
|
'dropdown_list'=>_('Dropdown List'),
|
|
'calendar'=>_('Calendar'),
|
|
'file_upload'=>_('File Upload'),
|
|
'status'=>_('Status'),
|
|
'checkbox'=>_('Checkbox'),
|
|
'hidden'=>_('Hidden')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'tasktype':
|
|
$list = array(
|
|
0=>_('Internal Method'),
|
|
1=>_('System Call')
|
|
);
|
|
|
|
break;
|
|
|
|
case 'trial_length':
|
|
$list = array(
|
|
0=>_('Days'),
|
|
1=>_('Weeks'),
|
|
2=>_('Months')
|
|
);
|
|
|
|
break;
|
|
|
|
default: return sprintf('Unknown staticlist: %s',$type);
|
|
}
|
|
|
|
# If ID is blank, we'll just return the value
|
|
if (! $input_id)
|
|
return $list[$default];
|
|
|
|
# If the NAME is blank, we'll return the list itself
|
|
if (! $name)
|
|
return $list;
|
|
|
|
$return = sprintf('<select id="%s" name="%s" class="%s">',$input_id,$name,$class);
|
|
|
|
if ($all)
|
|
$return .= '<option value=""> </option>';
|
|
|
|
foreach ($list as $element => $details) {
|
|
$selected = '';
|
|
|
|
if ($nokeys) {
|
|
if ($default == $details)
|
|
$selected = ' selected="selected"';
|
|
|
|
} else {
|
|
if ($default == $element)
|
|
$selected = ' selected="selected"';
|
|
}
|
|
|
|
$return .= sprintf('<option value="%s"%s>%s</option>',$nokeys ? $details : $element,$selected,$details);
|
|
}
|
|
|
|
$return .= '</select>';
|
|
|
|
return $return;
|
|
}
|