1
|
|
|
<?php |
2
|
|
|
// ----------------------------------------------------------------------- // |
3
|
|
|
// Alumni for Xoops 2.6.x // |
4
|
|
|
// By John Mordo // |
5
|
|
|
// // |
6
|
|
|
// // |
7
|
|
|
// // |
8
|
|
|
// // |
9
|
|
|
// ------------------------------------------------------------------------- // |
10
|
|
|
use Xoops\Core\Request; |
11
|
|
|
|
12
|
|
|
include __DIR__ . '/header.php'; |
13
|
|
|
$xoops = Xoops::getInstance(); |
14
|
|
|
$moduleDirName = basename(__DIR__); |
15
|
|
|
$myts = MyTextSanitizer::getInstance(); |
16
|
|
|
$lid = Request::getInt('lid', 0); |
17
|
|
|
|
18
|
|
|
$currenttheme = $xoopsConfig['theme_set']; |
19
|
|
|
$alumni = Alumni::getInstance(); |
20
|
|
|
$helper = Xoops::getModuleHelper('alumni'); |
21
|
|
|
$module_id = $helper->getModule()->getVar('mid'); |
22
|
|
|
|
23
|
|
|
$groups = $xoops->isUser() ? $xoops->user->getGroups() : '3'; |
24
|
|
|
$alumni_ids = $xoops->getHandlerGroupPermission()->getItemIds('alumni_view', $groups, $module_id); |
25
|
|
|
$listingHandler = $xoops->getModuleHandler('listing', 'alumni'); |
26
|
|
|
$listing_criteria = new CriteriaCompo(); |
27
|
|
|
$listing_criteria->add(new Criteria('lid', $lid, '=')); |
28
|
|
|
$listing_criteria->add(new Criteria('cid', '(' . implode(', ', $alumni_ids) . ')', 'IN')); |
29
|
|
|
$numrows = $listingHandler->getCount($listing_criteria); |
30
|
|
|
|
31
|
|
|
$listingArray = $listingHandler->getAll($listing_criteria); |
32
|
|
|
unset($listing_criteria); |
33
|
|
|
foreach (array_keys($listingArray) as $i) { |
34
|
|
|
$lid = $listingArray[$i]->getVar('lid'); |
35
|
|
|
$cid = $listingArray[$i]->getVar('cid'); |
36
|
|
|
$name = $listingArray[$i]->getVar('name'); |
37
|
|
|
$mname = $listingArray[$i]->getVar('mname'); |
38
|
|
|
$lname = $listingArray[$i]->getVar('lname'); |
39
|
|
|
$school = $listingArray[$i]->getVar('school'); |
40
|
|
|
$year = $listingArray[$i]->getVar('year'); |
41
|
|
|
$studies = $listingArray[$i]->getVar('studies'); |
42
|
|
|
$activities = $listingArray[$i]->getVar('activities'); |
43
|
|
|
$extrainfo = $listingArray[$i]->getVar('extrainfo'); |
44
|
|
|
$occ = $listingArray[$i]->getVar('occ'); |
45
|
|
|
$date = $listingArray[$i]->getVar('date'); |
46
|
|
|
$email = $listingArray[$i]->getVar('email'); |
47
|
|
|
$submitter = $listingArray[$i]->getVar('submitter'); |
48
|
|
|
$usid = $listingArray[$i]->getVar('usid'); |
49
|
|
|
$town = $listingArray[$i]->getVar('town'); |
50
|
|
|
$valid = $listingArray[$i]->getVar('valid'); |
51
|
|
|
$photo = $listingArray[$i]->getVar('photo'); |
52
|
|
|
$photo2 = $listingArray[$i]->getVar('photo2'); |
53
|
|
|
$view = $listingArray[$i]->getVar('view'); |
54
|
|
|
|
55
|
|
|
$useroffset = ''; |
56
|
|
View Code Duplication |
if ($xoopsUser) { |
|
|
|
|
57
|
|
|
$timezone = $xoopsUser->timezone(); |
58
|
|
|
if (isset($timezone)) { |
59
|
|
|
$useroffset = $xoopsUser->timezone(); |
60
|
|
|
} else { |
61
|
|
|
$useroffset = $xoopsConfig['default_TZ']; |
62
|
|
|
} |
63
|
|
|
} |
64
|
|
|
$date = ($useroffset * 3600) + $date; |
65
|
|
|
$date = XoopsLocale::formatTimestamp($date, 's'); |
66
|
|
|
$name = $myts->htmlSpecialChars($name); |
67
|
|
|
$mname = $myts->htmlSpecialChars($mname); |
68
|
|
|
$lname = $myts->htmlSpecialChars($lname); |
69
|
|
|
$school = $myts->htmlSpecialChars($school); |
70
|
|
|
$year = $myts->htmlSpecialChars($year); |
71
|
|
|
$studies = $myts->htmlSpecialChars($studies); |
72
|
|
|
$activities = $myts->displayTarea($activities, 1, 0, 1, 1, 1); |
73
|
|
|
$occ = $myts->htmlSpecialChars($occ); |
74
|
|
|
$submitter = $myts->htmlSpecialChars($submitter); |
75
|
|
|
$town = $myts->htmlSpecialChars($town); |
76
|
|
|
|
77
|
|
|
echo ' |
78
|
|
|
<html> |
79
|
|
|
<head><title>' . $xoopsConfig['sitename'] . '</title> |
80
|
|
|
<link rel="StyleSheet" href="../../themes/' . $currenttheme . '/style/style.css" type="text/css"> |
81
|
|
|
</head> |
82
|
|
|
<body bgcolor="#FFFFFF" text="#000000"> |
83
|
|
|
<table border=0><tr><td> |
84
|
|
|
<table border=0 width=640 cellpadding=0 cellspacing=1 bgcolor="#000000"><tr><td> |
85
|
|
|
<table border=0 width=100% cellpadding=8 cellspacing=1 bgcolor="#FFFFFF"><tr><td>'; |
86
|
|
|
|
87
|
|
|
echo "<table width=100% border=0 valign=top><tr><td><b>$name $mname $lname<br><br> $school " . AlumniLocale::CLASSOF . " $year</b>"; |
88
|
|
|
echo '</td> |
89
|
|
|
</tr>'; |
90
|
|
|
if ($studies) { |
91
|
|
|
echo '<tr> |
92
|
|
|
<td><br><b>' . AlumniLocale::STUDIES_2 . "</b><div style=\"text-align:justify;\">$studies</div><p>"; |
93
|
|
|
echo '</td> |
94
|
|
|
</tr>'; |
95
|
|
|
} |
96
|
|
|
if ($activities) { |
97
|
|
|
echo '<tr><td><br><b>' . AlumniLocale::ACTIVITIES_2 . "</b><div style=\"text-align:justify;\">$activities</div><p>"; |
98
|
|
|
echo '</td> |
99
|
|
|
</tr>'; |
100
|
|
|
} |
101
|
|
|
if ($occ) { |
102
|
|
|
echo '<tr><td><br><b>' . AlumniLocale::OCC_2 . "</b><div style=\"text-align:justify;\">$occ</div><p>"; |
103
|
|
|
echo '</td> |
104
|
|
|
</tr>'; |
105
|
|
|
} |
106
|
|
|
if ($town) { |
107
|
|
|
echo '<tr><td><br><b>' . AlumniLocale::TOWN_2 . "</b><div style=\"text-align:justify;\">$town</div>"; |
108
|
|
|
echo '</td></tr>'; |
109
|
|
|
} |
110
|
|
|
echo '</table><table width="100%" border=0 valign=top>'; |
111
|
|
|
if ($photo) { |
112
|
|
|
echo '<tr><td width="40%" valign="top"><br><b>' . AlumniLocale::GRAD_PHOTO . "</b><br><br><img src=\"photos/grad_photo/$photo\" width='125' border=0></td>"; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
if ($photo2) { |
116
|
|
|
echo '<td width="60%" valign="top"><br><b>' . AlumniLocale::NOW_PHOTO . "</b><br><br> <img src=\"photos/now_photo/$photo2\" width='125' border=0></td></tr>"; |
117
|
|
|
} |
118
|
|
|
echo '</table><table border=0>'; |
119
|
|
|
echo '<tr><td><br><b>' . AlumniLocale::LISTING_ADDED . " $date <br>"; |
120
|
|
|
echo '</td> |
121
|
|
|
</tr></table> |
122
|
|
|
</td></tr></table></td></tr></table> |
123
|
|
|
<br><br><center> |
124
|
|
|
' . AlumniLocale::LISTING_FROM . ' <b>' . $xoopsConfig['sitename'] . '</b><br> |
125
|
|
|
<a href="' . XOOPS_URL . "/modules/{$moduleDirName}/\">" . XOOPS_URL . "/modules/{$moduleDirName}/</a> |
126
|
|
|
</td></tr></table> |
127
|
|
|
</body> |
128
|
|
|
</html>"; |
129
|
|
|
} |
130
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.