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


PHP TopMessage::addWarning方法代码示例

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


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

示例1: doActionUpdate

 /**
  * Update membership list
  *
  * @return void
  */
 protected function doActionUpdate()
 {
     $data = \XLite\Core\Request::getInstance()->update_memberships;
     if (!is_array($data)) {
         // TODO - add top message
     } else {
         $code = $this->getCurrentLanguage();
         $flag = false;
         foreach ($data as $id => $row) {
             $m = \XLite\Core\Database::getRepo('\\XLite\\Model\\Membership')->find($id);
             if ($m) {
                 $duplicate = \XLite\Core\Database::getRepo('\\XLite\\Model\\Membership')->createQueryBuilder()->andWhere('translations.name = :name', 'm.membership_id != :id')->setParameter('name', $row['name'])->setParameter('id', $id)->setMaxResults(1)->getSingleResult();
                 if (!is_null($duplicate)) {
                     \XLite\Core\TopMessage::addWarning('"' . $row['name'] . '" ' . ' membership name is already in use. ' . 'Please specify another name for this membership level');
                 } else {
                     \XLite\Core\Database::getRepo('\\XLite\\Model\\Membership')->update($m, $row);
                 }
                 $flag = true;
             } else {
                 \XLite\Core\TopMessage::addError('Could not find membership ID#' . $id . ' record in the database');
             }
         }
         if ($flag) {
             \XLite\Core\Database::getEM()->flush();
         }
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:32,代码来源:Memberships.php

示例2: checkAmazonS3Settings

 /**
  * Check amazon S3 settings 
  * 
  * @return void
  */
 protected function checkAmazonS3Settings()
 {
     $config = \XLite\Core\Config::getInstance()->CDev->AmazonS3Images;
     if (!function_exists('curl_init')) {
         \XLite\Core\TopMessage::addError('This module uses PHP\'s cURL functions which are disabled on your web server');
     } elseif ($config->access_key && $config->secret_key && !\XLite\Module\CDev\AmazonS3Images\Core\S3::getInstance()->isValid()) {
         \XLite\Core\TopMessage::addWarning('Connection to Amazon S3 failed.' . ' Check whether the AWS Access key и AWS Secret key specified in the module settings are correct.');
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:14,代码来源:Module.php

示例3: doActionSaleCancelSale

 /**
  * Do action clone
  *
  * @return void
  */
 protected function doActionSaleCancelSale()
 {
     $select = \XLite\Core\Request::getInstance()->select;
     if ($select && is_array($select)) {
         \XLite\Core\Database::getRepo('\\XLite\\Model\\Product')->updateInBatchById($this->getUpdateInfo());
         \XLite\Core\TopMessage::addInfo('Products information has been successfully updated');
     } else {
         \XLite\Core\TopMessage::addWarning('Please select the products first');
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:15,代码来源:ProductList.php

示例4: forbidInDemoMode

 /**
  * This function is called if action is forbidden in demo mode
  *
  * @return void
  */
 protected function forbidInDemoMode()
 {
     $message = $this->getForbidInDemoModeMessage();
     if ($message) {
         \XLite\Core\TopMessage::addWarning($message);
     }
     $url = $this->getForbidInDemoModeRedirectURL();
     if ($url) {
         \Includes\Utils\Operator::redirect($url);
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:16,代码来源:AAdmin.php

示例5: doActionLocate

 /**
  * Place URL into engine's endpoints
  * 
  * @return void
  */
 protected function doActionLocate()
 {
     $engines = \XLite\Core\Request::getInstance()->engines;
     if ($engines) {
         foreach ($this->getEngines() as $key => $engine) {
             if (in_array($key, $engines)) {
                 $url = urlencode(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::CART_SELF)));
                 $url = str_replace('%url%', $url, $engine['url']);
                 $request = new \XLite\Core\HTTP\Request($url);
                 $response = $request->sendRequest();
                 if (200 == $response->code) {
                     \XLite\Core\TopMessage::addInfo('Site map successfully registred on X', array('engine' => $key));
                 } else {
                     \XLite\Core\TopMessage::addWarning('Site map has not been registred in X', array('engine' => $key));
                 }
             }
         }
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:24,代码来源:Sitemap.php

示例6: doActionLocate

 /**
  * Place URL into engine's endpoints
  *
  * @return void
  */
 protected function doActionLocate()
 {
     $engines = \XLite\Core\Request::getInstance()->engines;
     if ($engines) {
         foreach ($this->getEngines() as $key => $engine) {
             if (in_array($key, $engines)) {
                 $url = urlencode(\XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('sitemap', '', array(), \XLite::getCustomerScript())));
                 $url = str_replace('%url%', $url, $engine['url']);
                 $request = new \XLite\Core\HTTP\Request($url);
                 $response = $request->sendRequest();
                 if (200 == $response->code) {
                     \XLite\Core\TopMessage::addInfo('Site map successfully registred on X', array('engine' => $key));
                 } else {
                     \XLite\Core\TopMessage::addWarning('Site map has not been registred in X', array('engine' => $key));
                 }
             }
         }
     }
     $postedData = \XLite\Core\Request::getInstance()->getData();
     $options = \XLite\Core\Database::getRepo('\\XLite\\Model\\Config')->findBy(array('category' => $this->getOptionsCategory()));
     $isUpdated = false;
     foreach ($options as $key => $option) {
         $name = $option->getName();
         $type = $option->getType();
         if (isset($postedData[$name]) || 'checkbox' == $type) {
             if ('checkbox' == $type) {
                 $option->setValue(isset($postedData[$name]) ? 'Y' : 'N');
             } else {
                 $option->setValue($postedData[$name]);
             }
             $isUpdated = true;
             \XLite\Core\Database::getEM()->persist($option);
         }
     }
     if ($isUpdated) {
         \XLite\Core\Database::getEM()->flush();
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:43,代码来源:Sitemap.php

示例7: doActionGetCSV

 /**
  * Get CSV file for specified language
  *
  * @return void
  */
 protected function doActionGetCSV()
 {
     $code = \XLite\Core\Request::getInstance()->code;
     $lng = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->findOneBy(array('code' => $code));
     if ($lng) {
         $labels = \XLite\Core\Database::getRepo('XLite\\Model\\LanguageLabel')->findLabelsTranslatedToCode($code);
         if ($labels) {
             $fileName = LC_DIR_TMP . 'labels-' . $code . '.' . time() . '.php';
             $f = fopen($fileName, 'w');
             foreach ($labels as $label => $translation) {
                 $row = array($code, $label, $translation);
                 fputcsv($f, $row, ',');
             }
             fclose($f);
             $name = $code . '-translation-' . gmdate('Y-m-d') . '.csv';
             header('Content-Type: text/csv; charset=UTF-8');
             header('Content-Disposition: attachment; filename="' . $name . '"; modification-date="' . gmdate('r') . ';');
             header('Content-Length: ' . filesize($fileName));
             readfile($fileName);
             unlink($fileName);
             exit;
         } else {
             \XLite\Core\TopMessage::addWarning('There are no labels translated to X', array('language' => $lng->getName()));
         }
     } else {
         \XLite\Core\TopMessage::addWarning('Unknown language: X', array('code' => htmlspecialchars($code)));
     }
     $this->redirect();
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:34,代码来源:Languages.php

示例8: checkAddress

 /**
  * Check if address has duplicates
  *
  * @return boolean
  */
 protected function checkAddress()
 {
     $result = parent::checkAddress();
     $sameAddress = $this->getRepository()->findSameAddress($this);
     if ($sameAddress) {
         \XLite\Core\TopMessage::addWarning('Address was not saved as other address with specified fields is already exists.');
         $result = false;
     }
     return $result;
 }
开发者ID:kingsj,项目名称:core,代码行数:15,代码来源:Address.php

示例9: doActionCreateReturn

 /**
  * Do action :: create return
  *
  * @return void
  */
 protected function doActionCreateReturn()
 {
     $items = $this->prepareReturnItems();
     $message = strval(\XLite\Core\Request::getInstance());
     $this->getReturnMessage();
     if (!empty($items)) {
         $order = $this->getOrder();
         // Create new return model
         $returnRequest = new \XLite\Module\XC\CanadaPost\Model\ProductsReturn();
         \XLite\Core\Database::getEM()->persist($returnRequest);
         $returnRequest->setNotes($this->getReturnMessage());
         foreach ($items as $itemId => $itemData) {
             // Create new return item model
             $returnItem = new \XLite\Module\XC\CanadaPost\Model\ProductsReturn\Item();
             \XLite\Core\Database::getEM()->persist($returnItem);
             $returnItem->setAmount($itemData['amount']);
             $returnItem->setOrderItem($order->getItemById($itemId));
             $returnRequest->addItem($returnItem);
         }
         $order->addCapostReturn($returnRequest);
         \XLite\Core\Database::getEM()->flush();
         \XLite\Core\TopMessage::addInfo('The products return has been registered.');
     } else {
         \XLite\Core\TopMessage::addWarning('No items have been selected for return.');
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:31,代码来源:CapostReturns.php

示例10: doActionAddFeaturedProducts

 /**
  * doActionAddFeaturedProducts
  *
  * @return void
  */
 protected function doActionAddFeaturedProducts()
 {
     if (isset(\XLite\Core\Request::getInstance()->product_ids)) {
         $pids = array_keys(\XLite\Core\Request::getInstance()->product_ids);
         $products = \XLite\Core\Database::getRepo('\\XLite\\Model\\Product')->findByIds($pids);
         if (!$this->categoryId) {
             $this->categoryId = \XLite\Core\Database::getRepo('\\XLite\\Model\\Category')->getRootCategoryId();
         }
         $category = \XLite\Core\Database::getRepo('\\XLite\\Model\\Category')->find($this->categoryId);
         // Retreive existing featured products list of that category
         $this->category_id = $this->categoryId;
         $existingLinksIds = array();
         $existingLinks = $this->getFeaturedProductsList();
         if ($existingLinks) {
             foreach ($existingLinks as $k => $v) {
                 $existingLinksIds[] = $v->getProduct()->getProductId();
             }
         }
         if ($products) {
             foreach ($products as $product) {
                 if (in_array($product->getProductId(), $existingLinksIds)) {
                     \XLite\Core\TopMessage::addWarning('The product SKU#"' . $product->getSku() . '" is already set as featured for the category');
                 } else {
                     $fp = new \XLite\Module\CDev\FeaturedProducts\Model\FeaturedProduct();
                     $fp->setProduct($product);
                     if ($category) {
                         $fp->setCategory($category);
                     }
                     \XLite\Core\Database::getEM()->persist($fp);
                 }
             }
         }
         \XLite\Core\Database::getEM()->flush();
     }
 }
开发者ID:kingsj,项目名称:core,代码行数:40,代码来源:Categories.php

示例11: doActionUpdateProductClass

 /**
  * Update product class
  *
  * @return void
  */
 protected function doActionUpdateProductClass()
 {
     $updateClass = false;
     if (-1 == \XLite\Core\Request::getInstance()->productClass) {
         $name = trim(\XLite\Core\Request::getInstance()->newProductClass);
         if ($name) {
             $productClass = new \XLite\Model\ProductClass();
             $productClass->setName($name);
             \XLite\Core\Database::getRepo('\\XLite\\Model\\ProductClass')->insert($productClass);
             $updateClass = true;
         }
     } else {
         $productClass = \XLite\Core\Database::getRepo('\\XLite\\Model\\ProductClass')->find(\XLite\Core\Request::getInstance()->productClass);
         $updateClass = true;
     }
     if ($updateClass) {
         $productClassChanged = $productClass && (!$this->getProduct()->getProductClass() || $productClass->getId() != $this->getProduct()->getProductClass()->getId());
         $this->getProduct()->setProductClass($productClass);
         if ($productClassChanged) {
             \XLite\Core\Database::getRepo('\\XLite\\Model\\Attribute')->generateAttributeValues($this->getProduct(), true);
         }
         \XLite\Core\Database::getEM()->flush();
         \XLite\Core\TopMessage::addInfo('Product class have been updated successfully');
     } else {
         \XLite\Core\TopMessage::addWarning('Product class name is empty');
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:32,代码来源:ProductAbstract.php

示例12: processInvalidAmountError

 /**
  * Show message about wrong product amount
  *
  * @param \XLite\Model\OrderItem $item Order item
  *
  * @return void
  */
 protected function processInvalidAmountError(\XLite\Model\OrderItem $item)
 {
     \XLite\Core\TopMessage::addWarning('You tried to buy more items of "{{product}}" product {{description}} than are in stock. We have {{amount}} item(s) only. Please adjust the product quantity.', array('product' => $item->getProduct()->getName(), 'description' => $item->getExtendedDescription(), 'amount' => $item->getProductAvailableAmount()));
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:11,代码来源:ChangeAttributeValuesAbstract.php

示例13: doActionReturn

 /**
  * Process return
  *
  * @return void
  */
 protected function doActionReturn()
 {
     $txn = $this->detectTransaction();
     if ($txn) {
         $txn->getPaymentMethod()->getProcessor()->processReturn($txn);
         $txn->registerTransactionInOrderHistory('web');
         $urlParams = array();
         $urlParams['order_id'] = $txn->getOrder()->getOrderId();
         if ($txn->getNote()) {
             $urlParams['txnNote'] = base64_encode(static::t($txn->getNote()));
             $urlParams['txnNoteType'] = $txn->isFailed() ? \XLite\Core\TopMessage::ERROR : \XLite\Core\TopMessage::INFO;
         }
         \XLite\Core\Database::getEM()->flush();
         $url = $this->getShopURL($this->buildURL('checkout', 'return', $urlParams), \XLite\Core\Request::getInstance()->isHTTPS() || \XLite\Core\Config::getInstance()->Security->customer_security);
         switch ($txn->getPaymentMethod()->getProcessor()->getReturnType()) {
             case \XLite\Model\Payment\Base\WebBased::RETURN_TYPE_HTML_REDIRECT:
                 $this->doHTMLRedirect($url);
                 break;
             case \XLite\Model\Payment\Base\WebBased::RETURN_TYPE_HTML_REDIRECT_WITH_IFRAME_DESTROYING:
                 $this->doHTMLRedirectWithIframeDestroying($url);
                 break;
             case \XLite\Model\Payment\Base\WebBased::RETURN_TYPE_CUSTOM:
                 $txn->getPaymentMethod()->getProcessor()->doCustomReturnRedirect();
                 break;
             default:
                 $this->setReturnURL($url);
         }
     } else {
         // Log error
         \XLite\Logger::getInstance()->log('Requested payment return page with undefined payment transaction' . PHP_EOL . 'IP address: ' . $_SERVER['REMOTE_ADDR'] . PHP_EOL . 'Data: ' . var_export(\XLite\Core\Request::getInstance()->getData(), true), LOG_ERR);
         // Add top message
         \XLite\Core\TopMessage::addWarning('Unknown payment. If you see this message after returning from the payment page, please contact the store administrator for information about the status of your payment.');
         // Set return URL
         $url = $this->buildURL('');
         // Make redirect with destroying iframe (as it's unknown whether payment was via iframe method or not)
         $this->doHTMLRedirectWithIframeDestroying($url);
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:43,代码来源:PaymentReturn.php

示例14: importPaymentMethods

 /**
  * Import payment methods from X-Payments and return error or warning message (if any)
  *
  * @return void
  */
 public function importPaymentMethods()
 {
     $list = \XLite\Module\CDev\XPaymentsConnector\Core\XPaymentsClient::getInstance()->requestPaymentMethods();
     if (is_array($list) && !empty($list)) {
         foreach ($this->getPaymentMethods() as $pm) {
             if (!$this->checkMethodInImportedList($pm, $list)) {
                 \XLite\Core\Database::getEM()->remove($pm);
             }
         }
         foreach ($list as $settings) {
             if (!isset($settings['paymentMethodId'])) {
                 // Create new payment method
                 $pm = new \XLite\Model\Payment\Method();
                 \XLite\Core\Database::getEM()->persist($pm);
                 $xpModuleClass = $this->detectModuleClass($settings);
                 $pm->setClass('Module\\CDev\\XPaymentsConnector\\Model\\Payment\\Processor\\XPayments');
                 $pm->setServiceName('XPayments.' . $xpModuleClass);
                 $pm->setName($settings['moduleName']);
                 $pm->setType(\XLite\Model\Payment\Method::TYPE_CC_GATEWAY);
                 $pm->setOrderby(static::getPaymentMethodOrderby('XPayments.' . $xpModuleClass));
                 $pm->setAdded(true);
                 // Tokenization is disabled by default
                 $pm->setSetting('saveCards', 'N');
             } else {
                 // Use existsting payment method
                 $pm = \XLite\Core\Database::getRepo('XLite\\Model\\Payment\\Method')->find($settings['paymentMethodId']);
             }
             $this->setPaymentMethodSettings($pm, $settings);
         }
         \XLite\Core\Database::getEM()->flush();
         \XLite\Core\TopMessage::addInfo('Payment methods have been imported successfully');
     } elseif (is_array($list)) {
         \XLite\Core\TopMessage::addWarning('There are no payment configurations for this store.');
     } else {
         \XLite\Core\TopMessage::addError('Error had occured during the requesting of payment methods from X-Payments. See log files for details.');
     }
 }
开发者ID:kewaunited,项目名称:xcart,代码行数:42,代码来源:Settings.php

示例15: doActionDisable

 /**
  * Do action disable
  *
  * @return void
  */
 protected function doActionDisable()
 {
     $select = \XLite\Core\Request::getInstance()->select;
     if ($select && is_array($select)) {
         \XLite\Core\Database::getRepo('\\XLite\\Model\\Country')->updateInBatchById(array_fill_keys(array_keys($select), array('enabled' => false)));
         \XLite\Core\TopMessage::addInfo('Countries information has been successfully updated');
     } else {
         \XLite\Core\TopMessage::addWarning('Please select the countries first');
     }
 }
开发者ID:kirkbauer2,项目名称:kirkxc,代码行数:15,代码来源:Countries.php


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