Exemplo n.º 1
0
function buildUpcomingFavorites()
{
    /*
        Builds the list of the next 5 favorites showing soon.
    */
    $favorites = getUserFavorites();
    $favorites = explode(",", $favorites['favorites']);
    foreach ($favorites as $favorite) {
        if ($favorite == "") {
        } else {
            $titleInfo = getTimeForFavorites($favorite);
            $daysoftheweek = array("Monday", "Teusday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
            $dayoftitle = $daysoftheweek[mt_rand(0, 6)];
            if ($titleInfo[2] == 'tv_series') {
                $dayoftitle .= "s";
            }
            echo "<div class=\"panel-body\">\n\r\n                    <p class=\"well\"><a href=\"/phase5/pages/info.php?id={$titleInfo['0']}\">\r\n                    {$favorite}</a> on " . $dayoftitle . " at " . date("h:i A", strtotime($titleInfo[1])) . "</p>\n\r\n              </div>\n";
        }
    }
}
Exemplo n.º 2
0
function print_user_favorites($block = true, $config = "", $side, $index)
{
    global $pgv_lang, $PGV_IMAGE_DIR, $PGV_IMAGES, $GEDCOM, $TEXT_DIRECTION, $INDEX_DIRECTORY, $MEDIA_DIRECTORY, $MULTI_MEDIA, $MEDIA_DIRECTORY_LEVELS, $ctype;
    global $show_full, $PEDIGREE_FULL_DETAILS, $BROWSERTYPE, $ENABLE_AUTOCOMPLETE;
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    $show_full = 1;
    $PEDIGREE_FULL_DETAILS = 1;
    $userfavs = getUserFavorites(PGV_USER_NAME);
    if (!is_array($userfavs)) {
        $userfavs = array();
    }
    $id = "user_favorites";
    $title = print_help_link("mygedview_favorites_help", "qm", "", false, true);
    $title .= $pgv_lang["my_favorites"] . "&nbsp;&nbsp;";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    $title .= "(" . count($userfavs) . ")";
    if ($TEXT_DIRECTION == "rtl") {
        $title .= getRLM();
    }
    if ($ENABLE_AUTOCOMPLETE) {
        $content = '<script type="text/javascript" src="js/jquery/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.autocomplete.js"></script>
		<script type="text/javascript" src="js/jquery/jquery.ajaxQueue.js"></script>
		<script type="text/javascript">
		jQuery.noConflict(); // @see http://docs.jquery.com/Using_jQuery_with_Other_Libraries/
		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 (count($userfavs) == 0) {
        $content .= print_text("no_favorites", 0, 1);
    } else {
        $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=\"" . encode_url("index.php?ctype={$ctype}&action=deletefav&fv_id={$key}") . "\" onclick=\"return confirm('" . $pgv_lang["confirm_fav_remove"] . "');\">" . $pgv_lang["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" || PGV_USER_IS_ADMIN) {
                    $content .= $removeFavourite;
                }
                $content .= "<a href=\"" . $favorite["url"] . "\">" . PrintReady($favorite["title"]) . "</a>";
                $content .= "<br />" . PrintReady($favorite["note"]);
            } else {
                require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
                $indirec = find_gedcom_record($favorite["gid"], PGV_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" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    ob_start();
                    print_pedigree_person($favorite["gid"], $style, 1, $key);
                    $content .= ob_get_clean();
                    $content .= PrintReady($favorite["note"]);
                } else {
                    $record = GedcomRecord::getInstance($favorite['gid']);
                    $content .= "<div id=\"box" . $favorite["gid"] . ".0\" class=\"person_box\">";
                    if ($ctype == "user" || PGV_USER_IS_ADMIN) {
                        $content .= $removeFavourite;
                    }
                    if ($record) {
                        $content .= $record->format_list('span');
                    } else {
                        $content .= $pgv_lang['invalid_id'];
                    }
                    $content .= "<br />" . PrintReady($favorite["note"]);
                }
            }
            $content .= "</div>";
            $content .= "</td></tr>";
            $GEDCOM = $mygedcom;
            require $INDEX_DIRECTORY . $GEDCOM . '_conf.php';
        }
        $content .= "</table>";
    }
    $content .= '
	<script language="JavaScript" type="text/javascript">
	var pastefield;
	function paste_id(value) {
		pastefield.value=value;
	}
	</script>
	<br />
	';
    $uniqueID = floor(microtime() * 1000000);
    $content .= print_help_link("index_add_favorites_help", "qm", "", false, true);
    $content .= "<b><a href=\"javascript: " . $pgv_lang["add_favorite"] . " \" onclick=\"expand_layer('add_user_fav'); return false;\"><img id=\"add_user_fav_img\" src=\"" . $PGV_IMAGE_DIR . "/" . $PGV_IMAGES["plus"]["other"] . "\" border=\"0\" alt=\"\" />&nbsp;" . $pgv_lang["add_favorite"] . "</a></b>";
    $content .= "<br /><div id=\"add_user_fav\" style=\"display: none;\">";
    $content .= "<form name=\"addufavform\" method=\"post\" action=\"index.php\">";
    $content .= "<input type=\"hidden\" name=\"action\" value=\"addfav\" />";
    $content .= "<input type=\"hidden\" name=\"ctype\" value=\"{$ctype}\" />";
    $content .= "<input type=\"hidden\" name=\"favtype\" value=\"user\" />";
    $content .= "<input type=\"hidden\" name=\"ged\" value=\"{$GEDCOM}\" />";
    $content .= "<table width=\"{$tableWidth}\" style=\"border:none\" cellspacing=\"{$cellSpacing}\" class=\"center {$TEXT_DIRECTION}\">";
    $content .= "<tr><td>" . $pgv_lang["add_fav_enter_id"] . " <br />";
    $content .= "<input class=\"pedigree_form\" type=\"text\" name=\"gid\" id=\"gid{$uniqueID}\" size=\"5\" value=\"\" />";
    $content .= print_findindi_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findfamily_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findsource_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findrepository_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findnote_link("gid{$uniqueID}", '', true) . "\n";
    $content .= print_findmedia_link("gid{$uniqueID}", '1', '', true) . "\n";
    $content .= "<br />" . $pgv_lang["add_fav_or_enter_url"];
    $content .= "<table><tr><td>" . $pgv_lang["url"] . "</td><td><input type=\"text\" name=\"url\" size=\"40\" value=\"\" /></td></tr>";
    $content .= "<tr><td>" . $pgv_lang["title"] . "</td><td><input type=\"text\" name=\"favtitle\" size=\"40\" value=\"\" /></td></tr></table>";
    if ($block) {
        $content .= "\n</td></tr><tr><td><br />";
    } else {
        $content .= "\n</td><td>";
    }
    $content .= $pgv_lang["add_fav_enter_note"];
    $content .= "<br /><textarea name=\"favnote\" rows=\"6\" cols=\"50\"></textarea>";
    $content .= "</td></tr></table>";
    $content .= "<br /><input type=\"submit\" value=\"" . $pgv_lang["add"] . "\" style=\"font-size: 8pt; \" />";
    $content .= "</form></div>";
    global $THEME_DIR;
    if ($block) {
        require $THEME_DIR . 'templates/block_small_temp.php';
    } else {
        require $THEME_DIR . 'templates/block_main_temp.php';
    }
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}
Exemplo n.º 3
0
 static function &getFavoritesMenu()
 {
     global $REQUIRE_AUTHENTICATION, $pgv_lang, $GEDCOM, $QUERY_STRING, $SCRIPT_NAME, $PGV_IMAGE_DIR, $PGV_IMAGES, $TEXT_DIRECTION;
     global $SEARCH_SPIDER;
     global $controller;
     // Pages with a controller can be added to the favorites
     if (!empty($SEARCH_SPIDER)) {
         return false;
         // show no favorites, because they taint every page that is indexed.
     }
     if ($TEXT_DIRECTION == "rtl") {
         $ff = "_rtl";
     } else {
         $ff = "";
     }
     if (PGV_USER_ID || !$REQUIRE_AUTHENTICATION) {
         $menu = new Menu($pgv_lang['favorites'], '#', 'down');
         if (!empty($PGV_IMAGES['gedcom']['large'])) {
             $menu->addIcon($PGV_IMAGE_DIR . '/' . $PGV_IMAGES['gedcom']['large']);
         }
         $menu->addClass("menuitem{$ff}", "menuitem_hover{$ff}", "submenu{$ff}", "icon_large_gedcom");
         //			$menu->print_menu = NULL;
         $userfavs = getUserFavorites(PGV_USER_ID);
         $gedfavs = getUserFavorites($GEDCOM);
         // User favorites
         if ($userfavs || PGV_USER_ID) {
             $submenu = new Menu('<strong>' . $pgv_lang['my_favorites'] . '</strong>');
             $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
             $menu->addSubMenu($submenu);
             while (PGV_USER_ID && isset($controller)) {
                 // Get the right $gid from each supported controller type
                 switch (get_class($controller)) {
                     case 'IndividualController':
                         $gid = $controller->pid;
                         break;
                     case 'FamilyController':
                         $gid = $controller->famid;
                         break;
                     case 'MediaController':
                         $gid = $controller->mid;
                         break;
                     case 'SourceController':
                         $gid = $controller->sid;
                         break;
                     case 'RepositoryController':
                         $gid = $controller->rid;
                         break;
                     default:
                         break 2;
                 }
                 $submenu = new Menu('<em>' . $pgv_lang['add_to_my_favorites'] . '</em>', $SCRIPT_NAME . normalize_query_string($QUERY_STRING . '&amp;action=addfav&amp;gid=' . $gid));
                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                 $menu->addSubMenu($submenu);
                 break;
             }
             foreach ($userfavs as $fav) {
                 $OLD_GEDCOM = $GEDCOM;
                 $GEDCOM = $fav['file'];
                 switch ($fav['type']) {
                     case 'URL':
                         $submenu = new Menu(PrintReady($fav['title']), $fav['url']);
                         $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                         $menu->addSubMenu($submenu);
                         break;
                     case 'INDI':
                     case 'FAM':
                     case 'SOUR':
                     case 'OBJE':
                         if (displayDetailsById($fav['gid'], $fav['type'])) {
                             $obj = GedcomRecord::getInstance($fav['gid']);
                             if ($obj) {
                                 $submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
                                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                                 $menu->addSubMenu($submenu);
                             }
                         }
                         break;
                 }
                 $GEDCOM = $OLD_GEDCOM;
             }
             if ($gedfavs) {
                 $menu->addSeparator();
             }
         }
         // Gedcom favorites
         if ($gedfavs) {
             $submenu = new Menu('<strong>' . $pgv_lang['gedcom_favorites'] . '</strong>');
             $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
             $menu->addSubMenu($submenu);
             foreach ($gedfavs as $fav) {
                 $OLD_GEDCOM = $GEDCOM;
                 $GEDCOM = $fav['file'];
                 switch ($fav['type']) {
                     case 'URL':
                         $submenu = new Menu(PrintReady($fav['title']), $fav['url']);
                         $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                         $menu->addSubMenu($submenu);
                         break;
                     case 'INDI':
                     case 'FAM':
                     case 'SOUR':
                     case 'OBJE':
                         if (displayDetailsById($fav['gid'], $fav['type'])) {
                             $obj = GedcomRecord::getInstance($fav['gid']);
                             if ($obj) {
                                 $submenu = new Menu(PrintReady($obj->getFullName()), encode_url($obj->getLinkUrl()));
                                 $submenu->addClass('favsubmenuitem', 'favsubmenuitem_hover');
                                 $menu->addSubMenu($submenu);
                             }
                         }
                         break;
                 }
                 $GEDCOM = $OLD_GEDCOM;
             }
         }
     }
     return $menu;
 }
Exemplo n.º 4
0
 static function totalUserFavorites()
 {
     return count(getUserFavorites(PGV_USER_ID));
 }
Exemplo n.º 5
0
}
include_once "{$_SERVER['DOCUMENT_ROOT']}/phase5/inc/header.php";
// Body content
?>
<div class="wrap">
	<div class="row">
		<h3 class="page-header" align="center">Your Profile</h3>
	</div>
	<div Class="row">
		<div class="col-md-4">
			<div class="panel panel-primary">
            <div class="panel-heading">
                <h4>Favorites</h4>
            </div>
            <?php 
buildUserFavorites(getUserFavorites());
?>
            </div>
		</div>
	<div class="col-md-4">
		<div class="panel panel-primary">
            <div class="panel-heading">
                <h4>Upcoming Favorites</h4>
            </div>
            <?php 
buildUpcomingFavorites();
?>
        </div>
	</div>
	<div class="col-md-4">
		<div class="panel panel-primary">