| Server IP : 195.130.67.5 / Your IP : 216.73.217.154 Web Server : Microsoft-IIS/10.0 System : Windows NT WEBSERVER1 10.0 build 17763 (Windows Server 2016) i586 User : IUSR ( 0) PHP Version : 7.4.19 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /Old Sites/ees_request/administrator/components/com_printme/library/ |
Upload File : |
<?php
/**
* @version 0.1.0
* @package Printme
* @copyright Copyright (C) 2009 DT Design Inc. All rights reserved.
* @license GNU GPLv2 <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
* @link http://www.dioscouri.com
*/
require_once( JPATH_SITE.DS.'libraries'.DS.'joomla'.DS.'html'.DS.'html'.DS.'select.php' );
class PrintmeSelect extends JHTMLSelect
{
/**
* Generates a yes/no radio list
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
public static function booleans( $selected, $name = 'filter_enabled', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title='Select State', $yes = 'Enabled', $no = 'Disabled' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
$list[] = JHTML::_('select.option', '0', JText::_( $no ) );
$list[] = JHTML::_('select.option', '1', JText::_( $yes ) );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
* Generates range list
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
public static function range( $selected, $name = 'filter_range', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title = 'Select Range' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
$list[] = JHTML::_('select.option', 'today', JText::_( "Today" ) );
$list[] = JHTML::_('select.option', 'yesterday', JText::_( "Yesterday" ) );
$list[] = JHTML::_('select.option', 'last_seven', JText::_( "Last Seven Days" ) );
$list[] = JHTML::_('select.option', 'last_thirty', JText::_( "Last Thirty Days" ) );
$list[] = JHTML::_('select.option', 'ytd', JText::_( "Year to Date" ) );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
* Generates range list
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
public static function reportrange( $selected, $name = 'filter_range', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title = 'Select Range' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
$list[] = JHTML::_('select.option', 'custom', JText::_( "Custom" ) );
$list[] = JHTML::_('select.option', 'yesterday', JText::_( "Yesterday" ) );
$list[] = JHTML::_('select.option', 'last_week', JText::_( "Last Week" ) );
$list[] = JHTML::_('select.option', 'last_month', JText::_( "Last Month" ) );
$list[] = JHTML::_('select.option', 'ytd', JText::_( "Year to Date" ) );
$list[] = JHTML::_('select.option', 'all', JText::_( "All Time" ) );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
* Generates a created/modified select list
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
public static function datetype( $selected, $name = 'filter_datetype', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title='Select Type' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
$list[] = JHTML::_('select.option', 'created', JText::_( "Created" ) );
$list[] = JHTML::_('select.option', 'modified', JText::_( "Modified" ) );
$list[] = JHTML::_('select.option', 'shipped', JText::_( "Shipped" ) );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
*
* @param $selected
* @param $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @return unknown_type
*/
public static function category($selected, $name = 'filter_parentid', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $allowNone = false, $title = 'Select Category', $title_none = 'No Parent', $enabled = null )
{
// Build list
$list = array();
if ($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -", 'category_id', 'category_name' );
}
if ($allowNone) {
JTable::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'tables' );
$root = JTable::getInstance('Categories', 'Table')->getRoot();
$list[] = self::option( $root->category_id, "- ".JText::_( $title_none )." -", 'category_id', 'category_name' );
}
JTable::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'tables' );
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Categories', 'PrintmeModel' );
$model->setState('order', 'tbl.lft');
if (intval($enabled) == '1')
{
// get only the enabled items in the tree
// this would be used for the front-end
$items = $model->getTable()->getTree();
}
else
{
$items = $model->getList();
}
foreach (@$items as $item)
{
$list[] = self::option( $item->category_id, str_repeat( '. ', $item->level-1 ).JText::_($item->name), 'category_id', 'category_name' );
}
return self::genericlist($list, $name, $attribs, 'category_id', 'category_name', $selected, $idtag );
}
/**
*
* @param $selected
* @param $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @return unknown_type
*/
public static function manufacturer($selected, $name = 'filter_manufacturerid', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $allowNone = false, $title = 'Select Manufacturer', $title_none = 'No Manufacturer', $enabled = null )
{
// Build list
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -", 'manufacturer_id', 'manufacturer_name' );
}
if($allowNone) {
$list[] = self::option('0', "- ".JText::_( $title_none )." -", 'manufacturer_id', 'manufacturer_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Manufacturers', 'PrintmeModel' );
$model->setState( 'order', 'manufacturer_name' );
$model->setState( 'direction', 'ASC' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->manufacturer_id, JText::_($item->manufacturer_name), 'manufacturer_id', 'manufacturer_name' );
}
return self::genericlist($list, $name, $attribs, 'manufacturer_id', 'manufacturer_name', $selected, $idtag );
}
/**
*
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $attribs
* @param unknown_type $idtag
* @param unknown_type $allowAny
* @param unknown_type $allowNone
* @param unknown_type $title
* @param unknown_type $title_none
* @return unknown_type
*/
public static function taxclass($selected, $name = 'filter_tax_class_id', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $allowNone = false, $title = 'Select Tax Class', $title_none = 'No Tax Class' )
{
// Build list
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -", 'tax_class_id', 'tax_class_name' );
}
if($allowNone) {
$list[] = self::option('0', "- ".JText::_( $title_none )." -", 'tax_class_id', 'tax_class_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Taxclasses', 'PrintmeModel' );
$model->setState( 'order', 'tax_class_name' );
$model->setState( 'direction', 'ASC' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->tax_class_id, JText::_($item->tax_class_name), 'tax_class_id', 'tax_class_name' );
}
return self::genericlist($list, $name, $attribs, 'tax_class_id', 'tax_class_name', $selected, $idtag );
}
/**
*
* @param $selected
* @param $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @return unknown_type
*/
public static function country($selected, $name = 'filter_countryid', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select Country' )." -", 'country_id', 'country_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Countries', 'PrintmeModel' );
$model->setState( 'order', 'country_name' );
$model->setState( 'direction', 'ASC' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->country_id, JText::_($item->country_name), 'country_id', 'country_name' );
}
return self::genericlist($list, $name, $attribs, 'country_id', 'country_name', $selected, $idtag );
}
/**
*
* @param $selected
* @param $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @return unknown_type
*/
public static function geozonetypes($selected, $name = 'filter_geozonetype', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select Geo Zone Type' )." -", 'geozonetype_id', 'geozonetype_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Geozonetypes', 'PrintmeModel' );
$model->setState( 'order', 'geozonetype_name' );
$model->setState( 'direction', 'ASC' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->geozonetype_id, JText::_($item->geozonetype_name), 'geozonetype_id', 'geozonetype_name' );
}
return self::genericlist($list, $name, $attribs, 'geozonetype_id', 'geozonetype_name', $selected, $idtag );
}
/**
*
* @param $selected
* @param $name
* @param $countryid REQUIRED, therefore should be before $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @return unknown_type
*/
public static function zone($selected, $name = 'filter_zoneid', $countryid, $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select Zone' )." -", 'zone_id', 'zone_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Zones', 'PrintmeModel' );
$model->setState( 'order', 'zone_name' );
$model->setState( 'direction', 'ASC' );
if ($countryid !== null)
{
$model->setState( 'filter_countryid', $countryid );
}
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->zone_id, JText::_($item->zone_name), 'zone_id', 'zone_name' );
}
return self::genericlist($list, $name, $attribs, 'zone_id', 'zone_name', $selected, $idtag );
}
/**
*
* @param $selected
* @param $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @return unknown_type
*/
public static function geozone($selected, $name = 'filter_geozoneid', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
// TODO Make these static?
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select Geo Zone' )." -", 'geozone_id', 'geozone_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'Geozones', 'PrintmeModel' );
$model->setState( 'order', 'geozone_name' );
$model->setState( 'direction', 'ASC' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->geozone_id, JText::_($item->geozone_name), 'geozone_id', 'geozone_name' );
}
return self::genericlist($list, $name, $attribs, 'geozone_id', 'geozone_name', $selected, $idtag );
}
/**
*
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $attribs
* @param unknown_type $idtag
* @param unknown_type $allowAny
* @return unknown_type
*/
public static function currency($selected, $name = 'filter_currency_id', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select Currency' )." -", 'currency_id', 'currency_code' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'currencies', 'PrintmeModel' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->currency_id, JText::_($item->currency_code), 'currency_id', 'currency_code' );
}
return self::genericlist($list, $name, $attribs, 'currency_id', 'currency_code', $selected, $idtag );
}
/**
* TODO Is $type even necessary?
* I thought we were going to assume ALL addresses could be both shipping and billing
*
* @param unknown_type $userid REQUIRED, therefore at beginning of param list
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $type
* @param unknown_type $attribs
* @param unknown_type $idtag
* @param unknown_type $allowAny
* @return unknown_type
*/
public static function address($userid, $selected, $name = 'filter_address_id', $type = 1, $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
// TODO return empty array?
if (empty($userid))
{
return;
}
$address_type = '';
switch($type)
{
case 1:
$address_type = JText::_('Billing');
break;
case 2:
$address_type = JText::_('Shipping');
break;
}
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select '.$address_type.' Address' )." -", 'address_id', 'address_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'addresses', 'PrintmeModel' );
$model->setState("filter_userid", $userid);
$model->setState("filter_deleted", 0);
$items = $model->getList();
foreach (@$items as $item)
{
// TODO This shouldn't be set here. it should be set $selected when the function is called
if (($item->is_default_billing && ($type == 1)) || ($item->is_default_shipping && ($type == 2))) {
$selected = $item->address_id;
}
$list[] = self::option( $item->address_id, JText::_($item->address_name), 'address_id', 'address_name' );
}
if (count($list) == 1)
{
return;
}
else
{
return self::genericlist($list, $name, $attribs, 'address_id', 'address_name', $selected, $idtag );
}
}
/**
*
* @param $selected
* @param $name
* @param $attribs
* @param $idtag
* @param $allowAny
* @param $allowNone
* @param $title
* @param $title_none
* @return unknown_type
*/
public static function addressaction($selected, $name = 'filter_action', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $allowNone = false, $title = 'Select Action' )
{
$list = array();
if($allowAny)
{
$list[] = self::option('', "- ".JText::_( $title )." -", 'value', 'text' );
}
$list[] = JHTML::_('select.option', 'flag_shipping', JText::_( "Use as Default for Shipping" ) );
$list[] = JHTML::_('select.option', 'flag_billing', JText::_( "Use as Default for Billing" ) );
$list[] = JHTML::_('select.option', 'flag_deleted', JText::_( "Delete" ) );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
*
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $attribs
* @param unknown_type $idtag
* @param unknown_type $allowAny
* @return unknown_type
*/
public static function orderstate($selected, $name = 'filter_orderstateid', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false)
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( 'Select State' )." -", 'order_state_id', 'order_state_name' );
}
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'orderstates', 'PrintmeModel' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->order_state_id, JText::_($item->order_state_name), 'order_state_id', 'order_state_name' );
}
return self::genericlist($list, $name, $attribs, 'order_state_id', 'order_state_name', $selected, $idtag );
}
/**
* Generates shipping method type list
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
public static function shippingtype( $selected, $name = 'filter_shipping_method_type', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title = 'Select Shipping Type' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
JLoader::import( 'com_printme.helpers.shipping', JPATH_ADMINISTRATOR.DS.'components' );
$items = PrintmeHelperShipping::getTypes();
foreach ($items as $item)
{
$list[] = JHTML::_('select.option', $item->id, $item->title );
}
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
* Generates a selectlist for shipping methods
*
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $attribs
* @param unknown_type $idtag
* @return unknown_type
*/
public static function shippingmethod( $selected, $name = 'filter_shipping_method', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null )
{
$list = array();
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'shippingmethods', 'PrintmeModel' );
$items = $model->getList();
foreach (@$items as $item)
{
$list[] = self::option( $item->shipping_method_id, JText::_($item->shipping_method_name));
}
return JHTML::_('select.radiolist', $list, $name, $attribs, 'value', 'text', $selected, $idtag);
}
/**
* Generates a selectlist for the specified Product Attribute
*
* @param unknown_type $productattribute_id
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $attribs
* @param unknown_type $idtag
* @return unknown_type
*/
public static function productattributeoptions( $productattribute_id, $selected, $name = 'filter_pao', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null )
{
$list = array();
JModel::addIncludePath( JPATH_ADMINISTRATOR.DS.'components'.DS.'com_printme'.DS.'models' );
$model = JModel::getInstance( 'ProductAttributeOptions', 'PrintmeModel' );
$model->setState( 'filter_attribute', $productattribute_id );
$model->setState('order', 'tbl.ordering');
$items = $model->getList();
foreach (@$items as $item)
{
$display_suffix = ($item->productattributeoption_price > '0') ? ": ".$item->productattributeoption_prefix.PrintmeHelperBase::currency($item->productattributeoption_price) : '';
$display_name = JText::_($item->productattributeoption_name).$display_suffix;
$list[] = self::option( $item->productattributeoption_id, $display_name );
}
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
* Generates a +/- select list for pao prefixes
*
* @param unknown_type $selected
* @param unknown_type $name
* @param unknown_type $attribs
* @param unknown_type $idtag
* @param unknown_type $allowAny
* @param unknown_type $title
* @return unknown_type
*/
public static function productattributeoptionprefix( $selected, $name = 'filter_prefix', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title = 'Select Prefix' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
$list[] = JHTML::_('select.option', '+', "+" );
$list[] = JHTML::_('select.option', '-', "-" );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
/**
* Generates a Period Unit Select List for recurring payments
*
* @param string The value of the HTML name attribute
* @param string Additional HTML attributes for the <select> tag
* @param mixed The key that is selected
* @returns string HTML for the radio list
*/
public static function periodUnit( $selected, $name = 'filter_periodunit', $attribs = array('class' => 'inputbox', 'size' => '1'), $idtag = null, $allowAny = false, $title='Select Period Unit' )
{
$list = array();
if($allowAny) {
$list[] = self::option('', "- ".JText::_( $title )." -" );
}
$list[] = JHTML::_('select.option', 'D', JText::_( "Day" ) );
$list[] = JHTML::_('select.option', 'W', JText::_( "Week" ) );
$list[] = JHTML::_('select.option', 'M', JText::_( "Month" ) );
$list[] = JHTML::_('select.option', 'Y', JText::_( "Year" ) );
return self::genericlist($list, $name, $attribs, 'value', 'text', $selected, $idtag );
}
}