&%{};]*'); // All indis with this surname. NB - allow ' and " $search =safe_GET('search'); $last = array('alpha'=>$alpha, 'surname'=>$surname, 'search'=>$search); $_SESSION['sb_individuals_last'] = $last; if (!empty($search)) return $this->search($search); else if (empty($surname)) return $this->getAlphaSurnames($alpha, $surname); else return $this->getSurnameIndis($alpha, $surname); } // Implement WT_Module_Sidebar public function getSidebarContent() { global $SHOW_MARRIED_NAMES, $WT_IMAGES; // Fetch a list of the initial letters of all surnames in the database $initials=get_indilist_salpha($SHOW_MARRIED_NAMES, false, WT_GED_ID); $out = '

'; foreach ($initials as $letter=>$count) { switch ($letter) { case '@': $html=i18n::translate('(unknown)'); break; case ',': $html=i18n::translate('None'); break; default: $html=$letter; break; } $html=''.PrintReady($html).''; $out .= $html." "; } $out .= '

'; $out .= '
'; if (isset($_SESSION['sb_individuals_last'])) { $last = $_SESSION['sb_individuals_last']; $alpha = $last['alpha']; $search = $last['search']; $surname = $last['surname']; if (!empty($search)) $out.= $this->search($search); else if (!empty($alpha)) $out.= $this->getAlphaSurnames($alpha, $surname); } $out .= '
'; return $out; } public function getAlphaSurnames($alpha, $surname1='') { global $SHOW_MARRIED_NAMES; $surns=get_indilist_surns('', $alpha, $SHOW_MARRIED_NAMES, false, WT_GED_ID); $out = ''; return $out; } public function getSurnameIndis($alpha, $surname) { global $SHOW_MARRIED_NAMES; $indis=get_indilist_indis($surname, $alpha, '', $SHOW_MARRIED_NAMES, false, WT_GED_ID); $out = ''; return $out; } public function search($query) { if (strlen($query)<2) { return ''; } $rows= WT_DB::prepare( "SELECT ? AS type, i_id AS xref, i_file AS ged_id, i_gedcom AS gedrec, i_isdead, i_sex". " FROM `##individuals`, `##name`". " WHERE (i_id LIKE ? OR n_sort LIKE ?)". " AND i_id=n_id AND i_file=n_file AND i_file=?". " ORDER BY n_sort COLLATE '".i18n::$collation."'". " LIMIT 50" ) ->execute(array('INDI', "%{$query}%", "%{$query}%", WT_GED_ID)) ->fetchAll(PDO::FETCH_ASSOC); $out = ''; return $out; } }