'; $html .= ' QCM
'; if ($data->qcm) { foreach ($data->qcm as $qcm) { if ($qcm->name == 'bpa') { foreach ($qcm->categories as $category) { $html .= '
'; if ($wrong) { $html .= '

'.$category->num.' '.$category->name.'

'; } $found = false; foreach ($category->questions as $question) { if (!$search) { $show = true; } else { $show = false; $pattern = '/'.$search.'/i'; if (stripos($question->libelle, $search) !== false) { $show = true; } } if ($show) { $html .= '
'.$question->num.' - '.$question->libelle.'
'; $html .= '

'; foreach ($question->answers as $answer) { if ($answer->correct) { $html .= ''.$answer->libelle.''; } else if ($wrong) { $html .= ''.$answer->libelle.''; } if ($wrong) { $html .= '
'; } } $html .= '

'; } if ($search && $show) { //break; } } $html .= '
'; } } } } else { $html .= '

0 qcm

'; } $html .= ' '; $html .= ''; echo $html; ?>