-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
664 additions
and
139 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
namespace panlatent\schedule\actions; | ||
|
||
use Craft; | ||
use craft\helpers\App; | ||
use panlatent\craft\actions\abstract\Action; | ||
use panlatent\craft\actions\abstract\ContextInterface; | ||
|
||
class SendEmail extends Action | ||
{ | ||
public static function displayName(): string | ||
{ | ||
return Craft::t('schedule', 'Send Email'); | ||
} | ||
|
||
public array $emails = []; | ||
|
||
public string $subject = ''; | ||
|
||
public string $message = <<<TWIG | ||
Hello {{name}}, | ||
TWIG; | ||
|
||
public function execute(ContextInterface $context): bool | ||
{ | ||
$emails = []; | ||
foreach ($this->emails as $email) { | ||
if ($email['name']) { | ||
$emails[App::parseEnv($email['email'])] = $email['name']; | ||
} else { | ||
$emails[] = App::parseEnv($email['email']); | ||
} | ||
} | ||
|
||
$subject = Craft::$app->view->renderString($this->subject, [ | ||
'action' => $this, | ||
]); | ||
|
||
$message = Craft::$app->view->renderString($this->message, [ | ||
'action' => $this, | ||
]); | ||
|
||
return Craft::$app->mailer | ||
->compose() | ||
->setTo($emails) | ||
->setHtmlBody($message) | ||
->setSubject($subject) | ||
->send(); | ||
} | ||
|
||
public function getSettingsHtml(): ?string | ||
{ | ||
return Craft::$app->getView()->renderTemplate('schedule/_components/actions/SendEmail/settings', [ | ||
'action' => $this, | ||
]); | ||
} | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ | |
* | ||
* @package panlatent\schedule\controllers | ||
* @author Panlatent <[email protected]> | ||
* @deprecated since 1.0 | ||
*/ | ||
class TimersController extends Controller | ||
{ | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace panlatent\schedule\events; | ||
|
||
use craft\events\ModelEvent; | ||
use panlatent\craft\actions\abstract\ActionInterface; | ||
|
||
class ActionEvent extends ModelEvent | ||
{ | ||
public ?ActionInterface $action = null; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
* | ||
* @package panlatent\schedule\events | ||
* @author Panlatent <[email protected]> | ||
* @deprecated since 1.0 | ||
*/ | ||
class ScheduleBuildEvent extends Event | ||
{ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,24 +7,16 @@ | |
|
||
namespace panlatent\schedule\events; | ||
|
||
use panlatent\schedule\base\ScheduleInterface; | ||
use yii\base\Event; | ||
use craft\events\ModelEvent; | ||
use panlatent\schedule\models\Schedule; | ||
|
||
/** | ||
* Class ScheduleEvent | ||
* | ||
* @package panlatent\schedule\events | ||
* @author Panlatent <[email protected]> | ||
*/ | ||
class ScheduleEvent extends Event | ||
class ScheduleEvent extends ModelEvent | ||
{ | ||
/** | ||
* @var ScheduleInterface|null | ||
*/ | ||
public ?ScheduleInterface $schedule = null; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public bool $isNew = false; | ||
public ?Schedule $schedule = null; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,24 +7,19 @@ | |
|
||
namespace panlatent\schedule\events; | ||
|
||
use craft\events\ModelEvent; | ||
use panlatent\schedule\models\ScheduleGroup; | ||
use yii\base\Event; | ||
|
||
/** | ||
* Class ScheduleGroupEvent | ||
* | ||
* @package panlatent\schedule\events | ||
* @author Panlatent <[email protected]> | ||
*/ | ||
class ScheduleGroupEvent extends Event | ||
class ScheduleGroupEvent extends ModelEvent | ||
{ | ||
/** | ||
* @var ScheduleGroup|null | ||
*/ | ||
public ?ScheduleGroup $group = null; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public bool $isNew = false; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,24 +9,19 @@ | |
|
||
namespace panlatent\schedule\events; | ||
|
||
use craft\events\ModelEvent; | ||
use panlatent\schedule\base\TimerInterface; | ||
use yii\base\Event; | ||
|
||
/** | ||
* Class TimerEvent | ||
* | ||
* @package panlatent\schedule\events | ||
* @author Panlatent <[email protected]> | ||
*/ | ||
class TimerEvent extends Event | ||
class TimerEvent extends ModelEvent | ||
{ | ||
/** | ||
* @var TimerInterface|null | ||
*/ | ||
public ?TimerInterface $timer = null; | ||
|
||
/** | ||
* @var bool | ||
*/ | ||
public bool $isNew = false; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?php | ||
|
||
namespace panlatent\schedule\fields; | ||
|
||
use craft\base\Field; | ||
|
||
class Action extends Field | ||
{ | ||
|
||
} |
Oops, something went wrong.