本文整理汇总了PHP中VmHtml::ensureUniqueId方法的典型用法代码示例。如果您正苦于以下问题:PHP VmHtml::ensureUniqueId方法的具体用法?PHP VmHtml::ensureUniqueId怎么用?PHP VmHtml::ensureUniqueId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VmHtml
的用法示例。
在下文中一共展示了VmHtml::ensureUniqueId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInput
protected function getInput()
{
VmConfig::loadConfig();
VmConfig::loadJLang('com_virtuemart');
if (!is_array($this->value)) {
$this->value = array($this->value);
}
$categorylist = ShopFunctions::categoryListTree($this->value);
$name = $this->name;
if ($this->multiple) {
$name = $this->name;
$this->multiple = ' multiple="multiple" ';
}
$id = VmHtml::ensureUniqueId('vmcategories');
$html = '<select id="' . $id . '" class="inputbox" name="' . $name . '" ' . $this->multiple . ' >';
if (!$this->multiple) {
$html .= '<option value="0">' . vmText::_('COM_VIRTUEMART_CATEGORY_FORM_TOP_LEVEL') . '</option>';
}
$html .= $categorylist;
$html .= "</select>";
return $html;
}
示例2: jDate
static function jDate($date = '', $name = "date", $id = NULL, $resetBt = TRUE, $yearRange = '')
{
if ($yearRange) {
$yearRange = 'yearRange: "' . $yearRange . '",';
}
$test = (int) str_replace(array('-', ' ', ':'), '', $date);
if (empty($test)) {
$date = 0;
}
if (empty($id)) {
$id = str_replace(array('[]', '[', ']'), '.', $name);
$id = str_replace('..', '.', $id);
}
static $jDate;
if (!class_exists('VmHtml')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$id = VmHtml::ensureUniqueId($id);
$dateFormat = vmText::_('COM_VIRTUEMART_DATE_FORMAT_INPUT_J16');
//="m/d/y"
$search = array('m', 'd', 'Y');
$replace = array('mm', 'dd', 'yy');
$jsDateFormat = str_replace($search, $replace, $dateFormat);
if ($date) {
$formatedDate = JHtml::_('date', $date, $dateFormat);
} else {
$formatedDate = vmText::_('COM_VIRTUEMART_NEVER');
}
$display = '<input class="datepicker-db" id="' . $id . '" type="hidden" name="' . $name . '" value="' . $date . '" />';
$display .= '<input id="' . $id . '_text" class="datepicker" type="text" value="' . $formatedDate . '" />';
if ($resetBt) {
$display .= '<span class="vmicon vmicon-16-logout icon-nofloat js-date-reset"></span>';
}
// If exist exit
if ($jDate) {
return $display;
}
self::addJScript('datepicker', '
jQuery(document).ready( function($) {
jQuery(document).on( "focus",".datepicker", function() {
jQuery( this ).datepicker({
changeMonth: true,
changeYear: true,
' . $yearRange . '
dateFormat:"' . $jsDateFormat . '",
altField: $(this).prev(),
altFormat: "yy-mm-dd"
});
});
jQuery(document).on( "click",".js-date-reset", function() {
jQuery(this).prev("input").val("' . vmText::_('COM_VIRTUEMART_NEVER') . '").prev("input").val("0");
});
});
');
vmJsApi::css('ui/jquery.ui.all');
$lg = JFactory::getLanguage();
$lang = $lg->getTag();
$vlePath = vmJsApi::setPath('i18n/jquery.ui.datepicker-' . $lang, FALSE, '', $minified = NULL, 'js', true);
if (!file_exists($vlePath) or is_dir($vlePath)) {
$lang = 'en-GB';
}
vmJsApi::addJScript('i18n/jquery.ui.datepicker-' . $lang);
$jDate = TRUE;
return $display;
}
示例3: renderVendorFullVendorList
public static function renderVendorFullVendorList($vendorId, $multiple = false, $name = 'virtuemart_vendor_id')
{
$db = JFactory::getDBO();
$q = 'SELECT `virtuemart_vendor_id`,`vendor_name` FROM #__virtuemart_vendors';
$db->setQuery($q);
$vendors = $db->loadAssocList();
$attrs = array();
if (!class_exists('VmHtml')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$id = VmHtml::ensureUniqueId('vendor_name' . $vendorId);
$idA = $name;
$attrs['class'] = 'vm-chzn-select';
if ($multiple) {
$attrs['multiple'] = 'multiple';
$idA .= '[]';
} else {
$emptyOption = JHtml::_('select.option', '', vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION'), 'virtuemart_vendor_id', 'vendor_name');
array_unshift($vendors, $emptyOption);
}
$listHTML = JHtml::_('select.genericlist', $vendors, $idA, $attrs, 'virtuemart_vendor_id', 'vendor_name', $vendorId, $id);
return $listHTML;
}
示例4: displayProductCustomfieldFE
/**
* @author Max Milbers
* @param $product
* @param $customfield
*/
public function displayProductCustomfieldFE(&$product, &$customfields)
{
if (!class_exists('calculationHelper')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'calculationh.php';
}
$calculator = calculationHelper::getInstance();
$selectList = array();
$dynChilds = 1;
//= array();
$session = JFactory::getSession();
$virtuemart_category_id = $session->get('vmlastvisitedcategoryid', 0, 'vm');
foreach ($customfields as $k => &$customfield) {
if (!isset($customfield->display)) {
$customfield->display = '';
}
$calculator->_product = $product;
if (!class_exists('vmCustomPlugin')) {
require VMPATH_PLUGINLIBS . DS . 'vmcustomplugin.php';
}
if ($customfield->field_type == "E") {
JPluginHelper::importPlugin('vmcustom');
$dispatcher = JDispatcher::getInstance();
$ret = $dispatcher->trigger('plgVmOnDisplayProductFEVM3', array(&$product, &$customfield));
continue;
}
$fieldname = 'field[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_customfield_id . '][customfield_value]';
$customProductDataName = 'customProductData[' . $product->virtuemart_product_id . '][' . $customfield->virtuemart_custom_id . ']';
//This is a kind of fallback, setting default of custom if there is no value of the productcustom
$customfield->customfield_value = empty($customfield->customfield_value) ? $customfield->custom_value : $customfield->customfield_value;
$type = $customfield->field_type;
$idTag = (int) $product->virtuemart_product_id . '-' . $customfield->virtuemart_customfield_id;
$idTag = $idTag . 'customProductData';
$idTag = VmHtml::ensureUniqueId($idTag);
if (!class_exists('CurrencyDisplay')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'currencydisplay.php';
}
$currency = CurrencyDisplay::getInstance();
switch ($type) {
case 'C':
$html = '';
$dropdowns = array();
if (isset($customfield->options->{$product->virtuemart_product_id})) {
$productSelection = $customfield->options->{$product->virtuemart_product_id};
} else {
$productSelection = false;
}
$ignore = array();
foreach ($customfield->options as $product_id => $variants) {
foreach ($variants as $k => $variant) {
//if(in_array($variant,$ignore)){ vmdebug('Product to ignore, continue',$product_id,$k,$variant);continue;}
if (!isset($dropdowns[$k]) or !is_array($dropdowns[$k])) {
$dropdowns[$k] = array();
}
if (!in_array($variant, $dropdowns[$k])) {
if ($k == 0 or !$productSelection) {
$dropdowns[$k][] = $variant;
} else {
if ($k > 0 and $productSelection[$k - 1] == $variants[$k - 1]) {
$break = false;
for ($h = 1; $h <= $k; $h++) {
if ($productSelection[$h - 1] != $variants[$h - 1]) {
//$ignore[] = $variant;
$break = true;
}
}
if (!$break) {
$dropdowns[$k][] = $variant;
}
} else {
// break;
}
}
}
}
}
$tags = array();
foreach ($customfield->selectoptions as $k => $soption) {
$options = array();
$selected = false;
foreach ($dropdowns[$k] as $i => $elem) {
$elem = trim((string) $elem);
$text = $elem;
if ($soption->clabel != '' and in_array($soption->voption, self::$dimensions)) {
$rd = $soption->clabel;
if (is_numeric($rd) and is_numeric($elem)) {
$text = number_format(round((double) $elem, (int) $rd), $rd);
}
//vmdebug('($dropdowns[$k] in DIMENSION value = '.$elem.' r='.$rd.' '.$text);
} else {
if ($soption->voption === 'clabels' and $soption->clabel != '') {
$text = vmText::_($elem);
}
}
if ($elem == '0') {
$text = vmText::_('COM_VIRTUEMART_LIST_EMPTY_OPTION');
//.........这里部分代码省略.........
示例5: getLimitBox
function getLimitBox($sequence = 0)
{
$app = JFactory::getApplication();
// Initialize variables
$limits = array();
$selected = $this->limit;
// Build the select list
if ($app->isAdmin()) {
if (empty($sequence)) {
$sequence = VmConfig::get('pagseq', 0);
}
if (!empty($sequence)) {
$sequenceArray = explode(',', $sequence);
if (count($sequenceArray > 1)) {
foreach ($sequenceArray as $items) {
$limits[$items] = JHtml::_('select.option', $items);
}
}
}
if (empty($limits)) {
$limits[15] = JHtml::_('select.option', 15);
$limits[30] = JHtml::_('select.option', 30);
$limits[50] = JHtml::_('select.option', 50);
$limits[100] = JHtml::_('select.option', 100);
$limits[200] = JHtml::_('select.option', 200);
$limits[400] = JHtml::_('select.option', 400);
}
if (!array_key_exists($this->limit, $limits)) {
$limits[$this->limit] = JHtml::_('select.option', $this->limit);
ksort($limits);
}
$namespace = 'Joomla.';
$id = VmHtml::ensureUniqueId('limit');
$html = JHtml::_('select.genericlist', $limits, 'limit', 'class="inputbox" size="1" onchange="' . $namespace . 'submitform();"', 'value', 'text', $selected, $id);
} else {
$getArray = vRequest::getGet();
$link = '';
unset($getArray['limit']);
foreach ($getArray as $key => $value) {
if (is_array($value)) {
foreach ($value as $k => $v) {
$link .= '&' . urlencode($key) . '[' . urlencode($k) . ']' . '=' . urlencode($v);
}
} else {
$link .= '&' . urlencode($key) . '=' . urlencode($value);
}
}
$link = 'index.php?' . ltrim($link, '&');
if (empty($sequence)) {
$sequence = VmConfig::get('pagseq_' . $this->_perRow);
}
if (!empty($sequence)) {
$sequenceArray = explode(',', $sequence);
if (count($sequenceArray > 1)) {
foreach ($sequenceArray as $items) {
$limits[$items] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $items, false), $items);
}
}
}
if (empty($limits) or !is_array($limits)) {
if ($this->_perRow === 1) {
$this->_perRow = 5;
}
$limits[$this->_perRow * 5] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 5, false), $this->_perRow * 5);
$limits[$this->_perRow * 10] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 10, false), $this->_perRow * 10);
$limits[$this->_perRow * 20] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 20, false), $this->_perRow * 20);
$limits[$this->_perRow * 50] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->_perRow * 50, false), $this->_perRow * 50);
}
if (!array_key_exists($this->limit, $limits)) {
$limits[$this->limit] = JHtml::_('select.option', JRoute::_($link . '&limit=' . $this->limit, false), $this->limit);
ksort($limits);
}
$selected = JRoute::_($link . '&limit=' . $selected, false);
$js = 'onchange="window.top.location.href=this.options[this.selectedIndex].value"';
$id = VmHtml::ensureUniqueId('limit');
$html = JHtml::_('select.genericlist', $limits, '', 'class="inputbox" size="1" ' . $js, 'value', 'text', $selected, $id);
}
return $html;
}