init
This commit is contained in:
68
modules/EcmDocuments/generateTree.php
Executable file
68
modules/EcmDocuments/generateTree.php
Executable file
@@ -0,0 +1,68 @@
|
||||
<?
|
||||
set_time_limit(300);
|
||||
ob_start();
|
||||
session_start();
|
||||
include("../../config.php");
|
||||
$sql=mysql_connect($sugar_config['dbconfig']['db_host_name'],$sugar_config['dbconfig']['db_user_name'],$sugar_config['dbconfig']['db_password']);
|
||||
mysql_select_db($sugar_config['dbconfig']['db_name']);
|
||||
|
||||
function generateTree($iddir,$html)
|
||||
{
|
||||
$z="select id,name,no from ecmdocuments where iddir='".$iddir."'";
|
||||
$w=mysql_query($z);
|
||||
//print $z;
|
||||
while($r=mysql_fetch_array($w))
|
||||
{
|
||||
if($r['no']<10)$nod=0;
|
||||
else $nod="";
|
||||
|
||||
$html.="<div style='display:none;' id='all".$r['id']."'><table cellspacing='0' cellpadding='0' border='0'>
|
||||
<tr valign='top'>
|
||||
<td width='10' style='width:10px;'>
|
||||
<a style='cursor:pointer;' onclick='toggle_block(\"blocktree".$r['id']."\");'>
|
||||
<img id='plusminus".$r['id']."' src='modules/EcmDocuments/images/plus.gif' border='0'>
|
||||
</a>
|
||||
</td>
|
||||
<td width='10' style='width:10px;'>
|
||||
<img id='image".$r['id']."' src='modules/EcmDocuments/images/Folder.gif' border='0'>
|
||||
</td>
|
||||
<td width='999'>
|
||||
<a name='linktree".$r['id']."' onclick='' id='linktree".$r['id']."' href='index.php?module=EcmDocuments&action=DetailView&record=".$r['id']."'>".$nod.$r['no'].".".$r['name']."</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan='3'>
|
||||
<div style='display:none;margin-left:17px;' id='blocktree".$r['id']."'>";
|
||||
$html=generateTree($r['id'],$html);
|
||||
$html.="</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table></div>
|
||||
";
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
$html='<?
|
||||
$offset = 3600 * 24;
|
||||
header("Cache-Control: max-age=".$offset.", must-revalidate");
|
||||
$expire = "Expires: " . gmdate("D, d M Y H:i:s", time() + $offset) . " GMT";
|
||||
header($expire);
|
||||
$gmt_mtime = gmdate("D, d M Y H:i:s", time() ) . " GMT";
|
||||
header("Last-Modified: " . $gmt_mtime );
|
||||
?>';
|
||||
|
||||
$html.=generateTree("0","");
|
||||
|
||||
|
||||
print $html;
|
||||
|
||||
$filename = "../../tree.php";
|
||||
$plik = file($filename);
|
||||
$fp = fopen($filename,"w");
|
||||
flock($fp,2);
|
||||
fputs($fp,$html);
|
||||
flock($fp,3);
|
||||
fclose($fp);
|
||||
mysql_close($sql);
|
||||
?>
|
||||
Reference in New Issue
Block a user