1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
You may not change or alter any portion of this comment or credits |
4
|
|
|
of supporting developers from this source code or any supporting source code |
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
6
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
10
|
|
|
*/ |
11
|
|
|
/** |
12
|
|
|
* Alumni module for Xoops |
13
|
|
|
* |
14
|
|
|
* @copyright XOOPS Project https://xoops.org/ |
15
|
|
|
* @license GPL 2.0 or later |
16
|
|
|
* @package alumni |
17
|
|
|
* @since 2.6.x |
18
|
|
|
* @author John Mordo (jlm69) |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); |
22
|
|
|
|
23
|
|
|
include_once dirname(__DIR__) . '/include/common.php'; |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @param $options |
27
|
|
|
* @return array |
28
|
|
|
*/ |
29
|
|
|
|
30
|
|
|
function alumni_show($options) |
|
|
|
|
31
|
|
|
{ |
32
|
|
|
$block = []; |
33
|
|
|
$myts = MyTextSanitizer::getInstance(); |
|
|
|
|
34
|
|
|
$blockDirName = basename(dirname(__DIR__)); |
35
|
|
|
|
36
|
|
|
$xoops = Xoops::getInstance(); |
37
|
|
|
$helper = Xoops::getModuleHelper('alumni'); |
38
|
|
|
$module_id = $helper->getModule()->getVar('mid'); |
|
|
|
|
39
|
|
|
$listingHandler = $helper->getHandler('listing'); |
40
|
|
|
$groups = $xoops->getUserGroups(); |
41
|
|
|
$alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id); |
|
|
|
|
42
|
|
|
$all_ids = implode(', ', $alumni_ids); |
|
|
|
|
43
|
|
|
|
44
|
|
|
$criteria = new CriteriaCompo(); |
45
|
|
|
$criteria->add(new Criteria('valid', 1, '=')); |
46
|
|
|
$criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN')); |
|
|
|
|
47
|
|
|
$criteria->setLimit($options[1]); |
48
|
|
|
$criteria->setSort('date'); |
49
|
|
|
$criteria->setOrder('DESC'); |
50
|
|
|
$block_listings = $listingHandler->getall($criteria); |
|
|
|
|
51
|
|
|
|
52
|
|
|
foreach (array_keys($block_listings) as $i) { |
53
|
|
|
$name = $block_listings[$i]->getVar('name'); |
54
|
|
|
$mname = $block_listings[$i]->getVar('mname'); |
55
|
|
|
$lname = $block_listings[$i]->getVar('lname'); |
56
|
|
|
$school = $block_listings[$i]->getVar('school'); |
57
|
|
|
$year = $block_listings[$i]->getVar('year'); |
58
|
|
|
$view = $block_listings[$i]->getVar('view'); |
59
|
|
|
|
60
|
|
|
$a_item = []; |
|
|
|
|
61
|
|
|
$a_item['school'] = $school; |
62
|
|
|
$a_item['link'] = '<a href="' . XOOPS_URL . "/modules/{$blockDirName}/listing.php?lid=" . addslashes($block_listings[$i]->getVar('lid')) . "\"><b>$year - $name $mname $lname</b><br></a>"; |
|
|
|
|
63
|
|
|
|
64
|
|
|
$block['items'][] = $a_item; |
|
|
|
|
65
|
|
|
} |
66
|
|
|
$block['lang_title'] = AlumniLocale::BLOCKS_ITEM; |
67
|
|
|
$block['lang_date'] = AlumniLocale::BLOCKS_DATE; |
68
|
|
|
$block['link'] = '<a href="' . XOOPS_URL . "/modules/{$blockDirName}/index.php\"><b>" . AlumniLocale::BLOCKS_ALL_LISTINGS . '</b></a></div>'; |
69
|
|
|
|
70
|
|
|
return $block; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @param $options |
75
|
|
|
* @return string |
76
|
|
|
*/ |
77
|
|
|
|
78
|
|
|
function alumni_edit($options) |
|
|
|
|
79
|
|
|
{ |
80
|
|
|
$form = AlumniLocale::BLOCKS_ORDER . " <select name='options[]'>"; |
81
|
|
|
$form .= "<option value='date'"; |
82
|
|
|
if ('date' === $options[0]) { |
83
|
|
|
$form .= " selected='selected'"; |
84
|
|
|
} |
85
|
|
|
$form .= '>' . AlumniLocale::BLOCKS_DATE . "</option>\n"; |
86
|
|
|
$form .= "<option value='view'"; |
87
|
|
|
if ('view' === $options[0]) { |
88
|
|
|
$form .= " selected='selected'"; |
89
|
|
|
} |
90
|
|
|
$form .= '>' . AlumniLocale::BLOCKS_HITS . '</option>'; |
91
|
|
|
$form .= "</select>\n"; |
92
|
|
|
$form .= ' ' . AlumniLocale::BLOCKS_DISPLAY . " <input type='text' name='options[]' value='" . $options[1] . "'/> " . AlumniLocale::BLOCKS_LISTINGS; |
93
|
|
|
$form .= ' <br><br>' . AlumniLocale::BLOCKS_LENGTH . " <input type='text' name='options[]' value='" . $options[2] . "'/> " . AlumniLocale::BLOCKS_CHARS . '<br><br>'; |
94
|
|
|
|
95
|
|
|
return $form; |
96
|
|
|
} |
97
|
|
|
|
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.