0 votes
in SoSci Survey (dt.) by s265976 (130 points)
closed by SoSci Survey

Hier der Code :

$stimuli = [
    1 => [1,2,3,4],
    2 => [5,6,7,8],
    3 => [9,10,11,12],
    4 => [13,14,15,16],
    5 => [17,18,19,20]
];

foreach (array_keys($stimuli) as $bereich) {
    shuffle($stimuli[$bereich]);
}
debug($stimuli);

$block1 = [];
// Erstmal Block 1a
foreach (array_keys($stimuli) as $bereich) {
  // Die Liste $block wird jedesmal um ein Element ergänzt
  $block1[] = [
    $stimuli[$bereich][0],  // Die erste Spalte aus dem gemischten Array von oben
    1  // Code für das gain-Frame
  ];
}
// Und dann Block 1b
foreach (array_keys($stimuli) as $bereich) {
  // Die Liste $block wird jedesmal um ein Element ergänzt
  $block1[] = [
    $stimuli[$bereich][1],  // Die zweite Spalte aus dem gemischten Array von oben
    2  // Code für das loss-Frame
  ];
}
// Das Ergebnis können wir uns schonmal ansehen
debug($block1);

$outcomes = [1,1,1,1,1,2,2,2,2,2];
shuffle($outcomes);
foreach (array_keys($block1) as $i) {
    $block1[$i][2] = $outcomes[$i];
}

foreach (array_keys($block1) as $i) {
    $block1[$i][3] = 1;
}

shuffle($block1);
debug($block1);

$stimuli2 = [
    1 => [1,2,3,4],
    2 => [5,6,7,8],
    3 => [9,10,11,12],
    4 => [13,14,15,16],
    5 => [17,18,19,20]
];

foreach (array_keys($stimuli2) as $bereich2) {
    shuffle($stimuli2[$bereich2]);
}
debug($stimuli2);

$block2 = [];
// Erstmal Block 2a
foreach (array_keys($stimuli2) as $bereich2) {
  // Die Liste $block wird jedesmal um ein Element ergänzt
  $block2[] = [
    $stimuli2[$bereich2][0],  // Die erste Spalte aus dem gemischten Array von oben
    1  // Code für das gain-Frame
  ];
}
// Und dann Block 2b
foreach (array_keys($stimuli2) as $bereich2) {
  // Die Liste $block wird jedesmal um ein Element ergänzt
  $block2[] = [
    $stimuli2[$bereich2][1],  // Die zweite Spalte aus dem gemischten Array von oben
    2  // Code für das loss-Frame
  ];
}
// Das Ergebnis können wir uns schonmal ansehen
debug($block2);

$outcomes2 = [1,1,1,1,1,2,2,2,2,2];
shuffle($outcomes2);
foreach (array_keys($block2) as $i) {
    $block2[$i][2] = $outcomes2[$i];
}

foreach (array_keys($block2) as $i) {
    $block2[$i][3] = 1;
}

shuffle($block2);
debug($block2);

$blockGesamt = array_merge(
    $block1,
    $block2
);

$text =  [
  1 => 'FI01_01',
  2 => 'FI03_01',
  3 => 'FI05_01',
  4 => 'FI07_01',
  5 => 'GE01_01', 
  6 => 'GE07_01',
  7 => 'GE13_01',
  8 => 'GE19_01',
  9 => 'KO01_01',
  10 => 'KO07_01',
  11 => 'KO13_01',
  12 => 'KO19_01',
  13 => 'SB01_01',
  14 => 'SB07_01',
  15 => 'SB13_01',
  16 => 'SB19_01',
  17 => 'WO01_01',
  18 => 'WO07_01',
  19 => 'WO13_01',
  20 => 'WO20_01',

];

$text2 =  [
  1 => 'FI02_01',
  2 => 'FI04_01',
  3 => 'FI06_01',
  4 => 'FI08_01',
  5 => 'GE02_01', 
  6 => 'GE08_01',
  7 => 'GE14_01',
  8 => 'GE20_01',
  9 => 'KO02_01',
  10 => 'K08_01',
  11 => 'K14_01',
  12 => 'KO20_01',
  13 => 'SB02_01',
  14 => 'SB08_01',
  15 => 'SB14_01',
  16 => 'SB20_01',
  17 => 'WO02_01',
  18 => 'WO08_01',
  19 => 'WO14_01',
  20 => 'WO19_01',

];

$i = loopToPage('second', count($blockGesamt));
$line = $blockGesamt[$i];

$situation1 = $link[0];
$textID = $text[$situation1];
text($textID);

$situation2 = $link[0];
$textID = $text[$situation2];
text($textID);

if ($line[3] == 1) {
  goToPage('next');
}
closed with the note: Es liegen keine weiteren Informationen zu dem Problem vor, welche für eine hilfreiche Antwort erforderlich wären.
by SoSci Survey (308k points)
Das $link müssten Sie - wie gesagt - noch gegen $line austauschen. Und dann posten sie bitte, welche Fehlermeldungen ggf. noch auftauchen, und was die Debug-Information anzeigt.

Willkommen im Online-Support von SoSci Survey.

Hier bekommen Sie schnelle und fundierte Antworten von anderen Projektleitern und direkt von SoSci Survey.

→ Eine Frage stellen


Welcome to the SoSci Survey online support.

Simply ask a question to quickly get answers from other professionals, and directly from SoSci Survey.

→ Ask a Question

...