當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Core\TopMessage類代碼示例

本文整理匯總了PHP中XLite\Core\TopMessage的典型用法代碼示例。如果您正苦於以下問題:PHP TopMessage類的具體用法?PHP TopMessage怎麽用?PHP TopMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了TopMessage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: doActionRun

 /**
  * Run task
  *
  * @return void
  */
 protected function doActionRun()
 {
     $event = \XLite\Core\Request::getInstance()->event;
     $result = false;
     $errors = array();
     $task = \XLite\Core\Database::getRepo('XLite\\Model\\EventTask')->findOneBy(array('name' => $event));
     if ($task) {
         if (\XLite\Core\EventListener::getInstance()->handle($task->getName(), $task->getArguments())) {
             \XLite\Core\Database::getEM()->remove($task);
             $result = true;
         }
         $errors = \XLite\Core\EventListener::getInstance()->getErrors();
     } else {
         \XLite\Core\Database::getRepo('XLite\\Model\\TmpVar')->removeEventState($event);
     }
     \XLite\Core\Database::getEM()->flush();
     $state = \XLite\Core\Database::getRepo('XLite\\Model\\TmpVar')->getEventState($event);
     $this->setPureAction(true);
     if ($result && $state) {
         \XLite\Core\Event::eventTaskRun(array('percent' => \XLite\Core\Database::getRepo('XLite\\Model\\TmpVar')->getEventStatePercent($event), 'error' => !empty($errors)));
     } else {
         $result = false;
     }
     if ($errors) {
         foreach ($errors as $message) {
             \XLite\Core\TopMessage::addError($message);
         }
         $result = false;
     }
     $this->valid = $result;
 }
開發者ID:kingsj,項目名稱:core,代碼行數:36,代碼來源:EventTask.php

示例2: clearTopMessages

 /**
  * Clear list
  *
  * @return void
  */
 public function clearTopMessages()
 {
     parent::clearTopMessages();
     if (\XLite\Core\CMSConnector::isCMSStarted()) {
         \XLite\Module\CDev\DrupalConnector\Handler::getInstance()->clearTopMessages();
     }
 }
開發者ID:kingsj,項目名稱:core,代碼行數:12,代碼來源:TopMessage.php

示例3: 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

示例4: doActionSwitch

 /**
  * Switch state
  *
  * @return void
  */
 protected function doActionSwitch()
 {
     $value = !\XLite\Core\Config::getInstance()->XC->ThemeTweaker->edit_mode;
     \XLite\Core\Database::getRepo('XLite\\Model\\Config')->createOption(array('category' => 'XC\\ThemeTweaker', 'name' => 'edit_mode', 'value' => $value));
     \XLite\Core\TopMessage::addInfo($value ? 'Webmaster mode is enabled' : 'Webmaster mode is disabled');
     $this->setReturnURL($this->buildURL('theme_tweaker_templates'));
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:12,代碼來源:ThemeTweakerTemplates.php

示例5: capostValidateMerchant

 /**
  * Validate return from Canada Post merchant registration process
  *
  * @return void
  */
 protected function capostValidateMerchant()
 {
     $token = \XLite\Core\Request::getInstance()->{'token-id'};
     $status = \XLite\Core\Request::getInstance()->{'registration-status'};
     if (\XLite\Module\XC\CanadaPost\Core\Service\Platforms::REG_STATUS_SUCCESS === $status) {
         // Registration is complete
         // Send request to Canada Post server to retrieve merchant details
         $data = \XLite\Module\XC\CanadaPost\Core\Service\Platforms::getInstance()->callGetMerchantRegistrationInfoByToken($token);
         if (isset($data->merchantInfo)) {
             // Update Canada Post settings
             $this->updateCapostMerchantSettings($data->merchantInfo);
             // Disable wizard
             $this->disableCapostWizard();
             \XLite\Core\TopMessage::getInstance()->addInfo('Registration process has been completed successfully.');
         } else {
             foreach ($data->errors as $err) {
                 \XLite\Core\TopMessage::getInstance()->addError('ERROR: [' . $err->code . '] ' . $err->description);
             }
         }
     } else {
         // An error occurred
         if (\XLite\Module\XC\CanadaPost\Core\Service\Platforms::REG_STATUS_CANCELLED === $status) {
             \XLite\Core\TopMessage::getInstance()->addError('Registration process has been canceled.');
         } else {
             \XLite\Core\TopMessage::getInstance()->addError('Failure to finish registration process.');
         }
     }
     // Remove token from the session
     \XLite\Core\Session::getInstance()->capost_token_id = null;
     \XLite\Core\Session::getInstance()->capost_token_ts = null;
     // Redirect back to the Canada Post settings page
     $this->setReturnURL($this->buildURL('capost'));
 }
開發者ID:kewaunited,項目名稱:xcart,代碼行數:38,代碼來源:Main.php

示例6: doNoAction

 /**
  * Preprocessor for no-action run
  *
  * @return void
  */
 protected function doNoAction()
 {
     $this->restoreOrder();
     if ($this->addedOrder) {
         $reason = $this->addedOrder->getFailureReason() ?: $this->getDefaultFailureReason();
         \XLite\Core\TopMessage::addError($reason);
     }
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:13,代碼來源:CheckoutFailed.php

示例7: doActionUpdateInventoryProducts

 /**
  * doActionUpdateInventoryProducts
  *
  * @return void
  */
 protected function doActionUpdateInventoryProducts()
 {
     // Update price and other fields
     \XLite\Core\Database::getRepo('\\XLite\\Model\\Product')->updateInBatchById($this->getPostedData());
     // Update inventory
     \XLite\Core\Database::getRepo('\\XLite\\Model\\Inventory')->updateInBatchById($this->getPostedData());
     \XLite\Core\TopMessage::addInfo('Inventory has been successfully updated');
 }
開發者ID:kingsj,項目名稱:core,代碼行數:13,代碼來源:Main.php

示例8: handleRequest

 /**
  * Prevent users registering by administrator
  *
  * @return void
  */
 public function handleRequest()
 {
     if ($this->isRegisterMode() || 'delete' === \XLite\Core\Request::getInstance()->action) {
         \XLite\Core\TopMessage::addError('It is impossible to delete or create user accounts because your store currently works ' . 'as an integration with Drupal and shares users with Drupal. Deleting/creating user ' . 'accounts is possible via Drupal administrator interface.');
         $this->markAsAccessDenied();
     }
     return parent::handleRequest();
 }
開發者ID:kingsj,項目名稱:core,代碼行數:13,代碼來源:Profile.php

示例9: doActionConfirmWithPassword

 /**
  * Do action
  *
  * @return void
  */
 protected function doActionConfirmWithPassword()
 {
     $password = \XLite\Core\Request::getInstance()->password;
     $result = null !== $password && \XLite\Core\Auth::comparePassword(\XLite\Core\Auth::getInstance()->getProfile()->getPassword(), $password);
     if (!$result) {
         \XLite\Core\TopMessage::addError('Incorrect password. Please try again.');
     }
     \XLite\Core\Event::passwordConfirmed(array('result' => $result));
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:14,代碼來源:Confirm.php

示例10: doActionDelete

 /**
  * doActionDelete
  *
  * @return void
  * @throws
  */
 protected function doActionDelete()
 {
     if (\Includes\Utils\FileManager::isExists($this->sqldumpFile) && !\Includes\Utils\FileManager::deleteFile($this->sqldumpFile)) {
         \XLite\Core\TopMessage::addError(static::t('Unable to delete file') . ' ' . $this->sqldumpFile);
     } else {
         \XLite\Core\TopMessage::addInfo('SQL file was deleted successfully');
     }
     $this->doRedirect();
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:15,代碼來源:DbBackup.php

示例11: 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

示例12: 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

示例13: doActionTransaction

 /**
  * Do redirect customer to iDEAL server for payment
  *
  * @return void
  */
 protected function doActionTransaction()
 {
     try {
         $processor = new \XLite\Module\XC\IdealPayments\Model\Payment\Processor\IdealProfessional();
         $processor->doTransactionRequest(\XLite\Core\Request::getInstance()->iid, \XLite\Core\Request::getInstance()->transid);
     } catch (\Exception $e) {
         \XLite\Core\TopMessage::addError(static::t('Something wrong in the iDEAL payment module settings. Please try later or use other payment option.'));
         $this->setReturnURL('checkout');
     }
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:15,代碼來源:IdealPro.php

示例14: requestProbe

 /**
  * Request probe script
  *
  * @return void
  */
 protected function requestProbe()
 {
     $url = \XLite::getInstance()->getShopURL(\XLite\Core\Converter::buildURL('', '', array('key' => \XLite\Core\Config::getInstance()->Internal->probe_key), 'probe.php'));
     set_time_limit(0);
     $request = new \XLite\Core\HTTP\Request($url);
     $response = $request->sendRequest();
     if (200 != $response->code) {
         \XLite\Core\TopMessage::addError('Measuring productivity in manual mode failed.');
     }
 }
開發者ID:kirkbauer2,項目名稱:kirkxc,代碼行數:15,代碼來源:Measure.php

示例15: doActionRecoverPassword

 /**
  * doActionRecoverPassword
  *
  * @return void
  */
 protected function doActionRecoverPassword()
 {
     // show recover message if email is valid
     if ($this->requestRecoverPassword($this->get('email'))) {
         $this->setReturnURL($this->buildURL('recover_password', '', array('mode' => 'recoverMessage', 'link_mailed' => 1, 'email' => $this->get('email'))));
     } else {
         $this->setReturnURL($this->buildURL('recover_password', '', array('valid' => 0)));
         \XLite\Core\TopMessage::addError('There is no user with specified email address');
     }
 }
開發者ID:kingsj,項目名稱:core,代碼行數:15,代碼來源:RecoverPassword.php


注:本文中的XLite\Core\TopMessage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。