当前位置: 首页>>代码示例>>PHP>>正文


PHP CPropertyValue::ensureBoolean方法代码示例

本文整理汇总了PHP中CPropertyValue::ensureBoolean方法的典型用法代码示例。如果您正苦于以下问题:PHP CPropertyValue::ensureBoolean方法的具体用法?PHP CPropertyValue::ensureBoolean怎么用?PHP CPropertyValue::ensureBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CPropertyValue的用法示例。


在下文中一共展示了CPropertyValue::ensureBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: beforeAction

 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);
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:29,代码来源:PaymentsController.php

示例2: testEnsureBoolean

 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])}");
     }
 }
开发者ID:super-d2,项目名称:codeigniter_demo,代码行数:7,代码来源:CPropertyValueTest.php

示例3: getGridViewConfig

 /**
  * @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;
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:12,代码来源:ProfilesGridViewProfileWidget.php

示例4: parseTree

 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;
 }
开发者ID:hjlan,项目名称:webstore,代码行数:11,代码来源:Family.php

示例5: prepareOutput

 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;
 }
开发者ID:kuzmina-mariya,项目名称:unizaro-kamin,代码行数:15,代码来源:CFilterValidatorForm.php

示例6: beforeAction

 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);
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:18,代码来源:ThemeController.php

示例7: dropDownList

 /**
  * 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);
 }
开发者ID:hung5s,项目名称:yap,代码行数:27,代码来源:TaxonomyHelper.php

示例8: actionAddress

 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));
     }
 }
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:73,代码来源:MyaccountController.php

示例9: actionShipping

 /**
  * 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"));
         }
     }
//.........这里部分代码省略.........
开发者ID:uiDeveloper116,项目名称:webstore,代码行数:101,代码来源:CheckoutController.php

示例10: actionToggleVisible

 public function actionToggleVisible($id)
 {
     /** @var SettingParam $model */
     $model = SettingParam::model()->findByPk($id);
     if (is_object($model)) {
         $model->saveAttributes(array('visible' => !CPropertyValue::ensureBoolean($model->visible)));
     }
 }
开发者ID:hung5s,项目名称:yap,代码行数:8,代码来源:SettingController.php

示例11: getShippingEstimatorOptions

 /**
  * 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;
 }
开发者ID:hjlan,项目名称:webstore,代码行数:82,代码来源:WsShippingEstimator.php

示例12: getGridViewConfig

 /**
  * @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;
 }
开发者ID:dsyman2,项目名称:X2CRM,代码行数:11,代码来源:GridViewWidget.php

示例13: actionBrowse

 /**
  * 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()));
     }
 }
开发者ID:hjlan,项目名称:webstore,代码行数:79,代码来源:SearchController.php

示例14: formatLogEntry

 /**
  * 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;
 }
开发者ID:aakbar24,项目名称:CollegeCorner_Ver_2.0,代码行数:32,代码来源:YiiDebugToolbarPanelSql.php

示例15: setTaxCodeByAddress

 /**
  * 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.'));
     }
 }
开发者ID:hjlan,项目名称:webstore,代码行数:37,代码来源:ShoppingCart.php


注:本文中的CPropertyValue::ensureBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。