本文整理汇总了PHP中Msg::show方法的典型用法代码示例。如果您正苦于以下问题:PHP Msg::show方法的具体用法?PHP Msg::show怎么用?PHP Msg::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Msg
的用法示例。
在下文中一共展示了Msg::show方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: content
public function content($params = [])
{
$this->paramsParse($params);
if (empty($this->template->config['noSysMsgAutoShow'])) {
Msg::show();
}
if (!file_exists($this->template->contentPath)) {
echo 'Content not found';
} else {
extract($this->contentData);
include $this->template->contentPath;
}
}
示例2: foreach
<h3>Блокировки на счете</h3>
<?php
$currency_id = !empty($_GET['currency_id']) ? (int) $_GET['currency_id'] : 0;
$wallets = App::$cur->money->getUserWallets();
if ($currency_id && empty($wallets[$currency_id])) {
Msg::add('У вас нет такого кошелька');
Msg::show();
return;
}
if ($currency_id) {
$ids = $wallets[$currency_id]->id;
} else {
$ids = [];
foreach ($wallets as $wallet) {
$ids[] = $wallet->id;
}
$ids = implode(',', $ids);
}
$table = new \Ui\Table();
$table->setCols(['№', 'Кошелек', 'Сумма', 'Комментарий', 'Дата']);
//items pages
$pages = new \Ui\Pages($_GET, ['count' => \Money\Wallet\Block::getCount(['where' => ['wallet_id', $ids, 'IN']]), 'limit' => 20]);
$histories = \Money\Wallet\Block::getList(['where' => ['wallet_id', $ids, 'IN'], 'order' => [['date_create', 'DESC'], ['id', 'DESC']], 'start' => $pages->params['start'], 'limit' => $pages->params['limit']]);
foreach ($histories as $history) {
$amount = $history->amount;
$table->addRow([$history->id, $history->wallet->currency->name(), '<span class = "' . ($amount > 0 ? "text-success" : 'text-danger') . '">' . $amount . '</span>', $history->comment, $history->date_create]);
}
$table->draw();
$pages->draw();
示例3: checkRequest
public function checkRequest($params = [], $ajax = false)
{
if (!$this->checkAccess()) {
$this->drawError('you not have access to "' . $this->modelName . '" manager with name: "' . $this->formName . '"');
return [];
}
$successId = 0;
if (!empty($_POST[$this->requestFormName][$this->modelName])) {
$request = $_POST[$this->requestFormName][$this->modelName];
if ($this->model) {
$presets = !empty($this->form['preset']) ? $this->form['preset'] : [];
if (!empty($this->form['userGroupPreset'][\Users\User::$cur->group_id])) {
$presets = array_merge($presets, $this->form['userGroupPreset'][\Users\User::$cur->group_id]);
}
$afterSave = [];
$error = false;
foreach ($this->inputs as $col => $param) {
if (!empty($presets[$col])) {
continue;
}
if (is_object($param)) {
$afterSave[] = $param;
continue;
}
if (!empty($this->form['userGroupReadonly'][\Users\User::$cur->group_id]) && in_array($col, $this->form['userGroupReadonly'][\Users\User::$cur->group_id])) {
continue;
}
$inputClassName = '\\Ui\\ActiveForm\\Input\\' . ucfirst($param['type']);
$input = new $inputClassName();
$input->activeForm = $this;
$input->activeFormParams = $params;
$input->modelName = $this->modelName;
$input->colName = $col;
$input->colParams = $param;
try {
$input->validate($request);
$input->parseRequest($request);
} catch (\Exception $exc) {
\Msg::add($exc->getMessage(), 'danger');
$error = true;
}
}
if (!$error && empty($_GET['notSave'])) {
foreach ($presets as $col => $preset) {
if (!empty($preset['value'])) {
$this->model->{$col} = $preset['value'];
} elseif (!empty($preset['userCol'])) {
if (strpos($preset['userCol'], ':')) {
$rel = substr($preset['userCol'], 0, strpos($preset['userCol'], ':'));
$param = substr($preset['userCol'], strpos($preset['userCol'], ':') + 1);
$this->model->{$col} = \Users\User::$cur->{$rel}->{$param};
} else {
$this->model->{$col} = \Users\User::$cur->{$preset['userCol']};
}
}
}
if (!$this->parent) {
if (!empty($this->form['successText'])) {
$text = $this->form['successText'];
} else {
$text = $this->model->pk() ? 'Изменения были успешно сохранены' : 'Новый элемент был успешно добавлен';
}
\Msg::add($text, 'success');
}
$this->model->save(!empty($params['dataManagerParams']) ? $params['dataManagerParams'] : []);
foreach ($afterSave as $form) {
$form->checkRequest();
}
if ($ajax) {
\Msg::show();
} elseif (!empty($_GET['redirectUrl'])) {
\Tools::redirect($_GET['redirectUrl'] . (!empty($_GET['dataManagerHash']) ? '#' . $_GET['dataManagerHash'] : ''));
}
$successId = $this->model->pk();
}
}
if (!is_array($params) && is_callable($params)) {
$params($request);
}
}
return $successId;
}