<?php
namespace zin;

$targetHeader = array(
    array('title' => $lang->montecarlo->target, 'width' => '48'),
    array('title' => $lang->montecarlo->statistic, 'width' => '48')
);

$targetForm = $config->montecarlo->targetForm->form;

$targetForm['target']['width']  = $targetHeader[0]['width'];
$targetForm['target']['prefix'] = 'index';
$targetForm['target']['items']  = $lang->montecarlo->targetList;

$targetForm['targetYname']['hidden'] = true;

$targetForm['statistic']['width'] = $targetHeader[1]['width'];
$targetForm['statistic']['items'] = $lang->montecarlo->statisticList;

$targetRow = array($targetForm['target'], $targetForm['targetYname'], $targetForm['statistic']);

$fnGenerateTarget = function($data) use ($lang, $targetHeader, $targetRow, $fnGenerateFormHeader, $fnGenerateFormRow)
{
    $rows = array();
    foreach($data as $value) $rows[] = $fnGenerateFormRow('target', $value['targetYname'], $targetRow, $value, false);

    return array
    (
        $fnGenerateFormHeader($targetHeader),
        $rows,
        divider()
    );
};
