Esempio n. 1
0
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * This Page Is Valid XHTML 1.0 Transitional! > 23 August 2005
 *
 * @package PhpGedView
 * @subpackage Charts
 * @version $Id$
 */
require 'config.php';
require_once 'includes/controllers/hourglass_ctrl.php';
/*
 * The purpose of this page is to build the left half of the Hourglass chart via Ajax.
 * This page only produces a husband and wife with the connecting lines to unite and
 * 	label the pair as a pair.
 */
$controller = new HourglassController();
$controller->init();
// -- print html header information
if (isset($_REQUEST['type']) && $_REQUEST['type'] == 'desc') {
    $controller->print_descendency($controller->pid, 1, false);
} else {
    $controller->print_person_pedigree($controller->pid, 0);
}
Esempio n. 2
0
function print_charts_block($block = true, $config = "", $side, $index)
{
    global $PGV_BLOCKS, $pgv_lang, $ctype, $PGV_IMAGE_DIR, $PGV_IMAGES, $PEDIGREE_ROOT_ID, $PEDIGREE_FULL_DETAILS;
    global $show_full, $bwidth, $bheight;
    if (empty($config)) {
        $config = $PGV_BLOCKS["print_charts_block"]["config"];
    }
    if (empty($config['details'])) {
        $config['details'] = 'no';
    }
    if (empty($config["pid"])) {
        if (!PGV_USER_ID) {
            $config["pid"] = $PEDIGREE_ROOT_ID;
        } else {
            if (PGV_USER_GEDCOM_ID) {
                $config["pid"] = PGV_USER_GEDCOM_ID;
            } else {
                $config["pid"] = $PEDIGREE_ROOT_ID;
            }
        }
    }
    // Override GEDCOM configuration temporarily
    if (isset($show_full)) {
        $saveShowFull = $show_full;
    }
    $savePedigreeFullDetails = $PEDIGREE_FULL_DETAILS;
    if ($config["details"] == "no") {
        $show_full = 0;
        // Here we could adjust the block width & height to accommodate larger displays
    } else {
        $show_full = 1;
        // Here we could adjust the block width & height to accommodate larger displays
    }
    $PEDIGREE_FULL_DETAILS = $show_full;
    if ($config['type'] != 'treenav') {
        $controller = new HourglassController();
        $controller->init($config["pid"], 0, 3);
        $controller->setupJavascript();
    } else {
        $nav = new TreeNav($config['pid'], 'blocknav', -1);
        $nav->generations = 2;
    }
    $person = Person::getInstance($config["pid"]);
    if ($person == null) {
        $config["pid"] = $PEDIGREE_ROOT_ID;
        $person = Person::getInstance($PEDIGREE_ROOT_ID);
    }
    $id = "charts_block";
    $title = print_help_link("index_charts_help", "qm", "", false, true);
    if ($PGV_BLOCKS["print_charts_block"]["canconfig"]) {
        if ($ctype == "gedcom" && PGV_USER_GEDCOM_ADMIN || $ctype == "user" && PGV_USER_ID) {
            if ($ctype == "gedcom") {
                $name = PGV_GEDCOM;
            } else {
                $name = PGV_USER_NAME;
            }
            $title .= "<a href=\"javascript: configure block\" onclick=\"window.open('" . encode_url("index_edit.php?name={$name}&ctype={$ctype}&action=configure&side={$side}&index={$index}") . "', '_blank', 'top=50,left=50,width=700,height=400,scrollbars=1,resizable=1'); return false;\">";
            $title .= "<img class=\"adminicon\" src=\"{$PGV_IMAGE_DIR}/" . $PGV_IMAGES["admin"]["small"] . "\" width=\"15\" height=\"15\" border=\"0\" alt=\"" . $pgv_lang["config_block"] . "\" /></a>";
        }
    }
    if ($person) {
        $name = PrintReady($person->getFullName());
        switch ($config['type']) {
            case 'pedigree':
                $title .= $name . " " . $pgv_lang["index_header"];
                break;
            case 'descendants':
                $title .= $name . " " . $pgv_lang["descend_chart"];
                break;
            case 'hourglass':
                $title .= $name . " " . $pgv_lang["hourglass_chart"];
                break;
            case 'treenav':
                $title .= $name . " " . $pgv_lang["tree"];
                break;
        }
        $content = "";
        $content .= "<script src=\"js/phpgedview.js\" language=\"JavaScript\" type=\"text/javascript\"></script>";
        if ($show_full == 0) {
            $content .= '<center><span class="details2">' . $pgv_lang['charts_click_box'] . '</span></center><br />';
        }
        $content .= '<table cellspacing="0" cellpadding="0" border="0"><tr>';
        if ($config['type'] == 'descendants' || $config['type'] == 'hourglass') {
            $content .= "<td valign=\"middle\">";
            ob_start();
            $controller->print_descendency($person->getXref(), 1, false);
            $content .= ob_get_clean();
            $content .= "</td>";
        }
        if ($config['type'] == 'pedigree' || $config['type'] == 'hourglass') {
            //-- print out the root person
            if ($config['type'] != 'hourglass') {
                $content .= "<td valign=\"middle\">";
                ob_start();
                print_pedigree_person($person->getXref());
                $content .= ob_get_clean();
                $content .= "</td>";
            }
            $content .= "<td valign=\"middle\">";
            ob_start();
            $controller->print_person_pedigree($person->getXref(), 1);
            $content .= ob_get_clean();
            $content .= "</td>";
        }
        if ($config['type'] == 'treenav') {
            $content .= "<td>";
            ob_start();
            $nav->drawViewport('blocknav', "", "240px");
            $content .= ob_get_clean();
            $content .= "</td>";
        }
        $content .= "</tr></table>";
        $content .= '<script language="JavaScript" type="text/javascript">
			<!--
			if (sizeLines) sizeLines();
			-->
			</script>';
    } else {
        $content = $pgv_lang['invalid_id'];
    }
    global $THEME_DIR;
    require $THEME_DIR . 'templates/block_small_temp.php';
    // Restore GEDCOM configuration
    unset($show_full);
    if (isset($saveShowFull)) {
        $show_full = $saveShowFull;
    }
    $PEDIGREE_FULL_DETAILS = $savePedigreeFullDetails;
}