Skip to content

Instantly share code, notes, and snippets.

@Fi1osof
Created April 29, 2014 07:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fi1osof/80e5681962d5d8adcdcc to your computer and use it in GitHub Desktop.
Save Fi1osof/80e5681962d5d8adcdcc to your computer and use it in GitHub Desktop.
{$modx->regClientStartupScript("{$template_url}Scripts/jquery.validate.min.js")}
{$modx->regClientStartupScript("{$template_url}Scripts/jquery.validate.unobtrusive.min.js")}
{$request = $smarty.post}
{block name=properties}
{$properties = $request}
{$action = 'create'}
{/block}
{if $request}
{processor action="mgr/users/{$action}" ns="modxsite" params=$request assign=result}
{if !$result.success}
<p style="color:red;font-weight:bold;">{$result.message|default:"Ошибка выполнения запроса"}</p>
{foreach $result.field_errors as $error}
<p style="color:red;">{$error}</p>
{/foreach}
{else}
{$params = [
'user_id' => $result.object.id,
'delivery_group' => $request.delivery_group
]}
{processor action="mgr/users/deliverygroup/manage" ns="modxsite" params=$params assign=delivery_result}
{block name="result"}
<p style="color:green;">{$result.message|default:"Пользователь успешно создан"}</p>
<p><a href="{$modx->resource->uri}">Добавить еще пользователя</a></p>
{/block}
{/if}
{/if}
{block name=form}
{if !$result.success}
{include file="office/users/form.tpl"}
{/if}
{/block}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment