-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
80 lines (62 loc) · 2.85 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* Spotify Api module for xoops
*
* @package spotifyapi
* @subpackage page-level
* @author Squiz Pty Ltd <[email protected]>
* @copyright 2023 Michael Albertsen (www.culex.dk)
* @since 1.0
* @min_xoops 2.5.9
*/
use XoopsModules\Spotifyapi\{Spotifyapi_db, Spotifyapi_form};
use XoopsModules\Spotifyapi\Constants;
require_once dirname(__DIR__, 2) . '/mainfile.php';
include __DIR__ . '/preloads/autoloader.php';
require_once __DIR__ . '/include/common.php';
$GLOBALS['xoopsOption']['template_main'] = 'spotifyapi_indexfile.tpl';
$GLOBALS['xoopsLogger']->activated = true;
include __DIR__ . '/header.php';
include XOOPS_ROOT_PATH . '/header.php';
$helper = \XoopsModules\Spotifyapi\Spotifyapi_Helper::getInstance();
$timez = $helper->getConfig('spotifyapitimezones');
$GLOBALS['xoTheme']->addScript('https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js');
$d = new Spotifyapi_db();
$form = new Spotifyapi_form();
date_default_timezone_set($timez);
$weekly = 1;
$chart = [];
$i = 0;
$greatestgainer = 0;
$greatestgainerid = 0;
$td = $d->getTopSingleWeek();
$yd = $d->getLwTopSingleWeek();
$tit = sprintf(_SPOTIFYAPI_CHARTTITLE, $d->selecttoplimit);
$weekly = 1;
$sub = sprintf(
_SPOTIFYAPI_CHARTSUBTITLE,
$d->chart_day_count,
date_format(date_create_from_format('d-m-Y', $d->thisweek_start), 'd-m-Y'),
$d->chart_day_count,
date_format(date_create_from_format('d-m-Y', $d->thisweek_end), 'd-m-Y')
);
$dropstart = $form->dropdown('startingDate', $d->parseDistinctDates($d->getDistinctYears(), $arg = 'year'), $selected = null, $sep = '');
$dropend = $form->dropdown('endDate', array('', ''));
$radiobtn = $form->radiobutton('charttype', 'charttype', _SPOTIFYAPI_CHARTACCUMUM);
$GLOBALS['xoopsTpl']->assign('title', $tit);
$GLOBALS['xoopsTpl']->assign('subtitle', $sub);
$GLOBALS['xoopsTpl']->assign('dropstart', $dropstart);
$GLOBALS['xoopsTpl']->assign('dropend', $dropend);
$GLOBALS['xoopsTpl']->assign('radiobutton', $radiobtn);
$GLOBALS['xoopsTpl']->assign('sbmit', $form->submitBtn('spotifyapisubmitbutton', _SPOTIFYAPI_FILTER_TITLE, $sep = '<br>'));
$GLOBALS['xoopsTpl']->assign('charttype', "classic");
$GLOBALS['xoopsTpl']->assign('chart', $d->parseArrayDouble($td, $yd));
$GLOBALS['xoopsTpl']->assign('lastweek_text', _SPOTIFYAPI_STARTTIME);
$GLOBALS['xoopsTpl']->assign('weeklyLink', XOOPS_URL . "/modules/spotifyapi/week.php");
$GLOBALS['xoopsTpl']->assign('weekly', $weekly);
$GLOBALS['xoopsTpl']->assign('alltime', _SPOTIFYAPI_ALLTIME_TOP);
$GLOBALS['xoopsTpl']->assign('alltimeLink', XOOPS_URL . "/modules/spotifyapi/alltime.php");
$GLOBALS['xoopsTpl']->assign('starttimeLink', XOOPS_URL . "/modules/spotifyapi");
$GLOBALS['xoopsTpl']->assign('lastmonth', _SPOTIFYAPI_LASTMONTH_TOP);
$GLOBALS['xoopsTpl']->assign('lastmonthLink', XOOPS_URL . "/modules/spotifyapi/month.php");
include XOOPS_ROOT_PATH . '/footer.php';