Last active
January 24, 2017 09:01
-
-
Save kanetei/dbfd9e688aef2587701bcf6ab857da20 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// application\bootstrap\app.php | |
Core::bind('\Concrete\Core\Workflow\BasicWorkflow', function() { | |
return new \Application\Src\Workflow\BasicWorkflow(); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Application\Src\Workflow; | |
use Concrete\Core\Workflow\Progress\Progress as WorkflowProgress; | |
use Core; | |
use PermissionKey; | |
class BasicWorkflow extends \Concrete\Core\Workflow\BasicWorkflow | |
{ | |
protected function notify( | |
WorkflowProgress $wp, | |
$message, | |
$permission = 'notify_on_basic_workflow_entry', | |
$parameters = array() | |
) | |
{ | |
$nk = PermissionKey::getByHandle($permission); | |
$nk->setPermissionObject($this); | |
$users = $nk->getCurrentlyActiveUsers($wp); | |
foreach ($users as $ui) { | |
$mh = Core::make('helper/mail'); | |
$mh->addParameter('uName', $ui->getUserName()); | |
$mh->to($ui->getUserEmail()); | |
$mh->from('example@example.com', t('Basic Workflow')); | |
$mh->addParameter('message', $message); | |
foreach ($parameters as $key => $value) { | |
$mh->addParameter($key, $value); | |
} | |
$mh->addParameter('siteName', Core::make('config')->get('concrete.site')); | |
$mh->load('basic_workflow_notification'); | |
$mh->sendMail(); | |
unset($mh); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment