Loading...
 
Skip to main content

Ex-post functions

Events

Trigger events to be displayed in notification streams

Copy to clipboard
TikiLib::events()->trigger('tiki.category.update', [ 'type' => 'category', 'object' => $id, 'user' => $user, ]);

Logs

Trigger log entries to be created

Forward

Forward to another service controller action

Copy to clipboard
return array( 'FORWARD' => array( 'controller' => 'tracker', 'action' => 'update_item_status', 'status' => 'DONE', 'redirect' => $input->redirect->text(), ) );

Redirect

Trigger a redirect to another screen, optionally with a message that will appear on the target screen in a remarksbox

Redirect to a URL

Copy to clipboard
$accessLib = TikiLib::lib('access'); $accessLib->redirect('tiki-admin.php?page=wiki');

Redirect with a message to a URL variable

Copy to clipboard
$accessLib = TikiLib::lib('access'); $accessLib->redirect($return_url, tr('Your comment was posted.'));

Index update/rebuild

Tigger incremental update or complete rebuild of the unified search index.

Sample code
Copy to clipboard
TikiLib::lib('unifiedsearch')->processUpdateQueue(); TikiLib::events()->trigger('tiki.process.redirect'); // wait for indexing to complete before loading of next request to ensure updated info shown

Feedback

Trigger instant feedback for the user about the success of the action

Copy to clipboard
In the tpl file add this to the <form> element: class="confirm-action" In the controller add this return array: return array( 'modal' => '1', 'FORWARD' => array( 'controller' => 'utilities', 'action' => 'modal_alert', 'ajaxtype' => 'feedback', 'ajaxheading' => tra('Success'), 'ajaxmsg' => tra('Changes saved'), 'ajaxdismissible' => 'n', 'ajaxtimer' => '3', ) );
Collapse/expand modules below
Show PHP error messages