<!DOCTYPE html>
<html>

<!-- Meta data -->
<?php include('meta.php'); ?>

<body>

  <!-- Header -->
    <?php include('header.php'); ?>

  <!-- Menu -->
    <?php include('menu.php'); ?>

  <!-- START MAIN CONTENT -->
  <div class="qet-main">

    <div class="w3-row w3-padding-48">
      <div class="w3-twothird w3-container">
       <div class="w3-xxxlarge w3-left" style="margin-right:12px"><i class="fa fa-sitemap"></i></div>
       <h1 class="w3-text-dark-grey">Elements repository</h1>
       <p>The elements repository is an online tool with which you can <b>upload or download</b> elements (.elmt files).<br />
       You can even download whole collections or only parts of them.</p>
























      <div class="w3-container w3-card-2 qet-pale-yellow" style="padding-bottom:12px">
       <h3><i class="fa fa-upload" style="margin-right:12px"></i>Upload elements</h3>
       <p>
        If you want to contribute to the official QET collection, fill the form below.<br />
        The uploaded files are checked by us (moderation). Depending on their quality and their relevance, they will be integrated in the QET collection or not.<br />
        <!-- We encourage you to always follow the <a href="https://www.qelectrotech.org/wiki_new/start?id=en/doc/elements_guidelines" class="qet-text-link qet-hover-text-link" target="_blank">elements creation guidelines</a> in order to unify the look of all elements across the whole QET collection. -->
      </p>

      <a onclick="myFunction('upload-form')" class="w3-large qet-text-link qet-hover-text-link" style="cursor:pointer">
       <div class="w3-left" style="margin-right:12px"><i class="fa fa-chevron-down"></i></div>
       <p>Open the form</p>
     </a>
     <div class="w3-accordion">
       <div id="upload-form" class="w3-accordion-content w3-animate-top w3-container" style="margin-bottom:60px">
         <div class="w3-row-padding w3-margin-top">
            <?php include('elmt-upload.php'); ?>
        </div>
      </div>
    </div>
    
  </div>
  <br />

  <div class="w3-container w3-card-2 qet-pale-blue" style="padding-bottom:12px">
    <h3><i class="fa fa-download" style="margin-right:12px"></i>Download elements</h3>
    <p class=qet-text-red>The download service is temporarily not available.</p>
    
    <a onclick="myFunction('browse-qet-collec')" class="w3-large qet-text-link qet-hover-text-link" style="cursor:pointer">
     <div class="w3-left" style="margin-right:12px"><i class="fa fa-chevron-down"></i></div>
     <p>Browse the official QET collection</p>
   </a>
   <div class="w3-accordion">
     <div id="browse-qet-collec" class="w3-accordion-content w3-animate-top w3-container" style="margin-bottom:60px">
       <div class="w3-row-padding w3-margin-top">

        <?php

       
//header('Content-type: text/html; charset=utf-8');

        define('TREEMENU_DIR', 'treemenu/');
        include(TREEMENU_DIR.'treemenu.class.php');
        $treeMenu = new TreeMenu();

        $treeMenu -> SetHttpVars(array('submission','style','direction','animation'));
        
        $path='../../.cache/elements/collection_officielle/10_electric/10_allpole';

               
        $files_dirs = iterator_to_array(new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST));

        

        if (isset($_GET['style'])) {
            $treeMenu->SetStyle($_GET['style']);
        }
        if (isset($_GET['submission'])) {
            $treeMenu->SetPostBackMethod($_GET['submission']);
        }
        if (isset($_GET['direction'])) {
            $treeMenu->SetDirection($_GET['direction']);
        }
        if (isset($_GET['animation'])) {
            $treeMenu->SetAnimationEffect($_GET['animation']);
        }
        $treeMenu->SetId('tree');
        $pictures = $treeMenu->AddNode('Pictures');
                $treeMenu->UseDefaultFolderIcons(true);
        $treeMenu->UseDefaultFileIcons(true);
        

// create a new associative multi-dimensional array with dirs as keys and their files
        $dirs_files = array();
        foreach ($files_dirs as $dir) {
            if (is_dir($dir) and preg_match('/\/\.$/', $dir)) {
                $d = preg_replace('/\/\.$/', '', $dir);
                 $html = $treeMenu->AddNode(substr($dir, strlen($path)+1));
                foreach ($files_dirs as $file) {
                    if (is_file($file) and $d == dirname($file)) {
                        $f = basename($file);
                          $extension = pathinfo($file, PATHINFO_EXTENSION);
                        if ($extension=='svg') {
                            $html->AddNode($f, '', $dir.'/'.$f);
                        }
                    }
                }
            }
        }
      
        
       
        $html->AddNode('Anthems', 'content/anthems.htm');
        $text=$treeMenu->AddNode('Text', 'content/text.txt');
        $php=$treeMenu->AddNode('PHP', 'content/script.php?country=Italy');
        $code=$treeMenu->AddNode('Code');
        $newWindow=$treeMenu->AddNode('New Window', 'content/index2.htm');
        $newWindow->OpenNewWindow(true);

        $code->SetInnerHTML('<i>This code was inserted without using files</i>');
        $europe = $pictures->AddNode('Europe');
        $america = $pictures->AddNode('America');
        $america->SetTooltip('Ray Bradbury\'s homeland');

        $france=$europe->AddNode('Eiffel Tower', 'content/paris.jpg', 'content/france.gif');
        $britain=$europe->AddNode('Big Ben', 'content/london.jpg', 'content/britain.gif');
        $italy=$europe->AddNode('Italy', '', 'content/italy.jpg');
        $rome=$italy->AddNode('Rome', 'content/rome.jpg');
        $italy->AddNode('Pisa', 'content/pisa.jpg');

        $liberty=$america->AddNode('Statue of Liberty', 'content/newyork.jpg', 'content/newyorkflag.jpg');

        $treeMenu->ShowExpandCollapseAllButtons(true);

        $treeMenu->AllowRefreshSelectedNodes(true);
        $treeMenu->ShowTree();
        $treeMenu->ShowContent();

        ?>





       </div>
     </div>
   </div>

   <a onclick="myFunction('browse-awaiting')" class="w3-large qet-text-link qet-hover-text-link" style="cursor:pointer">
     <div class="w3-left" style="margin-right:12px"><i class="fa fa-chevron-down"></i></div>
     <p>Browse the elements awaiting moderation</p>
   </a>
   <div class="w3-accordion">
     <div id="browse-awaiting" class="w3-accordion-content w3-animate-top w3-container" style="margin-bottom:60px">
       <div class="w3-row-padding w3-margin-top">
         <p>bla bla et bla</p>
       </div>
     </div>
   </div>

   <a onclick="myFunction('browse-denied')" class="w3-large qet-text-link qet-hover-text-link" style="cursor:pointer">
     <div class="w3-left" style="margin-right:12px"><i class="fa fa-chevron-down"></i></div>
     <p>Browse the denied elements</p>
   </a>
   <div class="w3-accordion">
     <div id="browse-denied" class="w3-accordion-content w3-animate-top w3-container" style="margin-bottom:60px">
       <div class="w3-row-padding w3-margin-top">
        <?php include('../../showcategory-nuri-test.php'); ?>
      </div>
    </div>
  </div>
  
</div>
</div>

<!-- Side panel for sponsors, partners and last news -->
<?php include('sidepanel.php'); ?>
</div>

<!-- Footer -->
<?php include('footer.php'); ?>

<!-- END MAIN CONTENT -->
</div>

<!-- Javascript -->
<script src="../js-responsive.js"></script>

<!-- Javascript for accordions -->
<script src="../js-accordion.js"></script>
<script src="../js-menu.js"></script>

</body>
</html>
