XoopsModules25x /
suico
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | /* |
||
| 5 | You may not change or alter any portion of this comment or credits |
||
| 6 | of supporting developers from this source code or any supporting source code |
||
| 7 | which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 8 | |||
| 9 | This program is distributed in the hope that it will be useful, |
||
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 12 | */ |
||
| 13 | |||
| 14 | /** |
||
| 15 | * @category Module |
||
| 16 | * @package suico |
||
| 17 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 18 | * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
||
| 19 | * @author Marcello Brandão aka Suico, Mamba, LioMJ <https://xoops.org> |
||
| 20 | */ |
||
| 21 | |||
| 22 | use XoopsModules\Suico; |
||
| 23 | use XoopsModules\Suico\Helper; |
||
| 24 | |||
| 25 | if (!defined('XOOPS_ROOT_PATH')) { |
||
| 26 | exit(); |
||
| 27 | } |
||
| 28 | //include_once(XOOPS_ROOT_PATH."/class/criteria.php"); |
||
| 29 | //require_once XOOPS_ROOT_PATH . '/modules/suico/class/Friendship.php'; |
||
| 30 | /** |
||
| 31 | * @param $options |
||
| 32 | * @return array |
||
| 33 | */ |
||
| 34 | function b_suico_friends_show($options) |
||
| 35 | { |
||
| 36 | global $xoopsDB, $xoopsModule, $xoopsModuleConfig, $xoopsUser; |
||
| 37 | |||
| 38 | /** @var Helper $helper */ |
||
| 39 | if (!class_exists(Helper::class)) { |
||
| 40 | return false; |
||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||
| 41 | } |
||
| 42 | |||
| 43 | $helper = Helper::getInstance(); |
||
| 44 | |||
| 45 | $helper->loadLanguage('main'); |
||
| 46 | |||
| 47 | $myts = MyTextSanitizer::getInstance(); |
||
| 48 | $block = []; |
||
| 49 | if ($xoopsUser) { |
||
| 50 | /** |
||
| 51 | * Filter for fetch votes ishot and isnothot |
||
| 52 | */ |
||
| 53 | $criteria2 = new Criteria( |
||
| 54 | 'friend1_uid', $xoopsUser->getVar( |
||
| 55 | 'uid' |
||
| 56 | ) |
||
| 57 | ); |
||
| 58 | /** |
||
| 59 | * Creating factories of pictures and votes |
||
| 60 | */ |
||
| 61 | //$albumFactory = new ImagesHandler($xoopsDB); |
||
| 62 | $friendsFactory = new \XoopsModules\Suico\FriendshipHandler($xoopsDB); |
||
| 63 | $block['friends'] = $friendsFactory->getFriends($options[0], $criteria2); |
||
| 64 | $block['lang_allfriends'] = _MB_SUICO_ALLFRIENDS; |
||
| 65 | $block['lang_nofriends'] = _MB_SUICO_NOFRIENDSYET; |
||
| 66 | $block['enablepm'] = $options[1] ?? ''; |
||
| 67 | return $block; |
||
| 68 | } |
||
| 69 | } |
||
| 70 | |||
| 71 | /** |
||
| 72 | * @param array $options |
||
| 73 | * @return string |
||
| 74 | */ |
||
| 75 | function b_suico_friends_edit($options) |
||
| 76 | { |
||
| 77 | $form .= _MB_SUICO_TOTALFRIENDSTOSHOW . ' '; |
||
| 78 | $form .= "<input type='text' name='options[0]' value='" . $options[0] . "'><br>"; |
||
| 79 | $form .= _MB_SUICO_ENABLEPM . ' '; |
||
| 80 | if (isset($options[1]) && 1 === $options[1]) { |
||
| 81 | $chk = ' checked'; |
||
| 82 | } |
||
| 83 | $form .= "<input type='radio' name='options[1]' value='1'" . $chk . '> ' . _YES . ''; |
||
| 84 | $chk = ''; |
||
| 85 | if (!isset($options[1]) || 0 === $options[1]) { |
||
| 86 | $chk = ' checked'; |
||
| 87 | } |
||
| 88 | $form .= " <input type='radio' name='options[1]' value='0'" . $chk . '>' . _NO . '<br>'; |
||
| 89 | return $form; |
||
| 90 | } |
||
| 91 |