Source for file settings.php

Documentation is available at settings.php

  1. <?php
  2. /**
  3. * User settings
  4. * <br/><br/>
  5. * Script for defining settings for individual users
  6. * <br/><br/>
  7. * Access for all users
  8. @author Gabriele Droege, DNA Bank Network <contact@dnabank-network.org>
  9. @version 2.0
  10. @package Configuration
  11. @copyright Copyright © 2011 DNA Bank Network http://www.dnabank-network.org<br>The contents of this file are subject to the Mozilla Public License Version 1.1
  12. @filesource
  13. @license http://www.mozilla.org/MPL/ MPL
  14. */
  15.  
  16.     /**
  17.     * calling connection to database
  18.     */
  19.     include ("../config/head.php");
  20.  
  21.     /**
  22.     * calling authorisation script
  23.     */
  24.     include ("../auth.php");
  25. ?>
  26. <html>
  27.  
  28. <head>
  29. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  30. <title>DNA Module - Settings</title>
  31. <link rel="stylesheet" type="text/css" href="../format.css">
  32. <link rel="stylesheet" type="text/css" href="../input/XSLT/Styles.css">
  33. <SCRIPT LANGUAGE="JavaScript1.1" src="../Functions.js"></SCRIPT>
  34. <NOSCRIPT>Please enable Javascript!</NOSCRIPT>
  35.  
  36. </head>
  37.  
  38. <body>
  39. <form name="formular" method="POST" action="settings.php">
  40. <div align="center">
  41.  
  42. <?php 
  43.      /**
  44.     * including navigation menu
  45.     */
  46.     include("../tablenavi.php")?>
  47.     
  48. <table id="tablemain" class="main">
  49. <tr>
  50. <td id="tdLogo"><a href="<?php echo $Path_Wiki."/Installation#First_steps"?>" target="_blank"><img border="0" src="../images/Logo-Wiki.png" width="123"></a></td>
  51.         <td id="tdtitle">
  52.         <h1>User defined Settings</h1></td>
  53.     <td id="tdLogo2"><?php echo $Path_Logo?></td>
  54.     </tr>
  55.   <tr>
  56.     <td colspan="4"><?php
  57.     echo "Logged in as: ";
  58.     $log $_SESSION["log"];
  59.     $ID $_SESSION["log2"];
  60.     echo $log;
  61.     ?></td>
  62.   </tr>    
  63.     <tr>
  64.         <td colspan="3" valign="top">
  65.         <table border="0 id="table2">
  66.     <?php
  67.     
  68.     /********************************************************************************************
  69.     * updating table usersettings with new parameters                                           *
  70.     * START                                                                                     *
  71.     *********************************************************************************************/
  72.     if($_POST['formSubmitSave']{
  73.  
  74.     $sql "SELECT ID_Setting FROM usersettings WHERE ID_User = '$ID'";
  75.     $result mysql_query($sql);
  76.     
  77.     $count mysql_num_rows($result);
  78.     if($count == '0')
  79.     {    $sqlnew "INSERT INTO usersettings (Sorting, RecordsPerPage, SortingSP, RecordsPerPageSP, ID_User) VALUES ('$sorting','$recordspage','$sortingsp','$recordspagesp','$ID')";
  80.          $resultnew mysql_query($sqlnew)}
  81.     else {
  82.          $sqlchange "UPDATE usersettings SET Sorting = '$sorting', RecordsPerPage = '$recordspage', 
  83.          SortingSP = '$sortingsp', RecordsPerPageSP = '$recordspagesp' WHERE ID_User = '$ID'";
  84.          $resultchange mysql_query($sqlchange);
  85.          
  86.          if ($resultchangeecho '<tr><td colspan="3"><span class="fine">Changes accepted.</span></td></tr>';  
  87.          }
  88.  
  89.  
  90.     }
  91.     
  92.     /********************************************************************************************
  93.     * updating table usersettings with new parameters                                           *
  94.     * END                                                                                       *
  95.     *********************************************************************************************/
  96.     
  97.     /********************************************************************************************
  98.     * start page                                                                                *
  99.     * START                                                                                     *
  100.     *********************************************************************************************/
  101.     
  102.     $sql "SELECT * FROM usersettings WHERE ID_User = '$ID'";
  103.     $result mysql_query($sql);
  104.  
  105.     while($row mysql_fetch_object($result))
  106.     $RecordsPerPage $row->RecordsPerPage;
  107.       $Sorting $row->Sorting;
  108.       $RecordsPerPageSP $row->RecordsPerPageSP;
  109.       $SortingSP $row->SortingSP}
  110.            
  111.     ?>
  112.     <tr><td colspan="3"><h3>Search for DNA samples:</h3></td></tr>
  113.          <tr>
  114.                 <td id="DescriptionBlack">
  115.                 Records per page (hitlist):</td>
  116.                 <td colspan="2">
  117.         <input name="recordspage" id="SelectLong" type="text" value="<?php echo $RecordsPerPage?>"/></td>
  118.     </tr>
  119.     <tr>
  120.                 <td id="DescriptionBlack">
  121.                 Sorting:</td>
  122.                 <td colspan="2">
  123.         <select name="sorting" id="SelectLong">
  124.           <option <?php if($Sorting == ""echo "selected "?>value="">----------</option>
  125.           <option <?php if($Sorting == "DNANo"echo "selected "?>value="DNANo">DNA Number</option>
  126.           <option <?php if($Sorting == "UnitIDS"echo "selected "?>value="UnitIDS">UnitID Specimen</option>
  127.           <option <?php if($Sorting == "CollCodeS"echo "selected "?>value="CollCodeS">Collection Code Specimen</option>          
  128.           <option <?php if($Sorting == "InstCodeS"echo "selected "?>value="InstCodeS">Institution Code Specimen</option>          
  129.           <option <?php if($Sorting == "Taxon"echo "selected "?>value="Taxon">Taxon Name</option>          
  130.         </select></td>
  131.     </tr>
  132.     <tr><td colspan="3"><h3>Search in Specimen Tool:</h3></td></tr>
  133.          <tr>
  134.                 <td id="DescriptionBlack">
  135.                 Records per page (hitlist):</td>
  136.                 <td colspan="2">
  137.         <input name="recordspagesp" id="SelectLong" type="text" value="<?php echo $RecordsPerPageSP?>"/></td>
  138.     </tr>
  139.     <tr>
  140.                 <td id="DescriptionBlack">
  141.                 Sorting:</td>
  142.                 <td colspan="2">
  143.         <select name="sortingsp" id="SelectLong">
  144.           <option <?php if($SortingSP == ""echo "selected "?>value="">----------</option>
  145.           <option <?php if($SortingSP == "SU"echo "selected "?>value="SU">UnitID Specimen</option>
  146.           <option <?php if($SortingSP == "CU"echo "selected "?>value="CU">Collection Code Specimen</option>          
  147.           <option <?php if($SortingSP == "IU"echo "selected "?>value="IU">Institution Code Specimen</option>          
  148.           <option <?php if($SortingSP == "TU"echo "selected "?>value="TU">Taxon Name</option>          
  149.         </select></td>
  150.     </tr>    
  151.       <tr>
  152.         <td id="DescriptionBlack"></td>
  153.         <td>
  154.           <input type="submit" value="Save" name="formSubmitSave" id="SelectLong"></td>
  155.     </tr>    
  156.             </table>
  157.       
  158.       <?php 
  159.     /********************************************************************************************
  160.     * start page                                                                                *
  161.     * END                                                                                     *
  162.     *********************************************************************************************/
  163.       ?>
  164.         </td>
  165.     </tr>
  166.   <tr>
  167.       <td id="DescriptionBlack" colspan="2"></td>
  168.       <td align="right"><input type="button" value="Return to Configuration Tool" name="formSubmitMenu" id="SelectLong" onClick="self.location.href = 'configuration.php';"></td>
  169.     </tr>
  170. </table>
  171.  <?php
  172.     /**
  173.     * including footer
  174.     */
  175.     include ("../footer.php")?>
  176.  
  177. </form>
  178. </div>
  179. </body>
  180.  
  181. </html>

Documentation generated on Tue, 29 Nov 2011 10:45:17 +0100 by phpDocumentor 1.4.3