1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | You may not change or alter any portion of this comment or credits |
||
7 | of supporting developers from this source code or any supporting source code |
||
8 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
9 | |||
10 | This program is distributed in the hope that it will be useful, |
||
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
13 | */ |
||
14 | |||
15 | /** |
||
16 | * @copyright XOOPS Project https://xoops.org/ |
||
17 | * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
||
18 | * @author Marcello Brandão aka Suico |
||
19 | * @author XOOPS Development Team |
||
20 | * @since |
||
21 | */ |
||
22 | |||
23 | use XoopsModules\Yogurt; |
||
24 | use Xmf\Request; |
||
25 | |||
26 | const NBAUDIO = 'nbAudio'; |
||
27 | |||
28 | $GLOBALS['xoopsOption']['template_main'] = 'yogurt_audio.tpl'; |
||
29 | require __DIR__ . '/header.php'; |
||
30 | |||
31 | $controller = new Yogurt\AudioController($xoopsDB, $xoopsUser); |
||
32 | |||
33 | /** |
||
34 | * Fetching numbers of groups friends videos pictures etc... |
||
35 | */ |
||
36 | $nbSections = $controller->getNumbersSections(); |
||
37 | |||
38 | $start = Request::getInt('start', 0, 'GET'); |
||
39 | |||
40 | /** |
||
41 | * Fetching numbers of groups friends videos pictures etc... |
||
42 | */ |
||
43 | $nbSections = $controller->getNumbersSections(); |
||
44 | |||
45 | /** |
||
46 | * Criteria for Audio |
||
47 | */ |
||
48 | $criteriaUidAudio = new Criteria('uid_owner', $controller->uidOwner); |
||
49 | $criteriaUidAudio->setStart($start); |
||
50 | $criteriaUidAudio->setLimit($helper->getConfig('audiosperpage')); |
||
51 | |||
52 | /** |
||
53 | * Get all audios of this user and assign them to template |
||
54 | */ |
||
55 | $audios = $controller->getAudio($criteriaUidAudio); |
||
56 | $nbAudio = $nbSections[NBAUDIO] ?? 0; |
||
57 | try { |
||
58 | $audios_array = $controller->assignAudioContent($nbAudio, $audios); |
||
59 | } catch (\RuntimeException $e) { |
||
60 | } |
||
61 | |||
62 | if (is_array($audios_array)) { |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
63 | $xoopsTpl->assign('audios', $audios_array); |
||
64 | $audio_list = []; |
||
65 | foreach ($audios_array as $audio_item) { |
||
66 | $audio_list[] = XOOPS_UPLOAD_URL . '/yogurt/audio/' . $audio_item['url']; // . ' | '; |
||
67 | } |
||
68 | //$audio_list = substr($audio_list,-2); |
||
69 | $xoopsTpl->assign('audio_list', $audio_list); |
||
70 | } else { |
||
71 | $xoopsTpl->assign('lang_noaudioyet', _MD_YOGURT_NOAUDIOYET); |
||
72 | } |
||
73 | $pageNav = ''; |
||
74 | if (isset($nbSections[NBAUDIO]) && $nbSections[NBAUDIO] > 0) { |
||
75 | $pageNav = $controller->getAudiosNavBar($nbSections[NBAUDIO], $helper->getConfig('audiosperpage'), $start, 2); |
||
76 | } |
||
77 | $xoTheme->addScript('https://unpkg.com/wavesurfer.js'); |
||
78 | |||
79 | //meta language names |
||
80 | $xoopsTpl->assign('lang_meta', _MD_YOGURT_META); |
||
81 | $xoopsTpl->assign('lang_title', _MD_YOGURT_META_TITLE); |
||
82 | $xoopsTpl->assign('lang_album', _MD_YOGURT_META_ALBUM); |
||
83 | $xoopsTpl->assign('lang_artist', _MD_YOGURT_META_ARTIST); |
||
84 | $xoopsTpl->assign('lang_year', _MD_YOGURT_META_YEAR); |
||
85 | |||
86 | //form actions |
||
87 | $xoopsTpl->assign('lang_delete', _MD_YOGURT_DELETE); |
||
88 | $xoopsTpl->assign('lang_editdesc', _MD_YOGURT_EDIT_DESC); |
||
89 | $xoopsTpl->assign('lang_makemain', _MD_YOGURT_MAKEMAIN); |
||
90 | |||
91 | //Form Submit |
||
92 | $xoopsTpl->assign('lang_selectaudio', _MD_YOGURT_AUDIO_SELECT); |
||
93 | $xoopsTpl->assign('lang_authorLabel', _MD_YOGURT_AUDIO_AUTHOR); |
||
94 | $xoopsTpl->assign('lang_titleLabel', _MD_YOGURT_AUDIO_TITLE); |
||
95 | $xoopsTpl->assign('lang_submitValue', _MD_YOGURT_AUDIO_SUBMIT); |
||
96 | $xoopsTpl->assign('lang_addaudios', _MD_YOGURT_AUDIO_ADD); |
||
97 | |||
98 | $xoopsTpl->assign('width', $helper->getConfig('width_tube')); |
||
99 | $xoopsTpl->assign('height', $helper->getConfig('height_tube')); |
||
100 | $xoopsTpl->assign('player_from_list', _MD_YOGURT_PLAYER); |
||
101 | $xoopsTpl->assign('lang_audiohelp', sprintf(_MD_YOGURT_AUDIO_ADD_HELP, $helper->getConfig('maxfilesize'))); |
||
102 | $xoopsTpl->assign('max_youcanupload', $helper->getConfig('maxfilesize')); |
||
103 | |||
104 | $xoopsTpl->assign('lang_mysection', _MD_YOGURT_MYAUDIOS); |
||
105 | $xoopsTpl->assign('section_name', _MD_YOGURT_AUDIOS); |
||
106 | |||
107 | //Page Navigation |
||
108 | $xoopsTpl->assign('pageNav', $pageNav); |
||
109 | |||
110 | |||
111 | require __DIR__ . '/footer.php'; |
||
112 | require dirname(__DIR__, 2) . '/footer.php'; |
||
113 |