Различия

Здесь показаны различия между двумя версиями данной страницы.

Ссылка на это сравнение

Следующая версия
Предыдущая версия
start [2016/04/13 12:46]
admin создано
start [2016/04/13 13:10]
admin
Строка 1: Строка 1:
-====== ​Главная страница ​====== +<code php>​class admin_plugin_yourplugin extends DokuWiki_Admin_Plugin { 
 +  
 + private $explorer_helper ​null; 
 + private $explorer_registered ​false; 
 +  
 + function get_explorer(){ 
 + if (!$this->​explorer_helper){ 
 + $this->​explorer_helper ​plugin_load('​helper','​explorertree'​);​ 
 +
 + return $this->​explorer_helper;​ 
 +
 + function init_explorertree(){ 
 + if (!($e $this->​get_explorer())) return; 
 + if (!$this->​explorer_registered){ 
 + $e->​registerRoute('​yourroutingname',​array( 
 + '​init_plugin' ​=> array( // this is the method to register routing, hence this method itself is the '​init_plugin'​ option. 
 + '​plugin' ​=> '​yourplugin',​ 
 + '​type' ​=> '​admin',​ 
 + '​method' ​=> '​init_explorertree',​ 
 + ), 
 + '​vars' ​=> array( 
 + '​class' ​=> '​explorertree',​ // override css class 
 + '​id' ​=> '​mytreeid',​ // override id for the tree 
 + ), 
 + '​callbacks' ​=> array( // callbacks in your plugin, or any callback 
 + // php callbacks, which are called via ajax 
 + '​page_selected_cb'​ => array($this,'​pageselected'​),​ 
 + '​ns_selected_cb'​ => function($id){ /* any closure or callable*/ return array(); }, 
 + // javascript callbacks, which are called on client side (name must be a string, your client side defined function name): 
 + '​page_selected_js'​ => '​my_ns_callback',​ 
 + '​ns_selected_js'​ => '​my_page_callback',​ 
 + ), 
 + )); 
 + $this->​explorer_registered = true; 
 +
 + return $e; 
 + }</​code>​