...
This commit is contained in:
parent
93692a43ed
commit
c2aa9716d3
1 changed files with 30 additions and 20 deletions
|
@ -137,9 +137,9 @@ $cols=array(
|
|||
'TagID'=>array('name'=>'[Tags]','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID')),
|
||||
'Tags.Name'=>array('name'=>'Tags','type'=>'join','joini'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text'),
|
||||
|
||||
'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'int','join'=>'LEFT JOIN InstActivity ON InstActivity.InstID=Instances.ID','select'=>'MAX(Week) AS maxweek'),
|
||||
'Logins'=>array('name'=>'Logins ultima settimana','type'=>'int','join'=>'LEFT JOIN InstActivity ON InstActivity.InstID=Instances.ID','select'=>'MAX(Week) AS maxweek'),
|
||||
'Registrations'=>array('name'=>'Registrazioni ultima settimana','type'=>'int','join'=>'LEFT JOIN InstActivity ON InstActivity.InstID=Instances.ID','select'=>'MAX(Week) AS maxweek'),
|
||||
'Statuses'=>array('name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
|
||||
'Logins'=>array('name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
|
||||
'Registrations'=>array('name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','select'=>'MAX(Week) AS maxweek'),
|
||||
);
|
||||
|
||||
$types=array('bool','int','time','text','join','joini');
|
||||
|
@ -190,6 +190,7 @@ foreach ($cols as $key=>$val) {
|
|||
[closepar-6] => null
|
||||
*/
|
||||
|
||||
$sels=array();
|
||||
$joins=array();
|
||||
$where='';
|
||||
foreach ($_POST as $key=>$val) {
|
||||
|
@ -203,6 +204,8 @@ foreach ($_POST as $key=>$val) {
|
|||
if (!in_array($join,$joins))
|
||||
$joins[]=$join;
|
||||
}
|
||||
if ($buf[2]=='joini' && array_key_exists('select',$cols[$buf[1]]) && !in_array($cols[$buf[1]]['select'],$sels))
|
||||
$sels[]=$cols[$buf[1]]['select'];
|
||||
}
|
||||
} else {
|
||||
muoribene($dbg.'<br>Dati POST corrotti.<br>Puoi <a href="instances.php">riprovare</a> o <a href="index.php">tornare al login</a>.',true);
|
||||
|
@ -225,6 +228,11 @@ foreach ($_POST as $key=>$val) {
|
|||
if (preg_match('/^andor-\d+/',$key)===1 && preg_match('/^(AND|OR)$/',$val)===1)
|
||||
$where.=' '.$val.' ';
|
||||
}
|
||||
|
||||
if (count($sels)>0)
|
||||
$sels=', '.implode(', ',$sels);
|
||||
else
|
||||
$sels='';
|
||||
if ($where!='')
|
||||
$where='WHERE '.$where;
|
||||
if (count($joins)>0)
|
||||
|
@ -232,7 +240,7 @@ if (count($joins)>0)
|
|||
else
|
||||
$joins='';
|
||||
|
||||
$query='SELECT *, Instances.ID AS IID FROM Instances '.$joins.' '.$where.' GROUP BY IID ORDER BY Instances.URI ASC LIMIT 50';
|
||||
$query='SELECT *, Instances.ID AS IID'.$sels.' FROM Instances '.$joins.' '.$where.' GROUP BY IID ORDER BY Instances.URI ASC LIMIT 50';
|
||||
$dbg.='QUERONA: '.$query.'<br>'.N;
|
||||
$res=mysqli_query($link,$query)
|
||||
or muoribene($dbg.'<br>'.$query.': '.mysqli_error($link),true);
|
||||
|
@ -472,17 +480,15 @@ function addselopt(el,val,txt) {
|
|||
}
|
||||
function inpdisif(index) {
|
||||
var source=document.getElementById('condsel-'+index);
|
||||
var dest1=document.getElementById('valueinp-'+index);
|
||||
var dest2=document.getElementById('valuesel-'+index);
|
||||
var inp=document.getElementById('valueinp-'+index);
|
||||
var sel=document.getElementById('valuesel-'+index);
|
||||
var conds=['IS NULL','IS NOT NULL'];
|
||||
if (conds.includes(source.value)) {
|
||||
dest1.disabled=true;
|
||||
dest2.disabled=true;
|
||||
// dest.style='display:none';
|
||||
inp.disabled=true;
|
||||
sel.disabled=true;
|
||||
} else {
|
||||
dest1.disabled=false;
|
||||
dest2.disabled=false;
|
||||
// dest.style='display:block';
|
||||
if (inp.style.display!='none') inp.disabled=false;
|
||||
if (sel.style.display!='none') sel.disabled=false;
|
||||
}
|
||||
}
|
||||
function popusels(index) {
|
||||
|
@ -515,6 +521,10 @@ function popusels(index) {
|
|||
addselopt(condsel,'NOT LIKE','non contiene');
|
||||
addselopt(condsel,'=','è uguale a');
|
||||
addselopt(condsel,'!=','è diverso da');
|
||||
addselopt(condsel,'>=','è maggiore o uguale a');
|
||||
addselopt(condsel,'<=','è minore o uguale a');
|
||||
addselopt(condsel,'>','è maggiore di');
|
||||
addselopt(condsel,'<','è minore di');
|
||||
addselopt(condsel,'IS NOT NULL','è definito');
|
||||
addselopt(condsel,'IS NULL','non è definito');
|
||||
valsel.style='display:none';
|
||||
|
@ -524,12 +534,12 @@ function popusels(index) {
|
|||
condsel.setAttribute('onchange','inpdisif('+index+');');
|
||||
} else if (type=='int' || type=='time') {
|
||||
truncsel('condsel-'+index);
|
||||
addselopt(condsel,'>=','maggiore o uguale a');
|
||||
addselopt(condsel,'<=','minore o uguale a');
|
||||
addselopt(condsel,'>','maggiore di');
|
||||
addselopt(condsel,'<','minore di');
|
||||
addselopt(condsel,'=','uguale a');
|
||||
addselopt(condsel,'!=','diverso da');
|
||||
addselopt(condsel,'>=','è maggiore o uguale a');
|
||||
addselopt(condsel,'<=','è minore o uguale a');
|
||||
addselopt(condsel,'>','è maggiore di');
|
||||
addselopt(condsel,'<','è minore di');
|
||||
addselopt(condsel,'=','è uguale a');
|
||||
addselopt(condsel,'!=','è diverso da');
|
||||
addselopt(condsel,'IS NOT NULL','è definito');
|
||||
addselopt(condsel,'IS NULL','non è definito');
|
||||
valsel.style='display:none';
|
||||
|
@ -539,8 +549,8 @@ function popusels(index) {
|
|||
condsel.setAttribute('onchange','inpdisif('+index+');');
|
||||
} else if (type=='join') {
|
||||
truncsel('condsel-'+index);
|
||||
addselopt(condsel,'=','uguale a');
|
||||
addselopt(condsel,'!=','diverso da');
|
||||
addselopt(condsel,'=','è uguale a');
|
||||
addselopt(condsel,'!=','è diverso da');
|
||||
addselopt(condsel,'IS NOT NULL','è definito');
|
||||
addselopt(condsel,'IS NULL','non è definito');
|
||||
valsel.style='display:block';
|
||||
|
|
Loading…
Reference in a new issue