| [ PHPXref.com ] | [ Generated: Sun Jul 20 19:39:24 2008 ] | [ PhpGedView 4.0 ] |
| [ Index ] [ Variables ] [ Functions ] [ Classes ] [ Constants ] [ Statistics ] | ||
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * On Upcoming Events Block 4 * 5 * This block will print a list of upcoming events 6 * 7 * phpGedView: Genealogy Viewer 8 * Copyright (C) 2002 to 2003 John Finlay and Others 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * 24 * @package PhpGedView 25 * @subpackage Blocks 26 * @version $Id: upcoming_events.php,v 1.1.2.54 2006/04/19 01:20:14 canajun2eh Exp $ 27 */ 28 29 $PGV_BLOCKS["print_upcoming_events"]["name"] = $pgv_lang["upcoming_events_block"]; 30 $PGV_BLOCKS["print_upcoming_events"]["descr"] = "upcoming_events_descr"; 31 $PGV_BLOCKS["print_upcoming_events"]["canconfig"] = true; 32 $PGV_BLOCKS["print_upcoming_events"]["config"] = array("days"=>30, "filter"=>"all", "onlyBDM"=>"no"); 33 34 //-- upcoming events block 35 //-- this block prints a list of upcoming events of people in your gedcom 36 function print_upcoming_events($block=true, $config="", $side, $index) { 37 global $pgv_lang, $month, $year, $day, $monthtonum, $HIDE_LIVE_PEOPLE, $SHOW_ID_NUMBERS, $command, $TEXT_DIRECTION, $SHOW_FAM_ID_NUMBERS; 38 global $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $PGV_BLOCKS; 39 global $DAYS_TO_SHOW_LIMIT; 40 41 $block = true; // Always restrict this block's height 42 43 if (empty($config)) $config = $PGV_BLOCKS["print_upcoming_events"]["config"]; 44 if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30; 45 if (isset($config["days"])) $daysprint = $config["days"]; 46 else $daysprint = 30; 47 if (isset($config["filter"])) $filter = $config["filter"]; // "living" or "all" 48 else $filter = "all"; 49 if (isset($config["onlyBDM"])) $onlyBDM = $config["onlyBDM"]; // "yes" or "no" 50 else $onlyBDM = "no"; 51 52 if ($daysprint < 1) $daysprint = 1; 53 if ($daysprint > $DAYS_TO_SHOW_LIMIT) $daysprint = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit 54 55 // Look for cached Facts data 56 $found_facts = get_event_list(); 57 58 // Output starts here 59 print "<div id=\"upcoming_events\" class=\"block\">"; 60 print "<table class=\"blockheader\" cellspacing=\"0\" cellpadding=\"0\" style=\"direction:ltr;\"><tr>"; 61 print "<td class=\"blockh1\" > </td>"; 62 print "<td class=\"blockh2\" ><div class=\"blockhc\">"; 63 print_help_link("index_events_help", "qm"); 64 if ($PGV_BLOCKS["print_upcoming_events"]["canconfig"]) { 65 $username = getUserName(); 66 if ((($command=="gedcom")&&(userGedcomAdmin($username))) || (($command=="user")&&(!empty($username)))) { 67 if ($command=="gedcom") $name = preg_replace("/'/", "\'", $GEDCOM); 68 else $name = $username; 69 print "<a href=\"javascript: configure block\" onclick=\"window.open('index_edit.php?name=$name&command=$command&action=configure&side=$side&index=$index', '_blank', 'top=50,left=50,width=600,height=350,scrollbars=1,resizable=1'); return false;\">"; 70 print "<img class=\"adminicon\" src=\"$PGV_IMAGE_DIR/".$PGV_IMAGES["admin"]["small"]."\" width=\"15\" height=\"15\" border=\"0\" alt=\"".$pgv_lang["config_block"]."\" /></a>\n"; 71 } 72 } 73 print "<b>".$pgv_lang["upcoming_events"]."</b>"; 74 print "</div></td>"; 75 print "<td class=\"blockh3\"> </td></tr>\n"; 76 print "</table>"; 77 print "<div class=\"blockcontent\" >"; 78 if ($block) print "<div class=\"small_inner_block\">\n"; 79 80 $OutputDone = false; 81 $PrivateFacts = false; 82 $lastgid=""; 83 84 $dateRangeStart = mktime(0,0,0,$monthtonum[strtolower($month)],$day+1,$year); 85 $dateRangeEnd = $dateRangeStart+(60*60*24*$daysprint)-1; 86 87 foreach($found_facts as $key=>$factarray) { 88 $anniversaryDate = $factarray[3]; 89 if ($anniversaryDate>=$dateRangeStart && $anniversaryDate<=$dateRangeEnd) { 90 if ($factarray[2]=="INDI") { 91 $gid = $factarray[0]; 92 $factrec = $factarray[1]; 93 $disp = true; 94 if ($filter=="living" and is_dead_id($gid)) $disp = false; 95 else if (!displayDetailsByID($gid)) { 96 $disp = false; 97 $PrivateFacts = true; 98 } 99 if ($disp) { 100 $indirec = find_person_record($gid); 101 if ($indirec) { 102 $filterev = "all"; 103 if ($onlyBDM == "yes") $filterev = "bdm"; 104 $text = get_calendar_fact($factrec, "upcoming", $filter, $gid, $filterev); 105 if ($text!="filter") { 106 if (FactViewRestricted($gid, $factrec) or $text=="") { 107 $PrivateFacts = true; 108 } else { 109 if ($lastgid!=$gid) { 110 if ($lastgid != "") print "<br />"; 111 $name = get_person_name($gid); 112 print "<a href=\"individual.php?pid=$gid&ged=".$GEDCOM."\">"; 113 print "<b>".PrintReady($name)."</b>"; 114 print "<img id=\"box-".$gid."-".$key."-sex\" src=\"$PGV_IMAGE_DIR/"; 115 if (preg_match("/1 SEX M/", $indirec)>0) print $PGV_IMAGES["sex"]["small"]."\" title=\"".$pgv_lang["male"]."\" alt=\"".$pgv_lang["male"]; 116 else if (preg_match("/1 SEX F/", $indirec)>0) print $PGV_IMAGES["sexf"]["small"]."\" title=\"".$pgv_lang["female"]."\" alt=\"".$pgv_lang["female"]; 117 else print $PGV_IMAGES["sexn"]["small"]."\" title=\"".$pgv_lang["unknown"]."\" alt=\"".$pgv_lang["unknown"]; 118 print "\" class=\"sex_image\" />"; 119 if ($SHOW_ID_NUMBERS) { 120 print " "; 121 if ($TEXT_DIRECTION=="rtl") print "‏"; 122 print "(".$gid.")"; 123 if ($TEXT_DIRECTION=="rtl") print "‏"; 124 } 125 print "</a><br />\n"; 126 $lastgid=$gid; 127 } 128 print "<div class=\"indent" . ($TEXT_DIRECTION=="rtl"?"_rtl":"") . "\">"; 129 print $text; 130 print "</div>"; 131 $OutputDone = true; 132 } 133 } 134 } 135 } 136 } 137 138 if ($factarray[2]=="FAM") { 139 $gid = $factarray[0]; 140 $factrec = $factarray[1]; 141 142 $disp = true; 143 if ($filter=="living") { 144 $parents = find_parents($gid); 145 if (is_dead_id($parents["HUSB"])) $disp = false; 146 else if (!displayDetailsByID($parents["HUSB"])) { 147 $disp = false; 148 $PrivateFacts = true; 149 } 150 if ($disp) { 151 if (is_dead_id($parents["WIFE"])) $disp = false; 152 else if (!displayDetailsByID($parents["WIFE"])) { 153 $disp = false; 154 $PrivateFacts = true; 155 } 156 } 157 } 158 else if (!displayDetailsByID($gid, "FAM")) { 159 $disp = false; 160 $PrivateFacts = true; 161 } 162 if ($disp) { 163 $famrec = find_family_record($gid); 164 if ($famrec) { 165 $name = get_family_descriptor($gid); 166 $filterev = "all"; 167 if ($onlyBDM == "yes") $filterev = "bdm"; 168 $text = get_calendar_fact($factrec, "upcoming", $filter, $gid, $filterev); 169 // if ($text!="filter") { 170 if ($text!="filter" and strpos($famrec, "1 DIV")===false) { 171 if (FactViewRestricted($gid, $factrec) or $text=="") { 172 $PrivateFacts = true; 173 } else { 174 if ($lastgid!=$gid) { 175 if ($lastgid != "") print "<br />"; 176 print "<a href=\"family.php?famid=$gid&ged=".$GEDCOM."\"><b>".PrintReady($name)."</b>"; 177 if ($SHOW_FAM_ID_NUMBERS) { 178 print " "; 179 if ($TEXT_DIRECTION=="rtl") print "‏"; 180 print "(".$gid.")"; 181 if ($TEXT_DIRECTION=="rtl") print "‏"; 182 } 183 print "</a><br />\n"; 184 $lastgid=$gid; 185 } 186 print "<div class=\"indent" . ($TEXT_DIRECTION=="rtl"?"_rtl":"") . "\">"; 187 print $text; 188 print "</div>"; 189 $OutputDone = true; 190 } 191 } 192 } 193 } 194 } 195 } 196 } 197 198 if ($PrivateFacts) { // Facts were found but not printed for some reason 199 $pgv_lang["global_num1"] = $daysprint; 200 $Advisory = "no_events_privacy"; 201 if ($OutputDone) $Advisory = "more_events_privacy"; 202 if ($daysprint==1) $Advisory .= "1"; 203 print "<b>"; 204 print_text($Advisory); 205 print "</b><br />"; 206 } else if (!$OutputDone) { // No Facts were found 207 $pgv_lang["global_num1"] = $daysprint; 208 $Advisory = "no_events_" . $config["filter"]; 209 if ($daysprint==1) $Advisory .= "1"; 210 print "<b>"; 211 print_text($Advisory); 212 print "</b><br />"; 213 } 214 215 216 if ($block) print "</div>\n"; 217 print "</div>"; // blockcontent 218 print "</div>"; // block 219 } 220 221 function print_upcoming_events_config($config) { 222 global $pgv_lang, $PGV_BLOCKS, $DAYS_TO_SHOW_LIMIT, $TEXT_DIRECTION; 223 if (empty($config)) $config = $PGV_BLOCKS["print_upcoming_events"]["config"]; 224 if (!isset($DAYS_TO_SHOW_LIMIT)) $DAYS_TO_SHOW_LIMIT = 30; 225 if (!isset($config["days"])) $config["days"] = 30; 226 if (!isset($config["filter"])) $config["filter"] = "all"; 227 if (!isset($config["onlyBDM"])) $config["onlyBDM"] = "no"; 228 229 if ($config["days"] < 1) $config["days"] = 1; 230 if ($config["days"] > $DAYS_TO_SHOW_LIMIT) $config["days"] = $DAYS_TO_SHOW_LIMIT; // valid: 1 to limit 231 232 print "<tr><td class=\"descriptionbox width20\">"; 233 print_help_link("days_to_show_help", "qm"); 234 print $pgv_lang["days_to_show"]."</td>";?> 235 <td class="optionbox"> 236 <input type="text" name="days" size="2" value="<?php print $config["days"]; ?>" /> 237 </td></tr> 238 239 <?php 240 print "<tr><td class=\"descriptionbox width20\">".$pgv_lang["living_or_all"]."</td>";?> 241 <td class="optionbox"> 242 <select name="filter"> 243 <option value="all"<?php if ($config["filter"]=="all") print " selected=\"selected\"";?>><?php print $pgv_lang["no"]; ?></option> 244 <option value="living"<?php if ($config["filter"]=="living") print " selected=\"selected\"";?>><?php print $pgv_lang["yes"]; ?></option> 245 </select> 246 </td></tr> 247 248 <?php 249 print "<tr><td class=\"descriptionbox width20\">"; 250 print_help_link("basic_or_all_help", "qm"); 251 print $pgv_lang["basic_or_all"]."</td>";?> 252 <td class="optionbox"> 253 <select name="onlyBDM"> 254 <option value="no"<?php if ($config["onlyBDM"]=="no") print " selected=\"selected\"";?>><?php print $pgv_lang["no"]; ?></option> 255 <option value="yes"<?php if ($config["onlyBDM"]=="yes") print " selected=\"selected\"";?>><?php print $pgv_lang["yes"]; ?></option> 256 </select> 257 </td></tr> 258 <?php 259 } 260 ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| [ Powered by PHPXref - Served by Debian GNU/Linux ] |