本文整理汇总了PHP中XLite\Core\TopMessage::addError方法的典型用法代码示例。如果您正苦于以下问题:PHP TopMessage::addError方法的具体用法?PHP TopMessage::addError怎么用?PHP TopMessage::addError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\Core\TopMessage
的用法示例。
在下文中一共展示了TopMessage::addError方法的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: 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();
}
}
}
示例3: doActionUpdate
/**
* Update payment method
*
* @return void
*/
protected function doActionUpdate()
{
$settings = \XLite\Core\Request::getInstance()->settings;
$method = $this->getPaymentMethod();
if (!$method) {
\XLite\Core\TopMessage::addError('An attempt to update settings of unknown payment method');
} else {
if (is_array($settings)) {
foreach ($settings as $name => $value) {
$method->setSetting($name, trim($value));
}
}
$properties = \XLite\Core\Request::getInstance()->properties;
if (is_array($properties) && !empty($properties)) {
$method->map($properties);
}
\XLite\Core\Database::getRepo('\\XLite\\Model\\Payment\\Method')->update($method);
// If "just added" method is configured and can be enabled then we enable it
if (\XLite\Core\Request::getInstance()->just_added && $method->isConfigured() && $method->canEnable()) {
$method->setEnabled(true);
\XLite\Core\Database::getEM()->flush();
}
if ($method->isConfigured()) {
\XLite\Core\TopMessage::addInfo('The settings of payment method successfully updated');
$this->setReturnURL($this->buildURL('payment_settings'));
} else {
\XLite\Core\TopMessage::addWarning('Payment method has not been configured properly');
}
}
}
示例4: 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();
}
示例5: 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);
}
}
示例6: 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));
}
示例7: 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();
}
示例8: 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.');
}
}
示例9: 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.');
}
}
示例10: 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');
}
}
示例11: 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');
}
}
示例12: 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) {
echo 1;
} else {
\XLite\Core\TopMessage::addError('Incorrect password. Please try again.');
echo 0;
}
}
示例13: getModule
/**
* Return current module object
*
* @return \XLite\Model\Module
* @throws \Exception
*/
public function getModule()
{
if (!isset($this->module)) {
$this->module = \XLite\Core\Database::getRepo('\\XLite\\Model\\Module')->find($this->getModuleID());
if (!$this->module) {
\XLite\Core\TopMessage::addError('Add-on does not exist.');
\XLite\Logger::getInstance()->log('Add-on does not exist (ID: ' . $this->getModuleID() . ')', LOG_ERR);
$this->redirect($this->buildURL('addons_list_installed'));
}
}
return $this->module;
}
示例14: doActionImport
/**
* Action 'import'
*
* @return void
*/
protected function doActionImport()
{
$fileName = \XLite\Core\Session::getInstance()->language_import_file;
if (\Includes\Utils\FileManager::isExists($fileName)) {
$result = \XLite\Core\Database::getRepo('XLite\\Model\\Language')->parseImportFile($fileName, true);
\XLite\Core\Session::getInstance()->language_import_result = $result;
} else {
\XLite\Core\Session::getInstance()->language_import_file = null;
\XLite\Core\TopMessage::addError('File not found');
}
$this->setReturnURL($this->buildURL('languages'));
}
示例15: doActionSetSalePrice
/**
* Set sale price parameters for products list
*
* @return void
*/
protected function doActionSetSalePrice()
{
$form = new \XLite\Module\CDev\Sale\View\Form\SaleSelectedDialog();
$form->getRequestData();
if ($form->getValidationMessage()) {
\XLite\Core\TopMessage::addError($form->getValidationMessage());
} else {
\XLite\Core\Database::getRepo('\\XLite\\Model\\Product')->updateInBatchById($this->getUpdateInfo());
\XLite\Core\TopMessage::addInfo('Products information has been successfully updated');
}
$this->setReturnURL($this->buildURL('product_list', '', array('mode' => 'search')));
}