summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfisharebest <fisharebest@gmail.com>2011-10-16 14:21:24 +0000
committerfisharebest <fisharebest@gmail.com>2011-10-16 14:21:24 +0000
commit15aaf10b7de5b5118d126456fa2ce90d2260ed1a (patch)
tree1c12dce3351cf0d3b3a52bc1d75cfcb3483d0ac4
parentf1989434ba189c1d82a3e306fb8d9c959edc6da8 (diff)
downloadwebtrees-15aaf10b7de5b5118d126456fa2ce90d2260ed1a.tar.gz
webtrees-15aaf10b7de5b5118d126456fa2ce90d2260ed1a.tar.bz2
webtrees-15aaf10b7de5b5118d126456fa2ce90d2260ed1a.zip
1) Combine user and gedcom favourites blocks - they have identical logic.
2) Don't fetch data directly from database - use API.
-rw-r--r--modules_v3/gedcom_favorites/module.php90
-rw-r--r--modules_v3/user_favorites/module.php285
2 files changed, 48 insertions, 327 deletions
diff --git a/modules_v3/gedcom_favorites/module.php b/modules_v3/gedcom_favorites/module.php
index 7b904b7fe5..2e09f188b3 100644
--- a/modules_v3/gedcom_favorites/module.php
+++ b/modules_v3/gedcom_favorites/module.php
@@ -36,6 +36,8 @@ try {
die($ex);
}
+// Note that the user favorites module simply extends this module, so ensure that the
+// logic works for both.
class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
// Extend class WT_Module
public function getTitle() {
@@ -71,7 +73,7 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$record=WT_GedcomRecord::getInstance($gid);
if ($record && $record->canDisplayDetails()) {
self::addFavorite(array(
- 'username'=>WT_GEDCOM,
+ 'username'=>$ctype=='user' ? WT_USER_NAME : WT_GEDCOM,
'gid' =>$record->getXref(),
'type' =>$record->getType(),
'file' =>WT_GEDCOM,
@@ -82,7 +84,7 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
}
} elseif ($url) {
self::addFavorite(array(
- 'username'=>WT_GEDCOM,
+ 'username'=>$ctype=='user' ? WT_USER_NAME : WT_GEDCOM,
'gid' =>'',
'type' =>'URL',
'file' =>WT_GEDCOM,
@@ -110,13 +112,13 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$show_full = 1;
$PEDIGREE_FULL_DETAILS = 1;
- $userfavs = self::getUserFavorites(WT_GEDCOM);
+ $userfavs = self::getUserFavorites($ctype=='user' ? WT_USER_NAME : WT_GEDCOM);
if (!is_array($userfavs)) $userfavs = array();
$id=$this->getName().$block_id;
$title=$this->getTitle();
- if (WT_USER_IS_ADMIN && $ENABLE_AUTOCOMPLETE) {
+ if (WT_USER_ID && $ENABLE_AUTOCOMPLETE) {
// TODO: do we really need to load jquery again?
$content = '<script type="text/javascript" src="'.WT_JQUERY_URL.'"></script>
<script type="text/javascript" src="'.WT_STATIC_URL.'js/jquery/jquery.autocomplete.js"></script>
@@ -150,23 +152,29 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
foreach ($userfavs as $key=>$favorite) {
if (isset($favorite['id'])) $key=$favorite['id'];
- $removeFavourite = "<a class=\"font9\" href=\"index.php?ctype=$ctype&amp;action=deletefav&amp;fv_id={$key}\" onclick=\"return confirm('".WT_I18N::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".WT_I18N::translate('Remove')."</a><br />";
+ $removeFavourite = "<a class=\"font9\" href=\"index.php?ctype={$ctype}&amp;action=deletefav&amp;fv_id={$key}\" onclick=\"return confirm('".WT_I18N::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".WT_I18N::translate('Remove')."</a><br />";
$content .= '<tr><td>';
if ($favorite['type']=='URL') {
$content .= "<div id=\"boxurl".$key.".0\" class=\"person_box\">";
if ($ctype=='user' || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
$content .= "<a href=\"".$favorite['url']."\"><b>".PrintReady($favorite['title']).'</b></a>';
- $content .= "<br />".PrintReady($favorite["note"]);
- $content .= "</div>";
+ $content .= '<br />'.PrintReady($favorite['note']);
+ $content .= '</div>';
} else {
$record=WT_GedcomRecord::getInstance($favorite['gid']);
if ($record && $record->canDisplayDetails()) {
- if ($favorite["type"]=="INDI") {
- $indirec = find_person_record($favorite["gid"], WT_GED_ID);
+ if ($record->getType()=='INDI') {
$content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box";
- if (strpos($indirec, "\n1 SEX F")!==false) $content .= "F";
- elseif (strpos($indirec, "\n1 SEX M")!==false) $content .= "";
- else $content .= "NN";
+ switch($record->getsex()) {
+ case 'M':
+ break;
+ case 'F':
+ $content.='F';
+ break;
+ case 'U':
+ $content.='NN';
+ break;
+ }
$content .= "\">";
if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
ob_start();
@@ -176,38 +184,30 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$content .= "</div>";
} else {
$record=WT_GedcomRecord::getInstance($favorite['gid']);
- $content .= "<div id=\"box".$favorite["gid"].".0\" class=\"person_box\">";
- if ($ctype=="user" || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
+ $content .= "<div id=\"box".$favorite['gid'].".0\" class=\"person_box\">";
+ if ($ctype=='user' || WT_USER_GEDCOM_ADMIN) $content .= $removeFavourite;
if ($record) {
$content.=$record->format_list('span');
} else {
$content.=WT_I18N::translate('No such ID exists in this GEDCOM file.');
}
- $content .= "<br />".PrintReady($favorite["note"]);
- $content .= "</div>";
+ $content .= '<br />'.PrintReady($favorite['note']);
+ $content .= '</div>';
}
}
}
- $content .= "</td></tr>";
+ $content .= '</td></tr>';
}
- $content .= "</table>";
+ $content .= '</table>';
}
- if (WT_USER_GEDCOM_ADMIN) {
- $content .= '
- <script type="text/javascript">
- <!--
- var pastefield;
- function paste_id(value) {
- pastefield.value=value;
- }
- -->
- </script>
- <br />
- ';
- $uniqueID = floor(microtime() * 1000000);
- $content .= "<b><a href=\"javascript://".WT_I18N::translate('Add a new favorite')." \" onclick=\"expand_layer('add_ged_fav{$uniqueID}'); return false;\"><img id=\"add_ged_fav_img\" src=\"".$WT_IMAGES["plus"]."\" border=\"0\" alt=\"\" />&nbsp;".WT_I18N::translate('Add a new favorite')."</a></b>";
- $content .= "<br /><div id=\"add_ged_fav{$uniqueID}\" style=\"display: none;\">";
- $content .= "<form name=\"addgfavform\" method=\"get\" action=\"index.php\">";
+ if ($ctype=='user' || WT_USER_GEDCOM_ADMIN) {
+ $content .=
+ WT_JS_START.'var pastefield; function paste_id(value) {pastefield.value=value;}'.WT_JS_END.
+ '<br />';
+ $uniqueID = floor(microtime() * 1000000); // This block can theoretically appear multiple times, so use a unique ID.
+ $content .= "<b><a href=\"#\" onclick=\"expand_layer('add_fav{$uniqueID}'); return false;\"><img id=\"add_fav{$uniqueID}_img\" src=\"".$WT_IMAGES["plus"]."\" border=\"0\" alt=\"\" />&nbsp;".WT_I18N::translate('Add a new favorite')."</a></b>";
+ $content .= "<br /><div id=\"add_fav{$uniqueID}\" style=\"display: none;\">";
+ $content .= "<form name=\"addfavform\" method=\"get\" action=\"index.php\">";
$content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
$content .= "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />";
$content .= "<input type=\"hidden\" name=\"ged\" value=\"".WT_GEDCOM."\" />";
@@ -227,7 +227,7 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
$content .= "<tr><td>".WT_I18N::translate('Title:')."</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
if ($block) $content .= "</td></tr><tr><td><br />";
else $content .= "</td><td>";
- $content .= "".WT_I18N::translate('Enter an optional note about this favorite');
+ $content .= WT_I18N::translate('Enter an optional note about this favorite');
$content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
$content .= "</td></tr></table>";
$content .= "<br /><input type=\"submit\" value=\"".WT_I18N::translate('Add')."\" style=\"font-size: 8pt; \" />";
@@ -299,21 +299,21 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
*/
public static function addFavorite($favorite) {
// -- make sure a favorite is added
- if (empty($favorite["gid"]) && empty($favorite["url"]))
+ if (empty($favorite['gid']) && empty($favorite['url']))
return false;
//-- make sure this is not a duplicate entry
$sql = "SELECT 1 FROM `##favorites` WHERE";
- if (!empty($favorite["gid"])) {
+ if (!empty($favorite['gid'])) {
$sql.=" fv_gid=?";
- $vars=array($favorite["gid"]);
+ $vars=array($favorite['gid']);
} else {
$sql.=" fv_url=?";
- $vars=array($favorite["url"]);
+ $vars=array($favorite['url']);
}
$sql.=" AND fv_file=? AND fv_username=?";
- $vars[]=$favorite["file"];
- $vars[]=$favorite["username"];
+ $vars[]=$favorite['file'];
+ $vars[]=$favorite['username'];
if (WT_DB::prepare($sql)->execute($vars)->fetchOne()) {
return false;
@@ -325,13 +325,13 @@ class gedcom_favorites_WT_Module extends WT_Module implements WT_Module_Block {
->execute(array($favorite['username'], $favorite['gid'], $favorite['type'], $favorite['file'], $favorite['url'], $favorite['title'], $favorite['note']));
}
- // Get a family tree's favorites
- public static function getUserFavorites($gedcom) {
+ // Get favorites for a user or family tree
+ public static function getUserFavorites($username) {
return
WT_DB::prepare(
"SELECT fv_id AS id, fv_username AS username, fv_gid AS gid, fv_type AS type, fv_file AS file, fv_title AS title, fv_note AS note, fv_url AS url".
- " FROM `##favorites` WHERE fv_username=?")
- ->execute(array($gedcom))
+ " FROM `##favorites` WHERE fv_username=? AND fv_file=?")
+ ->execute(array($username, WT_GEDCOM))
->fetchAll(PDO::FETCH_ASSOC);
}
}
diff --git a/modules_v3/user_favorites/module.php b/modules_v3/user_favorites/module.php
index 913db4d8c6..f2af79a47e 100644
--- a/modules_v3/user_favorites/module.php
+++ b/modules_v3/user_favorites/module.php
@@ -36,220 +36,11 @@ try {
die($ex);
}
-class user_favorites_WT_Module extends WT_Module implements WT_Module_Block {
- // Extend class WT_Module
- public function getTitle() {
- return WT_I18N::translate('Favorites');
- }
-
+// The "user favorites" module is almost identical to the "gedcom favorites" module
+class user_favorites_WT_Module extends gedcom_favorites_WT_Module {
// Extend class WT_Module
public function getDescription() {
- return WT_I18N::translate('Display and manage a user’s favorite pages.');
- }
-
- // Implement class WT_Module_Block
- public function getBlock($block_id, $template=true, $cfg=null) {
- global $WT_IMAGES, $GEDCOM, $TEXT_DIRECTION, $MEDIA_DIRECTORY, $MEDIA_DIRECTORY_LEVELS, $ctype;
- global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
-
- $action=safe_GET('action');
- switch ($action) {
- case 'deletefav':
- $fv_id=safe_GET('fv_id');
- if ($fv_id) {
- self::deleteFavorite($fv_id);
- }
- unset($_GET['action']);
- break;
- case 'addfav':
- $gid =safe_GET('gid');
- $favnote =safe_GET('favnote');
- $url =safe_GET('url', WT_REGEX_URL);
- $favtitle=safe_GET('favtitle');
-
- if ($gid) {
- $record=WT_GedcomRecord::getInstance($gid);
- if ($record && $record->canDisplayDetails()) {
- self::addFavorite(array(
- 'username'=>WT_USER_NAME,
- 'gid' =>$record->getXref(),
- 'type' =>$record->getType(),
- 'file' =>WT_GEDCOM,
- 'url' =>'',
- 'note' =>$favnote,
- 'title' =>$favtitle,
- ));
- }
- } elseif ($url) {
- self::addFavorite(array(
- 'username'=>WT_USER_NAME,
- 'gid' =>'',
- 'type' =>'URL',
- 'file' =>WT_GEDCOM,
- 'url' =>$url,
- 'note' =>$favnote,
- 'title' =>$favtitle ? $favtitle : $url,
- ));
- }
- unset($_GET['action']);
- break;
- }
-
- $block=get_block_setting($block_id, 'block', false);
- if ($cfg) {
- foreach (array('block') as $name) {
- if (array_key_exists($name, $cfg)) {
- $$name=$cfg[$name];
- }
- }
- }
-
- // Override GEDCOM configuration temporarily
- if (isset($show_full)) $saveShowFull = $show_full;
- $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
- $show_full = 1;
- $PEDIGREE_FULL_DETAILS = 1;
-
- $userfavs = self::getUserFavorites(WT_USER_NAME);
- if (!is_array($userfavs)) $userfavs = array();
-
- $id=$this->getName().$block_id;
- $title=$this->getTitle();
-
- if ($ENABLE_AUTOCOMPLETE) {
- // TODO: do we really need to load jquery again?
- $content = '<script type="text/javascript" src="'.WT_JQUERY_URL.'"></script>
- <script type="text/javascript" src="'.WT_STATIC_URL.'js/jquery/jquery.autocomplete.js"></script>
- <script type="text/javascript">
- jQuery(document).ready(function($) {
- $("input[name^=gid]").autocomplete("autocomplete.php", {
- extraParams: {field:"IFSRO"},
- formatItem: function(row, i) {
- return row[0] + " (" + row[1] + ")";
- },
- formatResult: function(row) {
- return row[1];
- },
- width: 400,
- minChars: 2
- });
- });
- </script>';
- } else $content = '';
-
- if ($block) {
- $style = 2; // 1 means "regular box", 2 means "wide box"
- $tableWidth = ($BROWSERTYPE=='msie') ? '95%' : '99%'; // IE needs to have room for vertical scroll bar inside the box
- $cellSpacing = '1px';
- } else {
- $style = 2;
- $tableWidth = '99%';
- $cellSpacing = '3px';
- }
- if ($userfavs) {
- $mygedcom = $GEDCOM;
- $current_gedcom = $GEDCOM;
- $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
- foreach ($userfavs as $key=>$favorite) {
- if (isset($favorite['id'])) $key=$favorite['id'];
- $removeFavourite = "<a class=\"font9\" href=\"index.php?ctype={$ctype}&amp;action=deletefav&amp;fv_id={$key}\" onclick=\"return confirm('".WT_I18N::translate('Are you sure you want to remove this item from your list of Favorites?')."');\">".WT_I18N::translate('Remove')."</a><br />";
- $current_gedcom = $GEDCOM;
- $GEDCOM = $favorite['file'];
- $content .= '<tr><td>';
- if ($favorite['type']=='URL') {
- $content .= "<div id=\"boxurl".$key.".0\" class=\"person_box\">";
- if ($ctype=='user' || WT_USER_IS_ADMIN) $content .= $removeFavourite;
- $content .= "<a href=\"".$favorite['url']."\">".PrintReady($favorite['title']).'</a>';
- $content .= '<br />'.PrintReady($favorite['note']);
- } else {
- load_gedcom_settings(get_id_from_gedcom($GEDCOM));
- $indirec = find_gedcom_record($favorite['gid'], WT_GED_ID);
- if ($favorite['type']=='INDI') {
- $content .= "<div id=\"box".$favorite['gid'].".0\" class=\"person_box";
- if (strpos($indirec, "\n1 SEX F")!==false) $content .= 'F';
- elseif (strpos($indirec, "\n1 SEX M")!==false) $content .= '';
- else $content .= 'NN';
- $content .= "\">";
- if ($ctype=='user' || WT_USER_IS_ADMIN) $content .= $removeFavourite;
- ob_start();
- print_pedigree_person(WT_Person::getInstance($favorite['gid']), $style, 1, $key);
- $content .= ob_get_clean();
- $content .= PrintReady($favorite['note']);
- } else {
- $record=WT_GedcomRecord::getInstance($favorite['gid']);
- $content .= "<div id=\"box".$favorite['gid'].".0\" class=\"person_box\">";
- if ($ctype=='user' || WT_USER_IS_ADMIN) $content .= $removeFavourite;
- if ($record) {
- $content.=$record->format_list('span');
- } else {
- $content.=WT_I18N::translate('No such ID exists in this GEDCOM file.');
- }
- $content .= '<br />'.PrintReady($favorite['note']);
- }
- }
- $content .= '</div>';
- $content .= '</td></tr>';
- $GEDCOM = $mygedcom;
- }
- load_gedcom_settings(WT_GED_ID);
- $content .= '</table>';
- }
- $content .= '
- <script type="text/javascript">
- var pastefield;
- function paste_id(value) {
- pastefield.value=value;
- }
- </script>
- <br />
- ';
- $uniqueID = floor(microtime() * 1000000);
- $content .= "<b><a href=\"javascript: ".WT_I18N::translate('Add a new favorite')." \" onclick=\"expand_layer('add_user_fav{$uniqueID}'); return false;\"><img id=\"add_user_fav_img\" src=\"".$WT_IMAGES["plus"]."\" border=\"0\" alt=\"\" />&nbsp;".WT_I18N::translate('Add a new favorite')."</a></b>";
- $content .= "<br /><div id=\"add_user_fav{$uniqueID}\" style=\"display: none;\">";
- $content .= "<form name=\"addufavform\" method=\"get\" action=\"index.php\">";
- $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
- $content .= "<input type=\"hidden\" name=\"ctype\" value=\"$ctype\" />";
- $content .= "<input type=\"hidden\" name=\"ged\" value=\"$GEDCOM\" />";
- $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center $TEXT_DIRECTION\">";
- $content .= "<tr><td>".WT_I18N::translate('Enter a Person, Family, or Source ID')." <br />";
- $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
-
- $content .= print_findindi_link("gid{$uniqueID}",'',true);
- $content .= print_findfamily_link("gid{$uniqueID}",'',true);
- $content .= print_findsource_link("gid{$uniqueID}",'',true);
- $content .= print_findrepository_link("gid{$uniqueID}",'',true);
- $content .= print_findnote_link("gid{$uniqueID}",'',true);
- $content .= print_findmedia_link("gid{$uniqueID}",'1','',true);
-
- $content .= "<br />".WT_I18N::translate('OR<br />Enter a URL and a title');
- $content .= "<table><tr><td>".WT_Gedcom_Tag::getLabel('URL')."</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
- $content .= "<tr><td>".WT_I18N::translate('Title:')."</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
- if ($block) $content .= "</td></tr><tr><td><br />";
- else $content .= "</td><td>";
- $content .= WT_I18N::translate('Enter an optional note about this favorite');
- $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
- $content .= "</td></tr></table>";
- $content .= "<br /><input type=\"submit\" value=\"".WT_I18N::translate('Add')."\" style=\"font-size: 8pt; \" />";
- $content .= "</form></div>";
-
- 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;
- }
- // Restore GEDCOM configuration
- unset($show_full);
- if (isset($saveShowFull)) $show_full = $saveShowFull;
- $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
- }
-
- // Implement class WT_Module_Block
- public function loadAjax() {
- return false;
+ return /* I18N: Description of the "Favorites" module */ WT_I18N::translate('Display and manage a user’s favorite pages.');
}
// Implement class WT_Module_Block
@@ -262,74 +53,4 @@ class user_favorites_WT_Module extends WT_Module implements WT_Module_Block {
return false;
}
- // Implement class WT_Module_Block
- public function configureBlock($block_id) {
- if (safe_POST_bool('save')) {
- 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';
-
- $block=get_block_setting($block_id, 'block', false);
- echo '<tr><td class="descriptionbox wrap width33">';
- echo /* I18N: label for a yes/no option */ WT_I18N::translate('Add a scrollbar when block contents grow');
- echo '</td><td class="optionbox">';
- echo edit_field_yes_no('block', $block);
- echo '</td></tr>';
- }
-
- /**
- * deleteFavorite
- * deletes a favorite in the database
- * @param int $fv_id the id of the favorite to delete
- */
- public static function deleteFavorite($fv_id) {
- return (bool)
- WT_DB::prepare("DELETE FROM `##favorites` WHERE fv_id=?")
- ->execute(array($fv_id));
- }
-
- /**
- * stores a new favorite in the database
- * @param array $favorite the favorite array of the favorite to add
- */
- public static function addFavorite($favorite) {
- // -- make sure a favorite is added
- if (empty($favorite['gid']) && empty($favorite['url']))
- return false;
-
- //-- make sure this is not a duplicate entry
- $sql = "SELECT 1 FROM `##favorites` WHERE";
- if (!empty($favorite['gid'])) {
- $sql.=" fv_gid=?";
- $vars=array($favorite['gid']);
- } else {
- $sql.=" fv_url=?";
- $vars=array($favorite['url']);
- }
- $sql.=" AND fv_file=? AND fv_username=?";
- $vars[]=$favorite['file'];
- $vars[]=$favorite['username'];
-
- if (WT_DB::prepare($sql)->execute($vars)->fetchOne()) {
- return false;
- }
-
- //-- add the favorite to the database
- return (bool)
- WT_DB::prepare("INSERT INTO `##favorites` (fv_username, fv_gid, fv_type, fv_file, fv_url, fv_title, fv_note) VALUES (?, ? ,? ,? ,? ,? ,?)")
- ->execute(array($favorite['username'], $favorite['gid'], $favorite['type'], $favorite['file'], $favorite['url'], $favorite['title'], $favorite['note']));
- }
-
- // Get a user's favorites - from the current family tree only.
- public static function getUserFavorites($username) {
- return
- WT_DB::prepare(
- "SELECT fv_id AS id, fv_username AS username, fv_gid AS gid, fv_type AS type, fv_file AS file, fv_title AS title, fv_note AS note, fv_url AS url".
- " FROM `##favorites` WHERE fv_username=? AND fv_file=?")
- ->execute(array($username, WT_GEDCOM))
- ->fetchAll(PDO::FETCH_ASSOC);
- }
}