44 lines
2.3 KiB
PHP
44 lines
2.3 KiB
PHP
<?php
|
|
|
|
require('include/glob.php');
|
|
require('include/muoribene.php');
|
|
require('include/sessionstart.php');
|
|
|
|
$cols=array(
|
|
'PlaceID'=>array('select'=>'SELECT Places.ID AS Pid, CONCAT(Locality,\' (\',COUNT(Places.ID),\')\') AS Txt FROM Instances LEFT JOIN Places ON Places.ID=PlaceID WHERE PlaceID IS NOT NULL ORDER BY Locality ASC','optcol'=>'Pid','txtcol'=>'Txt'),
|
|
'LangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',COUNT(Languages.ID),\')\') AS Txt FROM InstLangs LEFT JOIN Languages ON Languages.ID=LangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
|
|
'OurLangID'=>array('select'=>'SELECT Languages.ID AS Lid, CONCAT(Code,\' (\',COUNT(Languages.ID),\')\') AS Txt FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID GROUP BY Languages.ID ORDER BY Code ASC','optcol'=>'Lid','txtcol'=>'Txt'),
|
|
'FinID'=>array('select'=>'SELECT Financing.ID AS Fid, CONCAT(Type,\' (\',COUNT(Financing.ID),\')\') AS Txt FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID GROUP BY Financing.ID ORDER BY Type ASC ','optcol'=>'Fid','txtcol'=>'Txt'),
|
|
'PolID'=>array('select'=>'SELECT Policies.ID AS Pid, CONCAT(Name,\' (\',COUNT(Policies.ID),\')\') AS Txt FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID GROUP BY Policies.ID ORDER BY Name ASC','optcol'=>'Pid','txtcol'=>'Txt'),
|
|
'TagID'=>array('select'=>'SELECT Tags.ID AS Tid, CONCAT(Name,\' (\',COUNT(Tags.ID),\')\') AS Txt FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID GROUP BY (Tags.ID) ORDER BY Name ASC','optcol'=>'Tid','txtcol'=>'Txt'),
|
|
);
|
|
|
|
if (array_key_exists('key',$_GET) && array_key_exists('parsel',$_GET) && array_key_exists($_GET['key'],$cols)) {
|
|
require('include/myconn.php');
|
|
$res=mysqli_query($link,$cols[$_GET['key']]['select'])
|
|
or muoribene(mysqli_error($link),true);
|
|
mysqli_close($link);
|
|
$jsout='e=window.parent.document.getElementById(\''.$_GET['parsel'].'\');'.N;
|
|
while ($row=mysqli_fetch_assoc($res)) {
|
|
$jsout.='o=new Option('.json_encode($row[$cols[$_GET['key']]['txtcol']]).','.$row[$cols[$_GET['key']]['optcol']].');e.add(o);'.N;
|
|
}
|
|
}
|
|
|
|
$out='Ciao!';
|
|
|
|
?>
|
|
<!DOCTYPE HTML>
|
|
<html lang="it">
|
|
<head>
|
|
<title>Mastodon Startpage Admin - Istanze - Helper</title>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
<script language="JavaScript">
|
|
<!--
|
|
<?php echo($jsout); ?>
|
|
//-->
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<?php echo($out); ?>
|
|
</body>
|
|
</html>
|