本文整理汇总了PHP中vmJsApi::writeJS方法的典型用法代码示例。如果您正苦于以下问题:PHP vmJsApi::writeJS方法的具体用法?PHP vmJsApi::writeJS怎么用?PHP vmJsApi::writeJS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vmJsApi
的用法示例。
在下文中一共展示了vmJsApi::writeJS方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
public function display($tpl = null)
{
$view = vRequest::getCmd('view', vRequest::getCmd('controller', 'virtuemart'));
if ($view == 'virtuemart' or $view == 'about' or $this->canDo->get('core.admin') or $this->canDo->get('vm.' . $view)) {
//Super administrators always have access
if (JFactory::getApplication()->isSite()) {
$unoverridable = array('category', 'manufacturer', 'user');
//This views have the same name and must not be overridable
if (!in_array($view, $unoverridable)) {
if (!class_exists('VmTemplate')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
}
$template = VmTemplate::getDefaultTemplate();
$this->addTemplatePath(VMPATH_ROOT . DS . 'templates' . DS . $template['template'] . DS . 'html' . DS . 'com_virtuemart' . DS . $this->_name);
}
}
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs) {
vmJsApi::keepAlive();
echo vmJsApi::writeJS();
}
return true;
} else {
JFactory::getApplication()->redirect('index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
}
}
示例2: display
public function display($tpl = null)
{
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs and get_class($this) != 'VirtueMartViewProductdetails') {
echo vmJsApi::writeJS();
}
}
示例3: display
public function display($tpl = null)
{
if ($this->isMail or $this->isPdf) {
$this->writeJs = false;
}
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs) {
self::withKeepAlive();
if (get_class($this) != 'VirtueMartViewProductdetails') {
echo vmJsApi::writeJS();
}
}
}
示例4: display
public function display($tpl = null)
{
if ($this->isMail or $this->isPdf) {
$this->writeJs = false;
}
if (!class_exists('VmHTML')) {
require VMPATH_ADMIN . DS . 'helpers' . DS . 'html.php';
}
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs) {
self::withKeepAlive();
if (get_class($this) != 'VirtueMartViewProductdetails') {
echo vmJsApi::writeJS();
}
}
vmTime('vm view Finished task ', 'Start');
}
示例5: display
public function display($tpl = null)
{
$view = vRequest::getCmd('view', vRequest::getCmd('controller','virtuemart'));
if ($view == 'virtuemart' //Virtuemart view is always allowed since this is the page we redirect to in case the user does not have the rights
or $view == 'about' //About view always displayed
or $this->canDo->get('core.admin')
or $this->canDo->get('vm.'.$view) ) { //Super administrators always have access
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
echo vmJsApi::writeJS();
return true;
} else {
JFactory::getApplication()->redirect( 'index.php?option=com_virtuemart', vmText::_('JERROR_ALERTNOAUTHOR'), 'error');
}
}
示例6: display
public function display($tpl = null)
{
$view = vRequest::getCmd('view', vRequest::getCmd('controller', 'virtuemart'));
if ($view == 'virtuemart' || $view == 'about' || $this->canDo->get('core.admin')) {
//Super administrators always have access
parent::display($tpl);
if ($this->writeJs) {
echo vmJsApi::writeJS();
}
return;
}
//Super administrator always has access
if ($this->canDo->get('core.admin')) {
parent::display($tpl);
if ($this->writeJs) {
echo vmJsApi::writeJS();
}
return;
}
if (!$this->canDo->get('vm.' . $view)) {
JFactory::getApplication()->redirect('index.php?option=com_virtuemart', JText::_('JERROR_ALERTNOAUTHOR'), 'error');
}
parent::display($tpl);
}
示例7: display
//.........这里部分代码省略.........
$close_ui_dialog_id = $input->get('ui_dialog_id', '', 'string');
$parent_ui_dialog_id = $input->get('ui_dialog_id', '', 'string');
$link_reload = $input->get('link_redirect', base64_encode('index.php?option=com_tsmart&view=' . $view), 'string');
$parent_iframe_id = $input->get('iframe_id', '', 'string');
$reload_iframe_id = $input->get('reload_iframe_id', '', 'string');
$remove_ui_dialog = $input->get('remove_ui_dialog', false, 'boolean');
$small_form = $input->get('small_form', 0, 'int');
if ($this->show_in_parent_window == 1) {
$doc->addScript(JUri::root() . '/administrator/components/com_tsmart/assets/js/asianventure_edit_from.js');
$doc->addScript(JUri::root() . '/media/system/js/base64.js');
$doc->addLessStyleSheet(JUri::root() . '/administrator/components/com_tsmart/assets/less/view_component.less');
$js_content = '';
ob_start();
?>
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('.admin.com_tsmart.view-<?php
echo $view;
?>
').asianventure_edit_from({
show_in_parent_window:<?php
echo $this->show_in_parent_window == 1 ? 1 : 0;
?>
,
view_height:<?php
echo $this->view_height ? $this->view_height : 0;
?>
,
close_window_children:<?php
echo $this->close_window_children;
?>
,
dialog_element_id:'<?php
echo $dialog_element_id;
?>
',
link_reload:'<?php
echo $link_reload;
?>
',
parent_iframe_id:'<?php
echo $parent_iframe_id;
?>
',
parent_ui_dialog_id:'<?php
echo $parent_ui_dialog_id;
?>
',
close_ui_dialog_id:'<?php
echo $close_ui_dialog_id;
?>
',
reload_iframe_id:'<?php
echo $reload_iframe_id;
?>
',
remove_ui_dialog:'<?php
echo json_encode($remove_ui_dialog);
?>
',
small_form:<?php
echo $small_form;
?>
});
});
</script>
<?php
$js_content = ob_get_clean();
require_once JPATH_ROOT . '/administrator/components/com_tsmart/helpers/utility.php';
$js_content = TSMUtility::remove_string_javascript($js_content);
$doc->addScriptDeclaration($js_content);
}
if ($view == 'tsmart' or $view == 'about' or $this->manager($view)) {
//or $this->canDo->get('core.admin')
//or $this->canDo->get('vm.'.$view) ) { //Super administrators always have access
if (JFactory::getApplication()->isSite()) {
$unoverridable = array('category', 'manufacturer', 'user');
//This views have the same name and must not be overridable
if (!in_array($view, $unoverridable)) {
if (!class_exists('VmTemplate')) {
require VMPATH_SITE . DS . 'helpers' . DS . 'vmtemplate.php';
}
$template = VmTemplate::getDefaultTemplate();
$this->addTemplatePath(VMPATH_ROOT . DS . 'templates' . DS . $template['template'] . DS . 'html' . DS . 'com_tsmart' . DS . $this->_name);
}
}
$result = $this->loadTemplate($tpl);
if ($result instanceof Exception) {
return $result;
}
echo $result;
if ($this->writeJs) {
vmJsApi::keepAlive();
echo vmJsApi::writeJS();
}
return true;
} else {
JFactory::getApplication()->redirect('index.php?option=com_tsmart', tsmText::_('JERROR_ALERTNOAUTHOR'), 'error');
}
}
示例8: jQuery
$jsVars = ' jQuery(document).ready(function(){
jQuery(".vmCartModule").productUpdate();
});' ;
//vmJsApi::addJScript('vm.CartModule.UpdateProduct',$jsVars);
//This is strange we have the whole thing again in controllers/cart.php public function viewJS()
if(!class_exists('VirtueMartCart')) require(VMPATH_SITE.DS.'helpers'.DS.'cart.php');
$cart = VirtueMartCart::getCart(false);
$viewName = vRequest::getString('view',0);
if($viewName=='cart'){
$checkAutomaticPS = true;
} else {
$checkAutomaticPS = false;
}
$data = $cart->prepareAjaxData($checkAutomaticPS);
if (!class_exists('CurrencyDisplay')) require(VMPATH_ADMIN . DS. 'helpers' . DS . 'currencydisplay.php');
$currencyDisplay = CurrencyDisplay::getInstance( );
vmJsApi::cssSite();
$moduleclass_sfx = $params->get('moduleclass_sfx', '');
$show_price = (bool)$params->get( 'show_price', 1 ); // Display the Product Price?
$show_product_list = (bool)$params->get( 'show_product_list', 1 ); // Display the Product Price?
require(JModuleHelper::getLayoutPath('mod_virtuemart_cart'));
echo vmJsApi::writeJS();
?>
示例9: get_store
function get_store($config, $id)
{
if ($this->mode != 'com_virtuemart') {
return array("price" => '', "cart" => '');
} else {
// if the VM is available
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
}
VmConfig::loadConfig();
// Load the language file of com_virtuemart.
JFactory::getLanguage()->load('com_virtuemart');
// load necessary classes
if (!class_exists('calculationHelper')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
}
if (!class_exists('VmImage')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('shopFunctionsF')) {
require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
if (!class_exists('calculationHelper')) {
require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('VirtueMartModelProduct')) {
JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
}
// load the base
$productModel = new VirtueMartModelProduct();
$product = $productModel->getProduct($id, 100, true, true, true);
$currency = CurrencyDisplay::getInstance();
$price = '<strong>' . $currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices, true) . '</strong>';
if ($config['vm_add_to_cart'] == 1) {
vmJsApi::jPrice();
vmJsApi::writeJS();
}
$news_price = '<div class="PricebasePriceWithTax">';
//
if ($config['vm_show_price_type'] != 'none') {
if ($config['vm_display_type'] == 'text_price') {
$news_price .= '<span class="PricebasePriceWithTax">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE') . ' ' . $price . '</span>';
} else {
$news_price .= '<span class="PricebasePriceWithTax">' . $price . '</span>';
}
}
$news_price .= '</div>';
// display discount
if ($config['vm_show_discount_amount'] == 1) {
$disc_amount = $currency->priceDisplay($product->prices['discountAmount'], $currency->getId());
$news_price .= '<div class="PricetaxAmount">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_DISCOUNT_AMOUNT') . $disc_amount . '</div>';
}
// display tax
if ($config['vm_show_tax'] == 1) {
$taxAmount = $currency->priceDisplay($product->prices['taxAmount'], $currency->getId());
$news_price .= '<div class="PricetaxAmount">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_TAX_AMOUNT') . $taxAmount . '</div>';
}
$news_cart = '';
// 'Add to cart' button
if ($config['vm_add_to_cart'] == 1) {
$code = '<div class="addtocart-area">';
$code .= '<form method="post" class="product" action="index.php">';
$code .= '<div class="addtocart-bar">';
$code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>';
$addtoCartButton = '';
if ($product->addToCartButton) {
$addtoCartButton = $product->addToCartButton;
} else {
$addtoCartButton = shopFunctionsF::getAddToCartButton($product->orderable);
}
$code .= $addtoCartButton;
$code .= '</div>
<input type="hidden" class="pname" value="' . $product->product_name . '"/>
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<input type="hidden" name="task" value="add" />
<input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
<input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
</form>';
$code .= '</div>';
$news_cart .= $code;
}
// results
return array("price" => $news_price, "cart" => $news_cart);
}
}
示例10: store
static function store($config, $item)
{
// Load the language file of com_virtuemart.
JFactory::getLanguage()->load('com_virtuemart');
// Load path constant
if (!defined('VMPATH_ADMIN')) {
define('VMPATH_ADMIN', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart');
}
// Load VM configuration if necessary
if (!class_exists('VmConfig')) {
require JPATH_ROOT . DS . 'administrator' . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'config.php';
VmConfig::loadConfig();
}
// load necessary classes
if (!class_exists('calculationHelper')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'calculationh.php';
}
if (!class_exists('CurrencyDisplay')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'currencydisplay.php';
}
if (!class_exists('VirtueMartModelVendor')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models' . DS . 'vendor.php';
}
if (!class_exists('VmImage')) {
require JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'image.php';
}
if (!class_exists('shopFunctionsF')) {
require JPATH_SITE . DS . 'components' . DS . 'com_virtuemart' . DS . 'helpers' . DS . 'shopfunctionsf.php';
}
if (!class_exists('calculationHelper')) {
require JPATH_COMPONENT_SITE . DS . 'helpers' . DS . 'cart.php';
}
if (!class_exists('VirtueMartModelProduct')) {
JLoader::import('product', JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_virtuemart' . DS . 'models');
}
// load the base
$productModel = new VirtueMartModelProduct();
$product = $productModel->getProduct($item['id'], 100, true, true, true);
$currency = CurrencyDisplay::getInstance();
$price = '<strong>' . $currency->createPriceDiv($config['vm_show_price_type'], '', $product->prices, true) . '</strong>';
if ($config['vm_add_to_cart'] == 1 && JRequest::getCmd('option') != 'com_virtuemart') {
vmJsApi::jPrice();
vmJsApi::addJScript('facebox');
vmJsApi::css('facebox');
vmJsApi::writeJS();
}
$news_price = '<div>';
//
if ($config['vm_show_price_type'] != 'none') {
if ($config['vm_display_type'] == 'text_price') {
$news_price .= '<span>' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_PRICE') . ' ' . $price . '</span>';
} else {
$news_price .= '<span>' . $price . '</span>';
}
}
// 'Add to cart' button
if ($config['vm_add_to_cart'] == 1) {
if (isset($product->customfields) && count($product->customfields)) {
foreach ($product->customfields as $field) {
if (isset($field->is_cart_attribute) && $field->is_cart_attribute == 1 || isset($field->layout_pos) && $field->layout_pos == 'addtocart') {
$product->orderable = 0;
break;
}
}
}
$code = '<div class="addtocart-area">';
if ($product->orderable != 0) {
$code .= '<form method="post" class="product" action="index.php">';
} else {
$code .= '<form method="post" class="product-variant" action="' . static::itemLink($item, $config) . '">';
}
$code .= '<div class="addtocart-bar">';
$code .= '<span class="quantity-box" style="display: none"><input type="text" class="quantity-input" name="quantity[]" value="1" /></span>';
$addtoCartButton = '';
if ($product->addToCartButton) {
$addtoCartButton = $product->addToCartButton;
} else {
$addtoCartButton = shopFunctionsF::getAddToCartButton($product->orderable);
}
$code .= str_replace('addtocart-button-disabled"', 'addtocart-button" type="submit"', $addtoCartButton);
if ($product->orderable != 0) {
$code .= '</div>
<input type="hidden" class="pname" value="' . $product->product_name . '"/>
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" name="virtuemart_product_id[]" value="' . $product->virtuemart_product_id . '" />
<input type="hidden" name="virtuemart_category_id[]" value="' . $product->virtuemart_category_id . '" />
</form>';
} else {
$code .= '</div></form>';
}
$code .= '</div>';
$news_price .= $code;
}
// display discount
if ($config['vm_show_discount_amount'] == 1) {
$disc_amount = $currency->priceDisplay($product->prices['discountAmount'], $currency->getId());
$news_price .= '<small class="nspDiscount">' . JText::_('MOD_NEWS_PRO_GK5_PRODUCT_DISCOUNT_AMOUNT') . $disc_amount . '</small>';
}
//.........这里部分代码省略.........
示例11: addtocart
public static function addtocart($product)
{
if (!class_exists('VmConfig')) {
require JPATH_ADMINISTRATOR . '/components/com_virtuemart/helpers/config.php';
}
VmConfig::loadConfig();
vmJsApi::jPrice();
if (version_compare(JVM_VERSION, 3, 'ge')) {
echo vmJsApi::writeJS();
}
if (!VmConfig::get('use_as_catalog', 0)) {
$add_to_cart = '<form method="post" class="product" action="index.php">
<span class="addtocart-button">
<input type="submit" name="addtocart" class="bt-addtocart addtocart-button" value="' . JText::_('Add cart') . '" title="' . sprintf(JText::_('ADD_PRODUCT_TO_CART'), $product->name) . '" />
</span>
<input type="hidden" class="pname" value="' . $product->name . '"/>
<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="view" value="cart" />
<noscript><input type="hidden" name="task" value="add" /></noscript>
<input type="hidden" class="quantity-input" name="quantity[]" value="1" />
<input type="hidden" name="virtuemart_product_id[]" value="' . $product->id . '" />
<input type="hidden" name="virtuemart_category_id[]" value="' . $product->category_id . '" />
</form>';
return $add_to_cart;
}
return false;
}