1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8//this script may only be included - so its better to die if called directly.
9if (strpos($_SERVER["SCRIPT_NAME"], basename(__FILE__)) !== false) {
10	header("location: index.php");
11	exit;
12}
13
14/**
15 * @return array
16 */
17function module_adminbar_info()
18{
19	return [
20		'name' => tra('Quick Admin Bar'),
21		'description' => tra('Consolidated admin bar with an easy access to quick admin links, recent changes, and important admin features'),
22		'prefs' => [],
23		'params' => [
24			'mode' => [
25				'name' => tra('Mode'),
26				'description' => tra('Display mode: module or header. Leave empty for module mode'),
27			],
28		]
29	];
30}
31
32/**
33 * @param $mod_reference
34 * @param $module_params
35 */
36function module_adminbar($mod_reference, $module_params)
37{
38	global $tiki_p_admin;
39	if ($tiki_p_admin != 'y') {
40		return;
41	}
42	$headerlib = TikiLib::lib("header");
43	$headerlib->add_css('div.contributors div br {clear: both;}');
44
45
46	$headerlib->add_js('$(document).ready(function() {
47			$(function() {
48				$(".js-admin-bar").click(function() {
49					$(\'.js-sliding-panel-admin-bar\').toggleClass("open");
50					$(\'.js-sliding-panel-admin-bar\').toggleClass("invisible");
51					$(\'header.page-header\').toggleClass("has-admin-bar-sliding-panel");
52					$(\'.icon-admin-bar\').toggleClass("open");
53					$(\'body.tiki\').toggleClass("open");
54				});
55			});
56			$(function() {
57				$(".navbar-toggler").click(function() {
58					$(\'.navbar-toggler\').toggleClass("open");
59					$(\'.navbar-toggler\').toggleClass("invisible");
60				});
61			});
62
63			var swiper = new Swiper(\'.js-admin-bar-slider\', {
64				slidesPerView: 6,
65				spaceBetween: 15,
66				freeMode: true,
67				pagination: {
68					el: \'.swiper-pagination\',
69					clickable: true,
70				},
71				navigation: {
72					nextEl: \'.swiper-button-next\',
73					prevEl: \'.swiper-button-prev\',
74				},
75				autoplay: false,
76				breakpoints: {
77					1024: {
78						slidesPerView: 6,
79						spaceBetween: 15,
80					},
81					768: {
82						slidesPerView: 4,
83						spaceBetween: 15,
84					},
85					640: {
86						slidesPerView: 2,
87						spaceBetween: 15,
88					},
89					320: {
90						slidesPerView: 2,
91						spaceBetween: 15,
92					}
93				}
94			});
95		});
96');
97	TikiLib::lib('smarty')->assign('recent_prefs', TikiLib::lib('prefs')->getRecent());
98}
99