Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/goliatone/emb-notices
Kohana flash notices module.
https://github.com/goliatone/emb-notices
Last synced: 4 days ago
JSON representation
Kohana flash notices module.
- Host: GitHub
- URL: https://github.com/goliatone/emb-notices
- Owner: goliatone
- Created: 2011-12-15T16:24:29.000Z (almost 13 years ago)
- Default Branch: master
- Last Pushed: 2012-02-02T14:54:01.000Z (almost 13 years ago)
- Last Synced: 2024-10-11T09:09:28.195Z (27 days ago)
- Language: PHP
- Homepage:
- Size: 97.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
#Notice
The **Notice** module enables to manage application's notifications.
It has a simple api and a light weight implementation, that allows for notice queuing and grouping.
The rendering of the notices is decoupled from the module and fully customizable.To set a notice, usually from one of your controllers, you simple call `Notice::add`
$level = Notice::ERROR;
$header = 'Validation Error';
$message = 'You need to provide a valid email.';
$notice_group = 'post.create';
Notice::add(Notice::ERROR, $message,$header, $notice_group);To render a notice, usually inside one of your views or partials, you can check for an specific group:
if(Notice::queued('post.create')) echo Notice::render('post.create');
Or just go ahead, and render all notices:
if(Notice::queued()) echo Notice::render();
Which, in turn will call the default basic view:
if (! empty($messages)) {
';
$output = '';
foreach ($messages as $type => $message) {
foreach ($message as $notice) {
$output .= '
}
}
echo $output;
}###Notice Levels
There are four default notice levels, and four shortcut methods to call them.
This way we don't have to specify the level like we do with `Notice::add`Notice::notice($message,$header, $notice_group);
Notice::success($message,$header, $notice_group);
Notice::warn($message,$header, $notice_group);
Notice::error($message,$header, $notice_group);