本文整理汇总了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;
}
示例2: clearTopMessages
/**
* Clear list
*
* @return void
*/
public function clearTopMessages()
{
parent::clearTopMessages();
if (\XLite\Core\CMSConnector::isCMSStarted()) {
\XLite\Module\CDev\DrupalConnector\Handler::getInstance()->clearTopMessages();
}
}
示例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();
}
}
}
示例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'));
}
示例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'));
}
示例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);
}
}
示例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');
}
示例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();
}
示例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));
}
示例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();
}
示例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.');
}
}
示例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');
}
}
示例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');
}
}
示例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.');
}
}
示例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');
}
}