<?php
  function afficherFormP()
  {
    global $connexion;
	  global $lang;
    global $txt;

    $html = '';

    $html .= '<ol class="breadcrumb">';
			$html .= '<li><a href="index.php">Menu</a></li>';
      $html .= '<li class="active">' . $txt['elementaryForm'] . '</li>';
		$html .= '</ol>';

    if (isset($_GET['saved']))
    {
      $html .= '<div class="alert alert-success alert-dismissable" role="alert">';
        $html .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
        $html .= '<span class="glyphicon glyphicon-check"></span>' . $txt['formSavedMsg'];
      $html .= '</div>';
    }

    $html .= '<div class="alert alert-info alert-dismissible" role="alert">';
      $html .= '<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>';
      $html .= '<span class="glyphicon glyphicon-info-sign"></span>' . $txt['dontForgetToSaveMsg'];
    $html .= '</div>';

    $nbPoints = calculerTotalPoints($_SESSION['usagerEcoleIsoActif']->u_id,'P');

    if ($nbPoints == '')
      $nbPoints = 0;
    else
      $percentage = ($nbPoints*100/50);

    $html .= '<h3 class="bottom-buffer-20">' . $txt['score'] . ' : ' . $nbPoints . '/50</h3>';

    if ($nbPoints > 0)
      $html .= '<h4 class="bottom-buffer-20">Certification : ' . afficherCertificationPrimaire($percentage) . '</h4>';

    $html .= '<form name="frmEvalP" id="frmEvalP" action="php/insert-results-p.php" method="post">';

      $html .= '<div class="panel-group" id="liste-criteres" role="tablist" aria-multiselectable="true">';

      $html .= '
      <div class="well well-panel-group">
        <h4><strong>' . $txt['sportAndPhysicalTitle'] . '</strong></h4>
        <p style="font-size:14px;">' . $txt['sportAndPhysicalDesc'] . '</p>
      </div>';

      $requete = 'SELECT * FROM isoactif_form_p WHERE fp_u_id_fk = ' . escapeValue($_SESSION['usagerEcoleIsoActif']->u_id);
      if (!$resultat = $connexion->query($requete)) { die('There was an error running the query : Fetch form P data'); }
      $nbResults = $resultat->num_rows;
      if ($nbResults == 1)
        $ligne = $resultat->fetch_assoc();

      $resultat->free();

      ### 1 ########################################
      $html .= '
        <div class="panel panel-primary">
          <div class="panel-heading" role="tab" id="panelQ1">
            <h4 class="panel-title">
              <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere1" aria-expanded="false" aria-controls="critere1">
                1. ' . $txt['fpB1'] . ' [+]
              </a>
            </h4>
          </div>
          <div id="critere1" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ1">
            <div class="panel-body">
              <div class="col-md-5">';

      $html .= '<h4 class="bleu-rseq">' . $txt['score'] . '</h4>';
      $html .= '<div class="form-group margin-top-0">';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q1" value="1" required';

            if ($nbResults == 1 && $ligne['fp_q1'] == 1)
              $html .= ' checked';

            $html .= '>';
            $html .= '1 point : ' . $txt['fpB1Q1-a1'];
          $html .= '</label>';
        $html .= '</div>';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q1" value="2" required';

            if ($nbResults == 1 && $ligne['fp_q1'] == 2)
              $html .= ' checked';

            $html .= '>';
            $html .= '2 points : ' . $txt['fpB1Q1-a2'];
          $html .= '</label>';
        $html .= '</div>';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q1" value="3" required';

            if ($nbResults == 1 && $ligne['fp_q1'] == 3)
              $html .= ' checked';

            $html .= '>';
            $html .= '3 points : ' . $txt['fpB1Q1-a3'];
          $html .= '</label>';
        $html .= '</div>';
      $html .= '</div>';

        $html .= '
              </div>
              <div class="col-md-7">
                <h4>' . $txt['explicatif'] . '</h4>
                ' . $txt['fpB1Q1-Explicatif'] . '
                <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                ' . $txt['fpB1-ElemConst'] . '
                <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . '</strong></h5>
                ' . $txt['fpB1-Exemple'] . '
              </div>
            </div>
          </div>
        </div>';





        ### 2 ########################################
        $html .= '
          <div class="panel panel-primary">
            <div class="panel-heading" role="tab" id="panelQ2">
              <h4 class="panel-title">
                <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere2" aria-expanded="false" aria-controls="critere2">
                  2. ' . $txt['fpB2'] . ' [+]
                </a>
              </h4>
            </div>
            <div id="critere2" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ2">
              <div class="panel-body">
                <div class="col-md-5">';

        $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';

        $html .= '<p><strong>2.1</strong> &mdash; ' . $txt['fpB2Q21'] . '</p>';
        $html .= '<div class="form-group margin-top-0">';
          $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2_1" value="1" required';

              if ($nbResults == 1 && $ligne['fp_q2_1'] == 1)
                $html .= ' checked';

              $html .= '>';
              $html .= '1 point : ' . $txt['fpB2Q21-a1'];
            $html .= '</label>';
          $html .= '</div>';
          $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2_1" value="3" required';

              if ($nbResults == 1 && $ligne['fp_q2_1'] == 3)
                $html .= ' checked';

              $html .= '>';
              $html .= '3 points : ' . $txt['fpB2Q21-a3'];
            $html .= '</label>';
          $html .= '</div>';
        $html .= '</div>';

        $html .= '<p><strong>2.2</strong> &mdash; ' . $txt['fpB2Q22'] . '</p>';
        $html .= '<div class="form-group margin-top-0">';
        $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2_2" value="0" required';

              if ($nbResults == 1 && !is_null($ligne['fp_q2_2']) && $ligne['fp_q2_2'] == 0)
                $html .= ' checked';

              $html .= '>';
              $html .= '0 point : ' . $txt['fpB2Q22-a0'];
            $html .= '</label>';
          $html .= '</div>';
          $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2_2" value="1" required';

              if ($nbResults == 1 && $ligne['fp_q2_2'] == 1)
                $html .= ' checked';

              $html .= '>';
              $html .= '1 point : ' . $txt['fpB2Q22-a1'];
            $html .= '</label>';
          $html .= '</div>';
          $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2_2" value="2" required';

              if ($nbResults == 1 && $ligne['fp_q2_2'] == 2)
                $html .= ' checked';

              $html .= '>';
              $html .= '2 points : ' . $txt['fpB2Q22-a2'];
            $html .= '</label>';
          $html .= '</div>';
          $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2_2" value="4" required';

              if ($nbResults == 1 && $ligne['fp_q2_2'] == 4)
                $html .= ' checked';

              $html .= '>';
              $html .= '4 points : ' . $txt['fpB2Q22-a4'];
            $html .= '</label>';
          $html .= '</div>';
        $html .= '</div>';

          $html .= '
                </div>
                <div class="col-md-7">
                  <h4>' . $txt['explicatif'] . '</h4>
                  ' . $txt['fpB2-Explicatif'] . '
                  <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                  ' . $txt['fpB2-ElemConst'] . '
                  <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                  ' . $txt['fpB2-Exemple'] . '
                </div>
              </div>
            </div>
          </div>';



          ### 3 ########################################
          $html .= '
            <div class="panel panel-primary">
              <div class="panel-heading" role="tab" id="panelQ3">
                <h4 class="panel-title">
                  <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere3" aria-expanded="false" aria-controls="critere3">
                    3. ' . $txt['fpB3'] . ' [+]
                  </a>
                </h4>
              </div>
              <div id="critere3" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ3">
                <div class="panel-body">
                  <div class="col-md-5">';

          $schoolInfo = getSchoolInfo($_SESSION['usagerEcoleIsoActif']->u_id_ecole);
          $requeteDisciplinesParIr = 'SELECT * FROM isoactif_disciplines
                                      JOIN isoactif_discipline_ir ON di_d_id_fk = d_id
                                      WHERE di_ir_id_fk = ' . $schoolInfo['a_id_fk'] . '
                                      AND di_actif = 1
                                      ORDER BY d_nom ASC';

          $resultatDisciplinesParIr = $connexion->query($requeteDisciplinesParIr);
          $nbDiscPourIr = $resultatDisciplinesParIr->num_rows;

          $html .= '<h4 class="bleu-rseq">' . $txt['score'] . '</h4>';

          // Si au moins une discipline offerte par l'IR
          if ($nbDiscPourIr > 0)
          {
            $html .= '<p><strong>3.1</strong> &mdash; ' . $txt['fpB3Q31'] . '</p>';
            $html .= '<div class="form-group margin-top-0">';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_1" id="q3_1_0pts" value="0" required';

                  if ($nbResults == 1 && !is_null($ligne['fp_q3_1']) && $ligne['fp_q3_1'] == 0)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '0 point : ' . $txt['fpB3Q31-a0'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_1" value="2" required';

                  if ($nbResults == 1 && $ligne['fp_q3_1'] == 2)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '2 points : ' . $txt['fpB3Q31-a2'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_1" value="3" required';

                  if ($nbResults == 1 && $ligne['fp_q3_1'] == 3)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '3 points : ' . $txt['fpB3Q31-a3'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_1" value="5" required';

                  if ($nbResults == 1 && $ligne['fp_q3_1'] == 5)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '5 points : ' . $txt['fpB3Q31-a5'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';
          }
          else // Si aucune discipline offerte par l'IR
          {
            $html .= '<p><strong>3.1</strong> &mdash; ' . $txt['fpB3Q31'] . '</p>';
            $html .= '<input type="hidden" name="q3_1" value="0">';
            $html .= '<p><strong><span class="text-danger">' . $txt['fpB3Q32noDisc'] . '</p>';
          }


          if ($nbDiscPourIr > 0)
          {
            $html .= '<div class="form-group">';

              $html .= $txt['fpB3Q31checkDisc'];

              if ($nbResults == 1 && !empty($ligne['fp_q3_liste_disciplines']))
                $q3_1_liste_disciplines = unserialize($ligne['fp_q3_liste_disciplines']);
              else {
                $q3_1_liste_disciplines = array();
              }

              while ($ligneDisciplinesParIr = $resultatDisciplinesParIr->fetch_assoc())
              {
                $html .= '
                <div class="checkbox">
                  <label>
                    <input type="checkbox" name="q3_1_di[]" value="' . $ligneDisciplinesParIr['d_id'] . '"';

                    if ($nbResults == 1 && in_array($ligneDisciplinesParIr['d_id'], $q3_1_liste_disciplines))
                      $html .= ' checked';

                    $html .= '> ';

					if ($lang == 'en')
						$html .= $ligneDisciplinesParIr['d_nom_en'];
					else
						$html .= $ligneDisciplinesParIr['d_nom'];

                  $html .= '
				  </label>
                </div>';
              }

            $html .= '</div>';
          }
          else {
            // $html .= '<p class="top-buffer-20">Désolé, aucune discipline n’est offerte par votre instance régionale.</p>';
          }

          $html .= '<hr></hr>';

          // Si au moins une discipline offerte par l'IR
          if ($nbDiscPourIr > 0)
          {
            $html .= '<p><strong>3.2</strong> &mdash; ' . $txt['fpB3Q32'] . '</p>';
            $html .= '<div class="form-group margin-top-0">';
            $html .= '<div class="radio hidden">';
              $html .= '<label>';
                $html .= '<input type="radio" name="q3_2" value="0" required';

                if ($nbResults == 1 && $ligne['fp_q3_2'] == 0)
                  $html .= ' checked';

                if ($nbResults == 1 && !is_null($ligne['fp_q3_1']) && $ligne['fp_q3_1'] == 0)
                  $html .= ' disabled';

                $html .= '>';
                $html .= '0 point : ' . $txt['fpB3Q32-a0'];
              $html .= '</label>';
            $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_2" value="2" required';

                  if ($nbResults == 1 && $ligne['fp_q3_2'] == 2)
                    $html .= ' checked';

                  if ($nbResults == 1 && !is_null($ligne['fp_q3_1']) && $ligne['fp_q3_1'] == 0)
                    $html .= ' disabled';

                  $html .= '>';
                  $html .= '2 points : ' . $txt['fpB3Q32-a2'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_2" value="3" required';

                  if ($nbResults == 1 && $ligne['fp_q3_2'] == 3)
                    $html .= ' checked';

                  if ($nbResults == 1 && !is_null($ligne['fp_q3_1']) && $ligne['fp_q3_1'] == 0)
                    $html .= ' disabled';

                  $html .= '>';
                  $html .= '3 points : ' . $txt['fpB3Q32-a3'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_2" value="5" required';

                  if ($nbResults == 1 && $ligne['fp_q3_2'] == 5)
                    $html .= ' checked';

                  if ($nbResults == 1 && !is_null($ligne['fp_q3_1']) && $ligne['fp_q3_1'] == 0)
                    $html .= ' disabled';

                  $html .= '>';
                  $html .= '5 points : ' . $txt['fpB3Q32-a5'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';
          }
          else // Si aucune discipline offerte par l'IR
          {
            $html .= '<p><strong>3.2</strong> &mdash; ' . $txt['fpB3Q32'] . '</p>';
            $html .= '<input type="hidden" name="q3_2" value="0">';
            $html .= $txt['fpB3Q32noDisc'];
          }

            $html .= '
                  </div>
                  <div class="col-md-7">';

                  if ($nbDiscPourIr <= 0)
                    $html .= '<h4>' . $txt['fpB3Q32noDisc'] . '</h4>';

                  $html .= '
                    <h5><strong>' . $txt['explicatif'] . '</strong></h5>' . $txt['fpB3-Explicatif'] . '
                    <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                    ' . $txt['fpB3-ElemConst'] . '
                    <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                    ' . $txt['fpB3-Exemple'] . '
                    <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['outils'] . '</strong></h5>
                    ' . $txt['fpB3-outils'] . '
                  </div>
                </div>
              </div>
            </div>';
            



            ### 4 ########################################
            $html .= '
              <div class="panel panel-primary">
                <div class="panel-heading" role="tab" id="panelQ4">
                  <h4 class="panel-title">
                    <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere4" aria-expanded="false" aria-controls="critere4">
                      4. ' . $txt['fpB4'] . ' [+]
                    </a>
                  </h4>
                </div>
                <div id="critere4" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ4">
                  <div class="panel-body">
                    <div class="col-md-5">';

            $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';

            $html .= '<p>' . $txt['fpB4-pointage'] . '</p>';
            // $html .= '
            // <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
            // ' . $txt['fpB4-exemple'];
            $html .= '<div class="form-group margin-top-0">';
            $html .= '<div class="radio">';
              $html .= '<label>';
                $html .= '<input type="radio" name="q4" value="0" required';

                if ($nbResults == 1 && !is_null($ligne['fp_q4']) && $ligne['fp_q4'] == 0)
                  $html .= ' checked';

                $html .= '>';
                $html .= '0 point : ' . $txt['fpB4Q4-a0'];
              $html .= '</label>';
            $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q4" value="2" required';

                  if ($nbResults == 1 && $ligne['fp_q4'] == 2)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '2 points : ' . $txt['fpB4Q4-a2'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q4" value="4" required';

                  if ($nbResults == 1 && $ligne['fp_q4'] == 4)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '4 points : ' . $txt['fpB4Q4-a4'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';

            $html .= $txt['fpB4Q4-discs'];
            $html .= '<textarea class="form-control" name="q4_liste_disciplines" rows="4">';

              if ($nbResults == 1 && $ligne['fp_q4_liste_disciplines'] != 'NULL')
                $html .= $ligne['fp_q4_liste_disciplines'];

            $html .= '</textarea>';

              $html .= '
                    </div>
                    <div class="col-md-7">
                      <h4>' . $txt['explicatif'] . '</h4>
                      ' . $txt['fpB4-Explicatif'] . '
                      
                      <h5 class="top-buffer-20"><strong>' . $txt['exemple'] . '</strong></h5>
                      ' . $txt['fpB4-exemple'] . '
                    </div>
                  </div>
                </div>
              </div>';


              ### 5 ########################################
              $html .= '
                <div class="panel panel-primary">
                  <div class="panel-heading" role="tab" id="panelQ5">
                    <h4 class="panel-title">
                      <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere5" aria-expanded="false" aria-controls="critere5">
                        5. ' . $txt['fpB5'] . ' [+]
                      </a>
                    </h4>
                  </div>
                  <div id="critere5" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ5">
                    <div class="panel-body">
                      <div class="col-md-5">';

              $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';

              $html .= '<div class="form-group margin-top-0">';
                $html .= '<div class="radio">';
                  $html .= '<label>';
                    $html .= '<input type="radio" name="q5" value="0" required';

                    if ($nbResults == 1 && !is_null($ligne['fp_q5']) && $ligne['fp_q5'] == 0)
                      $html .= ' checked';

                    $html .= '>';
                    $html .= '0 point : ' . $txt['fpB5Q5-a0'];
                  $html .= '</label>';
                $html .= '</div>';
                $html .= '<div class="radio">';
                  $html .= '<label>';
                    $html .= '<input type="radio" name="q5" value="2" required';

                    if ($nbResults == 1 && $ligne['fp_q5'] == 2)
                      $html .= ' checked';

                    $html .= '>';
                    $html .= '2 points : ' . $txt['fpB5Q5-a2'];
                  $html .= '</label>';
                $html .= '</div>';
                $html .= '<div class="radio">';
                  $html .= '<label>';
                    $html .= '<input type="radio" name="q5" value="4" required';

                    if ($nbResults == 1 && $ligne['fp_q5'] == 4)
                      $html .= ' checked';

                    $html .= '>';
                    $html .= '4 points : ' . $txt['fpB5Q5-a4'];
                  $html .= '</label>';
                $html .= '</div>';
              $html .= '</div>';

              $html .= '<div class="form-group">';

                $html .= $txt['fpB5Q5-discs'];

                $requeteActivites = 'SELECT * FROM isoactif_activites ORDER BY a_nom ASC';
                $resultatActivites = $connexion->query($requeteActivites);

                if ($nbResults == 1)
                  $q5_activites = unserialize($ligne['fp_q5_activites']);

                while ($ligneActivites = $resultatActivites->fetch_assoc())
                {
                  $html .= '
                  <div class="checkbox">
                    <label>
                      <input type="checkbox" name="q5_activites[]" value="' . $ligneActivites['a_id'] . '"';

                      if ($nbResults == 1 && in_array($ligneActivites['a_id'], $q5_activites))
                        $html .= ' checked';

                      $html .= '> ' . $ligneActivites['a_nom'] . ';
                    </label>
                  </div>';
                }

                // Activité autre
                $html .= '<div class="form-group">';
                  $html .= '<label for="fonction" style="font-weight:normal;">' . $txt['other'] . ' *</label>';
                  $html .= '<input class="form-control" type="text" name="q5_activites[autre]" style="max-width:400px;"';

                    if ($nbResults == 1)
                      $html .= ' value="' . $q5_activites['autre'] . '"';

                  $html .= '>';
                $html .= '</div>';

                $html .= '<small>* ' . $txt['fpB5-mustBe'] . '</small>';

              $html .= '</div>';

                $html .= '
                      </div>
                      <div class="col-md-7">
                        <h4>' . $txt['explicatif'] . '</h4>
                        ' . $txt['fpB5-Explicatif'] . '
                        <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                        ' . $txt['fpB5-ElemConst'] . '
                      </div>
                    </div>
                  </div>
                </div>';


                ### 6 ########################################
                $html .= '
                  <div class="panel panel-primary">
                    <div class="panel-heading" role="tab" id="panelQ6">
                      <h4 class="panel-title">
                        <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere6" aria-expanded="false" aria-controls="critere6">
                          6. ' . $txt['fpB6'] . ' [+]
                        </a>
                      </h4>
                    </div>
                    <div id="critere6" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ6">
                      <div class="panel-body">
                        <div class="col-md-5">';

                $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';
                $html .= '<div class="form-group margin-top-0">';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q6" value="0" required';

                      if ($nbResults == 1 && !is_null($ligne['fp_q6']) && $ligne['fp_q6'] == 0)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '0 point : ' . $txt['fpB6Q6-a0'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q6" value="1" required';

                      if ($nbResults == 1 && $ligne['fp_q6'] == 1)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '1 point : ' . $txt['fpB6Q6-a1'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q6" value="2" required';

                      if ($nbResults == 1 && $ligne['fp_q6'] == 2)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '2 points : ' . $txt['fpB6Q6-a2'];
                    $html .= '</label>';
                  $html .= '</div>';
                $html .= '</div>';

                $html .= $txt['fpB6Q6-acts'];
                $html .= '<textarea class="form-control" name="q6_activites" rows="6">';

                  if ($nbResults == 1)
                    $html .= $ligne['fp_q6_activites'];

                $html .= '</textarea>';

                  $html .= '
                        </div>
                        <div class="col-md-7">
                          <h4>' . $txt['explicatif'] . '</h4>
                          ' . $txt['fpB6-Explicatif'] . '
                          <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>' .
                          $txt['fpB6-ElemConst'] . '
                          <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                          ' . $txt['fpB6-Exemple'] . '
                        </div>
                      </div>
                    </div>
                  </div>';


        ### 7 ########################################
        $html .= '
          <div class="panel panel-primary">
            <div class="panel-heading" role="tab" id="panelQ7">
              <h4 class="panel-title">
                <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere7" aria-expanded="false" aria-controls="critere7">
                  7. ' . $txt['fpB7'] . ' [+]
                </a>
              </h4>
            </div>
            <div id="critere7" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ7">
              <div class="panel-body">
                <div class="col-md-5">';
                $html .= '<img src="images/en-forme-m.png" alt="En Forme au primaire" title="En Forme au primaire" style="display:inline-block; max-width:50%;width:100%" class="img-responsive"><img src="images/en-forme.jpg" alt="En Forme au primaire" title="En Forme au primaire" style="display:inline-block; max-width:50%;width:100%" class="img-responsive">';
                $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';

                $html .= '<div class="form-group margin-top-0">';
                  $html .= '<p><strong>7.1</strong> &mdash; ' . $txt['fpB7Q71'] . '</p>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_1" id="q7_1_0pts" value="0" required';

                      if ($nbResults == 1 && !is_null($ligne['fp_q7_1']) && $ligne['fp_q7_1'] == 0)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '0 point : ' . $txt['fpB7Q71-a0'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_1" value="2" required';

                      if ($nbResults == 1 && $ligne['fp_q7_1'] == 2)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '1 point : ' . $txt['fpB7Q71-a1'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_1" value="2" required';

                      if ($nbResults == 1 && $ligne['fp_q7_1'] == 2)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '2 points : ' . $txt['fpB7Q71-a2'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_1" value="4" required';

                      if ($nbResults == 1 && $ligne['fp_q7_1'] == 4)
                        $html .= ' checked';

                      $html .= '>';
                      $html .= '4 points : ' . $txt['fpB7Q71-a4'];
                    $html .= '</label>';
                  $html .= '</div>';
                $html .= '</div>';

                $html .= '<p><small>' . $txt['fpB7Q71-smallText'] . '</small></p>';

                $html .= '<hr></hr>';

                $html .= '<div class="form-group margin-top-0">';
                  $html .= '<p><strong>7.2</strong> &mdash; ' . $txt['fpB7Q72'] . '</p>';
                  $html .= '<div class="radio hidden">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_2" value="0" required';

                      if ($nbResults == 1 && $ligne['fp_q7_2'] == 0)
                        $html .= ' checked';

                      if ($nbResults == 1 && !is_null($ligne['fp_q7_1']) && $ligne['fp_q7_1'] == 0)
                        $html .= ' disabled';

                      $html .= '>';
                      $html .= '0 point';
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_2" value="1" required';

                      if ($nbResults == 1 && $ligne['fp_q7_2'] == 1)
                        $html .= ' checked';

                      if ($nbResults == 1 && !is_null($ligne['fp_q7_1']) && $ligne['fp_q7_1'] == 0)
                        $html .= ' disabled';

                      $html .= '>';
                      $html .= '1 point : ' . $txt['fpB7Q72-a1'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_2" value="2" required';

                      if ($nbResults == 1 && $ligne['fp_q7_2'] == 2)
                        $html .= ' checked';

                      if ($nbResults == 1 && !is_null($ligne['fp_q7_1']) && $ligne['fp_q7_1'] == 0)
                        $html .= ' disabled';

                      $html .= '>';
                      $html .= '2 points : ' . $txt['fpB7Q72-a2'];
                    $html .= '</label>';
                  $html .= '</div>';
                  $html .= '<div class="radio">';
                    $html .= '<label>';
                      $html .= '<input type="radio" name="q7_2" value="4" required';

                      if ($nbResults == 1 && $ligne['fp_q7_2'] == 4)
                        $html .= ' checked';

                      if ($nbResults == 1 && !is_null($ligne['fp_q7_1']) && $ligne['fp_q7_1'] == 0)
                        $html .= ' disabled';

                      $html .= '>';
                      $html .= '4 points : ' . $txt['fpB7Q72-a4'];
                    $html .= '</label>';
                  $html .= '</div>';
                $html .= '</div>';

          $html .= '
                </div>
                <div class="col-md-7">
                  <h4>' . $txt['explicatif'] . '</h4>
                  ' . $txt['fpB7-Explicatif'] . '
                  <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                  ' . $txt['fpB7-ElemConst'] . '
                </div>
              </div>
            </div>
          </div>';




          ### 8 ########################################
          $html .= '
            <div class="panel panel-primary">
              <div class="panel-heading" role="tab" id="panelQ8">
                <h4 class="panel-title">
                  <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere8" aria-expanded="false" aria-controls="critere8">
                    8. ' . $txt['fpB8'] . ' [+]
                  </a>
                </h4>
              </div>
              <div id="critere8" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ8">
                <div class="panel-body">
                  <div class="col-md-5">';

          $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';
          $html .= '<div class="form-group margin-top-0">';
            $html .= '<div class="radio">';
              $html .= '<label>';
                $html .= '<input type="radio" name="q8" value="0" required';

                if ($nbResults == 1 && !is_null($ligne['fp_q8']) && $ligne['fp_q8'] == 0)
                  $html .= ' checked';

                $html .= '>';
                $html .= '0 point : ' . $txt['fpB8Q8-a0'];
              $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="radio">';
              $html .= '<label>';
                $html .= '<input type="radio" name="q8" value="1" required';

                if ($nbResults == 1 && $ligne['fp_q8'] == 1)
                  $html .= ' checked';

                $html .= '>';
                $html .= '1 point : ' . $txt['fpB8Q8-a1'];
              $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="radio">';
              $html .= '<label>';
                $html .= '<input type="radio" name="q8" value="3" required';

                if ($nbResults == 1 && $ligne['fp_q8'] == 3)
                  $html .= ' checked';

                $html .= '>';
                $html .= '3 points : ' . $txt['fpB8Q8-a3'];
              $html .= '</label>';
            $html .= '</div>';
            $html .= '<div class="radio">';
              $html .= '<label>';
                $html .= '<input type="radio" name="q8" id="q84pts" value="4" required';

                if ($nbResults == 1 && $ligne['fp_q8'] == 4)
                  $html .= ' checked';

                $html .= '>';
                $html .= '4 points : ' . $txt['fpB8Q8-a4'];
              $html .= '</label>';
            $html .= '</div>';
          $html .= '</div>';

          $html .= '<div id="divQ8initiatives"';

            if (!($nbResults == 1 && $ligne['fp_q8'] == 4))
              $html .= ' style="display:none;"';

          $html .= '>';
            $html .= $txt['fpB8Q8-specifier'];
            $html .= '<textarea class="form-control" name="q8_initiatives" rows="6">';

              if ($nbResults == 1 && $ligne['fp_q8_initiatives'] != 'NULL')
                $html .= $ligne['fp_q8_initiatives'];

            $html .= '</textarea>';
          $html .= '</div>';

            $html .= '
                  </div>
                  <div class="col-md-7">
                    <img src="images/3r.jpg" alt="3R" title="3R" class="img-responsive pull-right" style="margin-left:10px;">
                    <h4>' . $txt['explicatif'] . '</h4>
                    ' . $txt['fpB8-Explicatif'] . '
                    <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                    ' . $txt['fpB8-ElemConst'] . '
                    <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                    ' . $txt['fpB8-Exemple'] . '
                  </div>
                </div>
              </div>
            </div>';







          $html .= '
          <div class="well well-panel-group top-buffer-20 ">
            <h4><strong>' . $txt['section2-titre'] . '</strong></h4>
            <p style="font-size:14px;">' . $txt['section2-desc'] . '</p>
          </div>';


            ### 9 ########################################
            $html .= '
              <div class="panel panel-primary">
                <div class="panel-heading" role="tab" id="panelQ9">
                  <h4 class="panel-title">
                    <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere9" aria-expanded="false" aria-controls="critere9">
                      9. ' . $txt['fpB9'] . ' [+]
                    </a>
                  </h4>
                </div>
                <div id="critere9" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ9">
                  <div class="panel-body">
                    <div class="col-md-5">';

            $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';
            $html .= '<div class="form-group margin-top-0">';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q9" value="0" required';

                  if ($nbResults == 1 && !is_null($ligne['fp_q9']) && $ligne['fp_q9'] == 0)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '0 point : ' . $txt['fpB9Q9-a0'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q9" value="1" required';

                  if ($nbResults == 1 && $ligne['fp_q9'] == 1)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '1 point : ' . $txt['fpB9Q9-a1'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q9" value="3" required';

                  if ($nbResults == 1 && $ligne['fp_q9'] == 3)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '3 points : ' . $txt['fpB9Q9-a3'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q9" value="4" required';

                  if ($nbResults == 1 && $ligne['fp_q9'] == 4)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '4 points : ' . $txt['fpB9Q9-a4'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';

              $html .= '
                    </div>
                    <div class="col-md-7">
                      <h4>' . $txt['explicatif'] . '</h4>
                      ' . $txt['fpB9-Explicatif'] . '
                      <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                      ' . $txt['fpB9-ElemConst'] . '
                      <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                      ' . $txt['fpB9-Exemple'] . '
                    </div>
                  </div>
                </div>
              </div>';



              $html .= '
              <div class="well well-panel-group top-buffer-20 ">
                <h4><strong>' . $txt['section3-titre'] . '</strong></h4>
                <p style="font-size:14px;">' . $txt['section3-desc'] . '</p>
              </div>';

      ### 10 ########################################
      $html .= '
        <div class="panel panel-primary">
          <div class="panel-heading" role="tab" id="panelQ10">
            <h4 class="panel-title">
              <a role="button" data-toggle="collapse" data-parent="#liste-criteres" href="#critere10" aria-expanded="false" aria-controls="critere10">
                10. ' . $txt['fpB10'] . ' [+]
              </a>
            </h4>
          </div>
          <div id="critere10" class="panel-collapse collapse" role="tabpanel" aria-labelledby="panelQ10">
            <div class="panel-body">
              <div class="col-md-5">';

      $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';
      $html .= '<div class="form-group margin-top-0">';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q10" value="0" required';

            if ($nbResults == 1 && !is_null($ligne['fp_q10']) && $ligne['fp_q10'] == 0)
              $html .= ' checked';

            $html .= '>';
            $html .= '0 point : ' . $txt['fpB10Q10-a0'];
          $html .= '</label>';
        $html .= '</div>';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q10" value="2" required';

            if ($nbResults == 1 && $ligne['fp_q10'] == 2)
              $html .= ' checked';

            $html .= '>';
            $html .= '2 points : ' . $txt['fpB10Q10-a2'];
          $html .= '</label>';
        $html .= '</div>';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q10" value="3" required';

            if ($nbResults == 1 && $ligne['fp_q10'] == 3)
              $html .= ' checked';

            $html .= '>';
            $html .= '3 points : ' . $txt['fpB10Q10-a3'];
          $html .= '</label>';
        $html .= '</div>';
        $html .= '<div class="radio">';
          $html .= '<label>';
            $html .= '<input type="radio" name="q10" value="4" required';

            if ($nbResults == 1 && $ligne['fp_q10'] == 4)
              $html .= ' checked';

            $html .= '>';
            $html .= '4 points : ' . $txt['fpB10Q10-a4'];
          $html .= '</label>';
        $html .= '</div>';
      $html .= '</div>';

        $html .= '
              </div>
              <div class="col-md-7">
                <h4>' . $txt['explicatif'] . '</h4>
                ' . $txt['fpB10-Explicatif'] . '
                <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                ' . $txt['fpB10-ElemConst'] . '
                <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                ' . $txt['fpB10-Exemple'] . '
              </div>
            </div>
          </div>
        </div>';



      $html .= '</div>';

      // SUBMIT
      //$html .= '<div class="text-center top-buffer-20"><button type="button" id="submitBtn" class="btn btn-primary" onclick="validateMyForm();">Soumettre</button></div>';
      $html .= '<div class="text-center top-buffer-20"><button type="submit" id="submitBtn" class="btn btn-primary" formnovalidate>Enregistrer</button></div>';

    $html .= '</form>';

    return $html;
  }
?>
