There is no license information available for the latest version (dev-master) of this package.

AgileToolkit universal messaging system

dev-master 2015-03-10 17:51 UTC

This package is not auto-updated.

Last update: 2020-01-10 15:23:49 UTC



  • Autocomplete field for to and from fields
  • Support of sending messages from different models based on different database tables
  • Messages from site admin
  • Messages to everybody (broadcast messages) or to certain group of users
  • Easy to extend



"atk4/messages": "dev-master"

Support for more "to" and "from" roles

By default add-on supports only few types of users

protected static $from_types = ['admin'=>'Administrator'];
protected static $to_types   = ['admin'=>'Administrator','broadcast'=>'Broadcast message'];

You can extend this list by creating your own model extended from atk4/messages/Model_Message and adding same static properties to your newly created model.

protected static $from_types = [ 'reader' => 'Reader', 'author' => 'Author' ];
protected static $to_types   = [ 'reader' => 'Reader', 'author' => 'Author' ];

Also you have to let add-on know that it should use your custom model


The original set of roles and your own will be mixed. Use {{your_model_name}}::getFromTypes() and {{your_model_name}}::getToTypes() to get all available roles.

Important!!! There are two separate lists of roles - "to" and "from"

Different models for different roles

After you added custom roles you must let add-on know what model to use for each role. Use atk4/messages/Config singleton to make your add-on settings available globally.

    ->setTypeModelClassName( 'reader', 'Model_Reader' )
    ->setTypeModelClassName( 'author', 'Model_Author' )


Create page for message management

class page_messages extends Page {
    function init(){
        $this->title = 'Messages';

        $m = $this->add('atk4/messages/Model_Message');
        // $m = $this->add('Model_MyMessage'); // <~~~~~~~~~~~~ for custom model

        $crud = $this->add('atk4/messages/CRUD_Messages');


        // optional paginator
        if ($crud->grid) {


Done! Now you have fully functional admin panel for message management.

Admin view CSS

You can change some css class using atk4/messages/Config singleton. List of available ... provided

'message-from-class'  => 'atk-label atk-effect-warning atk-block',
'message-to-class'    => 'atk-label atk-effect-warning atk-block',
'message-text-class'  => 'atk-swatch-gray atk-box',


It is your responsibility to create user UI.