Files
crm.e5.pl/modules/EcmDocuments/show_related_ecm.php
2024-04-27 09:23:34 +02:00

41 lines
1.5 KiB
PHP
Executable File

<?
session_start();
require_once("../../config.php");
print '<html >
<head >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
';
$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']);
mysql_query("set names utf8");
mysql_query("set charaecterset utf8");
require_once("dirstree.php");
$z="select ecmdocument_id from ".$_REQUEST['relation']." where ".$_REQUEST['relationid']."='".$_REQUEST['record']."' and deleted=0";
$rr=mysql_fetch_array(mysql_query("select name from ".str_replace("ecmdocuments_","",$_REQUEST['relation'])." where id='".$_REQUEST['record']."'"));
$name=$rr['name'];
$w=mysql_query($z);
while($r=mysql_fetch_array($w))$idp[]=$r['ecmdocument_id'];
$linked_path="";
if(mysql_num_rows($w)>0)
{
foreach($idp as $ids)
{
$bl=explode("||",$ids."||".check_block($ids,""));
for($i=count($bl)-1;$i>=0;$i--)
{
$z="select name,id,no from ecmdocuments where id='".$bl[$i]."'";
$w=mysql_query($z);
$r=mysql_fetch_array($w);
if($r['name'])$linked_path.='<a class=utilsLink href=index.php?module=EcmDocuments&action=DetailView&record='.$r['id'].'>'.$r['no'].'.'.$r['name'].'</a> / ';
}
$linked_path.="<br>";
}
}
print shortlinkdescription("name",255,$_REQUEST['record'],$linked_path,"",$_REQUEST['module'],1,$name);
mysql_close($sql);
print "</body></html>";
?>