2017 © Pedro Peláez

library messages

AgileToolkit universal messaging system



AgileToolkit universal messaging system

  • Tuesday, March 10, 2015
  • by rvadym
  • Repository
  • 3 Watchers
  • 1 Stars
  • 327 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown


ATK4 internal messaging system


  • 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


composer.json, (*1)

"atk4/messages": "dev-master"

Support for more "to" and "from" roles

By default add-on supports only few types of users, (*2)

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., (*3)

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, (*4)


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., (*5)

Important!!! There are two separate lists of roles - "to" and "from" , (*6)

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., (*7)

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


Create page for message management, (*8)

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., (*9)

Admin view CSS

You can change some css class using atk4/messages/Config singleton. List of available ... provided, (*10)

'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., (*11)

The Versions

10/03 2015



AgileToolkit universal messaging system

  Sources   Download

The Requires


The Development Requires

by Vadym Radvansky
by Konstantin Kolodnitsky

atk4 addon