예제 #1
0
/**
 * data_array function.
 * 
 * @access public
 * @param mixed $string
 * @param mixed $array
 * @param mixed array &$result. (default: null)
 * @return array
 */
function data_array($string, $array, array &$result = null)
{
    if (is_null($result)) {
        $result = array();
    }
    foreach ($array as $key => $value) {
        if ($key != 'summary') {
            if ($key == $string && !is_object($value)) {
                $result[] = (double) $value;
            } else {
                if (is_object($value)) {
                    data_array($string, $value, $result);
                }
            }
        }
    }
    return $result;
}
예제 #2
0
 function place_cells($type, $begin, $end, $increment, $maxchar, $numrows, $cellwidth)
 {
     global $dbh, $db_functions, $tree_prefix_quoted, $pdf, $data_array, $posy, $posx, $marr_date_array, $marr_place_array, $sexe, $gedcomnumber;
     $pdf->SetLeftMargin(16);
     $marg = 16;
     for ($m = $begin; $m <= $end; $m += $increment) {
         if ($type == "pers") {
             // person's name & details
             data_array($m, $maxchar, $numrows);
             $pdf->SetFont('Arial', 'B', 8);
             if ($m % 2 == 0 or $m == 1 and $sexe[$m] == "M") {
                 // male
                 $pdf->SetFillColor(191, 239, 255);
             } else {
                 // female
                 $pdf->SetFillColor(255, 228, 225);
             }
             $pdf->MultiCell($cellwidth, 4, $data_array[$m][0], "LTR", "C", true);
             $marg += $cellwidth;
             $pdf->SetFont('Arial', '', 8);
             $nstring = '';
             $used = $data_array[$m][3] + $data_array[$m][4] + $data_array[$m][5];
         } else {
             // marr date & place
             $space = '';
             if ($marr_date_array[$m] != '') {
                 $space = ' ';
             }
             if ($gedcomnumber[$m] != '') {
                 @($personDb = $db_functions->get_person($gedcomnumber[$m]));
                 $person_cls = new person_cls();
                 $person_cls->construct($personDb);
                 $pers_privacy = $person_cls->privacy;
             } else {
                 $pers_privacy = false;
             }
             if ($gedcomnumber[$m + 1] != '') {
                 @($womanDb = $db_functions->get_person($gedcomnumber[$m + 1]));
                 $woman_cls = new person_cls();
                 $woman_cls->construct($womanDb);
                 $woman_privacy = $person_cls->privacy;
             } else {
                 $woman_privacy = false;
             }
             if ($pers_privacy or $woman_privacy) {
                 $marr = __('PRIVACY FILTER');
             } else {
                 $marr = __('X') . ' ' . $marr_date_array[$m] . $space . $marr_place_array[$m];
             }
             $result = parse_line($marr, $maxchar, $numrows);
             $marg += $cellwidth;
             $nstring = '';
             $used = $result[0];
         }
         for ($x = 1; $x <= $numrows - $used; $x++) {
             $nstring .= "\n" . " ";
         }
         if ($type == "pers") {
             $breakln = '';
             if ($data_array[$m][1] != '' and $data_array[$m][2] != '') {
                 $breakln = "\n";
             }
             if ($data_array[$m][4] == 0 and $data_array[$m][5] == 0) {
                 $nstring = substr($nstring, 0, strlen($nstring) - 1);
             }
             $pdf->SetFont('Arial', '', 8);
             $pdf->MultiCell($cellwidth, 4, $data_array[$m][1] . $breakln . $data_array[$m][2] . $nstring, "LRB", "C", true);
         } else {
             $pdf->SetFont('Arial', 'I', 8);
             $pdf->MultiCell($cellwidth, 4, $result[1] . $nstring, "LR", "C", false);
         }
         if ($m < $end) {
             $pdf->SetLeftMargin($marg);
             $pdf->SetY($posy);
         }
     }
     $pdf->SetX($posx);
     $posy = $pdf->GetY();
 }