| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:12:48 2008 ] | [ OSC 2.0.5 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /******************************************************************************* 3 * 4 * filename : PrintView.php 5 * last change : 2003-01-29 6 * 7 * 8 * http://osc.sourceforge.net 9 * 10 * This product is based upon work previously done by Infocentral (infocentral.org) 11 * on their PHP version Church Management Software that they discontinued 12 * and we have taken over. We continue to improve and build upon this product 13 * in the direction of excellence. 14 * 15 * OpenSourceChurch (OSC) is free software; you can redistribute it and/or modify 16 * it under the terms of the GNU General Public License as published by 17 * the Free Software Foundation; either version 2 of the License, or 18 * (at your option) any later version. 19 * 20 * Any changes to the software must be submitted back to the OpenSourceChurch project 21 * for review and possible inclusion. 22 * 23 * Copyright 2001-2003 Phillip Hullquist, Deane Barker, Chris Gebhardt 24 ******************************************************************************/ 25 26 // Include the function library 27 require "Include/Config.php"; 28 require "Include/Functions.php"; 29 30 // Get the person ID from the querystring 31 $iPersonID = FilterInput($_GET["PersonID"],'int'); 32 33 // Get this person 34 $sSQL = "SELECT a.*, family_fam.*, cls.lst_OptionName AS sClassName, fmr.lst_OptionName AS sFamRole, b.per_FirstName AS EnteredFirstName, 35 b.Per_LastName AS EnteredLastName, c.per_FirstName AS EditedFirstName, c.per_LastName AS EditedLastName 36 FROM person_per a 37 LEFT JOIN family_fam ON a.per_fam_ID = family_fam.fam_ID 38 LEFT JOIN list_lst cls ON a.per_cls_ID = cls.lst_OptionID AND cls.lst_ID = 1 39 LEFT JOIN list_lst fmr ON a.per_fmr_ID = fmr.lst_OptionID AND fmr.lst_ID = 2 40 LEFT JOIN person_per b ON a.per_EnteredBy = b.per_ID 41 LEFT JOIN person_per c ON a.per_EditedBy = c.per_ID 42 WHERE a.per_ID = " . $iPersonID . " AND person_per.chu_Church_ID=" . $_SESSION['iChurchID']; 43 $rsPerson = RunQuery($sSQL); 44 extract(mysql_fetch_array($rsPerson)); 45 46 // Save for later 47 $sWorkEmail = trim($per_WorkEmail); 48 49 // Get the list of custom person fields 50 $sSQL = "SELECT person_custom_master.* FROM person_custom_master WHERE chu_Church_ID=" . $_SESSION['iChurchID'] . " ORDER BY custom_Order"; 51 $rsCustomFields = RunQuery($sSQL); 52 $numCustomFields = mysql_num_rows($rsCustomFields); 53 54 // Get the actual custom field data 55 $sSQL = "SELECT * FROM person_custom WHERE per_ID = " . $iPersonID . " AND chu_Church_ID=" . $_SESSION['iChurchID']; 56 $rsCustomData = RunQuery($sSQL); 57 $aCustomData = mysql_fetch_array($rsCustomData, MYSQL_BOTH); 58 59 // Get the notes for this person 60 $sSQL = "SELECT nte_Private, nte_ID, nte_Text, nte_DateEntered, nte_EnteredBy, nte_DateLastEdited, nte_EditedBy, a.per_FirstName AS EnteredFirstName, a.Per_LastName AS EnteredLastName, b.per_FirstName AS EditedFirstName, b.per_LastName AS EditedLastName "; 61 $sSQL = $sSQL . "FROM note_nte "; 62 $sSQL = $sSQL . "LEFT JOIN person_per a ON nte_EnteredBy = a.per_ID "; 63 $sSQL = $sSQL . "LEFT JOIN person_per b ON nte_EditedBy = b.per_ID "; 64 $sSQL = $sSQL . "WHERE nte_per_ID = " . $iPersonID . " " . " AND note_nte.chu_Church_ID=" . $_SESSION['iChurchID']; 65 $sSQL = $sSQL . "AND (nte_Private = 0 OR nte_Private = " . $_SESSION['iUserID'] . ")"; 66 $rsNotes = RunQuery($sSQL); 67 68 // Get the Groups this Person is assigned to 69 $sSQL = "SELECT grp_ID, grp_Name, grp_hasSpecialProps, role.lst_OptionName AS roleName 70 FROM group_grp 71 LEFT JOIN person2group2role_p2g2r ON p2g2r_grp_ID = grp_ID 72 LEFT JOIN list_lst role ON lst_OptionID = p2g2r_rle_ID AND lst_ID = grp_RoleListID 73 WHERE person2group2role_p2g2r.p2g2r_per_ID = " . $iPersonID . " 74 AND group_grp.chu_Church_ID=" . $_SESSION['iChurchID'] . " 75 ORDER BY grp_Name"; 76 $rsAssignedGroups = RunQuery($sSQL); 77 78 // Get the Properties assigned to this Person 79 $sSQL = "SELECT pro_Name, pro_ID, pro_Prompt, r2p_Value, prt_Name, pro_prt_ID 80 FROM record2property_r2p 81 LEFT JOIN property_pro ON pro_ID = r2p_pro_ID 82 LEFT JOIN propertytype_prt ON propertytype_prt.prt_ID = property_pro.pro_prt_ID 83 WHERE pro_Class = 'p' AND r2p_record_ID = " . $iPersonID . 84 " AND record2property_r2p.chu_Church_ID=" . $_SESSION['iChurchID'] . " ORDER BY prt_Name, pro_Name"; 85 $rsAssignedProperties = RunQuery($sSQL); 86 87 // Format the BirthDate 88 if ($per_BirthMonth > 0 && $per_BirthDay > 0) 89 { 90 $dBirthDate = $per_BirthMonth . "/" . $per_BirthDay; 91 if (is_numeric($per_BirthYear)) 92 { 93 $dBirthDate .= "/" . $per_BirthYear; 94 } 95 } 96 elseif (is_numeric($per_BirthYear)) 97 { 98 $dBirthDate = $per_BirthYear; 99 } 100 else 101 { 102 $dBirthDate = ""; 103 } 104 105 // Assign the values locally, after selecting whether to display the family or person information 106 107 SelectWhichAddress($sAddress1, $sAddress2, $per_Address1, $per_Address2, $fam_Address1, $fam_Address2, False); 108 $sCity = SelectWhichInfo($per_City, $fam_City, False); 109 $sState = SelectWhichInfo($per_State, $fam_State, False); 110 $sZip = SelectWhichInfo($per_Zip, $fam_Zip, False); 111 $sCountry = SelectWhichInfo($per_Country, $fam_Country, False); 112 $sHomePhone = SelectWhichInfo(ExpandPhoneNumber($per_HomePhone,$sCountry,$dummy), ExpandPhoneNumber($fam_HomePhone,$fam_Country,$dummy), False); 113 $sWorkPhone = SelectWhichInfo(ExpandPhoneNumber($per_WorkPhone,$sCountry,$dummy), ExpandPhoneNumber($fam_WorkPhone,$fam_Country,$dummy), False); 114 $sCellPhone = SelectWhichInfo(ExpandPhoneNumber($per_CellPhone,$sCountry,$dummy), ExpandPhoneNumber($fam_CellPhone,$fam_Country,$dummy), False); 115 $sUnformattedEmail = SelectWhichInfo($per_Email, $fam_Email, False); 116 117 // Set the page title and include HTML header 118 $sPageTitle = gettext("Printable View"); 119 $iTableSpacerWidth = 10; 120 require "Include/Header-Short.php"; 121 ?> 122 123 <table width="200"><tr><td> 124 <p class="ShadedBox"> 125 126 <?php 127 // Print the name and address header 128 echo "<b><font size=\"4\">" . $per_FirstName . " " . $per_LastName . "</font></b><br>"; 129 echo "<font size=\"3\">"; 130 if ($sAddress1 != "") { echo $sAddress1 . "<br>"; } 131 if ($sAddress2 != "") { echo $sAddress2 . "<br>"; } 132 if ($sCity != "") { echo $sCity . ", "; } 133 if ($sState != "") { echo $sState; } 134 if ($sZip != "") { echo " " . $sZip; } 135 if ($sCountry != "") {echo "<br>" . $sCountry; } 136 echo "</font>"; 137 138 $iFamilyID = $fam_ID; 139 140 if ($fam_ID) 141 { 142 //Get the family members for this family 143 $sSQL = "SELECT per_ID, per_Title, per_FirstName, per_LastName, per_Suffix, per_Gender, 144 per_BirthMonth, per_BirthDay, per_BirthYear, cls.lst_OptionName AS sClassName, 145 fmr.lst_OptionName AS sFamRole 146 FROM person_per 147 LEFT JOIN list_lst cls ON per_cls_ID = cls.lst_OptionID AND cls.lst_ID = 1 148 LEFT JOIN list_lst fmr ON per_fmr_ID = fmr.lst_OptionID AND fmr.lst_ID = 2 149 WHERE per_fam_ID = " . $iFamilyID . " AND person_per.chu_Church_ID=" . $_SESSION['iChurchID'] . " ORDER BY fmr.lst_OptionSequence"; 150 $rsFamilyMembers = RunQuery($sSQL); 151 } 152 ?> 153 154 </p></td></tr></table> 155 <BR> 156 157 <table border="0" width="100%" cellspacing="0" cellpadding="0"> 158 <tr> 159 <td width="33%" valign="top" align="left"> 160 <table cellspacing="1" cellpadding="4"> 161 <tr> 162 <td class="LabelColumn"><?php echo gettext("Home Phone:"); ?></td> 163 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 164 <td class="TextColumn"><?php echo $sHomePhone; ?> </td> 165 </tr> 166 <tr> 167 <td class="LabelColumn"><?php echo gettext("Work Phone:"); ?></td> 168 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 169 <td class="TextColumn"><?php echo $sWorkPhone; ?> </td> 170 </tr> 171 <tr> 172 <td class="LabelColumn"><?php echo gettext("Mobile Phone:"); ?></td> 173 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 174 <td class="TextColumn"><?php echo $sCellPhone; ?> </td> 175 </tr> 176 <?php 177 $numColumn3Fields = floor($numCustomFields / 3); 178 $leftOverFields = $numCustomFields - $numColumn3Fields; 179 $numColumn1Fields = ceil($leftOverFields / 2); 180 $numColumn2Fields = $leftOverFields - $numColumn1Fields; 181 182 for($i = 1; $i <= $numColumn1Fields; $i++) 183 { 184 $Row = mysql_fetch_array($rsCustomFields); 185 extract($Row); 186 $currentData = trim($aCustomData[$custom_Field]); 187 if ($type_ID == 11) $custom_Special = $sCountry; 188 echo "<tr><td class=\"LabelColumn\">" . $custom_Name . "</td><td width=\"" . $iTableSpacerWidth . "\"></td>"; 189 echo "<td class=\"TextColumn\">" . displayCustomField($type_ID, $currentData, $custom_Special) . "</td></tr>"; 190 } 191 ?> 192 </table> 193 </td> 194 195 <td width="33%" valign="top" align="left"> 196 <table cellspacing="1" cellpadding="4"> 197 <tr> 198 <td class="LabelColumn"><?php echo gettext("Gender:"); ?></td> 199 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 200 <td class="TextColumn"> 201 <?php 202 switch (strtolower($per_Gender)) 203 { 204 case 1: 205 echo gettext("Male"); 206 break; 207 case 2: 208 echo gettext("Female"); 209 break; 210 } ?> 211 </td> 212 </tr> 213 <tr> 214 <td class="LabelColumn"><?php echo gettext("BirthDate:"); ?></td> 215 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 216 <td class="TextColumn"><?php echo $dBirthDate; ?> </td> 217 </tr> 218 <tr> 219 <td class="LabelColumn"><?php echo gettext("Family:"); ?></td> 220 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 221 <td class="TextColumn"> 222 <?php if ($fam_Name != "") { echo $fam_Name; } else { echo "Unassigned"; } ?> 223 </td> 224 </tr> 225 <tr> 226 <td class="LabelColumn"><?php echo gettext("Family Role:"); ?></td> 227 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 228 <td class="TextColumnWithBottomBorder"><?php if ($sFamRole != "") { echo $sFamRole; } else { echo "Unassigned"; } ?> </td> 229 </tr> 230 <?php 231 for($i = 1; $i <= $numColumn2Fields; $i++) 232 { 233 $Row = mysql_fetch_array($rsCustomFields); 234 extract($Row); 235 $currentData = trim($aCustomData[$custom_Field]); 236 if ($type_ID == 11) $custom_Special = $sCountry; 237 echo "<tr><td class=\"LabelColumn\">" . $custom_Name . "</td><td width=\"" . $iTableSpacerWidth . "\"></td>"; 238 echo "<td class=\"TextColumn\">" . displayCustomField($type_ID, $currentData, $custom_Special) . "</td></tr>"; 239 } 240 ?> 241 </table> 242 </td> 243 <td width="33%" valign="top" align="left"> 244 <table cellspacing="1" cellpadding="4"> 245 <tr> 246 <td class="LabelColumn"><?php echo gettext("Email:"); ?></td> 247 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 248 <td class="TextColumnWithBottomBorder"><?php echo $sUnformattedEmail; ?> </td> 249 </tr> 250 <tr> 251 <td class="LabelColumn"><?php echo gettext("Work / Other Email:"); ?></td> 252 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 253 <td class="TextColumnWithBottomBorder"><?php echo $sWorkEmail; ?> </td> 254 </tr> 255 <tr> 256 <td class="LabelColumn"><?php echo gettext("Membership Date:"); ?></td> 257 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 258 <td class="TextColumn"><?php echo FormatDate($per_MembershipDate,false); ?> </td> 259 </tr> 260 <tr> 261 <td class="LabelColumn"><?php echo gettext("Classification:"); ?></td> 262 <td width="<?php echo $iTableSpacerWidth; ?>"></td> 263 <td class="TextColumnWithBottomBorder"><?php echo $sClassName; ?> </td> 264 </tr> 265 <?php 266 for($i = 1; $i <= $numColumn3Fields; $i++) 267 { 268 $Row = mysql_fetch_array($rsCustomFields); 269 extract($Row); 270 $currentData = trim($aCustomData[$custom_Field]); 271 if ($type_ID == 11) $custom_Special = $sCountry; 272 echo "<tr><td class=\"LabelColumn\">" . $custom_Name . "</td><td width=\"" . $iTableSpacerWidth . "\"></td>"; 273 echo "<td class=\"TextColumn\">" . displayCustomField($type_ID, $currentData, $custom_Special) . "</td></tr>"; 274 } 275 ?> 276 </table> 277 </td> 278 </tr> 279 </table> 280 <br> 281 282 <?php if ($fam_ID) { ?> 283 284 <b><?php echo gettext("Family Members:"); ?></b> 285 <table cellpadding=5 cellspacing=0 width="100%"> 286 <tr class="TableHeader"> 287 <td><?php echo gettext("Name"); ?></td> 288 <td><?php echo gettext("Gender"); ?></td> 289 <td><?php echo gettext("Role"); ?></td> 290 <td><?php echo gettext("Age"); ?></td> 291 </tr> 292 <?php 293 $sRowClass = "RowColorA"; 294 295 // Loop through all the family members 296 while ($aRow = mysql_fetch_array($rsFamilyMembers)) 297 { 298 $per_BirthYear = ""; 299 $agr_Description = ""; 300 301 extract($aRow); 302 303 // Alternate the row style 304 $sRowClass = AlternateRowStyle($sRowClass) 305 306 // Display the family member 307 ?> 308 <tr class="<?php echo $sRowClass ?>"> 309 <td> 310 <?php echo $per_FirstName . " " . $per_LastName ?> 311 <br> 312 </td> 313 <td> 314 <?php switch ($per_Gender) {case 1: echo gettext("Male"); break; case 2: echo gettext("Female"); break; default: echo "";} ?> 315 </td> 316 <td> 317 <?php echo $sFamRole ?> 318 </td> 319 <td> 320 <?php PrintAge($per_BirthMonth,$per_BirthDay,$per_BirthYear); ?> 321 </td> 322 </tr> 323 <?php 324 } 325 echo "</table>"; 326 } 327 ?> 328 <BR> 329 <b><?php echo gettext("Assigned Groups:"); ?></b> 330 331 <?php 332 333 //Initialize row shading 334 $sRowClass = "RowColorA"; 335 336 $sAssignedGroups = ","; 337 338 //Was anything returned? 339 if (mysql_num_rows($rsAssignedGroups) == 0) 340 { 341 echo "<p align\"center\">" . gettext("No group assignments.") . "</p>"; 342 } 343 else 344 { 345 echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">"; 346 echo "<tr class=\"TableHeader\">"; 347 echo "<td width=\"15%\"><b>" . gettext("Group Name") . "</b>"; 348 echo "<td><b>" . gettext("Role") . "</b></td>"; 349 echo "</tr>"; 350 351 //Loop through the rows 352 while ($aRow = mysql_fetch_array($rsAssignedGroups)) 353 { 354 extract($aRow); 355 356 //Alternate the row style 357 $sRowClass = AlternateRowStyle($sRowClass); 358 359 // DISPLAY THE ROW 360 echo "<tr class=\"" . $sRowClass . "\">"; 361 echo " <td>" . $grp_Name . "</td>"; 362 echo " <td>" . $roleName . "</td>"; 363 echo "</tr>"; 364 365 // If this group has associated special properties, display those with values and prop_PersonDisplay flag set. 366 if ($grp_hasSpecialProps == 'true') 367 { 368 $firstRow = true; 369 // Get the special properties for this group 370 $sSQL = "SELECT groupprop_master.* FROM groupprop_master 371 WHERE grp_ID = " . $grp_ID . " AND prop_PersonDisplay = 'true' ORDER BY prop_ID"; 372 $rsPropList = RunQuery($sSQL); 373 374 $sSQL = "SELECT * FROM groupprop_" . $grp_ID . " WHERE per_ID = " . $iPersonID; 375 $rsPersonProps = RunQuery($sSQL); 376 $aPersonProps = mysql_fetch_array($rsPersonProps, MYSQL_BOTH); 377 378 while ($aProps = mysql_fetch_array($rsPropList)) 379 { 380 extract($aProps); 381 $currentData = trim($aPersonProps[$prop_Field]); 382 if (strlen($currentData) > 0) 383 { 384 // only create the properties table if it's actually going to be used 385 if ($firstRow) { 386 echo "<tr><td colspan=\"2\"><table width=\"50%\"><tr><td width=\"15%\"></td><td><table width=\"90%\" cellspacing=\"0\">"; 387 echo "<tr class=\"TinyTableHeader\"><td>Property</td><td>Value</td></tr>"; 388 $firstRow = false; 389 } 390 $sRowClass = AlternateRowStyle($sRowClass); 391 if ($type_ID == 11) $prop_Special = $sCountry; 392 echo "<tr class=\"$sRowClass\"><td>" . $prop_Name . "</td><td>" . displayCustomField($type_ID, $currentData, $prop_Special) . "</td></tr>"; 393 } 394 } 395 if (!$firstRow) echo "</table></td></tr></table></td></tr>"; 396 } 397 398 $sAssignedGroups .= $grp_ID . ","; 399 } 400 echo "</table>"; 401 } 402 ?> 403 <BR> 404 <b><?php echo gettext("Assigned Properties:"); ?></b> 405 406 <?php 407 408 //Initialize row shading 409 $sRowClass = "RowColorA"; 410 411 $sAssignedProperties = ","; 412 413 //Was anything returned? 414 if (mysql_num_rows($rsAssignedProperties) == 0) 415 { 416 echo "<p align\"center\">" . gettext("No property assignments.") . "</p>"; 417 } 418 else 419 { 420 echo "<table width=\"100%\" cellpadding=\"4\" cellspacing=\"0\">"; 421 echo "<tr class=\"TableHeader\">"; 422 echo "<td width=\"25%\" valign=\"top\"><b>" . gettext("Name") . "</b>"; 423 echo "<td valign=\"top\"><b>" . gettext("Value") . "</td>"; 424 echo "</tr>"; 425 426 while ($aRow = mysql_fetch_array($rsAssignedProperties)) 427 { 428 $pro_Prompt = ""; 429 $r2p_Value = ""; 430 extract($aRow); 431 432 //Alternate the row style 433 $sRowClass = AlternateRowStyle($sRowClass); 434 435 //Display the row 436 echo "<tr class=\"" . $sRowClass . "\">"; 437 echo "<td valign=\"top\">" . $pro_Name . " </td>"; 438 echo "<td valign=\"top\">" . $r2p_Value . " </td>"; 439 440 echo "</tr>"; 441 442 $sAssignedProperties .= $pro_ID . ","; 443 } 444 echo "</table>"; 445 } 446 447 448 if ($_SESSION['bNotes']) 449 { 450 echo "<p><b>" . gettext("Notes:") . "</b></p>"; 451 452 // Loop through all the notes 453 while($aRow = mysql_fetch_array($rsNotes)) 454 { 455 extract($aRow); 456 echo "<p class=\"ShadedBox\")>" . $nte_Text . "</p>"; 457 echo "<span class=\"SmallText\">" . gettext("Entered:") . FormatDate($nte_DateEntered,True) . "</span><br>"; 458 459 if (strlen($nte_DateLastEdited)) 460 { 461 echo "<span class=\"SmallText\">" . gettext("Last Edited:") . FormatDate($nte_DateLastEdited,True) . ' ' . gettext("by") . ' ' . $EditedFirstName . " " . $EditedLastName . "</span><br>"; 462 } 463 } 464 } 465 466 require "Include/Footer-Short.php"; 467 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |