{"id":341,"date":"2016-12-12T07:22:17","date_gmt":"2016-12-12T07:22:17","guid":{"rendered":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/?page_id=341"},"modified":"2017-02-22T13:47:00","modified_gmt":"2017-02-22T13:47:00","slug":"complete-rei-list","status":"publish","type":"page","link":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/?page_id=341","title":{"rendered":"Complete REI list"},"content":{"rendered":"<p><script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.1.1\/jquery.min.js\"><\/script><\/p>\n<p><!--\n<span id=\"selectorText\">Select Category: &nbsp;<\/span>\n<select name=\"selection\" onchange=\"showSelection(this.value)\" id=\"reiSelectionField\"> \n<option value=\"1\">All<\/option>\n<option value=\"2\">Energy Efficiency<\/option>\n<option value=\"3\">Heating<\/option>\n <\/select>&nbsp;&nbsp;&nbsp;&nbsp;\n--><\/p>\n<p><input type=\"text\" name=\"searchField\" placeholder=\"Enter search term\" id=\"reiSearchField\"><br \/>\n<button type=\"button\" id=\"reiSearchButton\" onclick=\"startSearch()\">Search<\/button><br \/>\n<!-- <textarea rows=\"1\" cols=\"50\" placeholder=\"Enter search term\"><\/textarea> --><\/p>\n<div id=\"queryOutput\">output will be here<\/div>\n<p><script>\n\/\/string of last search query term\nvar lastQuery = \"\";<\/p>\n<p>\/\/last query where no extra search term was added\nvar lastNonSearchQuery  = \"\";<\/p>\n<p>var sortQuery = \"\";<\/p>\n<p>\/\/does the last search query term contain a \"WHERE LIKE\"?\nvar specifiedSearch = 0;     <\/p>\n<p>\/\/was the last query a request to sort a column ascending? \nvar sortedAscending = false;\nvar sortedDescending = false;\n\/\/which column was sorted the during the last query? (either ascending or descending)\nvar lastSortedColumn = \"\";<\/p>\n<p>function showSelection(selectionValue) {\n  var mysqlQuery = \"\";\n  if (selectionValue == 1)\n  {\n    mysqlQuery = \"SELECT * FROM `indicators`\";\n    lastQuery = mysqlQuery;\n    lastNonSearchQuery  = mysqlQuery;\n    specifiedSearch = 0;\n  } \n  else if (selectionValue == 2)\n  {\n    mysqlQuery = \"SELECT * FROM `indicators` WHERE `indicator` LIKE '%Energy Efficiency%'\";\n    lastQuery = mysqlQuery;\n    lastNonSearchQuery  = mysqlQuery;\n    specifiedSearch = 1;\n  } \n  else if (selectionValue == 3)\n  {\n    mysqlQuery = \"SELECT * FROM `indicators` WHERE `indicator` LIKE '%Heating%'\";\n    lastQuery = mysqlQuery;\n    lastNonSearchQuery  = mysqlQuery;\n    specifiedSearch = 1;\n  }<\/p>\n<p>  if (mysqlQuery==\"\") {\n    document.getElementById(\"txtHint\").innerHTML=\"no mysql query term\";\n    return;\n  }\n  else {\n    lastQueryType = 0;\n    $.get('\/wordpress\/interaction\/mysqlreq.php', {mysqlQuery: mysqlQuery}, function(response){\n                    $('div#queryOutput').html(response);\n                });<\/p>\n<p>    \/\/prepare sorting, because ID is sorted ascending when table is loaded\n    lastSortedColumn = \"id_name\";\n    sortedAscending = true;\n    sortedDesceding = false;\n  }<\/p>\n<p>}<\/p>\n<p>function startSearch () {\n  searchTerm = $(\"#reiSearchField\").val();<\/p>\n<p>  if (specifiedSearch == 0)  \/\/wenn die letzte Suche keinen \"WHERE LIKE\" Suchterm enthielt\n  {\n      searchQuery = lastNonSearchQuery + \" WHERE `id` LIKE '%\" + searchTerm + \"%'\" \n                                  + \" OR `abbrevation` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `indicator` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `description` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `formula` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `unit` LIKE '%\" + searchTerm + \"%'\";\n      lastQuery = searchQuery;<\/p>\n<p>  }\n  else if (specifiedSearch == 1)   \/\/wenn die letzte Suche einen \"WHERE LIKE\" Suchterm enthielt\n  {\n    searchQuery = lastNonSearchQuery + \" AND `id` LIKE '%\" + searchTerm + \"%'\"  \n                                  + \" OR `abbrevation` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `indicator` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `description` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `formula` LIKE '%\" + searchTerm + \"%'\"\n                                  + \" OR `unit` LIKE '%\" + searchTerm + \"%'\";\n      lastQuery = searchQuery;\n  }<\/p>\n<p>  $.get('\/wordpress\/interaction\/mysqlreq.php', {mysqlQuery: searchQuery}, function(response){\n                    $('div#queryOutput').html(response);\n                });\n  sortedAscending = false;\n  sortedDesceding = false;\n}<\/p>\n<p>function sortTable (sorter) {\n  if (!sortedAscending && !sortedDescending) \n  {\n    sortdirection = \"` ASC\";\n    sortedAscending = true;\n    sortedDesceding = false;\n  } \n  else if (sortedAscending && sorter == lastSortedColumn)\n  {\n    sortdirection = \"` DESC\";\n    sortedAscending = false;\n    sortedDesceding = true;\n  }\n  else if (sortedDescending && sorter == lastSortedColumn)\n  {\n    sortdirection = \"` ASC\";\n    sortedAscending = true;\n    sortedDesceding = false;\n  }\n  else\n  {\n    sortdirection = \"` ASC\";\n    sortedAscending = true;\n    sortedDesceding = false;   \n  }\n  lastSortedColumn = sorter;\n  var sortQuery = lastQuery + \" ORDER BY `indicators`.`\" + sorter + sortdirection;\n  lastQueryType = 0;\n  $.get('\/wordpress\/interaction\/mysqlreq.php', {mysqlQuery: sortQuery}, function(response){\n    $('div#queryOutput').html(response);\n  });\n}<\/p>\n<p>  \/\/set cookie and go to detail page of indicator\n  function detailPageLink (reiName)\n  {\n    document.cookie = \"detailPageRei=\" + reiName;\n    location.href = '\/wordpress\/?page_id=142';\n  }<\/p>\n<p>$(document).ready(function(){<\/p>\n<p>  \/\/start search if \"Enter\" is clicked in search field\n  $('#reiSearchField').keydown(function (e){\n    if(e.keyCode == 13){\n      startSearch();\n    }\n  })<\/p>\n<p>});<\/p>\n<p>\/\/load table with all indicators when page is loaded\nshowSelection(\"1\");\nlastQuery = \"SELECT * FROM `indicators`\";<\/p>\n<p>\/\/prepare sorting, because ID is sorted ascending when table is loaded\nlastSortedColumn = \"id_name\";\nsortedAscending = true;<\/p>\n<p><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Search output will be here<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":[],"_links":{"self":[{"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=\/wp\/v2\/pages\/341"}],"collection":[{"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=341"}],"version-history":[{"count":13,"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=\/wp\/v2\/pages\/341\/revisions"}],"predecessor-version":[{"id":729,"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=\/wp\/v2\/pages\/341\/revisions\/729"}],"wp:attachment":[{"href":"http:\/\/more.bci.tu-dortmund.de\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=341"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}