Ejemplo n.º 1
0
function set_params($current, $indfam, $xg, $zg, $titstr, $xt, $yt, $gx, $gz, $myfunc)
{
    global $x_as, $y_as, $z_as, $n1, $months;
    global $legend, $xdata, $ydata, $xmax, $zmax, $zgrenzen, $xgiven, $zgiven, $percentage, $male_female;
    global $stats;
    if (!function_exists($myfunc)) {
        echo WT_I18N::translate('%s not implemented', $myfunc);
        exit;
    }
    $monthdata = array();
    for ($i = 0; $i < 12; ++$i) {
        $monthdata[$i] = WT_Date_Gregorian::monthNameNominativeCase($i + 1, false);
    }
    $months = array('JAN', 'FEB', 'MAR', 'APR', 'MAY', 'JUN', 'JUL', 'AUG', 'SEP', 'OCT', 'NOV', 'DEC');
    if ($x_as == $current) {
        if (($x_as == 13 || $x_as == 15) && $z_as == 301) {
            $z_as = 300;
        }
        $xgiven = $xg;
        $zgiven = $zg;
        $title = $titstr;
        $xtitle = $xt;
        $ytitle = WT_I18N::translate('numbers');
        $grenzen_xas = $gx;
        $grenzen_zas = $gz;
        if ($xg == true) {
            $xdata = $monthdata;
            $xmax = 12;
        } else {
            calc_axis($grenzen_xas);
        }
        if ($z_as != 300 && $z_as != 301) {
            calc_legend($grenzen_zas);
        }
        $percentage = false;
        if ($y_as == 201) {
            $percentage = false;
            if ($current == 13 || $current == 15 || $current == 16 || $current == 21) {
                $ytitle = WT_I18N::translate('Families');
            } else {
                if ($current == 14) {
                    $ytitle = WT_I18N::translate('Children');
                } else {
                    $ytitle = WT_I18N::translate('Individuals');
                }
            }
        } else {
            if ($y_as == 202) {
                $percentage = true;
                $ytitle = WT_I18N::translate('percentage');
            }
        }
        $male_female = false;
        if ($z_as == 300) {
            $zgiven = false;
            $legend[0] = 'all';
            $zmax = 1;
            $zgrenzen[0] = 100000;
        } else {
            if ($z_as == 301) {
                $male_female = true;
                $zgiven = true;
                $legend[0] = WT_I18N::translate('Male');
                $legend[1] = WT_I18N::translate('Female');
                $zmax = 2;
                $xtitle = $xtitle . WT_I18N::translate(' per gender');
            } else {
                if ($z_as == 302) {
                    $xtitle = $xtitle . WT_I18N::translate(' per time period');
                }
            }
        }
        //-- reset the data array
        for ($i = 0; $i < $zmax; $i++) {
            for ($j = 0; $j < $xmax; $j++) {
                $ydata[$i][$j] = 0;
            }
        }
        $myfunc();
        if ($indfam == 'IND') {
            $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalIndividuals();
        } else {
            if ($x_as == 21) {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalChildren();
            } else {
                $hstr = $title . '|' . WT_I18N::translate('Counts ') . ' ' . WT_I18N::number($n1) . ' ' . WT_I18N::translate('of') . ' ' . $stats->totalFamilies();
            }
        }
        myplot($hstr, $zmax, $xdata, $xtitle, $ydata, $ytitle, $legend);
    }
}