dbrisinajumi/d2messages

internal messaging

Installs: 59

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 5

Forks: 0

Open Issues: 2

Type:yii-extension

dev-master 2015-03-05 08:04 UTC

This package is auto-updated.

Last update: 2024-10-07 21:46:14 UTC


README

/config/main.php

Add under import:

    'vendor.uldisn.ace.*',
    'vendor.dbrisinajumi.d2messages.*',          
    'vendor.dbrisinajumi.d2messages.models.*',          
    'vendor.dbrisinajumi.d2messages.widgets.*',        

add under module:

    'd2messages' => array( 
        'class' => 'vendor.dbrisinajumi.d2messages.D2messagesModule',
        'write' => array(
            'recipient' => array(
                    'person_user',  //all users
                    'roles',        // all roles
            ),
            'default_recipient' => array(
                  'person_user' => false,
                  'role' => false,
            ),            
        ),    
       
        //link definiton in message to model record view
        'path_to_models_records' => array(
            '[model_name]' => array(
                'route' => '[module]/[controler]/[action]',
                'params' => array(), //additional parameters
                'model_id_name' => 'id', //model ph field name
                
            )
        ),
    ),

under parameters add path to widgets views:

    'theme_settings' => array(
        'widgets_view_path' => 'vendor.uldisn.ace.widgets.views',
        ),    

/config/console.php

add under commandMap ==> migrate ==> modulePaths:

    'd2messages'              => 'vendor.dbrisinajumi.d2messages.migrations',  

migration

run in app directory

    yiic.php migrate.php

Widget

$this->widget('D2Mail', array(
    'pprs_id' => Yii::app()->getModule('user')->user()->profile->person_id, //optional - filtr messages to person
    'model_name' => get_class($model),  //optional filter messages by model name
    'model_id' => $model->primaryKey,  //optional filter messages by model name        
    'write_mail' => false,       //can not write mail
    // or define label of button
    'write_mail' => array(
        'label' => 'Write message',
    ),        
    'left_tabs' => array(
        array(
            'label' => 'Messages',
            'tab_code' => 'messages',
            'icon' => 'icon-inbox',
            'icon_color' => 'blue',
            'active' => true,
            'url' => array('AjaxShowMessages', 'aobj_id' => $model->primaryKey),
        ),
    ),
    'messages_format' => array(
        //show columns in messages list
        'columns' => array(
            'unread',
            'sender',
            'subject',
            'summary',
            'time',
            'model_label',
            'model_name',
        ),
    ),
    //mesage list title big
    'title_big' => 'Ziņojumi',
    )
);

translation

model names translation in application/en/models.php

Acces rights

Add to roles rights


INSERT INTO `authitemchild` (`parent`, `child`) VALUES ('[role]', 'D2messages.D2mmMessages.*'); 

menu item


                array(
                    'visible' => Yii::app()->user->checkAccess('[role]'),
                    'icon' => 'envelope white',
                    'badge_type' => 'info',
                    'badge_label' => D2mmMessages::getCountUnreadMessages(),
                    'url' => array('/d2messages/d2mmMessages/admin'),
                    'itemCssClass' => 'light-blue',
                ),