notifyii A module for notifications

Notifyii

  1. Run migrations
  2. Notify the end of the world
  3. Get all notifications
  4. Usage
  5. GitHub
  6. 1.3 (??? ??, ????)
  7. 1.2 (Oct 25, 2012)
  8. 1.1 (Oct 10, 2012)
  9. 1.0 (Oct 10, 2012)
Be shure to have the same 'db' configuratiion in these files:
protected/config/main.php
protected/config/console.php

To install notifyii, navigate to the forlder "protected/modules" of your project. If your project does not have any "modules" folder, just create id. Then, run the command:

$ git clone git@github.com:sensorario/notifyii

Now you just need to add module to confi file:

'modules'=>array(
    'notifyii',
),

And try to load these routes:

index.php?r=notifyii
index.php?r=notifyii/modelNotifyii

The first one show you a sample page that create a sample notification. The second one show you a crud to alter notifications.

If you want you can add these items to views/layouts/main.php file:

array('label'=>'Notifyii', 'url'=>array('/notifyii')),
array('label'=>'ModelNotifyii', 'url'=>array('/notifyii/modelNotifyii')),
array('label'=>'NotifyiiReads', 'url'=>array('/notifyii/notifyiiReads')),

Run migrations

/var/www/YOUR_APP_NAME/protected$ ./yiic migrate --migrationPath=webroot.modules.notifyii.migrations

Notify the end of the world

$notifyii = new Notifyii();
$notifyii->title('Mayans news!');
$notifyii->message('The end of the world');
$notifyii->expire(new DateTime("21-12-2012"));
$notifyii->from("-1 week");
$notifyii->to("+1 day");
$notifyii->role("admin");
$notifyii->link($this->createUrl('/site/index'));
$notifyii->save();

Get all notifications

ModelNotifyii::getAllNotifications()
ModelNotifyii::getAllRoledNotifications()

Usage

Suppose to load all notifications in your controller:

public function actionIndex()
{
    $this->render('index', array(
        'notifiche' => ModelNotifyii::getAllNotifications()
    ));
}

In the view, you can load all notifications

<?php foreach ($notifiche as $notifica) : ?>
    <?php if ($notifica->isNotReaded()) : ?>
        <div class="box">
            <h3><?php echo $notifica->title; ?></h3>
            <a href="<?php echo $notifica->link; ?>">
                <?php echo $notifica->expire; ?></a> - 
            <a href="<?php echo $notifica->link; ?>">
                <?php echo $notifica->content; ?></a> <br />
            <a href="<?php echo $this->createUrl('/notifyii/default/read',
                array('id' => $notifica->id)); ?>">
                    segna questa notifica come letta</a>
        </div>
    <?php endif; ?>
<?php endforeach; ?>

GitHub

https://github.com/sensorario/notifyii/

1.3 (??? ??, ????)

Bugfixes:

  • 26: Fixed title implementation

1.2 (Oct 25, 2012)

Bugfixes:

  • 16: You can add a notification with empty values bug

Enhancement:

  •  #23: Delete past notifications.
  •  #21: Added a title to notifications.
  •  #07: I can see notifications grouped by role.
  •  #22: I want to see who has read a notitication.
  •  #14: Improve notifyii backend pages UI.
  • 17: New notifications with CJuiDatePicker.

  • 13: Update form creation with roles.

  • 04: work with yii flash messages.

1.1 (Oct 10, 2012)

Enhancement:

  • 10: La notifica deve avere anche un link.

  • 09: Una notifica può essere marcata come letta.

  • 08: Aggiungere un tip per la configurazione della connessione della console.

  • 01: Migliorare la sintassi per recuperare tutte quante le notifiche.

1.0 (Oct 10, 2012)

Enhancement:

  • 3: Aggiungere rights o RBAC tra i prerequisiti della documentazione.

  • 2: Gestire anche il ruolo.

Bugfixes:

  • 6: Fix Readme bug

  • 5: Repository contains nbproject folder.

9 0
16 followers
828 downloads
Yii Version: 1.1
License: MIT
Category: User Interface
Developed by: sensorario
Created on: Oct 11, 2012
Last updated: 11 years ago

Downloads

show all

Related Extensions