Skip to content

Commit

Permalink
Add php tag to codesamples
Browse files Browse the repository at this point in the history
  • Loading branch information
bobmulder committed Jun 13, 2016
1 parent 5c1cf7c commit 846a367
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions README.md
Expand Up @@ -35,7 +35,7 @@ After loading the plugin you need to migrate the tables for the plugin using:

Before sending any notification, we need to register a template. An example about how to add templates:

```
```php
$notificationManager->addTemplate('newBlog', [
'title' => 'New blog by :username',
'body' => ':username has posted a new blog named :name'
Expand All @@ -49,7 +49,7 @@ and `:name`. Later on we will tell more about these variables.

Now we will be able to send a new notification using our `newBlog` template.

```
```php
$notificationManager->notify([
'users' => [1, 2],
'recipientLists' => ['administrators'],
Expand Down Expand Up @@ -78,15 +78,15 @@ be defined here.
To send notifications to large groups you are able to use RecipientLists.
You can register them with:

```
```php
$notificationManager->addRecipientList('administrators', [1,2,3,4]);
```

Now we have created a list of recipients called `administrators`.

This can be used later on when we send a new notification:

```
```php
$notificationManager->notify([
'recipientLists' => ['administrators'],
]);
Expand All @@ -100,7 +100,7 @@ Now, the users 1, 2, 3 and 4 will receive a notification.

You can easily retrieve notifications via the `getNotifications` method. Some examples:

```
```php
// getting a list of all notifications of the current logged in user
$this->Notifier->getNotifications();

Expand All @@ -118,7 +118,7 @@ You can easily retrieve notifications via the `getNotifications` method. Some ex

Getting counts of read/unread notifications can be done via the `countNotifications` method. Some examples:

```
```php
// getting a number of all notifications of the current logged in user
$this->Notifier->countNotifications();

Expand All @@ -136,7 +136,7 @@ Getting counts of read/unread notifications can be done via the `countNotificati

To mark notifications as read, you can use the `markAsRead` method. Some examples:

```
```php
// mark a single notification as read
$this->Notifier->markAsRead(500;

Expand All @@ -154,7 +154,7 @@ The following getters can be used at your notifications entity:

Example:

```
```php
// returns true or false
$entity->get('unread');

Expand All @@ -166,15 +166,15 @@ Example:

You can do something like this to use the notification list in your view:

```
```php
$this->set('notifications', $this->Notifier->getNotifications());
```

## Notification Manager

The `NotificationManager` is the Manager of the plugin. You can get an instance with:

```
```php
NotificationManager::instance();
```

Expand All @@ -192,7 +192,7 @@ The manager has the following methods available:

The `CakePlugins/Notifier.Notifier` component can be used in Controllers:

```
```php
public function initialize()
{
parent::initialize();
Expand Down

0 comments on commit 846a367

Please sign in to comment.