Download the PHP package icap/notification-bundle without Composer

On this page you can find all versions of the php package icap/notification-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package notification-bundle

NotificationBundle

WARNING

DEVELOPMENT HAS MOVED TO claroline/Distribution. THIS REPOSITORY IS NO LONGER MAINTAINED.


Notification bundle for Claroline Connect. See https://github.com/claroline/Claroline

Here is an analysis of what the Notification system does.

Installation

This bundle completes the Core bundle. It is needed so the system can generate notifications.

Via composer:

composer require icap/notification-bundle "dev-master"

Configuration

How to use in plugins

In order to integrate and enable notifications in a Claroline connect plugin you need to follow these steps:

  1. Add {% render controller('IcapNotificationBundle:FollowerResource:renderForm', {'resourceId': _resource.resourceNode.id, 'resourceClass': _resource.resourceNode.class}) %} somewhere in your interface to render the button that allows user to enable and disable notifications for a resource. As you can see, 2 parameters are required, the resource node id and the resource node class.

  2. Any event that you want to generate a notification needs to implement the NotifiableInterface. This interface has 9 methods.

    • getSendToFollowers() : returns true or false if event can notify the resource's followers
    • getIncludeUserIds() : returns a list of User ids that will receive the notification (extra Users that are not necessarily in followers list)
    • getExcludeUserIds() : returns a list of User ids that must not receive the notification (this Users can be either in followers list or includeUsers list)
    • getDoer() : returns the User whose action raised the notification (this method already exists in LogGenericEvent class)
    • getActionKey() : returns a sting with the name/key of the action performed
    • getIconKey() : returns a string, usually the name of the resource type e.g. "wiki" and is used to generate a color for every notification that has the same icon name. This color is the mini icon's background color and as text content for this icon is used the first letter of the icon key.
    • getResource() : returns the resource on which the action was performed (this method already exists in LogGenericEvent class)
    • getNotificationDetails() : returns an array (JsonArray in database) which contains informations about the resource name, id and type as well as other information, necessary to render the notification text. All the information about the "doer" are added by the Notification plugin automatically. All the rest (resource, etc.) need to be added manually.
    • isAllowedToNotify() : returns true or false and informs CoreBundle that this event raises or not a notification. It can test a condition and if this condition fails no notification is created or sent, else if condition is fulfilled a notification is created and sent to users.

    You can use the example of the LogContributionCreateEvent in the WikiBundle to guide you.

  3. Create a domain for translations under translations folder following the name pattern notification.lang.yml
  4. Under views folder create a Notification folder and store inside all views related to notifications' display/rendering. It is recommended to create a general twig file say notification_item.html.twig which will extend the IcapNotificationBundle:Templates:notification.html.twig template, will render all common elements and include any other necessary template according to the action type. An example is given here
  5. Create listener, for example NotificationListener and service e.g. listeners.yml is the example for WikiBundle
  6. *newCreate listener, NotificationUserParametersListener to enable user activate and deactivate the display of your notifications

You can find a complete example of these steps in iCAPLyon1/WikiBundle

Please enable notification only for events that inform of content creation/addition. Not for content deletion. Otherwise a user will be lost in a "notification overload".

Integrate user tagging in plugins

If you want to allow users to tag and notify other users then you should follow these steps:

  1. For every entity in your plugin that contains text, implemented by a tinymce editor (for example a post in a blog, a contribution in a wiki etc.) you need to create:

    • A protected variable to store the user picker object (contains the information about the original text, the final text, as long as the list of tagged users)

    • Develop a @ORM\PrePersist method that instanciates userPicker and swaps originalText with finalText.

    • Create an entity listener class and associate it with your entity. Here is an example (for Contribution entity in WikiBundle):

      This entity Listener is responsible to create a notification and notify every tagged user on entity's postPersist event. Here is the example of the Contribution listener.

  2. Add in listeners.yml file a line for the new event. Example:

  3. Handle the rendering of the new notification event. (Create dedicated view etc.) Here is this view for the wiki bundle and here is the modified notification_item view to include the new event.

All versions of notification-bundle with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.1
claroline/core-bundle Version ~6.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package icap/notification-bundle contains the following files

Loading the files please wait ....