getName().$block_id; if ($ctype=='gedcom' && WT_USER_GEDCOM_ADMIN || $ctype=='user' && WT_USER_ID) { $title="\"".i18n::translate('Configure')."\""; } else { $title=''; } $title.= i18n::translate('Upcoming Yahrzeiten').help_link('yahrzeit', $this->getName()); $content=''; // The standard anniversary rules cover most of the Yahrzeit rules, we just // need to handle a few special cases. // Fetch normal anniversaries... $yahrzeits=array(); for ($jd=$startjd-1; $jd<=$endjd+30;++$jd) { foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) { // Extract hebrew dates only if ($fact['date']->date1->CALENDAR_ESCAPE()=='@#DHEBREW@' && $fact['date']->MinJD()==$fact['date']->MaxJD()) { // Apply privacy if (canDisplayRecord(WT_GED_ID, find_person_record($fact['id'], WT_GED_ID)) && canDisplayFact($fact['id'], WT_GED_ID, $fact['factrec'])) { $yahrzeits[]=$fact; } } } } // ...then adjust dates foreach ($yahrzeits as $key=>$yahrzeit) { if (strpos('1 DEAT', $yahrzeit['factrec'])!==false) { // Just DEAT, not _YART $today=new JewishDate($yahrzeit['jd']); $hd=$yahrzeit['date']->MinDate(); $hd1=new JewishDate($hd); $hd1->y+=1; $hd1->SetJDFromYMD(); // Special rules. See http://www.hebcal.com/help/anniv.html // Everything else is taken care of by our standard anniversary rules. if ($hd->d==30 && $hd->m==2 && $hd->y!=0 && $hd1->DaysInMonth()<30) { // 30 CSH // Last day in CSH $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 3, 1)-1; } if ($hd->d==30 && $hd->m==3 && $hd->y!=0 && $hd1->DaysInMonth()<30) { // 30 KSL // Last day in KSL $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 4, 1)-1; } if ($hd->d==30 && $hd->m==6 && $hd->y!=0 && $today->DaysInMonth()<30 && !$today->IsLeapYear()) { // 30 ADR // Last day in SHV $yahrzeit[$key]['jd']=JewishDate::YMDtoJD($today->y, 6, 1)-1; } } } switch ($infoStyle) { case 'list': foreach ($yahrzeits as $yahrzeit) if ($yahrzeit['jd']>=$startjd && $yahrzeit['jd']<$startjd+$days) { $ind=person::GetInstance($yahrzeit['id']); $content .= "getHtmlUrl()."\" class=\"list_item name2\">".$ind->getFullName()."".$ind->getSexImage(); $content .= "
"; $content .= $yahrzeit['date']->Display(true); $content .= ', '.i18n::translate('%s year anniversary', $yahrzeit['anniv']); $content .= "
"; } break; case 'table': default: require_once WT_ROOT.'js/sorttable.js.htm'; require_once WT_ROOT.'includes/classes/class_gedcomrecord.php'; $table_id = "ID".floor(microtime()*1000000); // sorttable requires a unique ID $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $content .= ""; $count=0; foreach ($yahrzeits as $yahrzeit) { if ($yahrzeit['jd']>=$startjd && $yahrzeit['jd']<$startjd+$days) { ++$count; $ind=person::GetInstance($yahrzeit['id']); $content .= ""; // Record name(s) $name=$ind->getFullName(); $url=$ind->getHtmlUrl(); $content .= ""; // GIVN for sorting $content .= ""; $today=new JewishDate($yahrzeit['jd']); $td=new GedcomDate($today->Format('%@ %A %O %E')); // death/yahrzeit event date $content .= ""; // Anniversary $content .= ""; $content .= ""; } } // table footer $content .= ""; $content .= "'; $content .= ''; $content .= ''; $content .= '
".translate_fact('NAME')."GIVN".translate_fact('DATE')."\"".i18n::translate('Anniversary')."\"".translate_fact('_YART')."
"; $content .= "".PrintReady($name).""; $content .= $ind->getSexImage(); $addname=$ind->getAddName(); if ($addname) { $content .= "
".PrintReady($addname).""; } $content .= "
"; $exp = explode(",", str_replace('<', ',', $name).","); $content .= $exp[1]; $content .= ""; $content .= "".$yahrzeit['date']->Display(true, NULL, array()).""; $content .= ""; $anniv = $yahrzeit['anniv']; if ($anniv==0) { $content .= ' '; } else { $content .= "{$anniv}"; } // upcomming yahrzeit dates $content .= ""; $content .= "".$td->Display(true, NULL, array('gregorian')).""; // hCalendar:url $content .= " 
"; $content .= ' '.translate_fact('GIVN').'
'; $content .= i18n::translate('Total Names').": ".$count; $content .= '
GIVN   
'; break; } if ($template) { if ($block) { require $THEME_DIR.'templates/block_small_temp.php'; } else { require $THEME_DIR.'templates/block_main_temp.php'; } } else { return $content; } } // Implement class WT_Module_Block public function loadAjax() { return true; } // Implement class WT_Module_Block public function isUserBlock() { return true; } // Implement class WT_Module_Block public function isGedcomBlock() { return true; } // Implement class WT_Module_Block public function configureBlock($block_id) { if (safe_POST_bool('save')) { set_block_setting($block_id, 'days', safe_POST_integer('days', 1, 30, 7)); set_block_setting($block_id, 'infoStyle', safe_POST('infoStyle', array('list', 'table'), 'table')); set_block_setting($block_id, 'block', safe_POST_bool('block')); echo WT_JS_START, 'window.opener.location.href=window.opener.location.href;window.close();', WT_JS_END; exit; } require_once WT_ROOT.'includes/functions/functions_edit.php'; $days=get_block_setting($block_id, 'days', 7); echo ''; echo i18n::translate('Number of days to show'); echo ''; echo ''; echo ' ', i18n::plural('maximum %d day', 'maximum %d days', 30, 30) ,''; echo ''; $infoStyle=get_block_setting($block_id, 'infoStyle', 'table'); echo ''; echo i18n::translate('Presentation style'); echo ''; echo select_edit_control('infoStyle', array('list'=>i18n::translate('List'), 'table'=>i18n::translate('Table')), null, $infoStyle, ''); echo ''; $block=get_block_setting($block_id, 'block', true); echo ''; echo /* I18N: label for a yes/no option */ i18n::translate('Add a scrollbar when block contents grow'); echo ''; echo edit_field_yes_no('block', $block); echo ''; } }