Notifyii
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')),
/var/www/YOUR_APP_NAME/protected$ ./yiic migrate --migrationPath=webroot.modules.notifyii.migrations
$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();
ModelNotifyii::getAllNotifications() ModelNotifyii::getAllRoledNotifications()
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; ?>
https://github.com/sensorario/notifyii/
Bugfixes:
Bugfixes:
Enhancement:
Enhancement:
Enhancement:
Bugfixes:
Total 5 comments
Console and website configurations are different:
protected/config/main.php protected/config/console.php
If you have deleted database and receive that message, maybe means that you have console.php still configured with sqlite.
I used this for a week. the database and module work nice. when i deleted the database, i do a migrate again in the command prompt to get a database/ table again. why the systems respond "no new migration found,your system is uptodate"
This exactly what i was looking for!!! great work.
I do not write code when is not needed. But I think to introduce a "purge" function that aggregate notifications and/or delete readed (and no more useful) notifications.
At the moment notifyii has a crud. But I'll put some automatic stuff to improve performace for biggest sites.
Have you tested its limits? How well performs for a large website? How can be scaled?
Leave a comment
Please login to leave your comment.