<?php
  function afficherFormS()
  {
    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['highForm'] . '</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,'S');

    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="frmEvalS" id="frmEvalS" action="php/insert-results-s.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['fsSportAndPhysicalTitle'] . '</strong></h4>
        <p style="font-size:14px;">' . $txt['fsfSportAndPhysicalDesc'] . '</p>
      </div>';

      $requete = 'SELECT * FROM isoactif_form_s WHERE fs_u_id_fk = ' . escapeValue($_SESSION['usagerEcoleIsoActif']->u_id);
      if (!$resultat = $connexion->query($requete)) { die('There was an error running the query : Fetch form S data'); }
      //if (!$resultat = $connexion->query($requete)) { die('There was an error running the query : Fetch form S data ' . $connexion->error); }
      $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['fsB1'] . ' [+]
              </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['scoring'] . '</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['fs_q1'] == 1)
              $html .= ' checked';

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

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

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

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

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

        $html .= '
              </div>
              <div class="col-md-7">
                <h4>' . $txt['explicatif'] . '</h4>
                ' . $txt['fsB1Q1-Explicatif'] . '
                <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                ' . $txt['fsB1-ElemConst'] . '
              </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['fsB2Q2'] . ' [+]
                </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['score'] . '</h4>';

        $html .= '<p>Offre d’un programme sportif complémentaire</p>';
        $html .= '<div class="form-group margin-top-0">';
          $html .= '<div class="radio">';
            $html .= '<label>';
              $html .= '<input type="radio" name="q2" value="0" required';

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

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

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

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

          $html .= '
                </div>
                <div class="col-md-7">
                  <h4>' . $txt['explicatif'] . '</h4>' .  '
                  ' . $txt['fsB2-Explicatif'] . '
                  <strong>' . $txt['elemConst'] . '</strong>
                  ' . $txt['fsB2-ElemConst'] . '
                </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['fsB3'] . ' [+]
                  </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_sec 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['scoring'] . '</h4>';

          // Si au moins une discipline offerte par l'IR
          if ($nbDiscPourIr > 0)
          {
            $html .= '<p><strong>3.1</strong> &mdash; ' . $txt['fsB3Q31'] . '</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['fs_q3_1']) && $ligne['fs_q3_1'] == 0)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '0 point : ' . $txt['fsB3Q31-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['fs_q3_1'] == 2)
                    $html .= ' checked';

                  $html .= '>';
                  $html .= '2 points : ' . $txt['fsB3Q31-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['fs_q3_1'] == 3)
                    $html .= ' checked';

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

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

                  $html .= '>';
                  $html .= '4 points : ' . $txt['fsB3Q31-a4'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';
          }
          else // Si aucune discipline offerte par l'IR
          {
            $html .= '<p><strong>3.1</strong> &mdash; ' . $txt['fsB3Q31'] . '</p>';
            $html .= '<input type="hidden" name="q3_1" value="0">';
            $html .= $txt['fsB3Q31noDisc'];
          }


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

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

              if ($nbResults == 1 && !empty($ligne['fs_q3_liste_disciplines']))
                $q3_1_liste_disciplines = unserialize($ligne['fs_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['fsB3Q32'] . '</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 && !is_null($ligne['fs_q3_2']) && $ligne['fs_q3_2'] == 0)
                    $html .= ' checked';

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

                  $html .= '>';
                  $html .= '0 point : Aucun élève de l’école ne participe à l’une ou l’autre des disciplines du RSEQ.';
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_2" value="2" required';

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

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

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

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

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

                  $html .= '>';
                  $html .= '4 points : ' . $txt['fsB3Q32-a4'];
                $html .= '</label>';
              $html .= '</div>';
              $html .= '<div class="radio">';
                $html .= '<label>';
                  $html .= '<input type="radio" name="q3_2" value="6" required';

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

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

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

            $html .= '
                  </div>
                  <div class="col-md-7">
                    <h4>' . $txt['explicatif'] . '</h4>' .  $txt['fsB3-Explicatif'] . '
                    <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                    ' . $txt['fsB3-ElemConst'] . '
                    <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                    ' . $txt['fsB3-Exemple'] . '
                  </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['fsB4'] . ' [+]
                    </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['fsB4Q4'] . '</p>';

            $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['fs_q4']) && $ligne['fs_q4'] == 0)
                  $html .= ' checked';

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

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

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

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

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

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

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

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

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

            $html .= '</textarea>';

              $html .= '
                    </div>
                    <div class="col-md-7">
                      <h4>' . $txt['explicatif'] . '</h4>' .  '
                      ' . $txt['fsB4-Explicatif'] . '
                      <strong>' . $txt['elemConst'] . '</strong>
                      ' . $txt['fsB4-ElemConst'] . '
                      <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                      ' . $txt['fsB4-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['fsB5'] . ' [+]
                      </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['fs_q5']) && $ligne['fs_q5'] == 0)
                      $html .= ' checked';

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

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

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

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

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

                // Activités
                $html .= '';

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

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

                $html .= '</textarea>';

              $html .= '</div>';

              $html .= '
                    </div>
                    <div class="col-md-7">
                      <h4>' . $txt['explicatif'] . '</h4>' .  $txt['fsB5-Explicatif'] . '
                      <strong>' . $txt['elemConst'] . '</strong>
                      ' . $txt['fsB5-ElemConst'] . '
                      <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                      ' . $txt['fsB5-Exemple'] . '
                    </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['fsB6'] . ' [+]
                        </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 .= '<img src="images/en-forme-s.jpg" alt="En Forme au primaire" title="En Forme au primaire" class="img-responsive">';
                        $html .= '<h4 class="bleu-rseq">' . $txt['scoring'] . '</h4>';

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

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

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

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

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

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

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

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

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

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

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


                        $html .= '<div class="form-group margin-top-10">';
                          $html .= '<div class="checkbox">';
                            $html .= '<label>';
                              $html .= '<input type="checkbox" name="q6_boni" id="q6_boni" value="1"';

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

                              $html .= '>';
                              $html .= $txt['fsB6Q61-bonus'];
                            $html .= '</label>';
                          $html .= '</div>';
                        $html .= '</div>';

                        $html .= '<div class="form-group">';
                          $html .= '<label for="fonction" style="font-weight:normal;">' . $txt['fsB6Q61-specify'] . '</label>';
                          $html .= '<input class="form-control" type="text" name="q6_programme" style="max-width:400px;"';

                            if ($nbResults == 1)
                              $html .= ' value="' .  $ligne['fs_q6_programme'] . '"';

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  $html .= '
                        </div>
                        <div class="col-md-7">
                          ' . $txt['fsB6Q62-info'] . '

                          <h4>' . $txt['explicatif'] . '</h4>' .   $txt['fsB6-Explicatif'] . '
                          <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                          ' . $txt['fsB6-ElemConst'] . '
                        </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['fsB7'] . ' [+]
                  </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 .= '<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="q7" value="0" required';

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

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

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

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

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

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

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

                $html .= '>';
                $html .= '5 points : ' . $txt['fsB7Q7-a5'];
              $html .= '</label>';
            $html .= '</div>';
          $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['fsB7-Explicatif'] . '
                    <h5 class="top-buffer-20"><strong>' . $txt['elemConst'] . '</strong></h5>
                    ' . $txt['fsB7-ElemConst'] . '
                    <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                    ' . $txt['fsB7-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>';


            ### 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['fsB8'] . ' [+]
                    </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['fs_q8']) && $ligne['fs_q8'] == 0)
                    $html .= ' checked';

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

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

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

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

                  $html .= '>';
                  $html .= '5 points : ' . $txt['fsB8Q8-a5'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';

            $html .= '<div class="form-group margin-top-10">';
              $html .= '<div class="checkbox">';
                $html .= '<label>';
                  $html .= '<input type="checkbox" name="q8_boni" id="q8_boni" value="1"';

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

                  $html .= '>';
                  $html .= $txt['fsB8Q8-bonus'];
                $html .= '</label>';
              $html .= '</div>';
            $html .= '</div>';

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


                ### 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['fsB9'] . ' [+]
                        </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['fs_q9']) && $ligne['fs_q9'] == 0)
                        $html .= ' checked';

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

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

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

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

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

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

                      $html .= '>';
                      $html .= '6 points : ' . $txt['fsB9Q9-a6'];
                    $html .= '</label>';
                  $html .= '</div>';
                $html .= '</div>';

                $html .= '<div class="form-group margin-top-10">';
                  $html .= '<div class="checkbox">';
                    $html .= '<label>';
                      $html .= '<input type="checkbox" name="q9_boni" id="q9_boni" value="2"';

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

                      $html .= '>';
                      $html .= $txt['fsB9Q9-bonus'];
                    $html .= '</label>';
                  $html .= '</div>';
                $html .= '</div>';

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



              $html .= '
              <div class="well well-panel-group top-buffer-20 ">
                <h4><strong>' . $txt['section4-titre'] . '</strong></h4>
                <p style="font-size:14px;">' . $txt['section4-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['fsB10'] . ' [+]
              </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['fs_q10']) && $ligne['fs_q10'] == 0)
              $html .= ' checked';

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

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

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

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

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

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

            $html .= '>';
            $html .= '6 points : ' . $txt['fsB10Q10-a6'];
          $html .= '</label>';
        $html .= '</div>';
      $html .= '</div>';

        $html .= '
              </div>
              <div class="col-md-7">
                <h4>' . $txt['explicatif'] . '</h4>' .  $txt['fsB10-Explicatif'] . '
                <strong>' . $txt['elemConst'] . '</strong>
                ' . $txt['fsB10-ElemConst'] . '
                <h5 class="top-buffer-20 bleu-rseq"><strong>' . $txt['exemple'] . 's</strong></h5>
                ' . $txt['fsB10-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>' . $txt['save'] . '</button></div>';

    $html .= '</form>';

    return $html;
  }
?>
