Cześć,
postaram się jak najlepiej opisać co chcę osiągnąć.
Poniżej jak to jest teraz:
//Rekomendacja
private function getRecomendationWOL($documentData) {
$policies = $documentData['policies']['WOL'];
$count = count($policies); for($n=0; $n<$count; $n++){
//--- START grupa 1 ---
$recomend[] = array('Podstawowe informacje ('.$policies[$n]['lifeInsured'].') ... '.$policies[$n]['company'].': '); $recomend[] = array('Podstawowe cd. '.$documentData['primary']['firstName'].' to ?'.$policies[$n]['primary']['lifeCover'].'. '.$policies[$n]['DOC']['lifedis'].''); $recomend[] = array('Podstawowe cd. '.$policies[$n]['DOC']['lifechanges']); //--- START grupa 2 ---
$recomend[] = array('Informacje GRUPA 2.'); $recomend[] = array('Informacje GRUPA 2 cd. .'); //--- START grupa 3 ---
$recomend[] = array('Dodatkowo informacje GRUPA 3'); foreach ($policies[$n]['DOC']['companydis'] as $value) {
$recomend[] = array($value); }
}
}
return $recomend;
}
A potem wywołuję to tak i w ten sposób tworze formularz html:
public function __construct(DocumentData $documentData = null) {
if (!$documentData) {
$documentData = new DocumentData();
}
$documentData = $documentData->getData();
//throw new Exception('<pre>'.print_r($documentData['policies'],1). '</pre>');
'name' => 'Opis',
'type' => 'textMulti',
'label' => 'Wprowadzenie',
'optional' => true, // false -> bez checkbox
'partitions' => $this->getRecomendationWOL($documentData)
),
),
),
);
No i jest ok i to działa.
Teraz wywołując $this->getRecomendationWOL otrzymuję
(
(
[0] => Podstawowe informacje (dane osoby) ... (dane firmy):
[1] => Podstawowe cd.
[2] => Podstawowe cd.
[3] => Informacje GRUPA 2.
[4] => Informacje GRUPA 2 cd.
[5] => Dodatkowo informacje GRUPA 3
[6] => Dodatkowo informacje GRUPA 3 cd.
A to co chciałbym uzyskać to możliwość wywołania osobno danych dla Grupy 1 / Grupy 2 / Grupy 3
'common1 => array (
'name' => 'Opis1',
'elements'=> array (
'multiText' => array(
'type' => 'textMulti',
'label' => 'GROUPA 1',
'optional' => true, // false -> bez checkbox
'partitions' => $this->getRecomendationWOL1($documentData)
),
'multiText1' => array(
'type' => 'textMulti',
'label' => 'GRUPA 2',
'optional' => true, // false -> bez checkbox
'partitions' => $this->RecomendationWOL2($documentData)
),
'multiText2' => array(
'type' => 'textMulti',
'label' => 'GRUPA 3',
'optional' => true, // false -> bez checkbox
'partitions' => $this->RecomendationWOL3($documentData)
),
),
),
);
Dziękuję za informacje jak to osiągnąć i za wyrozumiałość.
Domyślam się że muszę zmodyfikować:
return $recomend;
na coś w stylu:
public function getValues() {
return array (
'group1' => $this->recomend[1][],
'group2' => $this->recomend[2][],
'group3' => $this->recomend[3][]
);
}
No ale nie potrafię sobie sam z tym poradzić...
Dziękuję jak zawsze za wyrozumiałość.
Temat do zamknięciawystarczyło dane w tablicy zapisać jako
$recomend[group1
][] = array('Podstawowe informacje ('.$policies[$n]['lifeInsured'].') ... '.$policies[$n]['company'].': '); ...
$recomend[group2
][] = array('Informacje GRUPA 2.');
a potem wywołać funkcje poprzez
$this->getRecomendationWOL($documentData)[group1]
...
$this->getRecomendationWOL($documentData)[group2]
Ten post edytował pela222 26.03.2021, 13:42:49