diff --git a/getData.php b/getData.php deleted file mode 100644 index 67a2c4c..0000000 --- a/getData.php +++ /dev/null @@ -1,31 +0,0 @@ -prepare('SELECT * FROM queriesJSON WHERE username = :username ORDER BY simName'); - $stmt->execute(array(':username' => $_POST['username'])); - foreach ($stmt as $row) { - $data['simName'][] = $row['simName']; - $data['qid'][] = $row['qid']; - } - echo JSON_encode($data); -} - -if($_POST['param']=="saveSim"){ - $stmt = $db->prepare('INSERT INTO queriesJSON (username, simName, json) VALUES (:username, :simName, :json)'); - $stmt->execute(array(':username' => $_POST['username'], ':simName' => $_POST['simName'], ':json' => $_POST['json'])); - echo JSON_encode('Success'); -} - -if($_POST['param']=="getSavedSim"){ - $stmt = $db->prepare('SELECT * FROM queriesJSON WHERE qid = :qid'); - $stmt->execute(array(':qid' => $_POST['qid'])); - foreach ($stmt as $row) { - $data['data'] = $row['json']; - $data['simName'] = $row['simName']; - $data['qid'] = $row['qid']; - } - echo JSON_encode($data); -} - - -?> \ No newline at end of file diff --git a/js/cFIREsimOpen.js b/js/cFIREsimOpen.js index 817041c..c3e4fc2 100644 --- a/js/cFIREsimOpen.js +++ b/js/cFIREsimOpen.js @@ -76,50 +76,6 @@ var Simulation = { sim: [], tabs: 0, g: [], //dygraph object - getQueries: function() { - var username = $("#username").html(); - $.ajax({ - url: "getData.php", - type: "POST", - dataType: 'JSON', - data: { - param: "getNames", - username: username, - }, - }).success(function(data) { - var html = ""; - for (var i = 0; i < data.qid.length; i++) { - html += "
  • ID:" + data.qid[i] + " - " + data.simName[i] + "
  • " - } - $("#savedSimsDropdown").html(html); - $('.dropdown-menu a').click(function() { - var id = $(this).attr('id'); - Simulation.getSavedSim(id); - }); - }); - }, - getSavedSim: function(qid) { - $.ajax({ - url: "getData.php", - type: "POST", - dataType: "JSON", - data: { - param: "getSavedSim", - qid: qid, - } - }).success(function(data) { - if (data == null) { - var html = "

    Could not load ID:" + Simulation.getUrlVars(['id']) + ". There is no data for that ID.

    "; - $("#loadedSimFailText").html(html); - $("#loadedSimFail").show(); - } else { - Simulation.loadSavedSim(data.data); - var html = "

    Successfully loaded ID#" + data.qid + " - '" + data.simName + "'

    "; - $("#loadedSimHeaderText").html(html); - $("#loadedSimHeader").show(); - } - }); - }, loadSavedSim: function(data) { //Load in angular scope from outside the controller var scope = angular.element($("#input")).scope();