<!DOCTYPE html>
<html>
   <head>
      <title>Relating Tool</title>
      <?php
         define('USER', 'jesse.turner@gatewaybaltic.com');
         define('TOKEN', 'reNaj8P1B4r3y9=fD8RaM0a4Lf30sdBda1d210we'); 
         require 'Solve360Service.php';
         $solve360Service = new Solve360Service(USER, TOKEN);
         /*$projects = $solve360Service->getAllProjectblogs();
         $data=array();
         foreach ($projects->children() as $ch) {
            $title=$ch->title;
            if (strlen($title)>0) $data[]="$title";
         }*/

         $tags = $solve360Service->getCompanyCategories();
         foreach ($tags->children() as $ch) {
            echo '-> '.$ch->getName().' = '.$ch.'<br/>';
            foreach ($ch->children() as $gch) {
               echo '-> -> '.$gch->getName().' = '.$gch.'<br/>';
               foreach ($gch->children() as $ggch) {
                  echo '-> -> -> '.$ggch->getName().' = '.$ggch.'<br/>';
                  foreach ($ggch->children() as $gggch) {
                     echo '-> -> -> -> '.$gggch->getName().' = '.$gggch.'<br/>';
                  }
               }
            }
         }
         
         /*
         $tagdata=array();
         foreach ($tags->children() as $ch) {
            $title=$ch->title;
            if (strlen($title)>0) $tagdata[]="$title";
            echo $ch.'<br/>';
            foreach ($ch->children() as $gch) {
               echo $gch.'<br/>';
            }
         }
         */
      ?>
      <script type="text/javascript" src="library_functions.js"></script>
      <script type="text/javascript">
         var blogs;
      </script>
      <style type="text/css">
         body { margin:20px; padding:0; font-family:arial,sans-serif; position:relative; }
         p,label { font-size:12px; }
         .italic { font-style:italic; }
         .imagebox { float:left; width:170px; height:170px; overflow:hidden; margin:30px; }
         #companyList { position: absolute; top:0; left:450px; width:500px; height:500px; border:1px solid black; margin:0; padding:0; overflow-x:hidden; overflow-y:auto; }
         #enterBlog { width:350px; }
      </style>
   </head>
   <body>
      <label for="enterBlog">Project blog:</label>
      <input list="projBlogs" id="enterBlog"/>
      <datalist id="projBlogs">
      </datalist>
      <br/>
      <label for="enterImport">Import tag:</label>
      <input list="catTags" id="enterImport"/>
      <datalist id="catTags">
      </datalist>
      <br/><br/>
      <button id="searchButton">Search</button>
      <button id="relateButton">Relate</button>
      <div id="companyList"></div>
   </body>
   <script type="text/javascript">
      /*
      _disable("relateButton");
      blogs = <?php echo json_encode($tagdata); ?>;
      for (var i=0;i<blogs.length;i++) {
         var el=_new("option");
         el.setAttribute("value",blogs[i]);
         _add("projBlogs",el);
      }
      alert(blogs.toSource());
      */
   </script>
</html> 
