Php+dojo database Save a way to drag a layout dojo here to download _php tips

Source: Internet
Author: User
Tags chr explode learn php
Look at the Dojo framework introduced by the boss, learn to write down. Just beginning to learn PHP please advise! Found not to send attachments. Send two code you have learned it yourself.
Copy Code code as follows:

<?php
Session_Start ();
if ($_session[' gh ']== ') {
Header (' location:login.php ');
}
Include ("config.php");
$sql = "SELECT * from module";
$result =mssql_query ($sql, $conn);
$num =mssql_num_rows ($result);
Echo $num;
?>
<style type= "Text/css" >
<!--
#container0 {
border:1px dotted #990033;
height:10px;
margin:10px;
}
-->
</style>
<script type= "Text/javascript" src= "Include/dojo.js" ></script>
<script type= "Text/javascript" >
Refer to the following two dojo packages
Dojo.require ("Dojo.style");
Dojo.require ("dojo.dnd.*");
function init () {
Use classname to take the list of elements and register it as Dojo.dnd.HtmlDragSour
var arr=dojo.html.getelementsbyclass (' Divdrag ')
for (Var i=0;i<arr.length;i++) {
var parentdiv=arr.parentnode.id
New Dojo.dnd.HtmlDragSource (ARR,PARENTDIV);
}
Defining containers
New Dojo.dnd.HtmlDropTarget ("Container0", ["Container0", <?php for ($p = 1; $p <= $num; $p + +) {
Echo ' "'. ' Container '. $p. ' ";
if ($p!= $num) {
echo ",";
}
}
Echo ']); ';

for ($p =1; $p <= $num; $p + +) {
Echo Chr (13). ' New Dojo.dnd.HtmlDropTarget ("Container '. $p. '", ["Container0", ';
for ($o =1; $o <= $num; $o + +) {
echo ' container '. $o. ' "
if ($o!= $num) {
echo ",";
}
}
Echo ']); ';
}
Echo Chr (13);

?>
}
Add to Window.onload Event
Window.onload=function () {init ();}
function Bjsave () {
Gr= ""
<?php
$sql = ' Select id from module ';
$result =mssql_query ($sql, $conn);
while ($myrow =mssql_fetch_array ($result))
Echo ' if (Mokuai '. $myrow [' id ']. Parentelement.id!= "Container0") {'. chr (13). ' gr=gr+ '. $myrow [' id ']. ' +"|" + Mokuai '. $myrow [' id ']. Parentelement.id+ "$" '. Chr (13). '} '. Chr (13);
?>
FORM1.GR.VALUE=GR;
Form1.submit ();
}
</script>
<div id= "Overdiv" style= "Position:absolute; Visibility:hide; z-index:1; " ></div>
<div id= "Container0" >
<?php
$sql = ' SELECT * from module where ID ' (select mokuaiid from geren where gh = '. $_session[' gh ') '.
$result =mssql_query ($sql, $conn);
while ($myrow =mssql_fetch_array ($result))
Echo ' <span class= "Divdrag" id= "Mokuai". $myrow [' id ']. ' style= ' border:1px dotted #990033; height:20px;width:100px; margin:5px; "Title=" '. $myrow [' Mmark ']. ' " > '. $myrow [' mn ']. ' </span> ';
?>
</div>
<table width= "98%" border= "1" cellspacing= "0" cellpadding= "0" >
<tr>
&LT;TD width= "valign=" "Top" >
<?php
for ($p =1; $p <= $num; $p = $p +2) {
Echo ' <div id= ' container '. $p. ' style= ' border:1px dotted #990033 height:100px;margin:10px; ">";
$sql = ' Select Mokuaiid from Geren where biaogeid= '. $p. ' and GH = '. $_session[' GH '];
$result =mssql_query ($sql, $conn);
while ($myrow =mssql_fetch_array ($result)) {
$sql = ' SELECT * from module where id= '. $myrow [' mokuaiid '];
$result 1=mssql_query ($sql, $conn);
while ($myrow 1=mssql_fetch_array ($result 1)) {
Echo ' <span class= ' Divdrag ' id= ' Mokuai '. $myrow 1[' id '. ' style= ' border:1px dotted #990033; height:20px;width:100px ; margin:5px; "Title=" '. $myrow 1[' Mmark ']. > '. $myrow 1[' mn ']. ' </span> ';
}
}
Echo ' </div> ';
}
?></td>
&LT;TD width= "valign=" "Top" >
<?php
for ($p =2; $p <= $num; $p = $p +2) {
Echo ' <div id= ' container '. $p. ' style= ' border:1px dotted #990033 height:100px;margin:10px; ">";
$sql = ' Select Mokuaiid from Geren where biaogeid= '. $p. ' and GH = '. $_session[' GH '];
$result =mssql_query ($sql, $conn);
while ($myrow =mssql_fetch_array ($result)) {
$sql = ' SELECT * from module where id= '. $myrow [' mokuaiid '];
$result 1=mssql_query ($sql, $conn);
while ($myrow 1=mssql_fetch_array ($result 1)) {
Echo ' <span class= ' Divdrag ' id= ' Mokuai '. $myrow 1[' id '. ' style= ' border:1px dotted #990033; height:20px;width:100px ; margin:5px; "Title=" '. $myrow 1[' Mmark ']. > '. $myrow 1[' mn ']. ' </span> ';
}
}
Echo ' </div> ';
}
?>
</td>
</tr>
</table>
<input type= "button" Name= "Submit" value= "Save Layout" onclick= "Bjsave ();"/>
<form id= "Form1" Name= "Form1" method= "Post" action= "savegr.php" >
<input name= "gr" type= "hidden" value= ""/>
</form>




Copy Code code as follows:

<?php
Session_Start ();
if ($_session[' gh ']== ') {
Header (' location:login.php ');
}
Include ("config.php");
$sql = ' Delete from Geren where gh= '. $_session[' GH '];
Mssql_query ($sql);
$gr =str_replace ("Container", "" ", $_post[' gr ']);
Echo $gr;
$array = Explode ("$", $gr);
For ($i =0 $i <=count ($array)-2; $i + +) {
$add =explode ("|", $array [$i]);
$sql = ' INSERT INTO Geren (MOKUAIID,BIAOGEID,GH) VALUES ("'. $add [0]. $add
[1]. ', ' '. $_session[' gh '. ' ") ';
echo $sql. ' <br> ';
Mssql_query ($sql);
}
Header ("location:view.php");
?>

Dojo here to download Http://download.dojotoolkit.org/release-0.3.1/dojo-0.3.1-ajax.zip

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.