<commit_before><?php
$email = $_GET['email'] ;
$sid = $_GET['surveyid'] ;

echo $email ;
echo $sid ;

?>
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
	<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link href="https://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet">
    <!-- Compiled and minified CSS -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script src="js/materialize.js"></script>
  <script src="js/init.js"></script>
  </head>

  <script type="text/javascript">
  $(document).ready(function(){

    $('.myForm input').on('change', function() {
    console.log($('input[name=group1]:checked', '.myForm').val());
    });

    $("#bt").click(function(){
      var test = $("#test1").checked ;
      console.log(test) ;
      console.log($('input[name=group1]:checked').val());
      console.log($('input[name=group2]:checked').val());
    })

    $.ajax({
      type : "POST",
      url : "getsurveyquestions.php",
      data : "surveyid=<?php echo $sid ?>" ,
      cache : false,
      success : function(result){
        result = JSON.parse(result) ;
        console.log(result) ;

        // get the questions of the survey and now getting the options
        var len = result.length ;

        function getOptions(qid , options)
        {
          for(var i = 0 ; i < options.length ; i++)
          {
            if(qid == options[i]["qid"])
            {
              return options[i] ;
            }
          }
        }



        $.ajax({
          type : "POST",
          url : "getoptions.php",
          data : "surveyid=<?php echo $sid ?>" ,
          cache : false,
          success : function(options){
            options = JSON.parse(options) ;
            console.log(options) ;
            console.log(result);

            // having all the questions and options of mcq questions

            for (var i = 0; i < len; i++) {
              // c  onsole.log("type : " + result[i]["type"]) ;
              if(result[i]["type"] == "1")
              {
                console.log("mcq") ;
                var opt = getOptions(result[i]["qid"] , options) ;
                console.log(opt) ;



              }
              if(result[i]["type"] == "2")
              {
                console.log("input");
              }
              if(result[i]["type"] == "3")
              {
                console.log("custom");
              }
              if(result[i]["type"] == "4")
              {
                console.log("rank");
              }
            }
          }
        })
      }
    })
  })
  </script>

  <body>
  <nav class="white" role="navigation">
      <div class="nav-wrapper container">
        <a id="logo-container" href="#" class="brand-logo" style="color:black">Logo</a>
        <ul class="right hide-on-med-and-down">
          <li><a href="#">Navbar Link</a></li>
        </ul>

        <ul id="nav-mobile" class="side-nav">
          <li><a href="#">Navbar Link</a></li>
          <li><a href="#">Voting</a></li>
          <li><a href="takesurvey.php">Take Survey</a></li>
          <li><a href="#">Login</a></li>
          <li><a href="#">Sign Up</a></li>
        </ul>
        <a href="#" data-activates="nav-mobile" class="button-collapse"><i class="material-icons">menu</i></a>
      </div>
  </nav>

  <div class="container">

    <div id="heading">
      <div id="main-content">
        <div id="question">
          <!-- here goes the question -->
        </div>
        <div id="options">
          <!-- here goes the options of the questions -->
        </div>
      </div>
    </div>

    <form action="#" class="myForm">
        <p><commit_msg>displaying the questions with their options too<commit_after><?php
$email = $_GET['email'] ;
$sid = $_GET['surveyid'] ;

echo $email ;
echo $sid ;

?>
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no"/>
	<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link href="css/materialize.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link href="css/style.css" type="text/css" rel="stylesheet" media="screen,projection"/>
    <link href="https://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet">
    <!-- Compiled and minified CSS -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/css/materialize.min.css">

  <!-- Compiled and minified JavaScript -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
  <script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <script src="js/materialize.js"></script>
  <script src="js/init.js"></script>
  </head>

  <script type="text/javascript">
  $(document).ready(function(){

    $("#question").html("") ;
    $("#options").html("");

    $('.myForm input').on('change', function() {
    console.log($('input[name=group1]:checked', '.myForm').val());
    });



    function getOptions(qid , options)
    {
      for(var i = 0 ; i < options.length ; i++)
      {
        if(qid == options[i]["qid"])
        {
          return options[i] ;
        }
      }
    }

    var sendobj = {} ;
    sendobj["test"] = "1" ;
    sendobj["test1"] = "12" ;
    sendobj["test2"] = "13" ;

    console.log(sendobj) ;

    $("#bt").click(function(){
      $.ajax({
        type : "POST",
        url : "getsurveyquestions.php",
        data : "surveyid=<?php echo $sid ?>" ,
        cache : false,
        success : function(result){
          result = JSON.parse(result) ;
          console.log(result) ;
          var len = result.length ;
          sendobj = "" ;
          for(var i = 0 ; i < len ; i++)
          {
            // console.log($('input[name='+ result[i]["qid"] +']:checked').val()) ;
            if(result[i]["type"] == "1")
            {
              sendobj += $('input[name='+ result[i]["qid"] +']:checked').val() + ","
            }
          }
          sendobj = sendobj.slice(0,sendobj.length-1);
          console.log(sendobj) ;
        }
      }) ;
    })



    $.ajax({
      type : "POST",
      url : "getsurveyquestions.php",
      data : "surveyid=<?php echo $sid ?>" ,
      cache : false,
      success : function(result){
        result = JSON.parse(result) ;
        console.log(result) ;

        // get the questions of the survey and now getting the options
        var len = result.length ;


        $.ajax({
          type : "POST",
          url : "getoptions.php",
          data : "surveyid=<?php echo $sid ?>" ,
          cache : false,
          success : function(options){
            options = JSON.parse(options) ;
            console.log(options) ;
            console.log(result);

            // having all the questions and options of mcq questions

            for (var i = 0; i < len; i++) {
              // c  onsole.log("type : " + result[i]["type"]) ;
              if(result[i]["type"] == "1")
              {
                console.log("mcq") ;
                var optdata = getOptions(result[i]["qid"] , options) ;
                console.log(optdata) ;
                // got the mcq questions and the option of that questions
                $("#options").append("<h4 class='header'>" + result[i]['question'] + "</h4>") ;

                var opt = optdata["answer_option"] ;
                var optarr = opt.split(",") ;
                var olen = optarr.length ;
                console.log(optarr) ;
                console.log("option array length : " + olen)
                for(var j = 0 ; j < olen ; j++)
                {
                  console.log("<input name=" + "'" + result[i]["qid"] + "'" +  " type='radio' id=" + "'" + result[i]["qid"] +  "'" + " value=" + "'" + result[i]["qid"]+"-"+result[i]["type"]+ j + "'" +  " />" + " <label for=" + "'" + result[i]["qid"]  + "'" + ">" + options[j]["answer_option"] + "</label>") ;
                  $("#options").append("<input name=" + "'" + result[i]["qid"] + "'" +  " type='radio' id=" + "'" + result[i]["qid"]+j +  "'" + " value=" + "'" + result[i]["qid"]+"-"+result[i]["type"]+'-'+ j + "'" +  " />" + " <label for=" + "'" + result[i]["qid"]+j  + "'" + ">" + optarr[j] + "</label><br>") ;
                }

              }
              if(result[i]["type"] == "2")
              {
                console.log("input");
              }
              if(result[i]["type"] == "3")
              {
                console.log("custom");
              }
              if(result[i]["type"] == "4")
              {
                console.log("rank");
              }
            }
          }
        })
      }
    })
  })
  </script>

  <body>
  <nav class="white" role="navigation">
      <div class="nav-wrapper container">
        <a id="logo-container" href="#" class="brand-logo" style="color:black">Logo</a>
        <ul class="right hide-on-med-and-down">
          <li><a href="#">Navbar Link</a></li>
        </ul>

        <ul id="nav-mobile" class="side-nav">
          <li><a href="#">Navbar Link</a></li>
          <li><a href="#">Voting</a></li>
          <li><a href="takesurvey.php">Take Survey</a></li>
          <li><a href="#">Login</a></li>
          <li><a href="#">Sign Up</a></li>
        </ul>
        <a href="#" data-activates="nav-mobile" class="button-collapse"><i class="material-icons">menu</i></a>
      </div>
  </nav>

  <div class="container">

    <div id="heading">
      <div id="main-content">
        <div id="options">
                                                <!-- here goes the question -->
                                              <!-- here goes the options of the questions -->
        </div>
      </div>
    </div>

    <h4 class='header'>How would you rate the quality of the desk in your class</h4>

    <form action="#" class="myForm">
        <p>
{'fraction_non_alphanumeric': 0.2037483763221377, 'fraction_numerical': 0.00658749304138059, 'mean_word_length': 1.9792703150912105, 'pattern_counts': {'":': 0, '<': 177, '<?xml version=': 0, '>': 171, 'https://': 12, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3332956', 'n_tokens_mistral': 3494, 'n_tokens_neox': 3385, 'n_words': 606}