本文整理汇总了PHP中Cx\Core\Html\Sigma::replaceBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Sigma::replaceBlock方法的具体用法?PHP Sigma::replaceBlock怎么用?PHP Sigma::replaceBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cx\Core\Html\Sigma
的用法示例。
在下文中一共展示了Sigma::replaceBlock方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setMotives
function setMotives()
{
global $objDatabase, $_ARRAYLANG;
\JS::activate('shadowbox');
$this->_objTpl->loadTemplateFile('module_ecard_overview.html', true, true);
$this->_pageTitle = $_ARRAYLANG['TXT_MOTIVE_SELECTION'];
$mediaBrowser = new \Cx\Core_Modules\MediaBrowser\Model\Entity\MediaBrowser();
$mediaBrowser->setCallback('mbCallback');
$mediaBrowser->setOptions(array('type' => 'button', 'data-cx-mb-views' => 'filebrowser', 'id' => 'mediabrowser_button', 'style' => 'display: none;'));
/* Update progress */
if (!empty($_POST['saveMotives'])) {
$i = 0;
$motiveInputArray = $_POST['motiveInputArray'];
while ($i < 9) {
$filepath = $motiveInputArray[$i];
$filename = basename($filepath);
$query = "\n UPDATE " . DBPREFIX . "module_ecard_settings\n SET setting_value='" . contrexx_addslashes($filename) . "'\n WHERE setting_name='motive_{$i}'";
$objResult = $objDatabase->Execute($query);
/* Create optimized picture for e-card dispatch */
if ($filepath != '' && file_exists(\Env::get('cx')->getWebsitePath() . $filepath)) {
$this->resizeMotive(2, \Env::get('cx')->getWebsitePath() . $filepath, ASCMS_ECARD_OPTIMIZED_PATH . '/');
$this->resizeMotive(1, \Env::get('cx')->getWebsitePath() . $filepath, ASCMS_ECARD_THUMBNAIL_PATH . '/');
}
++$i;
}
$this->_objTpl->setVariable(array('CONTENT_OK_MESSAGE' => $this->strOkMessage = $_ARRAYLANG['TXT_DATA_SAVED']));
}
$this->_objTpl->setGlobalVariable(array('TXT_SAVE' => $_ARRAYLANG['TXT_SAVE'], 'TXT_DELETE_MOTIVE' => $_ARRAYLANG['TXT_DELETE_MOTIVE'], 'TXT_PICTURE' => $_ARRAYLANG['TXT_PICTURE'], 'TXT_PATH' => $_ARRAYLANG['TXT_PATH'], 'TXT_BROWSE' => $_ARRAYLANG['TXT_BROWSE'], 'TXT_CHOOSE' => $_ARRAYLANG['TXT_CHOOSE'], 'TXT_DELETE' => $_ARRAYLANG['TXT_DELETE'], 'TXT_ECARD_IMAGES' => $_ARRAYLANG['TXT_ECARD_IMAGES'], 'MEDIABROWSER_BUTTON' => $mediaBrowser->getXHtml($_ARRAYLANG['TXT_CORE_CM_BROWSE'])));
/* Display progress */
$query = "\n SELECT `setting_value`\n FROM " . DBPREFIX . "module_ecard_settings\n WHERE setting_name LIKE 'motive_%'\n ORDER BY setting_name ASC";
$objResult = $objDatabase->Execute($query);
$i = 0;
/* Create thumbnails */
while (!$objResult->EOF) {
$motiveFilename = $objResult->fields['setting_value'];
$thumbnail = ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . "no_picture.gif";
$sourcePath = '';
if ($motiveFilename != '') {
$sourcePath = ASCMS_ECARD_OPTIMIZED_WEB_PATH . '/' . $motiveFilename;
$thumbnail = ASCMS_ECARD_THUMBNAIL_WEB_PATH . '/' . $motiveFilename;
}
/* Initialize DATA placeholder */
$this->_objTpl->setVariable(array('MOTIVE_PATH' => $sourcePath, 'MOTIVE_THUMB_PATH' => $thumbnail, 'MOTIVE_ID' => $i++));
$this->_objTpl->parse('motiveBlock');
$objResult->MoveNext();
}
$this->_objTpl->replaceBlock('motiveBlock', '', true);
}
示例2: edit
/**
* Edit coupons
* @param \Cx\Core\Html\Sigma $objTemplate The Template
*/
static function edit($objTemplate)
{
global $_ARRAYLANG;
//DBG::activate(DBG_ADODB|DBG_LOG_FIREPHP|DBG_PHP);
$result = true;
if (isset($_GET['delete'])) {
list($code, $customer_id) = explode('-', $_GET['delete']);
$result &= self::delete(contrexx_input2raw($code), intval($customer_id));
}
$edit = isset($_REQUEST['edit']) ? contrexx_input2raw($_REQUEST['edit']) : null;
//DBG::log("Edit: ".($edit ? $edit : 'NULL'));
$code = isset($_POST['code']) ? contrexx_input2raw($_POST['code']) : null;
$payment_id = empty($_POST['payment_id']) ? 0 : intval($_POST['payment_id']);
$start_time = empty($_POST['start_date']) ? 0 : strtotime(contrexx_input2raw($_POST['start_date']));
$end_time = empty($_POST['end_date_unlimited']) ? empty($_POST['end_date']) ? 0 : strtotime(contrexx_input2raw($_POST['end_date'])) : 0;
$coupon_type = empty($_POST['coupon_type']) ? null : contrexx_input2raw($_POST['coupon_type']);
$discount_rate = intval(empty($_POST['discount_rate']) ? 0 : floatval($_POST['discount_rate']));
$discount_amount = Currency::formatPrice(empty($_POST['discount_amount']) ? 0 : floatval($_POST['discount_amount']));
if ($coupon_type == 'rate') {
$discount_amount = 0;
}
if ($coupon_type == 'amount') {
$discount_rate = 0;
}
$minimum_amount = Currency::formatPrice(empty($_POST['minimum_amount']) ? 0 : floatval($_POST['minimum_amount']));
$uses = empty($_POST['unlimited']) ? empty($_POST['uses']) ? 1 : intval($_POST['uses']) : self::USES_UNLIMITED;
$customer_id = empty($_POST['customer_id']) ? 0 : intval($_POST['customer_id']);
$product_id = empty($_POST['product_id']) ? 0 : intval($_POST['product_id']);
$global = !empty($_POST['global_or_customer']);
//DBG::log("code $code, start_time $start_time, end_time $end_time, minimum amount $minimum_amount, discount_rate $discount_rate, discount_amount $discount_amount, uses $uses, customer_id $customer_id");
if (isset($code)) {
$result &= self::storeCode($code, $payment_id, $minimum_amount, $discount_rate, $discount_amount, $start_time, $end_time, $uses, $global, $customer_id, $product_id, $edit);
if ($result) {
$code = $edit = null;
} else {
if (empty($edit)) {
$edit = "{$code}-{$customer_id}";
}
}
}
// Reset the end time if it's in the past
if ($end_time < time()) {
$end_time = 0;
}
$uri = \Html::getRelativeUri();
\Html::stripUriParam($uri, 'view');
\Html::stripUriParam($uri, 'edit');
\Html::stripUriParam($uri, 'order_coupon');
$arrSortingFields = array('code' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CODE'], 'start_time' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_START_TIME'], 'end_time' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_END_TIME'], 'minimum_amount' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'discount_rate' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_RATE'], 'discount_amount' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'uses' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_USES'], 'global' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_SCOPE'], 'customer_id' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CUSTOMER'], 'product_id' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PRODUCT'], 'payment_id' => $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PAYMENT']);
$objSorting = new \Sorting($uri, $arrSortingFields, true, 'order_coupon');
$objTemplate->setGlobalVariable($_ARRAYLANG + array('TXT_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_CURRENCY' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'TXT_SHOP_DISCOUNT_COUPON_AMOUNT_CURRENCY' => sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_AMOUNT_FORMAT'], Currency::getDefaultCurrencyCode()), 'TXT_SHOP_DISCOUNT_COUPON_ADD_OR_EDIT' => $_ARRAYLANG[$edit ? 'TXT_SHOP_DISCOUNT_COUPON_EDIT' : 'TXT_SHOP_DISCOUNT_COUPON_ADD'], 'SHOP_DISCOUNT_COUPON_VIEW_ACTIVE' => $edit ? '' : 'active', 'SHOP_DISCOUNT_COUPON_EDIT_ACTIVE' => $edit ? 'active' : '', 'SHOP_DISCOUNT_COUPON_VIEW_DISPLAY' => $edit ? 'none' : 'block', 'SHOP_DISCOUNT_COUPON_EDIT_DISPLAY' => $edit ? 'block' : 'none', 'HEADER_SHOP_DISCOUNT_COUPON_CODE' => $objSorting->getHeaderForField('code'), 'HEADER_SHOP_DISCOUNT_COUPON_START_TIME' => $objSorting->getHeaderForField('start_time'), 'HEADER_SHOP_DISCOUNT_COUPON_END_TIME' => $objSorting->getHeaderForField('end_time'), 'HEADER_SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT_CURRENCY' => $objSorting->getHeaderForField('minimum_amount'), 'HEADER_SHOP_DISCOUNT_COUPON_RATE' => $objSorting->getHeaderForField('discount_rate'), 'HEADER_SHOP_DISCOUNT_COUPON_AMOUNT_CURRENCY' => $objSorting->getHeaderForField('discount_amount'), 'HEADER_SHOP_DISCOUNT_COUPON_USES' => $objSorting->getHeaderForField('uses'), 'HEADER_SHOP_DISCOUNT_COUPON_SCOPE' => $objSorting->getHeaderForField('global'), 'HEADER_SHOP_DISCOUNT_COUPON_CUSTOMER' => $objSorting->getHeaderForField('customer_id'), 'HEADER_SHOP_DISCOUNT_COUPON_PRODUCT' => $objSorting->getHeaderForField('product_id'), 'HEADER_SHOP_DISCOUNT_COUPON_PAYMENT' => $objSorting->getHeaderForField('payment_id')));
$count = 0;
$limit = \Cx\Core\Setting\Controller\Setting::getValue('numof_coupon_per_page_backend', 'Shop');
if (empty($limit)) {
self::errorHandler();
}
$arrCoupons = self::getArray(\Paging::getPosition(), $limit, $count, $objSorting->getOrder());
$arrProductName = Products::getNameArray(true, $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PRODUCT_FORMAT']);
$arrPaymentName = Payment::getNameArray();
$i = 0;
$row = 0;
$objCouponEdit = new Coupon();
$objCouponEdit->code($code);
$objCouponEdit->payment_id($payment_id);
$objCouponEdit->minimum_amount($minimum_amount);
$objCouponEdit->discount_rate($discount_rate);
$objCouponEdit->discount_amount($discount_amount);
$objCouponEdit->start_time($start_time);
$objCouponEdit->end_time($end_time);
$objCouponEdit->uses($uses);
$objCouponEdit->is_global($global);
$objCouponEdit->customer_id($customer_id);
$objCouponEdit->product_id($product_id);
global $_CONFIG;
foreach ($arrCoupons as $index => $objCoupon) {
$coupon_uri_id = 'coupon_uri_' . $index;
$objTemplate->setVariable(array('SHOP_ROWCLASS' => 'row' . (++$row % 2 + 1), 'SHOP_DISCOUNT_COUPON_CODE' => $objCoupon->code, 'SHOP_DISCOUNT_COUPON_URI_ICON' => '<div class="icon_url"' . '> </div>', 'SHOP_DISCOUNT_COUPON_URI_INPUT' => '<div class="layer_url" id="' . $coupon_uri_id . '">' . \Html::getInputText('dummy', 'http://' . $_CONFIG['domainUrl'] . \Cx\Core\Core\Controller\Cx::instanciate()->getWebsiteOffsetPath() . '/' . CONTREXX_DIRECTORY_INDEX . '?section=Shop' . MODULE_INDEX . '&coupon_code=' . $objCoupon->code, false, 'readonly="readonly"' . ' style="width: 200px;"' . ' onfocus="this.select();"' . ' onblur="cx.jQuery(\'#' . $coupon_uri_id . '\').hide();"') . '</div>', 'SHOP_DISCOUNT_COUPON_START_TIME' => $objCoupon->start_time ? date(ASCMS_DATE_FORMAT_DATE, $objCoupon->start_time) : $_ARRAYLANG['TXT_SHOP_DATE_NONE'], 'SHOP_DISCOUNT_COUPON_END_TIME' => $objCoupon->end_time ? date(ASCMS_DATE_FORMAT_DATE, $objCoupon->end_time) : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_END_TIME_UNLIMITED'], 'SHOP_DISCOUNT_COUPON_MINIMUM_AMOUNT' => $objCoupon->minimum_amount > 0 ? $objCoupon->minimum_amount : $_ARRAYLANG['TXT_SHOP_AMOUNT_NONE'], 'SHOP_DISCOUNT_COUPON_RATE' => $objCoupon->discount_rate > 0 ? $objCoupon->discount_rate : $_ARRAYLANG['TXT_SHOP_RATE_NONE'], 'SHOP_DISCOUNT_COUPON_AMOUNT' => $objCoupon->discount_amount > 0 ? $objCoupon->discount_amount : $_ARRAYLANG['TXT_SHOP_AMOUNT_NONE'], 'SHOP_DISCOUNT_COUPON_USES' => sprintf($_ARRAYLANG['TXT_SHOP_COUPON_USES_FORMAT'], $objCoupon->used, $objCoupon->uses < 1000000000.0 ? $objCoupon->uses : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_USES_UNLIMITED']), 'SHOP_DISCOUNT_COUPON_SCOPE' => $objCoupon->global ? $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_GLOBALLY'] : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PER_CUSTOMER'], 'SHOP_DISCOUNT_COUPON_PER_CUSTOMER' => !$objCoupon->global ? \Html::getRadio('foo_' . ++$i, '', false, true, '', \Html::ATTRIBUTE_DISABLED) : ' ', 'SHOP_DISCOUNT_COUPON_CUSTOMER' => $objCoupon->customer_id ? Customers::getNameById($objCoupon->customer_id, '%4$s (%3$u)') : $_ARRAYLANG['TXT_SHOP_CUSTOMER_ANY'], 'SHOP_DISCOUNT_COUPON_PRODUCT' => $objCoupon->product_id ? isset($arrProductName[$objCoupon->product_id]) ? $arrProductName[$objCoupon->product_id] : $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PRODUCT_INVALID'] : $_ARRAYLANG['TXT_SHOP_PRODUCT_ANY'], 'SHOP_DISCOUNT_COUPON_PAYMENT' => $objCoupon->payment_id ? sprintf($_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_PAYMENT_FORMAT'], $objCoupon->payment_id, $arrPaymentName[$objCoupon->payment_id]) : $_ARRAYLANG['TXT_SHOP_PAYMENT_ANY'], 'SHOP_DISCOUNT_COUPON_FUNCTIONS' => \Html::getBackendFunctions(array('edit' => ADMIN_SCRIPT_PATH . '?cmd=Shop&act=settings&tpl=coupon&edit=' . urlencode($index), 'delete' => "javascript:delete_coupon('" . urlencode($index) . "');"))));
$objTemplate->parse('shopDiscountCouponView');
if ($index === $edit) {
$objCouponEdit = $objCoupon;
}
}
$objTemplate->replaceBlock('shopDiscountCouponView', '', true);
$paging = \Paging::get($uri, $_ARRAYLANG['TXT_SHOP_DISCOUNT_COUPON_CODES'], $count, $limit);
//DBG::log("Paging: $paging");
$objTemplate->setVariable('SHOP_PAGING', $paging);
$attribute_code = 'style="width: 230px; text-align: left;" maxlength="20"';
$attribute_time = 'style="width: 230px; text-align: left;" maxlength="10"';
$attribute_discount_rate = 'style="width: 230px; text-align: right;" maxlength="3"';
$attribute_discount_amount = 'style="width: 230px; text-align: right;" maxlength="9"';
$attribute_minimum_amount = 'style="width: 230px; text-align: right;" maxlength="9"';
$attribute_uses = 'style="width: 230px; text-align: right;" maxlength="6"';
// Superseded by the widget, see below
// $attribute_customer = 'style="width: 230px;"';
$attribute_product = 'style="width: 230px;"';
$attribute_payment = 'style="width: 230px;"';
//.........这里部分代码省略.........