|
31 | 31 |
|
32 | 32 | use Glpi\Plugin\Hooks; |
33 | 33 |
|
34 | | -define('PLUGIN_ACTUALTIME_VERSION', '3.2.1'); |
| 34 | +define('PLUGIN_ACTUALTIME_VERSION', '3.2.2-beta'); |
35 | 35 |
|
36 | 36 | // Minimal GLPI version, inclusive |
37 | 37 | define("PLUGIN_ACTUALTIME_MIN_GLPI", "10.0.10"); |
@@ -73,18 +73,18 @@ function plugin_init_actualtime(): void |
73 | 73 |
|
74 | 74 | $PLUGIN_HOOKS[Hooks::CSRF_COMPLIANT]['actualtime'] = true; |
75 | 75 |
|
76 | | - $plugin = new Plugin(); |
77 | | - |
78 | | - if ($plugin->isActivated('actualtime')) { //is plugin active? |
| 76 | + if (Plugin::isPluginActive('actualtime')) { |
79 | 77 | // Classes |
80 | | - Plugin::registerClass(PluginActualtimeProfile::class, ['addtabon' => 'Profile']); |
| 78 | + Plugin::registerClass(PluginActualtimeProfile::class, ['addtabon' => Profile::class]); |
81 | 79 | // Add settings form as a tab on Setup - General page |
82 | | - Plugin::registerClass(PluginActualtimeConfig::class, ['addtabon' => 'Config']); |
| 80 | + Plugin::registerClass(PluginActualtimeConfig::class, ['addtabon' => Config::class]); |
83 | 81 |
|
84 | 82 | Plugin::registerClass(PluginActualtimeTask::class, ['planning_types' => true]); |
85 | 83 |
|
86 | 84 | // Hooks |
87 | | - $PLUGIN_HOOKS[Hooks::POST_ITEM_FORM]['actualtime'] = [PluginActualtimeTask::class, 'postForm']; |
| 85 | + $PLUGIN_HOOKS[Hooks::POST_ITEM_FORM]['actualtime'] = [ |
| 86 | + PluginActualtimeTask::class, 'postForm' |
| 87 | + ]; |
88 | 88 |
|
89 | 89 | $PLUGIN_HOOKS[Hooks::SHOW_ITEM_STATS]['actualtime'] = [ |
90 | 90 | Ticket::class => 'plugin_actualtime_item_stats', |
@@ -125,23 +125,35 @@ function plugin_init_actualtime(): void |
125 | 125 |
|
126 | 126 | $PLUGIN_HOOKS[Hooks::POST_SHOW_ITEM]['actualtime'] = 'plugin_actualtime_postshowitem'; |
127 | 127 |
|
128 | | - $PLUGIN_HOOKS[Hooks::DASHBOARD_CARDS]['actualtime'] = [PluginActualtimeDashboard::class, 'dashboardCards']; |
| 128 | + $PLUGIN_HOOKS[Hooks::DASHBOARD_CARDS]['actualtime'] = [ |
| 129 | + PluginActualtimeDashboard::class, 'dashboardCards' |
| 130 | + ]; |
129 | 131 |
|
130 | 132 | $config = new PluginActualtimeConfig(); |
131 | 133 | if ($config->showTimerPopup()) { |
132 | 134 | // This hook is not needed if not showing popup |
133 | | - $PLUGIN_HOOKS[Hooks::POST_SHOW_TAB]['actualtime'] = [PluginActualtimeTask::class, 'postShowTab']; |
| 135 | + $PLUGIN_HOOKS[Hooks::POST_SHOW_TAB]['actualtime'] = [ |
| 136 | + PluginActualtimeTask::class, 'postShowTab' |
| 137 | + ]; |
134 | 138 | } |
135 | 139 |
|
136 | 140 | if (Session::getLoginUserID()) { |
137 | 141 | $PLUGIN_HOOKS[Hooks::ADD_JAVASCRIPT]['actualtime'] = 'js/actualtime.js'; |
| 142 | + |
| 143 | + /** @var array $CFG_GLPI */ |
| 144 | + global $CFG_GLPI; |
| 145 | + |
| 146 | + // preload the fullcalendar library |
| 147 | + $CFG_GLPI['javascript']['actualtime']['sourcetimer'] = ['fullcalendar']; |
138 | 148 | } |
139 | 149 |
|
140 | 150 | if (Session::haveRight('plugin_actualtime_running', READ)) { |
141 | | - $PLUGIN_HOOKS['menu_toadd']['actualtime'] = ['admin' => 'PluginActualtimeRunning']; |
| 151 | + $PLUGIN_HOOKS['menu_toadd']['actualtime'] = [ |
| 152 | + 'admin' => 'PluginActualtimeRunning' |
| 153 | + ]; |
142 | 154 | } |
143 | 155 |
|
144 | 156 | // Standard settings link, on Setup - Plugins page |
145 | | - $PLUGIN_HOOKS['config_page']['actualtime'] = 'front/config.form.php'; |
| 157 | + $PLUGIN_HOOKS[Hooks::CONFIG_PAGE]['actualtime'] = 'front/config.form.php'; |
146 | 158 | } |
147 | 159 | } |
0 commit comments