case 'cleanup2': foreach (User::all() as $user) { if (WT_Filter::post('del_' . $user->getUserId()) == '1') { Log::addAuthenticationLog('Deleted user: '******'Deleted user: '******'<br>'; $user->delete(); } } break; case 'listusers': default: echo '<table id="list">', '<thead>', '<tr>', '<th style="margin:0 -2px 1px 1px; padding:6px 0 5px;"> </th>', '<th> user-id </th>', '<th>', WT_I18N::translate('Username'), '</th>', '<th>', WT_I18N::translate('Real name'), '</th>', '<th>', WT_I18N::translate('Email'), '</th>', '<th> </th>', '<th>', WT_I18N::translate('Language'), '</th>', '<th> date_registered </th>', '<th>', WT_I18N::translate('Date registered'), '</th>', '<th> last_login </th>', '<th>', WT_I18N::translate('Last logged in'), '</th>', '<th>', WT_I18N::translate('Verified'), '</th>', '<th>', WT_I18N::translate('Approved'), '</th>', '<th style="margin:0 -2px 1px 1px; padding:3px 0 4px;"> </th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>'; $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addExternalJavascript(WT_JQUERY_JEDITABLE_URL)->addInlineJavascript(' var oTable = jQuery("#list").dataTable({ dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', ' . WT_I18N::datatablesI18N() . ', processing: true, serverSide: true, ajax: "' . WT_SCRIPT_NAME . '?action=loadrows", jQueryUI: true, autoWidth: false, pageLength: ' . Auth::user()->getSetting('admin_users_page_size', 10) . ', pagingType: "full_numbers", sorting: [[2,"asc"]], columns: [ /* details */ { sortable: false, class: "icon-open" }, /* user-id */ { visible: false }, /* user_name */ null, /* real_name */ null, /* email */ null, /* email link */ { sortable: false },
$datum[2] = WT_Filter::escapeHtml($datum[2]); } // Total filtered/unfiltered rows $recordsFiltered = WT_DB::prepare("SELECT FOUND_ROWS()")->fetchColumn(); $recordsTotal = WT_DB::prepare($SELECT2 . $WHERE)->execute($args)->fetchColumn(); header('Content-type: application/json'); echo json_encode(array('sEcho' => WT_Filter::getInteger('sEcho'), 'recordsTotal' => $recordsTotal, 'recordsFiltered' => $recordsFiltered, 'data' => $data)); exit; } $controller->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#log_list").dataTable( { dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', processing: true, serverSide: true, ajax: "' . WT_SERVER_NAME . WT_SCRIPT_PATH . WT_SCRIPT_NAME . '?action=load_json&from=' . $from . '&to=' . $to . '&type=' . $type . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc) . '", ' . WT_I18N::datatablesI18N(array(10, 20, 50, 100, 500, 1000, -1)) . ', jQueryUI: true, autoWidth: false, sorting: [[ 0, "desc" ]], pageLength: ' . Auth::user()->getSetting('admin_site_log_page_size', 20) . ', pagingType: "full_numbers" }); '); $url = WT_SCRIPT_NAME . '?from=' . rawurlencode($from) . '&to=' . rawurlencode($to) . '&type=' . rawurlencode($type) . '&text=' . rawurlencode($text) . '&ip=' . rawurlencode($ip) . '&user='******'&gedc=' . rawurlencode($gedc); $users_array = array(); foreach (User::all() as $tmp_user) { $users_array[$tmp_user->getUserName()] = $tmp_user->getUserName(); } echo '<form name="logs" method="get" action="' . WT_SCRIPT_NAME . '">', '<input type="hidden" name="action", value="show">', '<table class="site_logs">', '<tr>', '<td colspan="6">', WT_I18N::translate('From %s to %s', '<input class="log-date" name="from" value="' . WT_Filter::escapeHtml($from) . '">', '<input class="log-date" name="to" value="' . WT_Filter::escapeHtml($to) . '">'), '</td>', '</tr><tr>', '<td>', WT_I18N::translate('Type'), '<br>', select_edit_control('type', array('' => '', 'auth' => 'auth', 'config' => 'config', 'debug' => 'debug', 'edit' => 'edit', 'error' => 'error', 'media' => 'media', 'search' => 'search'), null, $type, ''), '</td>', '<td>', WT_I18N::translate('Message'), '<br><input class="log-filter" name="text" value="', WT_Filter::escapeHtml($text), '"> ', '</td>', '<td>', WT_I18N::translate('IP address'), '<br><input class="log-filter" name="ip" value="', WT_Filter::escapeHtml($ip), '"> ', '</td>', '<td>', WT_I18N::translate('User'), '<br>', select_edit_control('user', $users_array, '', $user, ''), '</td>', '<td>', WT_I18N::translate('Family tree'), '<br>', select_edit_control('gedc', WT_Tree::getNameList(), '', $gedc, Auth::isAdmin() ? '' : 'disabled'), '</td>', '</tr><tr>', '<td colspan="6">', '<input type="submit" value="', WT_I18N::translate('Filter'), '">', '<input type="submit" value="', WT_I18N::translate('Export'), '" onclick="document.logs.action.value=\'export\';return true;" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '<input type="submit" value="', WT_I18N::translate('Delete'), '" onclick="if (confirm(\'', WT_Filter::escapeHtml(WT_I18N::translate('Permanently delete these records?')), '\')) {document.logs.action.value=\'delete\';return true;} else {return false;}" ', $action == 'show' ? '' : 'disabled="disabled"', '>', '</td>', '</tr>', '</table>', '</form>'; if ($action) { echo '<br>', '<table id="log_list">', '<thead>', '<tr>', '<th>', WT_I18N::translate('Timestamp'), '</th>', '<th>', WT_I18N::translate('Type'), '</th>', '<th>', WT_I18N::translate('Message'), '</th>', '<th>', WT_I18N::translate('IP address'), '</th>', '<th>', WT_I18N::translate('User'), '</th>', '<th>', WT_I18N::translate('Family tree'), '</th>', '</tr>', '</thead>', '<tbody>', '</tbody>', '</table>';
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $controller; $show_unassigned = get_block_setting($block_id, 'show_unassigned', true); $show_other = get_block_setting($block_id, 'show_other', true); $show_future = get_block_setting($block_id, 'show_future', true); $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('show_unassigned', 'show_other', 'show_future', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) { $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; } else { $title = ''; } $title .= $this->getTitle() . help_link('todo', $this->getName()); $table_id = Uuid::uuid4(); // create a unique ID $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#' . $table_id . '").dataTable({ dom: \'t\', ' . WT_I18N::datatablesI18N() . ', autoWidth: false, paginate: false, lengthChange: false, filter: false, info: true, jQueryUI: true, columns: [ /* 0-DATE */ { visible: false }, /* 1-Date */ { dataSort: 0 }, /* 1-Record */ null, /* 2-Username */ null, /* 3-Text */ null ] }); jQuery("#' . $table_id . '").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $content = ''; $content .= '<div class="loading-image"> </div>'; $content .= '<table id="' . $table_id . '" style="visibility:hidden;">'; $content .= '<thead><tr>'; $content .= '<th>DATE</th>'; //hidden by datables code $content .= '<th>' . WT_Gedcom_Tag::getLabel('DATE') . '</th>'; $content .= '<th>' . WT_I18N::translate('Record') . '</th>'; if ($show_unassigned || $show_other) { $content .= '<th>' . WT_I18N::translate('Username') . '</th>'; } $content .= '<th>' . WT_Gedcom_Tag::getLabel('TEXT') . '</th>'; $content .= '</tr></thead><tbody>'; $found = false; $end_jd = $show_future ? 99999999 : WT_CLIENT_JD; foreach (get_calendar_events(0, $end_jd, '_TODO', WT_GED_ID) as $fact) { $record = $fact->getParent(); $user_name = $fact->getAttribute('_WT_USER'); if ($user_name == WT_USER_NAME || !$user_name && $show_unassigned || $user_name && $show_other) { $content .= '<tr>'; //-- Event date (sortable) $content .= '<td>'; //hidden by datables code $content .= $fact->getDate()->JD(); $content .= '</td>'; $content .= '<td class="wrap">' . $fact->getDate()->Display(empty($SEARCH_SPIDER)) . '</td>'; $content .= '<td class="wrap"><a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a></td>'; if ($show_unassigned || $show_other) { $content .= '<td class="wrap">' . $user_name . '</td>'; } $text = $fact->getValue(); $content .= '<td class="wrap">' . $text . '</td>'; $content .= '</tr>'; $found = true; } } $content .= '</tbody></table>'; if (!$found) { $content .= '<p>' . WT_I18N::translate('There are no research tasks in this family tree.') . '</p>'; } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } }
function print_events_table($startjd, $endjd, $events = 'BIRT MARR DEAT', $only_living = false, $sort_by = 'anniv') { global $controller; $html = ''; $table_id = 'table-even-' . Uuid::uuid4(); // lists requires a unique ID in case there are multiple lists per page $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#' . $table_id . '").dataTable({ dom: \'t\', ' . WT_I18N::datatablesI18N() . ', autoWidth: false, paging: false, lengthChange: false, filter: false, info: true, jQueryUI: true, sorting: [[ ' . ($sort_by == 'alpha' ? 1 : 3) . ', "asc"]], columns: [ /* 0-Record */ { dataSort: 1 }, /* 1-NAME */ { visible: false }, /* 2-Date */ { dataSort: 3 }, /* 3-DATE */ { visible: false }, /* 4-Anniv. */ { dataSort: 5, class: "center" }, /* 5-ANNIV */ { type: "num", visible: false }, /* 6-Event */ { class: "center" } ] }); '); // Did we have any output? Did we skip anything? $output = 0; $filter = 0; $filtered_events = array(); foreach (get_events_list($startjd, $endjd, $events) as $fact) { $record = $fact->getParent(); //-- only living people ? if ($only_living) { if ($record instanceof WT_Individual && $record->isDead()) { $filter++; continue; } if ($record instanceof WT_Family) { $husb = $record->getHusband(); if (is_null($husb) || $husb->isDead()) { $filter++; continue; } $wife = $record->getWife(); if (is_null($wife) || $wife->isDead()) { $filter++; continue; } } } //-- Counter $output++; if ($output == 1) { //-- table body $html .= '<table id="' . $table_id . '" class="width100">'; $html .= '<thead><tr>'; $html .= '<th>' . WT_I18N::translate('Record') . '</th>'; $html .= '<th>NAME</th>'; //hidden by datatables code $html .= '<th>' . WT_Gedcom_Tag::getLabel('DATE') . '</th>'; $html .= '<th>DATE</th>'; //hidden by datatables code $html .= '<th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th>'; $html .= '<th>ANNIV</th>'; $html .= '<th>' . WT_Gedcom_Tag::getLabel('EVEN') . '</th>'; $html .= '</tr></thead><tbody>'; } $filtered_events[] = $fact; } foreach ($filtered_events as $n => $fact) { $record = $fact->getParent(); $html .= '<tr>'; $html .= '<td>'; $html .= '<a href="' . $record->getHtmlUrl() . '">' . $record->getFullName() . '</a>'; if ($record instanceof WT_Individual) { $html .= $record->getSexImage(); } $html .= '</td>'; $html .= '<td>' . $record->getSortName() . '</td>'; $html .= '<td>' . $fact->getDate()->Display(empty($SEARCH_SPIDER)) . '</td>'; $html .= '<td>' . $n . '</td>'; $html .= '<td>' . WT_I18N::number($fact->anniv) . '</td>'; $html .= '<td>' . $fact->anniv . '</td>'; $html .= '<td>' . $fact->getLabel() . '</td>'; $html .= '</tr>'; } if ($output != 0) { $html .= '</tbody></table>'; } // Print a final summary message about restricted/filtered facts $summary = ''; if ($endjd == WT_CLIENT_JD) { // We're dealing with the Today’s Events block if ($output == 0) { if ($filter == 0) { $summary = WT_I18N::translate('No events exist for today.'); } else { $summary = WT_I18N::translate('No events for living individuals exist for today.'); } } } else { // We're dealing with the Upcoming Events block if ($output == 0) { if ($filter == 0) { if ($endjd == $startjd) { $summary = WT_I18N::translate('No events exist for tomorrow.'); } else { // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow” $summary = WT_I18N::plural('No events exist for the next %s day.', 'No events exist for the next %s days.', $endjd - $startjd + 1, WT_I18N::number($endjd - $startjd + 1)); } } else { if ($endjd == $startjd) { $summary = WT_I18N::translate('No events for living individuals exist for tomorrow.'); } else { // I18N: translation for %s==1 is unused; it is translated separately as “tomorrow” $summary = WT_I18N::plural('No events for living people exist for the next %s day.', 'No events for living people exist for the next %s days.', $endjd - $startjd + 1, WT_I18N::number($endjd - $startjd + 1)); } } } } if ($summary != "") { $html .= '<strong>' . $summary . '</strong>'; } return $html; }
private function show_list() { global $controller; $controller = new WT_Controller_Page(); $controller->setPageTitle($this->getTitle())->pageHeader()->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#story_table").dataTable({ dom: \'<"H"pf<"dt-clear">irl>t<"F"pl>\', ' . WT_I18N::datatablesI18N() . ', autoWidth: false, paging: true, pagingType: "full_numbers", lengthChange: true, filter: true, info: true, jQueryUI: true, sorting: [[0,"asc"]], columns: [ /* 0-name */ null, /* 1-NAME */ null ] }); '); $stories = WT_DB::prepare("SELECT block_id, xref" . " FROM `##block` b" . " WHERE module_name=?" . " AND gedcom_id=?" . " ORDER BY xref")->execute(array($this->getName(), WT_GED_ID))->fetchAll(); echo '<h2 class="center">', WT_I18N::translate('Stories'), '</h2>'; if (count($stories) > 0) { echo '<table id="story_table" class="width100">'; echo '<thead><tr> <th>', WT_I18N::translate('Story title'), '</th> <th>', WT_I18N::translate('Individual'), '</th> </tr></thead> <tbody>'; foreach ($stories as $story) { $indi = WT_Individual::getInstance($story->xref); $story_title = get_block_setting($story->block_id, 'title'); $languages = get_block_setting($story->block_id, 'languages'); if (!$languages || in_array(WT_LOCALE, explode(',', $languages))) { if ($indi) { if ($indi->canShow()) { echo '<tr><td><a href="' . $indi->getHtmlUrl() . '#stories">' . $story_title . '</a></td><td><a href="' . $indi->getHtmlUrl() . '#stories">' . $indi->getFullName() . '</a></td></tr>'; } } else { echo '<tr><td>', $story_title, '</td><td class="error">', $story->xref, '</td></tr>'; } } } echo '</tbody></table>'; } }
public function getBlock($block_id, $template = true, $cfg = null) { global $ctype, $controller; $days = get_block_setting($block_id, 'days', 7); $infoStyle = get_block_setting($block_id, 'infoStyle', 'table'); $calendar = get_block_setting($block_id, 'calendar', 'jewish'); $block = get_block_setting($block_id, 'block', true); if ($cfg) { foreach (array('days', 'infoStyle', 'block') as $name) { if (array_key_exists($name, $cfg)) { ${$name} = $cfg[$name]; } } } $startjd = WT_CLIENT_JD; $endjd = WT_CLIENT_JD + $days - 1; $id = $this->getName() . $block_id; $class = $this->getName() . '_block'; if ($ctype == 'gedcom' && WT_USER_GEDCOM_ADMIN || $ctype == 'user' && WT_USER_ID) { $title = '<i class="icon-admin" title="' . WT_I18N::translate('Configure') . '" onclick="modalDialog(\'block_edit.php?block_id=' . $block_id . '\', \'' . $this->getTitle() . '\');"></i>'; } else { $title = ''; } $title .= $this->getTitle(); $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 + $days; ++$jd) { foreach (get_anniversary_events($jd, 'DEAT _YART') as $fact) { // Exact hebrew dates only $date = $fact->getDate(); if ($date->MinDate() instanceof WT_Date_Jewish && $date->MinJD() == $date->MaxJD()) { $fact->jd = $jd; $yahrzeits[] = $fact; } } } // ...then adjust dates $jewish_calendar = new JewishCalendar(); foreach ($yahrzeits as $yahrzeit) { if ($yahrzeit->getTag() == 'DEAT') { // Just DEAT, not _YART $today = new WT_Date_Jewish($yahrzeit->jd); $hd = $yahrzeit->getDate()->MinDate(); $hd1 = new WT_Date_Jewish($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->jd = $jewish_calendar->ymdToJd($today->y, 3, 1) - 1; } elseif ($hd->d == 30 && $hd->m == 3 && $hd->y != 0 && $hd1->daysInMonth() < 30) { // 30 KSL // Last day in KSL $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 4, 1) - 1; } elseif ($hd->d == 30 && $hd->m == 6 && $hd->y != 0 && $today->daysInMonth() < 30 && !$today->isLeapYear()) { // 30 ADR // Last day in SHV $yahrzeit->jd = $jewish_calendar->ymdToJd($today->y, 6, 1) - 1; } } } switch ($infoStyle) { case 'list': foreach ($yahrzeits as $yahrzeit) { if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { $ind = $yahrzeit->getParent(); $content .= "<a href=\"" . $ind->getHtmlUrl() . "\" class=\"list_item name2\">" . $ind->getFullName() . "</a>" . $ind->getSexImage(); $content .= "<div class=\"indent\">"; $content .= $yahrzeit->getDate()->Display(true); $content .= ', ' . WT_I18N::translate('%s year anniversary', $yahrzeit->anniv); $content .= "</div>"; } } break; case 'table': default: $table_id = Uuid::uuid4(); // table requires a unique ID $controller->addExternalJavascript(WT_JQUERY_DATATABLES_URL)->addInlineJavascript(' jQuery("#' . $table_id . '").dataTable({ dom: \'t\', ' . WT_I18N::datatablesI18N() . ', autoWidth: false, paginate: false, lengthChange: false, filter: false, info: true, jQueryUI: true, sorting: [[5,"asc"]], columns: [ /* 0-name */ { dataSort: 1 }, /* 1-NAME */ { visible: false }, /* 2-date */ { dataSort: 3 }, /* 3-DATE */ { visible: false }, /* 4-Aniv */ { class: "center"}, /* 5-yart */ { dataSort: 6 }, /* 6-YART */ { visible: false } ] }); jQuery("#' . $table_id . '").css("visibility", "visible"); jQuery(".loading-image").css("display", "none"); '); $content = ''; $content .= '<div class="loading-image"> </div>'; $content .= '<table id="' . $table_id . '" class="width100" style="visibility:hidden;">'; $content .= '<thead><tr>'; $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>'; $content .= '<th>' . WT_Gedcom_Tag::getLabel('NAME') . '</th>'; $content .= '<th>' . WT_Gedcom_Tag::getLabel('DEAT') . '</th>'; $content .= '<th>DEAT</th>'; $content .= '<th><i class="icon-reminder" title="' . WT_I18N::translate('Anniversary') . '"></i></th>'; $content .= '<th>' . WT_Gedcom_Tag::getLabel('_YART') . '</th>'; $content .= '<th>_YART</th>'; $content .= '</tr></thead><tbody>'; foreach ($yahrzeits as $yahrzeit) { if ($yahrzeit->jd >= $startjd && $yahrzeit->jd < $startjd + $days) { $content .= '<tr>'; $ind = $yahrzeit->getParent(); // Individual name(s) $name = $ind->getFullName(); $url = $ind->getHtmlUrl(); $content .= '<td>'; $content .= '<a href="' . $url . '">' . $name . '</a>'; $content .= $ind->getSexImage(); $addname = $ind->getAddName(); if ($addname) { $content .= '<br><a href="' . $url . '">' . $addname . '</a>'; } $content .= '</td>'; $content .= '<td>' . $ind->getSortName() . '</td>'; // death/yahrzeit event date $content .= '<td>' . $yahrzeit->getDate()->Display() . '</td>'; $content .= '<td>' . $yahrzeit->getDate()->minJD() . '</td>'; // sortable date // Anniversary $content .= '<td>' . $yahrzeit->anniv . '</td>'; // upcomming yahrzeit dates switch ($calendar) { case 'gregorian': $today = new WT_Date_Gregorian($yahrzeit->jd); break; case 'jewish': default: $today = new WT_Date_Jewish($yahrzeit->jd); break; } $td = new WT_Date($today->format('%@ %A %O %E')); $content .= '<td>' . $td->Display() . '</td>'; $content .= '<td>' . $td->minJD() . '</td>'; // sortable date $content .= '</tr>'; } } $content .= '</tbody></table>'; break; } if ($template) { if ($block) { require WT_THEME_DIR . 'templates/block_small_temp.php'; } else { require WT_THEME_DIR . 'templates/block_main_temp.php'; } } else { return $content; } }