public function beforeAction($action) { $this->scanModules('payment'); $arrModules = Modules::model()->findAllByAttributes(array('category' => 'payment'), array('order' => 'module')); $this->_allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']); $menuSidebar = array(); foreach ($arrModules as $module) { $currentModule = Yii::app()->getComponent($module->module); if (is_null($currentModule)) { continue; } if ($currentModule->cloudCompatible === false && _xls_get_conf('LIGHTSPEED_CLOUD') > 0) { continue; } if ($currentModule->isDisplayable() === false) { continue; } $menuSidebar[] = array('label' => $currentModule->AdminName, 'url' => array('payments/module', 'id' => $module->module), 'advancedPayment' => $currentModule->advancedMode); } $advancedPaymentMethods = where($menuSidebar, array('advancedPayment' => true)); $simplePaymentMethods = where($menuSidebar, array('advancedPayment' => false)); $this->menuItems = array_merge(array(array('label' => 'Simple Integration Modules', 'linkOptions' => array('class' => 'nav-header'))), $simplePaymentMethods, array(array('label' => 'Advanced Integration Modules', 'linkOptions' => array('class' => 'nav-header'), 'visible' => count($advancedPaymentMethods) > 0)), $advancedPaymentMethods, $this->getPaymentSetupLinks()); $objModules = Modules::model()->findAllByAttributes(array('category' => 'payment', 'active' => 1)); if (count($objModules) === 0 && $action->id == "index") { $this->noneActive = 1; Yii::app()->user->setFlash('error', Yii::t('admin', 'WARNING: You have no payment modules activated. No one can checkout.')); } return parent::beforeAction($action); }
public function testEnsureBoolean() { $entries = array(array(true, true), array(false, false), array(null, false), array(0, false), array(1, true), array(-1, true), array(2.1, true), array('', false), array('abc', false), array('0', false), array('1', true), array('123', true), array('false', false), array('true', true), array('tRue', true), array(array(), false), array(array(0), true), array(array(1), true)); foreach ($entries as $index => $entry) { $this->assertTrue(CPropertyValue::ensureBoolean($entry[0]) === $entry[1], "Comparison {$index}: {$this->varToString($entry[0])}=={$this->varToString($entry[1])}"); } }
/** * @return array the config array passed to widget () */ public function getGridViewConfig() { if (!isset($this->_gridViewConfig)) { $this->_gridViewConfig = array_merge(parent::getGridViewConfig(), array('possibleResultsPerPage' => array(5, 10, 20, 30, 40, 50, 75, 100), 'defaultGvSettings' => array('isActive' => 65, 'fullName' => 125, 'lastLogin' => 80, 'emailAddress' => 100), 'template' => CHtml::openTag('div', X2Html::mergeHtmlOptions(array('class' => 'page-title'), array('style' => !CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')) && !CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader')) ? 'display: none;' : ''))) . '<h2 class="grid-widget-title-bar-dummy-element">' . '</h2>{buttons}{filterHint}' . '{summary}{topPager}</div>{items}{pager}', 'includedFields' => array('tagLine', 'username', 'officePhone', 'cellPhone', 'emailAddress', 'googleId', 'isActive', 'leadRoutingAvailability'), 'specialColumns' => array('fullName' => array('name' => 'fullName', 'header' => Yii::t('profile', 'Full Name'), 'value' => 'CHtml::link(CHtml::encode($data->fullName),array("view","id"=>$data->id))', 'type' => 'raw'), 'lastLogin' => array('name' => 'lastLogin', 'header' => Yii::t('profile', 'Last Login'), 'value' => '$data->user ? ($data->user->lastLogin == 0 ? "" : ' . 'Formatter::formatDateDynamic ($data->user->lastLogin)) : ""', 'type' => 'raw'), 'isActive' => array('name' => 'isActive', 'header' => Yii::t('profile', 'Active'), 'value' => '"<span title=\'' . '".(Session::isOnline ($data->username) ? ' . '"' . Yii::t('profile', 'Active User') . '" : "' . Yii::t('profile', 'Inactive User') . '")."\'' . ' class=\'".(Session::isOnline ($data->username) ? ' . '"active-indicator" : "inactive-indicator")."\'></span>"', 'type' => 'raw'), 'username' => array('name' => 'username', 'header' => Yii::t('profile', 'Username'), 'value' => '$data->user ? CHtml::encode($data->user->alias) : ""', 'type' => 'raw'), 'leadRoutingAvailability' => array('name' => 'leadRoutingAvailability', 'header' => Yii::t('profile', 'Lead Routing Availability'), 'value' => 'CHtml::encode($data->leadRoutingAvailability ? Yii::t("profile", "Available") : Yii::t("profile", "Unavailable"))', 'type' => 'raw')), 'enableControls' => false)); } return $this->_gridViewConfig; }
public static function parseTree($objRet, $root = 0) { $return = array(); # Traverse the tree and search for direct children of the root foreach ($objRet as $objItem) { if (CPropertyValue::ensureInteger($objItem->child_count) > 0 || CPropertyValue::ensureBoolean(Yii::app()->params['DISPLAY_EMPTY_CATEGORY'])) { $return[] = array('text' => CHtml::link($objItem->family, $objItem->Link), 'label' => $objItem->family, 'link' => $objItem->Link, 'request_url' => $objItem->request_url, 'url' => $objItem->Link, 'id' => $objItem->id, 'child_count' => $objItem->child_count, 'children' => null, 'items' => null); } } return empty($return) ? null : $return; }
private function prepareOutput() { $preparedAttributes = array(); foreach ($this->getAttributes() as $key => $value) { if (in_array($key, array('enableClientValidation', 'safe', 'skipOnError'))) { $preparedAttributes[$key] = CPropertyValue::ensureBoolean($value); } if ($key === 'except' || $key === 'on') { if (!is_null($value)) { $preparedAttributes[$key] = array_map('trim', explode(',', $value)); } } } return $preparedAttributes; }
public function beforeAction($action) { $this->scanModules('theme'); if (Yii::app()->theme) { $this->currentTheme = Yii::app()->theme->name; if (Theme::hasAdminForm($this->currentTheme)) { $model = Yii::app()->getComponent('wstheme')->getAdminModel($this->currentTheme); $this->currentTheme = $model->name; } } else { $this->currentTheme = "unknown"; } // Only old self-hosted customers can download/upgrade themes on their own. $canDisplayThemeGallery = CPropertyValue::ensureBoolean(Yii::app()->params['LIGHTSPEED_HOSTING']) === false && CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_LEGACY_THEMES']); $this->menuItems = array(array('label' => 'Manage My Themes', 'url' => array('theme/manage')), array('label' => 'Configure ' . ucfirst($this->currentTheme), 'url' => array('theme/module')), array('label' => 'Edit CSS for ' . ucfirst($this->currentTheme), 'url' => array('theme/editcss'), 'visible' => Theme::hasAdminForm(Yii::app()->theme->name)), array('label' => 'View Theme Gallery', 'url' => array('theme/gallery'), 'visible' => $canDisplayThemeGallery), array('label' => 'Upload Theme .Zip', 'url' => array('theme/upload'), 'visible' => !(Yii::app()->params['LIGHTSPEED_MT'] > 0)), array('label' => 'My Header/Image Gallery', 'url' => array('theme/image', 'id' => 1)), array('label' => 'Upload FavIcon', 'url' => array('theme/favicon'), 'visible' => !(Yii::app()->params['LIGHTSPEED_MT'] > 0))); //run parent beforeAction() after setting menu so highlighting works return parent::beforeAction($action); }
/** * dropDownList Taxonomy * * @param string $name * @param string $taxonomy * @param string $module * @param int $objectId * @param array $htmlOptions */ public static function dropDownList($name, $taxonomy, $module, $objectId, $htmlOptions = array()) { $properties = array('name' => $name, 'taxonomy' => $taxonomy, 'module' => $module, 'objectId' => $objectId); if (isset($htmlOptions['type'])) { $properties['type'] = CPropertyValue::ensureString($htmlOptions['type']); unset($htmlOptions['type']); } if (isset($htmlOptions['repeatChar'])) { $properties['repeatChar'] = CPropertyValue::ensureString($htmlOptions['repeatChar']); unset($htmlOptions['repeatChar']); } if (isset($htmlOptions['useRepeatChar'])) { $properties['useRepeatChar'] = CPropertyValue::ensureBoolean($htmlOptions['useRepeatChar']); unset($htmlOptions['useRepeatChar']); } $properties['htmlOptions'] = $htmlOptions; return Yii::app()->controller->widget('ListTaxonomy', $properties, true); }
public function actionAddress() { if (Yii::app()->user->isGuest) { $this->redirect($this->createUrl("/myaccount")); } $this->breadcrumbs = array(Yii::t('global', 'My Account') => $this->createUrl("/myaccount"), Yii::t('global', 'Add an address') => $this->createUrl("myaccount/address")); $model = new CustomerAddress(); $model->country_id = _xls_get_conf('DEFAULT_COUNTRY', 224); $checkout = new CheckoutForm(); //For logged in users we grab the current model $objCustomer = Customer::GetCurrent(); $id = null; if (Yii::app()->getRequest()->getParam('id') != null) { $id = Yii::app()->getRequest()->getParam('id'); } elseif (isset($_POST['CustomerAddress']) && isset($_POST['CustomerAddress']['id'])) { $id = $_POST['CustomerAddress']['id']; } $objAddress = CustomerAddress::model()->findByPk($id); if ($id && $objAddress instanceof CustomerAddress && $objAddress->customer_id == Yii::app()->user->id) { $model = $objAddress; } // collect user input data if (isset($_POST['CustomerAddress'])) { $model->setScenario('Default'); $model->attributes = $_POST['CustomerAddress']; if ($model->validate()) { $model->customer_id = $objCustomer->id; if (!$model->save()) { Yii::log('Error creating new customer address ' . print_r($model->getErrors(), true), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__); } if (CPropertyValue::ensureBoolean($model->makeDefaultBilling) === true) { $objCustomer->default_billing_id = $model->id; } elseif (CPropertyValue::ensureInteger($objCustomer->default_billing_id) === CPropertyValue::ensureInteger($model->id)) { $objCustomer->default_billing_id = null; } if (CPropertyValue::ensureBoolean($model->makeDefaultShipping) === true) { $objCustomer->default_shipping_id = $model->id; } elseif (CPropertyValue::ensureInteger($objCustomer->default_shipping_id) === CPropertyValue::ensureInteger($model->id)) { $objCustomer->default_shipping_id = null; } $objCustomer->save(); ShoppingCart::displayNoTaxMessage(); try { Yii::app()->shoppingcart->setTaxCodeByDefaultShippingAddress(); } catch (Exception $e) { Yii::log('Error updating customer cart ' . $e->getMessage(), 'error', 'application.' . __CLASS__ . '.' . __FUNCTION__); } Yii::app()->shoppingcart->save(); if (Yii::app()->request->isAjaxRequest === false) { $this->redirect($this->createUrl("/myaccount")); } } } if ($id && $objCustomer->default_billing_id == $model->id) { $model->makeDefaultBilling = 1; } if ($id && $objCustomer->default_shipping_id == $model->id) { $model->makeDefaultShipping = 1; } // Added Ajax for Brooklyn2014 if (Yii::app()->request->isAjaxRequest) { unset($model->password); $errors = $model->getErrors(); if (empty($errors) === false) { $response = array('status' => 'error', 'errors' => $errors); } else { $response = array('status' => 'success', 'address' => $model); } $this->renderJSON($response); } else { $this->render('address', array('model' => $model, 'checkout' => $checkout)); } }
/** * Display a form for the user to choose Store Pickup or * enter a shipping address and process the input * * @return void */ public function actionShipping() { $this->publishJS('shipping'); $this->publishJS('zippo'); $this->layout = '/layouts/checkout'; $this->checkoutForm = MultiCheckoutForm::loadFromSessionOrNew(); $arrObjAddresses = CustomerAddress::getActiveAddresses(); // In some cases an address may be rejected. // TODO: it's not ideal to rely on the client to tell us whether to // display an error or not. if (CPropertyValue::ensureBoolean(Yii::app()->request->getQuery('error-destination')) === true) { $message = Yii::t('checkout', 'Sorry, we cannot ship to this destination'); $this->checkoutForm->addError('shipping', $message); } // if the logged in customer has at least one address on file // take them to the page where they can select it if (count($arrObjAddresses) > 0) { if (isset($message)) { Yii::app()->user->setFlash('error', $message); } $this->redirect($this->createAbsoluteUrl('/checkout/shippingaddress')); } if (isset($_POST['MultiCheckoutForm'])) { $this->checkoutForm->attributes = $_POST['MultiCheckoutForm']; $this->checkoutForm->setScenario('Shipping'); // store pickup checkbox is checked if (isset($_POST['storePickupCheckBox']) && $_POST['storePickupCheckBox'] == 1) { $this->checkoutForm->fillFieldsForStorePickup(); $this->checkoutForm->setScenario('StorePickup'); if ($this->checkoutForm->validate() && $this->checkoutForm->updateAddressId()) { // Update the shipping scenarios based on the new address. $this->checkoutForm->saveFormToSession(); Shipping::updateCartScenariosInSession(); // Update the shopping cart taxes. Yii::app()->shoppingcart->setTaxCodeByCheckoutForm($this->checkoutForm); // Update shipping. If in-store pickup was chosen then we need to // ensure the cart shipping values are updated. $objShipping = CartShipping::getOrCreateCartShipping(); if ($objShipping->hasErrors() === false) { $objShipping->updateShipping(); $this->checkoutForm->addErrors($objShipping->getErrors()); } else { $this->checkoutForm->addErrors($objShipping->getErrors()); } // save the passed scenario $this->checkoutForm->passedScenario = $this->checkoutForm->getScenario(); // Go straight to payment $this->redirect($this->createUrl('/checkout/final')); } } else { // Check whether the in-store pickup was previously selected. // If it was, unset it. if ($this->checkoutForm->isStorePickupSelected()) { $this->checkoutForm->shippingProvider = null; $this->checkoutForm->shippingPriority = null; $this->checkoutForm->pickupFirstName = null; $this->checkoutForm->pickupLastName = null; } $this->checkoutForm->contactFirstName = $this->checkoutForm->shippingFirstName; $this->checkoutForm->contactLastName = $this->checkoutForm->shippingLastName; $this->checkoutForm->shippingPostal = strtoupper($this->checkoutForm->shippingPostal); } // validate before we can progress if ($this->checkoutForm->validate()) { $this->checkoutForm->saveFormToSession(); // update the cart if ($this->checkoutForm->updateAddressId('shipping')) { // Save the passed scenario. $this->checkoutForm->passedScenario = $this->checkoutForm->getScenario(); $this->checkoutForm->saveFormToSession(); // Update the shipping scenarios based on the new address. Shipping::updateCartScenariosInSession(); // Update the cart shipping. Do not update the taxes yet - // it is possible user has entered an invalid tax // destination. The tax destinations are checking on the // shippingoptions page. // Update shipping. If in-store pickup was chosen then we need to // ensure the cart shipping values are updated. $objShipping = CartShipping::getOrCreateCartShipping(); if ($objShipping->hasErrors() === false) { $objShipping->updateShipping(); $this->checkoutForm->addErrors($objShipping->getErrors()); } else { $this->checkoutForm->addErrors($objShipping->getErrors()); } $this->redirect($this->createUrl('/checkout/shippingoptions')); } } } elseif (isset($_GET['address_id'])) { $result = $this->checkoutForm->fetchCustomerShippingAddress($_GET['address_id']); if ($result === false) { $this->redirect($this->createAbsoluteUrl("/checkout/shippingaddress")); } } $this->checkoutForm->saveFormToSession(); if (empty($this->checkoutForm->shippingCountry) === false) { // Update shipping. If in-store pickup was chosen then we need to // ensure the cart shipping values are updated. $objShipping = CartShipping::getOrCreateCartShipping(); if ($objShipping->hasErrors() === false) { $objShipping->updateShipping(); $this->checkoutForm->addErrors($objShipping->getErrors()); } else { $this->checkoutForm->addErrors($objShipping->getErrors()); } } $this->render('shipping', array('model' => $this->checkoutForm, 'error' => $this->formatErrors())); }
public function actionToggleVisible($id) { /** @var SettingParam $model */ $model = SettingParam::model()->findByPk($id); if (is_object($model)) { $model->saveAttributes(array('visible' => !CPropertyValue::ensureBoolean($model->visible))); } }
/** * Get the options required by WsShippingEstimator.js. * * @param array $arrCartScenario An array of cart scenarios @see * Shipping::getCartScenarios. * @param integer $selectedShippingProviderId The ID (xlsws_modules.id) of * the selected shipping provider. * @param string $selectedShippingPriorityLabel The label for the shipping * priority. This value in combination with $selectedShippingProviderId * describes which shipping option is selected. * @param string $shippingCity The city that the cart is shipping to. * @param string $shippingStateCode The code for the state that the cart is shipping to. * @param string $shippingCountryCode The code the country that the cart is shipping to. * @param bool $updateOnLoad Whether the shipping estimator should get updated estimates right away. * * @return array $shippingEstimatorOptions */ public static function getShippingEstimatorOptions($arrCartScenario, $selectedShippingProviderId, $selectedShippingPriorityLabel, $shippingCity, $shippingStateCode, $shippingCountryCode, $updateOnLoad = false) { // Build up an associative array of the options required for the shipping estimator. $shippingEstimatorOptions = array('class' => self::CSS_CLASS, 'getShippingRatesEndpoint' => Yii::app()->createUrl('cart/getshippingrates'), 'setShippingOptionEndpoint' => Yii::app()->createUrl('cart/chooseshippingoption'), 'updateOnLoad' => CPropertyValue::ensureBoolean($updateOnLoad), 'shippingCity' => $shippingCity, 'shippingState' => $shippingStateCode, 'messages' => array()); // If a shipping country code is provided, then use it to get the // shipping country name. if ($shippingCountryCode !== null) { $shippingCountryName = Country::CountryByCode($shippingCountryCode); } else { // Otherwise, just use the first option from the list of countries. $countries = CHtml::listData(Country::getShippingCountries(), 'code', 'country'); $shippingCountryName = reset($countries); $shippingCountryCode = key($countries); } $shippingEstimatorOptions['shippingCountryName'] = $shippingCountryName; $shippingEstimatorOptions['shippingCountryCode'] = $shippingCountryCode; $shippingEstimatorOptions['selectedShippingOption'] = null; // With a set of shipping scenarios available and a previously selected // option, we can try to find a match. if ($arrCartScenario !== null) { if ($selectedShippingProviderId !== null && $selectedShippingPriorityLabel !== null) { // Try to find the previously selected option in the cart scenario array. $selectedCartScenario = findWhere($arrCartScenario, array('providerId' => $selectedShippingProviderId, 'priorityLabel' => $selectedShippingPriorityLabel)); if ($selectedCartScenario !== null) { // The selected scenario is available. $shippingEstimatorOptions['selectedProviderId'] = $selectedShippingProviderId; $shippingEstimatorOptions['selectedPriorityLabel'] = $selectedShippingPriorityLabel; // Currently if we get back too many shipping options, the selected one might // not be part of the returned options on the view since we limit our results to 8 // For now, a selected shipping option will be added as a key to the $shippingEstimatorOptions $shippingEstimatorOptions['selectedShippingOption'] = static::formartCartScenarioAsShippingOption($selectedCartScenario); } else { // The selected shipping option is not available. array_push($shippingEstimatorOptions['messages'], array('code' => 'WARN', 'message' => Yii::t('cart', 'Shipping option unavailable. Please choose another shipping option.'))); } } // Find store pickup and remove from array if found. // We must do this after we check to see if store // pickup was previously selected foreach ($arrCartScenario as $key => $cartScenario) { if ($cartScenario['module'] === 'storepickup') { // Setup message to show end user $strMessage = sprintf('We also offer %s. Proceed to checkout for complete details', $cartScenario['providerLabel']); array_push($shippingEstimatorOptions['messages'], array('code' => 'INFOTOP', 'message' => Yii::t('cart', $strMessage))); // remove store pickup from options unset($arrCartScenario[$key]); // there can be only one storepickup scenario // so no need to continue the loop break; } } // Apply the maximum shipping options limit to the cart scenarios. if (sizeof($arrCartScenario) > self::MAX_SHIPPING_OPTIONS) { $totalNumberOfOptions = sizeof($arrCartScenario); // In order to prevent writing "1 more shipping options" // (because it's not grammatically correct) we actually show 1 // less than the limit. $arrCartScenario = array_slice($arrCartScenario, 0, self::MAX_SHIPPING_OPTIONS - 1); array_push($shippingEstimatorOptions['messages'], array('code' => 'INFO', 'message' => Yii::t('cart', '{number} more shipping options. Proceed to checkout for complete options.', array('{number}' => $totalNumberOfOptions - sizeof($arrCartScenario))))); } // Format the cart scenarios into an array of shipping options. $shippingEstimatorOptions['shippingOptions'] = self::formatCartScenariosAsShippingOptions($arrCartScenario); } return $shippingEstimatorOptions; }
/** * @return array the config array passed to widget () */ public function getGridViewConfig() { if (!isset($this->_gridViewConfig)) { list($updateRoute, $updateParams) = $this->getAjaxUpdateRouteAndParams(); $this->_gridViewConfig = array('ajaxUrl' => Yii::app()->controller->createUrl($updateRoute, $updateParams), 'showHeader' => CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')), 'hideFullHeader' => CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader'))); } return $this->_gridViewConfig; }
/** * Used for general category browsing (which is really a search by category or family) * The URL manager passes the category request_url which we look up here */ public function actionBrowse() { $strC = Yii::app()->getRequest()->getQuery('cat'); $strB = Yii::app()->getRequest()->getQuery('brand'); $strS = Yii::app()->getRequest()->getQuery('class_name'); $strInv = ''; //If we haven't passed any criteria, we just query the database $criteria = new CDbCriteria(); $criteria->alias = 'Product'; if (!empty($strC)) { $objCategory = Category::LoadByRequestUrl($strC); if ($objCategory) { $criteria->join = 'LEFT JOIN xlsws_product_category_assn as ProductAssn ON ProductAssn.product_id=Product.id'; $intIdArray = array($objCategory->id); $intIdArray = array_merge($intIdArray, $objCategory->GetBranchPath()); $criteria->addInCondition('category_id', $intIdArray); $this->pageTitle = $objCategory->PageTitle; $this->pageDescription = $objCategory->PageDescription; $this->pageImageUrl = $objCategory->CategoryImage; $this->breadcrumbs = $objCategory->Breadcrumbs; $this->pageHeader = Yii::t('category', $objCategory->label); $this->subcategories = $objCategory->getSubcategoryTree($this->MenuTree); if ($objCategory->custom_page) { $this->custom_page_content = $objCategory->customPage->page; } $this->canonicalUrl = $objCategory->getCanonicalUrl(); } } if (!empty($strB)) { $objFamily = Family::LoadByRequestUrl($strB); if ($objFamily) { $criteria->addCondition('family_id = :id'); $criteria->params = array(':id' => $objFamily->id); $this->pageTitle = $objFamily->PageTitle; $this->pageHeader = $objFamily->family; $this->canonicalUrl = $objFamily->getCanonicalUrl(); } } if (!empty($strS)) { $objClasses = Classes::LoadByRequestUrl($strS); if ($objClasses) { $criteria->addCondition('class_id = :id'); $criteria->params = array(':id' => $objClasses->id); $this->pageHeader = $objClasses->class_name; $this->canonicalUrl = $objClasses->getCanonicalUrl(); } } if (_xls_get_conf('INVENTORY_OUT_ALLOW_ADD') == Product::InventoryMakeDisappear) { $criteria->addCondition('(inventory_avail>0 OR inventoried=0)'); } if (!_xls_get_conf('CHILD_SEARCH') || empty($strQ)) { $criteria->addCondition('Product.parent IS NULL'); } if (Product::HasFeatured() && empty($strS) && empty($strB) && empty($strC)) { $criteria->addCondition('featured=1'); $this->pageHeader = 'Featured Products'; } $criteria->addCondition('web=1'); $criteria->addCondition('current=1'); $criteria->order = 'Product.' . _xls_get_sort_order(); $productsGrid = new ProductGrid($criteria); $this->returnUrl = $this->canonicalUrl; $this->pageImageUrl = ""; if ($strB == '*') { $familiesCriteria = new CDbCriteria(); $familiesCriteria->order = 'family'; if (CPropertyValue::ensureBoolean(Yii::app()->params['DISPLAY_EMPTY_CATEGORY']) === false) { $familiesCriteria->addCondition('child_count > 0'); } $families = Family::model()->findAll($familiesCriteria); $this->render('brands', array('model' => $families)); } else { $this->render('grid', array('model' => $productsGrid->getProductGrid(), 'item_count' => $productsGrid->getNumberOfRecords(), 'page_size' => Yii::app()->params['PRODUCTS_PER_PAGE'], 'items_count' => $productsGrid->getNumberOfRecords(), 'pages' => $productsGrid->getPages())); } }
/** * Format log entry * * @param array $entry * @return array */ public function formatLogEntry(array $entry) { // extract query from the entry $queryString = $entry[0]; $sqlStart = strpos($queryString, '(') + 1; $sqlEnd = strrpos($queryString, ')'); $sqlLength = $sqlEnd - $sqlStart; $queryString = substr($queryString, $sqlStart, $sqlLength); if (false !== strpos($queryString, '. Bound with ')) { list($query, $params) = explode('. Bound with ', $queryString); $params = explode(',', $params); $binds = array(); foreach ($params as $param) { list($key, $value) = explode('=', $param, 2); $binds[trim($key)] = trim($value); } $entry[0] = strtr($query, $binds); } else { $entry[0] = $queryString; } if (false !== CPropertyValue::ensureBoolean($this->highlightSql)) { $entry[0] = $this->getTextHighlighter()->highlight($entry[0]); } $entry[0] = strip_tags($entry[0], '<div>,<span>'); return $entry; }
/** * Find the tax code associated with the provided address and update the * shopping cart to use it. * * When the shipping country is empty, the Store Default tax code is used. * This is generally used before an address is entered and for store * pickup. * * If the provided address is not matched to any destination, the tax code * for ANY/ANY is used. * * @param mixed $shippingCountry The 2-letter country code for the country or the country ID. * @param mixed $shippingState The 2-letter code for the state or the state ID. * @param string $shippingPostal The postal code with all spaces removed. * @return void * @throws CException If tax destinations are not configured. */ public function setTaxCodeByAddress($shippingCountry, $shippingState, $shippingPostal) { $previousTaxCodeId = $this->getModel()->tax_code_id; $taxCode = TaxCode::getTaxCodeByAddress($shippingCountry, $shippingState, $shippingPostal); $newTaxCodeId = $taxCode->lsid; $this->setTaxCodeId($newTaxCodeId); // Validate the promo code after saving, since recalculating updates // the cart item prices and may invalidate a promo code based on its // threshold. $this->recalculateAndSave(); $this->revalidatePromoCode(); // In a tax inclusive environment there can only be 2 tax codes. // Changing tax code means we've gone from tax-inclusive to // tax-exclusive or vice versa. This implies that the price display has // changed. // TODO: Is this always true? What if tax_code_id was null? if (CPropertyValue::ensureBoolean(_xls_get_conf('TAX_INCLUSIVE_PRICING')) == 1 && $previousTaxCodeId !== $newTaxCodeId) { Yii::app()->user->setFlash('taxModeChange', Yii::t('checkout', 'Prices have changed based on your tax locale.')); } }
/** * Inserts a row into the table based on this active record attributes. * If the table's primary key is auto-incremental and is null before insertion, * it will be populated with the actual value after insertion. * Note, validation is not performed in this method. You may call {@link validate} to perform the validation. * After the record is inserted to DB successfully, its {@link isNewRecord} property will be set false, * and its {@link scenario} property will be set to be 'update'. * @param array $attributes list of attributes that need to be saved. Defaults to null, * meaning all attributes that are loaded from DB will be saved. * @return boolean whether the attributes are valid and the record is inserted successfully. * @throws EMongoException if the record is not new * @throws EMongoException on fail of insert or insert of empty document * @throws EMongoException on fail of insert, when safe flag is set to true * @throws EMongoException on timeout of db operation , when safe flag is set to true * @since v1.0 */ public function insert(array $attributes = null) { if (!$this->getIsNewRecord()) { throw new EMongoException(Yii::t('yii', 'The EMongoDocument cannot be inserted to database because it is not new.')); } if ($this->beforeSave()) { Yii::trace(get_class($this) . '.insert()', 'ext.MongoDb.EMongoDocument'); $rawData = $this->toArray(); // free the '_id' container if empty, mongo will not populate it if exists if (empty($rawData['_id'])) { unset($rawData['_id']); } // filter attributes if set in param if ($attributes !== null) { foreach ($rawData as $key => $value) { if (!in_array($key, $attributes)) { unset($rawData[$key]); } } } // Check for individual pk $pk = $this->primaryKey(); if ('_id' !== $pk && 0 !== $this->countByAttributes(array($pk => $this->{$pk}))) { throw new EMongoException(Yii::t('yii', 'The EMongoDocument cannot be inserted because the primary key already exists.')); } if ($this->getMongoDBComponent()->enableProfiling) { Yii::beginProfile(get_class($this) . '.insert(' . json_encode($attributes) . ')', 'ext.MongoDb.EMongoDocument'); } if (version_compare(Mongo::VERSION, '1.0.5', '>=') === true) { $result = $this->getCollection()->insert($rawData, array('fsync' => $this->getFsyncFlag(), 'safe' => $this->getSafeFlag())); } else { $result = $this->getCollection()->insert($rawData, CPropertyValue::ensureBoolean($this->getSafeFlag())); } if ($this->getMongoDBComponent()->enableProfiling) { Yii::endProfile(get_class($this) . '.insert(' . json_encode($attributes) . ')', 'ext.MongoDb.EMongoDocument'); } if ($result !== false) { // strict comparison needed $this->_id = $rawData['_id']; $this->afterSave(); $this->setIsNewRecord(false); $this->setScenario('update'); return true; } throw new EMongoException(Yii::t('yii', 'Can\\t save the document to disk, or attempting to save an empty document.')); } return false; }
/** * Set whether the Gravatar image email already hashed * @see http://en.gravatar.com/site/implement/hash/ * @param boolean $value whether the Gravatar image email already hashed */ public function setEmailHashed($value = true) { $this->_emailHashed = CPropertyValue::ensureBoolean($value); }
/** * Inserts a row into the table based on this active record attributes. * If the table's primary key is auto-incremental and is null before insertion, * it will be populated with the actual value after insertion. * Note, validation is not performed in this method. You may call {@link validate} to perform the validation. * After the record is inserted to DB successfully, its {@link isNewRecord} property will be set false, * and its {@link scenario} property will be set to be 'update'. * @param array $attributes list of attributes that need to be saved. Defaults to null, * meaning all attributes that are loaded from DB will be saved. * @return boolean whether the attributes are valid and the record is inserted successfully. * @throws CException if the record is not new * @throws EMongoException on fail of insert or insert of empty document * @throws MongoCursorException on fail of insert, when safe flag is set to true * @throws MongoCursorTimeoutException on timeout of db operation , when safe flag is set to true * @since v1.0 */ public function insert(array $attributes = null) { if (!$this->getIsNewRecord()) { throw new CDbException(Yii::t('yii', 'The EMongoDocument cannot be inserted to database because it is not new.')); } if ($this->beforeSave()) { Yii::trace(get_class($this) . '.insert()', 'ext.MongoDb.EMongoDocument'); $rawData = $this->toArray(); // free the '_id' container if empty, mongo will not populate it if exists if (empty($rawData['_id'])) { unset($rawData['_id']); } // filter attributes if set in param if ($attributes !== null) { foreach ($rawData as $key => $value) { if (!in_array($key, $attributes)) { unset($rawData[$key]); } } } //by yongze add 查看入库数组 if (defined('ENABLE_DEBUGMONGODATA') && ENABLE_DEBUGMONGODATA === true) { // FunctionUTL::Debug($rawData); } // FunctionUTL::Debug($rawData);exit; //开启 if (version_compare(Mongo::VERSION, '1.0.5', '>=') === true) { $result = $this->getCollection()->insert($rawData, array('fsync' => $this->getFsyncFlag(), 'safe' => $this->getSafeFlag())); } else { $result = $this->getCollection()->insert($rawData, CPropertyValue::ensureBoolean($this->getSafeFlag())); } if ($result !== false) { $this->_id = $rawData['_id']; $this->setIsNewRecord(false); $this->setScenario('update'); $this->afterSave(); return true; } throw new EMongoException(Yii::t('yii', 'Can\\t save document to disk, or try to save empty document!')); } return false; }
'); $relationshipsDataProvider = $this->getDataProvider(); ?> <div id="relationships-form" <?php ?> class="<?php echo $this->getWidgetProperty('mode') === 'simple' ? 'simple-mode' : 'full-mode'; ?> "> <?php $columns = array(array('name' => 'expandButton.', 'header' => '', 'value' => "in_array (\n get_class (\$data->relatedModel), \n QuickCRUDBehavior::getModelsWhichSupportQuickView ()) ?\n\n '<span class=\\'detail-view-toggle\\' title=\\'" . CHtml::encode(Yii::t('app', 'View inline record details')) . "\\'\n data-id=\\''.\$data->relatedModel->id.'\\'\n data-class=\\''.get_class (\$data->relatedModel).'\\'\n data-name=\\''.CHtml::encode (\$data->relatedModel->name).'\\'>\n <span class=\\'fa fa-caret-right\\'></span>\n <span class=\\'fa fa-caret-down\\' style=\\'display: none;\\'></span>\n </span>' : ''", 'type' => 'raw'), array('name' => 'name', 'header' => Yii::t("contacts", 'Name'), 'value' => '$data->renderAttribute ("name")', 'type' => 'raw'), array('name' => 'relatedModelName', 'header' => Yii::t("contacts", 'Type'), 'value' => '$data->renderAttribute ("relatedModelName")', 'filter' => array('' => CHtml::encode(Yii::t('app', '-Select one-'))) + $linkableModelsOptions, 'type' => 'raw'), array('name' => 'assignedTo', 'header' => Yii::t("contacts", 'Assigned To'), 'value' => '$data->renderAttribute("assignedTo")', 'type' => 'raw'), array('name' => 'label', 'header' => Yii::t("contacts", 'Label'), 'value' => '$data->renderAttribute("label")', 'type' => 'raw'), array('name' => 'createDate', 'header' => Yii::t('contacts', 'Create Date'), 'value' => '$data->renderAttribute("createDate")', 'filterType' => 'date', 'type' => 'raw')); $columns[] = array('name' => 'deletion.', 'header' => Yii::t("contacts", 'Delete'), 'htmlOptions' => array('class' => 'delete-button-cell'), 'value' => "\n CHtml::ajaxLink(\n '<span class=\\'fa fa-times x2-delete-icon\\'></span>',\n '" . Yii::app()->controller->createUrl('/site/deleteRelationship') . "?firstId='.\$data->relatedModel->id.\n '&firstType='.get_class(\$data->relatedModel).\n '&secondId=" . $model->id . "&secondType=" . get_class($model) . "&redirect=/" . Yii::app()->controller->getId() . "/" . $model->id . "',\n array (\n 'success' => 'function () {\n \$.fn.yiiGridView.update(\\'relationships-grid\\');\n }',\n ),\n array(\n 'class'=>'x2-hint',\n 'title'=>'Deleting this relationship will not delete the linked record.',\n 'confirm'=>'Are you sure you want to delete this relationship?'))", 'type' => 'raw'); $this->widget('InlineRelationshipsGridView', array('id' => "relationships-grid", 'possibleResultsPerPage' => array(5, 10, 20, 30, 40, 50, 75, 100), 'enableGridResizing' => false, 'showHeader' => CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')), 'hideFullHeader' => CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader')), 'resultsPerPage' => $this->getWidgetProperty('resultsPerPage'), 'sortableWidget' => $this, 'defaultGvSettings' => array('expandButton.' => '12', 'name' => '22%', 'relatedModelName' => '18%', 'assignedTo' => '18%', 'label' => '18%', 'createDate' => '15%', 'deletion.' => 70), 'filter' => $this->getFilterModel(), 'htmlOptions' => array('class' => $relationshipsDataProvider->itemCount < $relationshipsDataProvider->totalItemCount ? 'grid-view has-pager' : 'grid-view'), 'dataColumnClass' => 'X2DataColumnGeneric', 'gvSettingsName' => 'inlineRelationshipsGrid', 'baseScriptUrl' => Yii::app()->request->baseUrl . '/themes/' . Yii::app()->theme->name . '/css/gridview', 'template' => '<div class="title-bar">{summary}</div>{items}{pager}', 'afterAjaxUpdate' => 'js: function(id, data) { refreshQtip(); }', 'dataProvider' => $relationshipsDataProvider, 'columns' => $columns, 'enableColDragging' => false, 'rememberColumnSort' => false)); ?> </div> <!----> <?php if ($hasUpdatePermissions) { Yii::app()->clientScript->registerScriptFile(Yii::app()->getBaseUrl() . '/js/Relationships.js'); ?> <div class='clearfix'></div> <form id='new-relationship-form' class="form" style='display: none;'> <input type="hidden" id='ModelId' name="ModelId" value="<?php echo $model->id; ?>
/** * @param boolean $value set is panel enabled */ public function setEnabled($value) { $this->_enabled = CPropertyValue::ensureBoolean($value); }
/** * Check if a customer's default shipping address is tax inclusive. * * @return bool true if the current customer's default shipping address is tax inclusive. * @see Cart::getIsTaxIn The logic is very similar. */ public function defaultShippingIsTaxIn() { // Tax-exclusive stores never have tax inclusive customers. if (CPropertyValue::ensureBoolean(_xls_get_conf('TAX_INCLUSIVE_PRICING', 0)) === false) { return false; } // Tax-inclusive stores only have 2 tax codes: their tax inclusive tax // code and a no-tax tax code. if ($this->defaultShippingIsNoTax() === true) { return false; } return true; }
/** * Format log entry * * @param array $entry * @return array */ public function formatLogEntry(array $entry) { // extract query from the entry $queryString = $entry[0]; $sqlStart = strpos($queryString, '(') + 1; $sqlEnd = strrpos($queryString, ')'); $sqlLength = $sqlEnd - $sqlStart; $queryString = substr($queryString, $sqlStart, $sqlLength); if (false !== strpos($queryString, '. Bound with ')) { list($query, $params) = explode('. Bound with ', $queryString); $binds = array(); $matchResult = preg_match_all("/(?<key>[a-z0-9\\.\\_\\-\\:]+)=(?<value>[\\d\\.e\\-\\+]+|''|'.+?(?<!\\\\)')/ims", $params, $paramsMatched, PREG_SET_ORDER); if ($matchResult) { foreach ($paramsMatched as $paramsMatch) { if (isset($paramsMatch['key'], $paramsMatch['value'])) { $binds[':' . trim($paramsMatch['key'], ': ')] = trim($paramsMatch['value']); } } } $entry[0] = strtr($query, $binds); } else { $entry[0] = $queryString; } if (false !== CPropertyValue::ensureBoolean($this->highlightSql)) { $entry[0] = $this->getTextHighlighter()->highlight($entry[0]); } $entry[0] = strip_tags($entry[0], '<div>,<span>'); return $entry; }
public function setInitiallyOpen($value) { $this->initiallyOpen = CPropertyValue::ensureBoolean($value); }
/** * * @param string $name * @return boolean */ public function getAsBoolean($name) { return CPropertyValue::ensureBoolean($this->get($name)); }
/** * Returns an indexed array of hypothetical cart scenarios ordered by the * shipping price of the scenario from lowest to highest. * * TODO: WS-3481 Refactor this to use Cart instead of ShoppingCart. * TODO: WS-3676 Refactor Shipping::getCartScenarios to implicitly modify the cart and the checkoutform * * @param $checkoutForm * @return array Indexed array of cart scenarios where each cart scenario * is an associative array with the following keys: * formattedCartSubtotal - The formatted subtotal of the cart for this * scenario, * formattedCartTax - The formatted amount of tax on the cart, * formattedCartTotal - The formatted total price of the cart, * formattedShippingPrice - The formatted shipping price, * module - The internal module string identifier (xlsws_module.module). * priorityIndex - An index for the shipping priority (unique per provider), * priorityLabel - A label for the shipping priority, * providerId - The xlsws_module.id of the shipping provider, * providerLabel - A label for the shipping provider, * shippingLabel - A label describing the provider and priority, * shippingPrice - The shipping price for this priortity, * shoppingCart - An instance of ShoppingCart with attributes set for * this scenario, * sortOrder - The xlsws_module.sort_order. * cartItems - The individual cartItem objects for the scenario * * Formatted currencies are formatted according to the user's language. * * @throws Exception If $checkoutForm does not contain enough details to * get shipping rates. * @throws Exception If no shipping providers are enabled (via * Shipping::getAvailableShippingProviders). * @throws Exception If no shipping providers are able to provide rates * (via Shipping::addRatesToShippingProviders). */ public static function getCartScenarios($checkoutForm) { $logLevel = 'info'; if (CPropertyValue::ensureBoolean(_xls_get_conf('DEBUG_SHIPPING', false)) === true) { $logLevel = 'error'; } // TODO: This, and the setting of hasTaxModeChanged, should be // refactored out of this method. It would be better if // getCartScenarios did not have side-effects. Yii::app()->shoppingcart->setTaxCodeByCheckoutForm($checkoutForm); // We are going to modify the shopping cart and save the intermediate // values so we need to save the current value. $savedTaxId = Yii::app()->shoppingcart->tax_code_id; $cart = Yii::app()->shoppingcart->getModel(); // The call to setTaxCodeByCheckoutForm() on the shopping cart will call // recalculateAndSave(). That call is going to add taxes on shipping by // calling updateTaxShipping(). The first run will have the correct values. // On later runs, we will have taxes set in the shopping cart and add more // when we call updateTaxShipping(). Plus, we used to also make a call to // recalculateAndSave() while going through the shipping providers. Then we // would call AddTaxes() which would add taxes on top of taxes. $cart->updateTaxExclusive(); $savedStorePickup = $cart->blnStorePickup; // Get the list of shipping modules. $arrShippingProvider = self::getAvailableShippingProviders($checkoutForm); Yii::log('Got shipping modules ' . print_r($arrShippingProvider, true), $logLevel, 'application.' . __CLASS__ . '.' . __FUNCTION__); // Run each shipping module to get the rates. $arrShippingProvider = self::addRatesToShippingProviders($arrShippingProvider); // Compile each shipping providers rates into an array of "cart scenarios". // Each cart scenario is an associative array containing details about // the cart as it would be if a particular shipping option were chosen. $arrCartScenario = array(); // The shopping cart variable has to be set in case we encounter // a case where the arrShippingProvider is empty. $shoppingCart = Yii::app()->shoppingcart->getModel(); $savedStorePickup = false; foreach ($arrShippingProvider as $shippingModuleId => $shippingProvider) { // Since Store Pickup means paying local taxes, set the cart so our // scenarios work out. if ($shippingProvider['component']->IsStorePickup === true) { Yii::app()->shoppingcart->tax_code_id = TaxCode::getDefaultCode(); $cart->blnStorePickup = true; } else { Yii::app()->shoppingcart->tax_code_id = $savedTaxId; $cart->blnStorePickup = false; } // Get the "shipping" product, which may vary from module to module. $strShippingProduct = $shippingProvider['component']->LsProduct; Yii::log('Shipping Product for ' . $shippingProvider['module']->module . ' is ' . $strShippingProduct, $logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__); if (Yii::app()->params['SHIPPING_TAXABLE'] == 1) { // When shipping is taxable we need to find the tax code on the actual shipping product. $objShipProduct = Product::LoadByCode($strShippingProduct); if ($objShipProduct instanceof Product === true) { $intShipProductLsid = $objShipProduct->taxStatus->lsid; } else { // We may not find a shipping product in cloud mode, so // just use -1 which skips statuses. $intShipProductLsid = -1; } } foreach ($shippingProvider['rates'] as $priorityIndex => $priority) { $priorityPrice = $priority['price']; $includeTaxInShippingPrice = false; $shippingTaxValues = array(); if (Yii::app()->params['SHIPPING_TAXABLE'] == '1') { $shippingTaxPrices = Tax::calculatePricesWithTax($priority['price'], Yii::app()->shoppingcart->tax_code_id, $intShipProductLsid); Yii::log("Shipping Taxes retrieved " . print_r($shippingTaxPrices, true), $logLevel, 'application.' . __CLASS__ . "." . __FUNCTION__); $shippingTaxValues = $shippingTaxPrices['arrTaxValues']; if (Yii::app()->params['TAX_INCLUSIVE_PRICING'] == '1') { $includeTaxInShippingPrice = true; } if ($includeTaxInShippingPrice === true) { $priorityPrice = $shippingTaxPrices['fltSellTotalWithTax']; } else { Yii::app()->shoppingcart->AddTaxes($shippingTaxValues); } } $formattedCartTax = _xls_currency(Yii::app()->shoppingcart->TaxTotal); if (Yii::app()->params['TAX_INCLUSIVE_PRICING'] == '1') { // For tax inclusive stores, we never show cart tax. This is because either: // 1. The destination is inside the tax-inclusive region, or // 2. The destination is inside a tax-exclusive region, in // which case it must be set up as 0% tax. $formattedCartTax = ''; } // TODO: Do the _xls_currency() in the formatter rather than here. $arrCartScenario[] = array('formattedCartSubtotal' => _xls_currency(Yii::app()->shoppingcart->subtotal), 'formattedCartTax' => $formattedCartTax, 'formattedCartTax1' => _xls_currency(Yii::app()->shoppingcart->tax1), 'formattedCartTax2' => _xls_currency(Yii::app()->shoppingcart->tax2), 'formattedCartTax3' => _xls_currency(Yii::app()->shoppingcart->tax3), 'formattedCartTax4' => _xls_currency(Yii::app()->shoppingcart->tax4), 'formattedCartTax5' => _xls_currency(Yii::app()->shoppingcart->tax5), 'formattedCartTotal' => _xls_currency($cart->getTotalWithShipping($priorityPrice)), 'cartTax1' => Yii::app()->shoppingcart->tax1, 'cartTax2' => Yii::app()->shoppingcart->tax2, 'cartTax3' => Yii::app()->shoppingcart->tax3, 'cartTax4' => Yii::app()->shoppingcart->tax4, 'cartTax5' => Yii::app()->shoppingcart->tax5, 'formattedShippingPrice' => _xls_currency($priorityPrice), 'module' => $shippingProvider['module']->module, 'priorityIndex' => $priorityIndex, 'priorityLabel' => $priority['label'], 'providerId' => $shippingModuleId, 'providerLabel' => $shippingProvider['component']->Name, 'shippingLabel' => $shippingProvider['component']->Name . ' ' . $priority['label'], 'shippingPrice' => $priority['price'], 'shippingPriceWithTax' => $priorityPrice, 'shippingProduct' => $strShippingProduct, 'cartAttributes' => $cart->attributes, 'cartItems' => $cart->cartItems, 'sortOrder' => $shippingProvider['module']->sort_order); // Remove shipping taxes to accommodate the next shipping priority in the loop. if (Yii::app()->params['SHIPPING_TAXABLE'] == '1' && $includeTaxInShippingPrice === false) { Yii::app()->shoppingcart->SubtractTaxes($shippingTaxValues); } } } // Restore the original storePickup boolean $cart->blnStorePickup = $savedStorePickup; // Restore the original tax code on the cart. Yii::app()->shoppingcart->setTaxCodeId($savedTaxId); // Sort the shipping options based on the price key. usort($arrCartScenario, function ($item1, $item2) { if ($item1['shippingPrice'] == $item2['shippingPrice']) { return 0; } return $item1['shippingPrice'] > $item2['shippingPrice'] ? 1 : -1; }); return $arrCartScenario; }
/** * We use this function to know if the payment method is allowed to be * used. * * @return bool True if we can display the payment method. False * otherwise. */ public function isDisplayable() { $allowAdvancedPayments = CPropertyValue::ensureBoolean(Yii::app()->params['ALLOW_ADVANCED_PAY_METHODS']); if ($allowAdvancedPayments === false && $this->advancedMode === true) { return false; } return parent::isDisplayable(); }
<?php /** * Created by Roman Revin <*****@*****.**>. * Date: 31.01.12 13:19 */ /** * @var $this QtzPanelWidget * @var $panel QtzPanel * @var $assets string * @var $bar array * @var $items array of QtzPanelElement * @var $item QtzPanelElement */ $jsOptions = array('id' => $panel->getId(), 'initiallyOpen' => $this->initiallyOpen, 'useCookie' => $this->useCookie, 'panelHeight' => $this->height . 'px', 'showBarLogs' => CPropertyValue::ensureBoolean($panel->getState('bar-logs')), 'showBarDB' => CPropertyValue::ensureBoolean($panel->getState('bar-db'))); Yii::app()->getClientScript()->registerCoreScript('jquery'); Yii::app()->getClientScript()->registerCssFile($assets . '/style.css'); Yii::app()->getClientScript()->registerScript('QtzPanel init ' . $this->getId(), 'QPanelPool[' . CJavaScript::encode($panel->getId()) . '] = new QtzPanel(' . CJavaScript::jsonEncode($jsOptions) . ');'); if ($this->useCookie) { Yii::app()->getClientScript()->registerCoreScript('cookie'); } ?> <div class="qtzpanelWrapper"> <div class="panel" id="qtzpanel-<?php echo $panel->getId(); ?> " style="height: <?php echo $this->height; ?> px;">
/** * @return array the config array passed to widget () */ public function getGridViewConfig() { if (!isset($this->_gridViewConfig)) { $this->_gridViewConfig = array_merge(parent::getGridViewConfig(), array('sortableWidget' => $this, 'id' => $this->getWidgetKey(), 'enableScrollOnPageChange' => false, 'possibleResultsPerPage' => array(5, 10, 20, 30, 40, 50, 75, 100), 'buttons' => array('advancedSearch', 'clearFilters', 'columnSelector', 'autoResize'), 'template' => CHtml::openTag('div', X2Html::mergeHtmlOptions(array('class' => 'page-title'), array('style' => !CPropertyValue::ensureBoolean($this->getWidgetProperty('showHeader')) && !CPropertyValue::ensureBoolean($this->getWidgetProperty('hideFullHeader')) ? 'display: none;' : ''))) . '<h2 class="grid-widget-title-bar-dummy-element">' . '</h2>{buttons}{filterHint}' . '{summary}{topPager}<div class="clear"></div></div>{items}{pager}', 'fixedHeader' => false, 'dataProvider' => $this->dataProvider, 'filter' => $this->model, 'pager' => array('class' => 'CLinkPager', 'maxButtonCount' => 10), 'modelName' => get_class($this->model), 'viewName' => 'profile', 'gvSettingsName' => get_called_class() . $this->widgetUID, 'enableControls' => true, 'fullscreen' => false, 'enableSelectAllOnAllPages' => false)); } return $this->_gridViewConfig; }
/** * Determine if the current cart is taxable based on it's taxcode * @return boolean true if the carts tax code is taxable * @throws Exception * @see Customer::defaultShippingIsTaxIn The logic is very similar. */ public function getIsTaxIn() { if ($this->hasTaxCode() === false) { throw new Exception("No tax code."); } // Tax-exclusive stores never have tax inclusive carts. if (CPropertyValue::ensureBoolean(_xls_get_conf('TAX_INCLUSIVE_PRICING', 0)) === false) { return false; } // Tax-inclusive stores only have 2 tax codes: their tax inclusive tax // code and a no-tax tax code. if ($this->taxCode->IsNoTax() === true) { return false; } return true; }