fhiiqm/test/tabs_dyn_content.php
changeset 31 0a1eb975fbd9
parent 30 d02d02efc55a
--- a/fhiiqm/test/tabs_dyn_content.php	Fri Aug 31 14:22:20 2012 +0200
+++ b/fhiiqm/test/tabs_dyn_content.php	Fri Nov 16 10:39:25 2012 +0100
@@ -9,6 +9,8 @@
 
     error_reporting(E_ALL ^ E_NOTICE);
     header('Content-type: text/html; charset="iso-8859-1',true);    
+
+
     session_start();
     if (! isset($_SESSION["userid"]))
     { 
@@ -23,6 +25,8 @@
         exit;
     }    
 
+	include_once($_SERVER['DOCUMENT_ROOT'] ."/fhiiqm/inc/dbconnect.inc.php");
+	if (!isset($dbc) || !$dbc) $dbc = new dbconnection();
     $titel = "Test tabs"
 ?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -44,40 +48,7 @@
     <?php     
         echo "<h3>&nbsp;&nbsp;&nbsp;$titel </h3>";
         echo "<table width='80%'><tr>
-        <td class='bigger'>&nbsp;&nbsp;&nbsp;hier k&ouml;nnen Informationen erfasst und daneben die Produkte eingesehen werden<br /><br /><br /></td><td>";
-        
-    ?>
-    <form id="infol" method="POST" action="<?php $_SERVER['PHP_SELF'] ?>" enctype="application/x-www-form-urlencoded">
-    <table>
-        <tr><td>Infoliste sort nach</td>
-            <td><select name="s">
-                <option value="15">Kennzeichen</option>
-                <option value="2">Titel</option>
-                <option value="3">Kurzinfo</option>
-                <option value="4">Infotyp</option>
-                <option value="5">Produkt</option>
-                <option value="6">Adressat</option>
-                <option value="7">Verantwortlichen</option>
-                <option value="8">Autor</option>
-                <option value="9">erstellt am</option>
-                <option value="10">gültig ab</option>
-                <option value="11">gültig bis</option>
-                <option value="12">Status</option>
-            </select>
-            </td>
-        </tr>
-        <tr><td>Sortierrichtung</td>
-            <td><select name="d">
-                <option value="ASC">aufsteigend</option>
-                <option value="DESC">absteigend</option>
-            </select>
-            &nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="subil" value="sortieren" /></td>
-        </tr>
-    
-    </table>
-    </form>
-    <?php
-        echo "</td></tr></table>";
+        <td class='bigger'>&nbsp;&nbsp;&nbsp;hier k&ouml;nnen Informationen erfasst, editiert, angelistet und daneben die Produkte eingesehen werden<br /><br /><br /></td><td>";
         
         $zeil = $_GET["z"];
         if (!$zeil) $zeil = $_POST["z"];
@@ -94,9 +65,70 @@
     
         $fnum   = $_GET["f"];   // Spaltennummer, nach der aktuell gefiltert wird
         if (!isset($fnum) && !$fnum) $fnum = $_POST["f"];
+/*
+        $infoid = $_POST['id']; // aus Feld 'id'
+        if ($infoid == -1) $infoid=null;
+        else*/if (!$infoid) $infoid=$_GET['i'] ; // aus tab_info_flist.php
 //        print_r ($_GET); echo "<br /><br />";
+//        print_r ($_POST); echo "<br /><br />";
+
+//        $_GET['i'] = $infoid;   // fuer tab_info_ed.php, wenn klick aus info-liste
     ?>
-
+    <form id="infol" method="POST" action="<?php $_SERVER['PHP_SELF'] ?>" enctype="application/x-www-form-urlencoded">
+    <table>
+        <tr><td>Infoliste sort nach</td>
+            <td><select name="s">
+                <?php
+                $asort = array(15=>"Kennzeichen",2=>"Titel",3=>"Kurzinfo",4=>"Infotyp",5=>"Produkt",6=>"Adressat",
+                        7=>"Verantwortlichen",8=>"Autor",9=>"erstellt am",10=>"gültig ab",11=>"gültig bis",12=>"Status"); 
+                foreach ($asort as $key => $val)
+                {
+                    $select = ($sort == $key)? "selected" : "";
+                    echo "<option $select value='$key'>$val</option>\n";
+                }        
+                ?>
+            </select>
+            </td>
+        </tr>
+        <tr><td>Sortierrichtung</td>
+            <td><select name="d">
+                <?php $select = ($dir == "ASC")? "selected" : "";
+                echo "<option $select value='ASC'>aufsteigend</option>";
+                $select = ($dir == "DESC")? "selected" : "";
+                echo "<option $select value='DESC'>absteigend</option>"; ?>
+            </select>
+            &nbsp;&nbsp;&nbsp;<input type="submit" class="button" name="subil" id="subil" value="sortieren" /></td>
+        </tr>
+    
+    </table>
+    </form>
+    <?php
+        echo "</td></tr></table>";
+        
+    ?>
+<!--
+    <form id="infoi" method="POST" action="<?php $_SERVER['PHP_SELF'] ?>" enctype="application/x-www-form-urlencoded">
+    <table>
+        <tr><td>&nbsp;&nbsp;&nbsp;zu editierende Info wählen</td>
+            <td><select name="id" onchange="this.form.submit();">
+            <option value="-1">&nbsp;</option>
+            <?php
+            /*
+                $sql = " SELECT info_ID,info_name_s FROM Info ORDER BY 2";
+                if ($res = $dbc -> queryObjectArray($sql));
+                    foreach ($res as $row)
+                    {
+                        $select = ($row->info_ID == $infoid) ? "selected" : "";
+                        echo "<option $select value='$row->info_ID'>$row->info_ID - $row->info_name_s</option>\n";
+                    }
+             */                                
+            ?>            
+                </select>
+            </td>
+        <td>&nbsp;&nbsp;&nbsp;<a href="#tab_1" id="link_edit" class="link_edit">Edit Info</a></td></tr>
+    </table>
+    </form>
+-->
     <script>
     <!--
         $(function() {
@@ -135,31 +167,41 @@
                         }
             });
              $('.link_edit').click(function() { 
-                $('#tabs').tabs("url", 0, '/fhiiqm/test/tab_info_ed.php?i=123');
+                $('#tabs').tabs('select',0);
+                $('#tabs').tabs("url", 0, '/fhiiqm/test/tab_info_ed.php?i=<?php echo $infoid; ?>');
                 $('#tabs').tabs("load",0);
 //                window.location = $('#tabs').tabs( "option", "selected",0);
 //                alert ("url:" + $('#tabs').( "option", "selected" ));
 //                $('#tabs').bind('tabsshow', function(event, ui){document.location = $(document).attr('location').pathname + '#' + ui.panel.id +"?i=123";});                 alert ("url = "+ui.tab.href);
                 return false;
                 })
+/*
+             $('.info_edit').click(function() { 
+                $('#tabs').tabs('select',0);
+                $('#tabs').tabs("url", 0, '/fhiiqm/test/tab_info_ed.php?i=<?php echo $_GET["i"]; ?>');
+                $('#tabs').tabs("load",0);
+                return false;
+                })
+*/
+             $('#subil').click(function() { 
+                $('#tabs').tabs('select',1);
+                return true;
+                })
         });
     -->
 	</script>
 
-    <p>&nbsp;&nbsp;&nbsp;<a href="#tab_1" id="link_edit" class="link_edit">Edit Info</a></p>
+    <p>&nbsp;</p>
     <div id="tabs">
     	<ul>
-            <li><a href="#tab_1">Info editieren</a></li>
+            <li><a href="#tab_1">Info neu/editieren</a></li>
 <!--            <li><a href="#tab_2">Infoliste</a></li>   -->
     		<li><a href="/fhiiqm/test/tab_info_flist.php<?php echo "?f=$fnum&s=$sort&d=$dir&st=$start&z=$zeil";?>" class="thisPane">Infoliste</a></li>
     		<li><a href="/fhiiqm/test/tab_prod_hier.php?b=0&g=0&s=1">Produkte</a></li>
     	</ul>
         <div id="tab_1">
             <?php include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/test/tab_info_ed.php"); ?>
-        </div> <!-- tab_1 -->
-<!--        <div id="tab_2">
-            <?php // include ($_SERVER["DOCUMENT_ROOT"]."/fhiiqm/test/tab_info_flist.php"); ?>
-        </div> <!-- tab_2 -->
+        </div>            
     </div> <!-- tabs -->
  </body>
  </html>
\ No newline at end of file