# shiftcontroller/4.9.66/sh4/notifications/html/admin/controller/edit.php

ShiftController Employee Shift Scheduling, version 4.9.66. 47 lines.

- Page: https://pluginprobe.com/plugins/shiftcontroller/4.9.66/code/sh4/notifications/html/admin/controller/edit.php
- Raw: https://pluginprobe.com/plugins/shiftcontroller/4.9.66/raw/sh4/notifications/html/admin/controller/edit.php
- Modified: 2023-05-29T12:46:18+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/shiftcontroller/4.9.66/code/sh4/notifications/html/admin/controller/edit.php#L10-L20`.

```php
<?php if (! defined('ABSPATH')) exit; // Exit if accessed directly
#[AllowDynamicProperties]
class SH4_Notifications_Html_Admin_Controller_Edit
{
	public function __construct(
		HC3_Hooks $hooks,
		HC3_Post $post,

		SH4_Calendars_Query $calendarsQuery,
		SH4_Notifications_Service $notificationsService
		)
	{
		$this->post = $hooks->wrap($post);

		$this->calendarsQuery = $hooks->wrap( $calendarsQuery );
		$this->notificationsService = $hooks->wrap( $notificationsService );
		$this->self = $hooks->wrap($this);
	}

	public function execute( $calendarId, $notificationId )
	{
		$calendar = $this->calendarsQuery->findById( $calendarId );

		$subject = $this->post->get('subject');
		$body = $this->post->get('body');

		$template = join( "\n", array($subject, $body) );

		$this->notificationsService->setTemplate( $calendar, $notificationId, $template );

		$to = 'admin/notifications/' . $calendarId;
		$return = array( $to, '__Notification Updated__' );
		return $return;
	}

	public function executeReset( $calendarId, $notificationId )
	{
		$calendar = $this->calendarsQuery->findById( $calendarId );

		$template = NULL;
		$this->notificationsService->setTemplate( $calendar, $notificationId, $template );

		$to = 'admin/notifications/' . $calendarId;
		$return = array( $to, '__Notification Updated__' );
		return $return;
	}
}
```
