diff options
author | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 14:58:52 -0300 |
---|---|---|
committer | Silvio Rhatto <rhatto@riseup.net> | 2014-03-15 14:58:52 -0300 |
commit | 323fdcc59e467e6437aad244c475ed0184c7a020 (patch) | |
tree | 0dc86b7aeb394ee6d1c3c9106362dea16c982cde /mod/translation_editor/lib/hooks.php | |
parent | 8d66daa258a58b65c3658b38e99382732c88e017 (diff) | |
parent | 2d9b20157957a55bd83875775085ed31c9062577 (diff) | |
download | elgg-323fdcc59e467e6437aad244c475ed0184c7a020.tar.gz elgg-323fdcc59e467e6437aad244c475ed0184c7a020.tar.bz2 |
Merge commit '2d9b20157957a55bd83875775085ed31c9062577' as 'mod/translation_editor'
Diffstat (limited to 'mod/translation_editor/lib/hooks.php')
-rw-r--r-- | mod/translation_editor/lib/hooks.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/mod/translation_editor/lib/hooks.php b/mod/translation_editor/lib/hooks.php new file mode 100644 index 000000000..486fb0b7a --- /dev/null +++ b/mod/translation_editor/lib/hooks.php @@ -0,0 +1,45 @@ +<?php
+
+ function translation_editor_user_hover_menu($hook, $type, $return, $params) {
+ $user = $params['entity'];
+
+ if (elgg_is_admin_logged_in() && !($user->isAdmin())){
+ // TODO: replace with a single toggle editor action?
+ if(translation_editor_is_translation_editor($user->getGUID())){
+ $url = "action/translation_editor/unmake_translation_editor?user=" . $user->getGUID();
+ $title = elgg_echo("translation_editor:action:unmake_translation_editor");
+ } else {
+ $url = "action/translation_editor/make_translation_editor?user=" . $user->getGUID();
+ $title = elgg_echo("translation_editor:action:make_translation_editor");
+ }
+
+ $item = new ElggMenuItem('translation_editor', $title, $url);
+ $item->setSection('admin');
+ $item->setConfirmText(elgg_echo("question:areyousure"));
+ $return[] = $item;
+
+ return $return;
+ }
+ }
+
+ function translation_editor_actions_hook($hook, $type, $return, $params){
+ $allowed_actions = array(
+ "admin/plugins/activate",
+ "admin/plugins/deactivate",
+ "admin/plugins/activate_all",
+ "admin/plugins/deactivate_all",
+ "admin/plugins/set_priority",
+ "upgrading" // not actualy an action but comes from events.php
+ );
+
+ if(!empty($type) && in_array($type, $allowed_actions)){
+ // make sure we have all translations
+ translation_editor_reload_all_translations();
+
+ if($languages = get_installed_translations()){
+ foreach($languages as $key => $desc){
+ remove_private_setting(elgg_get_site_entity()->getGUID(), "te_last_update_" . $key);
+ }
+ }
+ }
+ }
\ No newline at end of file |