This page documents useful functions that can be used in a service controller action after the execution of modifications (insert/update/delete)
Events
Trigger events to be displayed in notification streams
Learn more more about events and activities
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
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
lib/tikiaccesslib.php
lib/core/Services/Broker.php
Redirect to a URL
$accessLib = TikiLib::lib('access'); $accessLib->redirect('tiki-admin.php?page=wiki');
Redirect with a message to a URL variable
$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.
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
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', ) );