Skip to content

Instantly share code, notes, and snippets.

@tolanych
Last active April 13, 2019 18:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolanych/fc9025b9dd14a43573f4c391e625a7ea to your computer and use it in GitHub Desktop.
Save tolanych/fc9025b9dd14a43573f4c391e625a7ea to your computer and use it in GitHub Desktop.
plugin mgr
<?php
switch ($modx->event->name) {
case 'OnCommentSave':
if ($modx->context->key == 'mgr' && $mode == 'new') {
$scriptProperties = [
'tplCommentEmailReply' => 'tpl.Tickets.comment.email.reply',
'tplCommentEmailOwner' => 'tpl.Tickets.comment.email.owner',
'tplCommentEmailSubscription' => 'tpl.Tickets.comment.email.subscription',//чанк письма
'allowGuestEmails' => 1
];
$Tickets = $modx->getService('tickets', 'Tickets', $modx->getOption('tickets.core_path', null,
$modx->getOption('core_path') . 'components/tickets/') . 'model/tickets/', $scriptProperties);
$Tickets->initialize($modx->context->key, $scriptProperties);
$comment = $object->toArray();
if ($user = $modx->getObject('modUser', $comment['createdby'])) {
$profile = $user->getOne('Profile');
$comment = array_merge($profile->toArray(), $user->toArray(), $comment);
}
$Tickets->sendCommentMails($comment);
}
break;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment