diff --git a/web/admin/dafa.txt b/web/admin/dafa.txt index f587d20..f4f7302 100644 --- a/web/admin/dafa.txt +++ b/web/admin/dafa.txt @@ -3,8 +3,9 @@ * fatto ~ più o meno -* quando ordinamento è su una "1 a molti", eseguirlo su "GROUP_CONCAT" di questi molti ordinati per "Pos" della joinosa tabella +- instances.php: ckf: controllare che non venga eseguito ordinamento su una stessa colonna più volte (non rompe query ma è ridondante) +* instances.php: quando ordinamento è su una "1 a molti", eseguirlo su "GROUP_CONCAT" di questi molti ordinati per "Pos" della joinosa tabella * ripristinare le colonne descrittive in Languages: una per la locale impostata (it), una per en, una per fr, una per sp... * instancesh.php: ritornare di tutte solo quelle che effettivamente sono usate, magari con un count tra () * instances.php: definito/non definito non vengono riprodotte bene dalla plancia dopo post -* quando si seleziona definito/non definito, oltre a disabilitare il campo valsel/valinp, farlo sparire proprio? assegnargli un css che da disabilitato lo fa diventare tuttonero? tipo +* instances.php: quando si seleziona definito/non definito, oltre a disabilitare il campo valsel/valinp, farlo sparire proprio? assegnargli un css che da disabilitato lo fa diventare tuttonero? tipo diff --git a/web/admin/instances.php b/web/admin/instances.php index ac22d49..2dd3508 100644 --- a/web/admin/instances.php +++ b/web/admin/instances.php @@ -91,6 +91,7 @@ $dbg.='
'.print_r($_POST,1).'
'; /*SELECT *, Instances.ID AS IID, GROUP_CONCAT(OrdOurLanguages.NameIt ORDER BY OrdInstOurLangs.Pos ASC SEPARATOR '; ') AS OrdOurLangs FROM Instances LEFT JOIN InstOurLangs ON InstOurLangs.InstID=Instances.ID LEFT JOIN Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID LEFT JOIN InstOurLangs AS OrdInstOurLangs ON OrdInstOurLangs.InstID=Instances.ID LEFT JOIN Languages AS OrdOurLanguages ON OrdOurLanguages.ID=OrdInstOurLangs.OurLangID WHERE OurLanguages.NameIT LIKE '%italiano%' GROUP BY IID LIMIT 50*/ $cols=array( + 'Instances.New'=>array('field'=>'Instances.New','name'=>'Nuova','type'=>'bool'), 'Instances.Good'=>array('field'=>'Instances.Good','name'=>'Papabile','type'=>'bool'), 'Instances.Chosen'=>array('field'=>'Instances.Chosen','name'=>'Scelta','type'=>'bool'), @@ -102,6 +103,8 @@ $cols=array( 'Instances.LongDesc'=>array('field'=>'Instances.LongDesc','name'=>'Descrizione lunga','type'=>'text'), 'Instances.OurDesc'=>array('field'=>'Instances.OurDesc','name'=>'Descrizione nostra','type'=>'text'), +//-------------------------------- + 'Instances.LocalityID'=>array('field'=>'Instances.LocalityID','name'=>'Località ⮞','type'=>'join','join'=>array(),'ord'=>false), 'Localities.Locality'=>array('field'=>'Localities.Locality','name'=>'Località','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID'),'subtype'=>'text'), @@ -114,6 +117,8 @@ $cols=array( 'States.ID'=>array('field'=>'States.ID','name'=>'Stato ⮞','type'=>'join','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID','Regions ON Regions.ID=Provinces.RegionID','States ON States.ID=Regions.StateID'),'ord'=>false), 'States.State'=>array('field'=>'States.State','name'=>'Stato','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID','Provinces ON Provinces.ID=Localities.ProvinceID','Regions ON Regions.ID=Provinces.RegionID','States ON States.ID=Regions.StateID'),'subtype'=>'text'), +//-------------------------------- + 'Instances.Email'=>array('field'=>'Instances.Email','name'=>'Email di contatto','type'=>'text'), 'Instances.Software'=>array('field'=>'Instances.Software','name'=>'Software','type'=>'text'), 'Instances.Version'=>array('field'=>'Instances.Version','name'=>'Versione','type'=>'text'), @@ -133,35 +138,75 @@ $cols=array( 'Instances.AdmAvatar'=>array('field'=>'Instances.AdmAvatar','name'=>'Avatar admin','type'=>'text','search'=>false,'ord'=>false), 'Instances.AdmNote'=>array('field'=>'Instances.AdmNote','name'=>'Note dell’admin','type'=>'text'), - 'InstLangs.LangID'=>array('field'=>'InstLangs.LangID','name'=>'Lingue dichiarate ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'ord'=>false), - 'Languages.NameIT'=>array('field'=>'Languages.NameIT','name'=>'Lingue dichiarate','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstLangs AS OrdInstLangs ON OrdInstLangs.InstID=Instances.ID','Languages AS OrdLanguages ON OrdLanguages.ID=OrdInstLangs.LangID'),'ordselmore'=>'GROUP_CONCAT(OrdLanguages.NameIT ORDER BY OrdInstLangs.Pos ASC SEPARATOR \'\') AS xOrdLangs','ordby'=>'xOrdLangs'), - 'InstLangs.LangID.First'=>array('field'=>'InstLangs.LangID','name'=>'Lingua primaria dichiarata ⮞','type'=>'join','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID'),'wheremore'=>'InstLangs.Pos=1','ord'=>false), - 'Languages.NameIT.First'=>array('field'=>'Languages.NameIT','name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs ON InstLangs.InstID=Instances.ID','Languages ON Languages.ID=InstLangs.LangID'),'subtype'=>'text','wheremore'=>'InstLangs.Pos=1','ord'=>false), +//-------------------------------- - 'InstOurLangs.OurLangID'=>array('field'=>'InstOurLangs.OurLangID','name'=>'Lingue impostate da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'ord'=>false), - 'OurLanguages.NameIT'=>array('field'=>'OurLanguages.NameIT','name'=>'Lingue impostate da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstOurLangs AS OrdInstOurLangs ON OrdInstOurLangs.InstID=Instances.ID','Languages AS OrdOurLanguages ON OrdOurLanguages.ID=OrdInstOurLangs.OurLangID'),'ordselmore'=>'GROUP_CONCAT(OrdOurLanguages.NameIT ORDER BY OrdInstOurLangs.Pos ASC SEPARATOR \'\') AS xOrdOurLangs','ordby'=>'xOrdOurLangs'), - 'InstOurLangs.OurLangID.First'=>array('field'=>'InstOurLangs.OurLangID','name'=>'Lingua primaria impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID'),'wheremore'=>'InstOurLangs.Pos=1','ord'=>false), - 'OurLanguages.NameIT.First'=>array('field'=>'OurLanguages.NameIT','name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs ON InstOurLangs.InstID=Instances.ID','Languages AS OurLanguages ON OurLanguages.ID=InstOurLangs.OurLangID'),'subtype'=>'text','wheremore'=>'InstOurLangs.Pos=1','ord'=>false), + 'InstLangs'=>array('name'=>'Lingue dichiarate','search'=>false,'ord'=>false), - 'InstFinancing.FinID'=>array('field'=>'InstFinancing.FinID','name'=>'Modalità di finanziamento ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'ord'=>false), - 'Financing.Type'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstFinancing AS OrdInstFinancing ON OrdInstFinancing.InstID=Instances.ID','Financing AS OrdFinancing ON OrdFinancing.ID=OrdInstFinancing.FinID'),'ordselmore'=>'GROUP_CONCAT(OrdFinancing.Type ORDER BY OrdInstFinancing.Pos ASC SEPARATOR \'\') AS xOrdFinancing','ordby'=>'xOrdFinancing'), - 'InstFinancing.FinID.First'=>array('field'=>'InstFinancing.FinID','name'=>'Modalità di finanziamento primaria ⮞','type'=>'join','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID'),'wheremore'=>'InstFinancing.Pos=1','ord'=>false), - 'Financing.Type.First'=>array('field'=>'Financing.Type','name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing ON InstFinancing.InstID=Instances.ID','Financing ON Financing.ID=InstFinancing.FinID'),'subtype'=>'text','wheremore'=>'InstFinancing.Pos=1','ord'=>false), + 'InstLangs.LangID'=>array('field'=>'InstLangs%.LangID','name'=>'Una lingua dichiarata ⮞','type'=>'join','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID'),'ord'=>false), - 'InstPolicies.PolID'=>array('field'=>'InstPolicies.PolID','name'=>'Restrizioni sui contenuti ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'ord'=>false), - 'Policies.Name'=>array('field'=>'Policies.Name','name'=>'Restrizioni sui contenuti','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstPolicies AS OrdInstPolicies ON OrdInstPolicies.InstID=Instances.ID','Policies AS OrdPolicies ON OrdPolicies.ID=OrdInstPolicies.PolID'),'ordselmore'=>'GROUP_CONCAT(OrdPolicies.Name ORDER BY OrdInstPolicies.Pos ASC SEPARATOR \'\') AS xOrdPolicies','ordby'=>'xOrdPolicies'), - 'InstPolicies.PolID.First'=>array('field'=>'InstPolicies.PolID','name'=>'Restrizione sui contenuti primaria ⮞','type'=>'join','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID'),'wheremore'=>'InstPolicies.Pos=1','ord'=>false), - 'Policies.Name.First'=>array('field'=>'Policies.Name','name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies ON InstPolicies.InstID=Instances.ID','Policies ON Policies.ID=InstPolicies.PolID'),'subtype'=>'text','wheremore'=>'InstPolicies.Pos=1','ord'=>false), + 'Languages.NameIT'=>array('field'=>'Languages%.NameIT','name'=>'Una lingua dichiarata','type'=>'joini','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID','Languages AS Languages% ON Languages%.ID=InstLangs%.LangID'),'subtype'=>'text','ord'=>true,'ordname'=>'Lingue dichiarate','ordjoin'=>array('InstLangs AS OrdInstLangs ON OrdInstLangs.InstID=Instances.ID','Languages AS OrdLanguages ON OrdLanguages.ID=OrdInstLangs.LangID'),'ordselmore'=>'GROUP_CONCAT(OrdLanguages.NameIT ORDER BY OrdInstLangs.Pos ASC SEPARATOR \'\') AS xOrdLangs','ordby'=>'xOrdLangs'), - 'InstTags.TagID'=>array('field'=>'InstTags.TagID','name'=>'Tags ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'ord'=>false), - 'Tags.Name'=>array('field'=>'Tags.Name','name'=>'Tags','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text','ord'=>true,'ordjoin'=>array('InstTags AS OrdInstTags ON OrdInstTags.InstID=Instances.ID','Tags AS OrdTags ON OrdTags.ID=OrdInstTags.TagID'),'ordselmore'=>'GROUP_CONCAT(OrdTags.Name ORDER BY OrdInstTags.Pos ASC SEPARATOR \'\') AS xOrdTags','ordby'=>'xOrdTags'), - 'InstTags.TagID.First'=>array('field'=>'InstTags.TagID','name'=>'Tag primaria ⮞','type'=>'join','join'=>array('InstTags ON InstTags.InstID=Instances.ID'),'wheremore'=>'InstTags.Pos=1','ord'=>false), - 'Tags.Name.First'=>array('field'=>'Tags.Name','name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags ON InstTags.InstID=Instances.ID','Tags ON Tags.ID=InstTags.TagID'),'subtype'=>'text','wheremore'=>'InstTags.Pos=1','ord'=>false), + 'InstLangs.LangID.First'=>array('field'=>'InstLangs%.LangID','name'=>'Lingua primaria dichiarata ⮞','type'=>'join','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID AND InstLangs%.Pos=1'),'ord'=>false), -// queste 3 qui sotto se si usano sia per ricerca sia per ordinamento e/o se si usano congiuntamente per più ricerche e/o ordinamenti, producono query un po' sporche, con ridondanza di where clause "InstActivity.Pos=1", ma viva l'ottimizzatore :)) - 'InstActivity.Statuses.First'=>array('field'=>'InstActivity.Statuses','name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1'), - 'InstActivity.Logins.First'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1'), - 'IntstActivity.Registrations.First'=>array('field'=>'InstActivity.Registrations','name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1'), + 'Languages.NameIT.First'=>array('field'=>'Languages%.NameIT','name'=>'Lingua primaria dichiarata','type'=>'joini','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID AND InstLangs%.Pos=1','Languages AS Languages% ON Languages%.ID=InstLangs%.LangID'),'subtype'=>'text','ord'=>false), + +//-------------------------------- + + 'InstOurLangs'=>array('name'=>'Lingue impostate da noi','search'=>false,'ord'=>false), + + 'InstOurLangs.OurLangID'=>array('field'=>'InstOurLangs%.OurLangID','name'=>'Una lingua impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID'),'ord'=>false), + + 'OurLanguages.NameIT'=>array('field'=>'OurLanguages%.NameIT','name'=>'Una lingua impostata da noi','type'=>'joini','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID','Languages AS OurLanguages% ON OurLanguages%.ID=InstOurLangs%.OurLangID'),'subtype'=>'text','ord'=>true,'ordname'=>'Lingue impostate da noi','ordjoin'=>array('InstOurLangs AS OrdInstOurLangs ON OrdInstOurLangs.InstID=Instances.ID','Languages AS OrdOurLanguages ON OrdOurLanguages.ID=OrdInstOurLangs.OurLangID'),'ordselmore'=>'GROUP_CONCAT(OrdOurLanguages.NameIT ORDER BY OrdInstOurLangs.Pos ASC SEPARATOR \'\') AS xOrdOurLangs','ordby'=>'xOrdOurLangs'), + + 'InstOurLangs.OurLangID.First'=>array('field'=>'InstOurLangs%.OurLangID','name'=>'Lingua primaria impostata da noi ⮞','type'=>'join','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID AND InstOurLangs%.Pos=1'),'ord'=>false), + + 'OurLanguages.NameIT.First'=>array('field'=>'OurLanguages%.NameIT','name'=>'Lingua primaria impostata da noi','type'=>'joini','join'=>array('InstOurLangs AS InstOurLangs% ON InstOurLangs%.InstID=Instances.ID AND InstOurLangs%.Pos=1','Languages AS OurLanguages% ON OurLanguages%.ID=InstOurLangs%.OurLangID'),'subtype'=>'text','ord'=>false), + +//-------------------------------- + + 'InstFinancing'=>array('name'=>'Modalità di finanziamento','search'=>false,'ord'=>false), + + 'InstFinancing.FinID'=>array('field'=>'InstFinancing%.FinID','name'=>'Una modalità di finanziamento ⮞','type'=>'join','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID'),'ord'=>false), + + 'Financing.Type'=>array('field'=>'Financing%.Type','name'=>'Una modalità di finanziamento','type'=>'joini','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID','Financing AS Financing% ON Financing%.ID=InstFinancing%.FinID'),'subtype'=>'text','ord'=>true,'ordname'=>'Modalità di finanziamento','ordjoin'=>array('InstFinancing AS OrdInstFinancing ON OrdInstFinancing.InstID=Instances.ID','Financing AS OrdFinancing ON OrdFinancing.ID=OrdInstFinancing.FinID'),'ordselmore'=>'GROUP_CONCAT(OrdFinancing.Type ORDER BY OrdInstFinancing.Pos ASC SEPARATOR \'\') AS xOrdFinancing','ordby'=>'xOrdFinancing'), + + 'InstFinancing.FinID.First'=>array('field'=>'InstFinancing%.FinID','name'=>'Modalità di finanziamento primaria ⮞','type'=>'join','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID AND InstFinancing%.Pos=1'),'ord'=>false), + + 'Financing.Type.First'=>array('field'=>'Financing%.Type','name'=>'Modalità di finanziamento primaria','type'=>'joini','join'=>array('InstFinancing AS InstFinancing% ON InstFinancing%.InstID=Instances.ID AND InstFinancing%.Pos=1','Financing AS Financing% ON Financing%.ID=InstFinancing%.FinID'),'subtype'=>'text','ord'=>false), + +//-------------------------------- + + 'InstPolicies'=>array('name'=>'Restrizioni sui contenuti','search'=>false,'ord'=>false), + + 'InstPolicies.PolID'=>array('field'=>'InstPolicies%.PolID','name'=>'Una restrizione sui contenuti ⮞','type'=>'join','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID'),'ord'=>false), + + 'Policies.Name'=>array('field'=>'Policies%.Name','name'=>'Una restrizione sui contenuti','type'=>'joini','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID','Policies AS Policies% ON Policies%.ID=InstPolicies%.PolID'),'subtype'=>'text','ord'=>true,'ordname'=>'Restrizioni sui contenuti','ordjoin'=>array('InstPolicies AS OrdInstPolicies ON OrdInstPolicies.InstID=Instances.ID','Policies AS OrdPolicies ON OrdPolicies.ID=OrdInstPolicies.PolID'),'ordselmore'=>'GROUP_CONCAT(OrdPolicies.Name ORDER BY OrdInstPolicies.Pos ASC SEPARATOR \'\') AS xOrdPolicies','ordby'=>'xOrdPolicies'), + + 'InstPolicies.PolID.First'=>array('field'=>'InstPolicies%.PolID','name'=>'Restrizione sui contenuti primaria ⮞','type'=>'join','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID AND InstPolicies%.Pos=1'),'ord'=>false), + + 'Policies.Name.First'=>array('field'=>'Policies%.Name','name'=>'Restrizione sui contenuti primaria','type'=>'joini','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID AND InstPolicies%.Pos=1','Policies AS Policies% ON Policies%.ID=InstPolicies%.PolID'),'subtype'=>'text','ord'=>false), + +//-------------------------------- + + 'InstTags'=>array('name'=>'Tags','search'=>false,'ord'=>false), + + 'InstTags.TagID'=>array('field'=>'InstTags%.TagID','name'=>'Una tag ⮞','type'=>'join','join'=>array('InstTags% ON InstTags%.InstID=Instances.ID'),'ord'=>false), + + 'Tags.Name'=>array('field'=>'Tags%.Name','name'=>'Una tag','type'=>'joini','join'=>array('InstTags AS InstTags% ON InstTags%.InstID=Instances.ID','Tags AS Tags% ON Tags%.ID=InstTags%.TagID'),'subtype'=>'text','ord'=>true,'ordname'=>'Tags','ordjoin'=>array('InstTags AS OrdInstTags ON OrdInstTags.InstID=Instances.ID','Tags AS OrdTags ON OrdTags.ID=OrdInstTags.TagID'),'ordselmore'=>'GROUP_CONCAT(OrdTags.Name ORDER BY OrdInstTags.Pos ASC SEPARATOR \'\') AS xOrdTags','ordby'=>'xOrdTags'), + + 'InstTags.TagID.First'=>array('field'=>'InstTags%.TagID','name'=>'Tag primaria ⮞','type'=>'join','join'=>array('InstTags AS InstTags% ON InstTags%.InstID=Instances.ID AND InstTags%.Pos=1'),'ord'=>false), + + 'Tags.Name.First'=>array('field'=>'Tags%.Name','name'=>'Tag primaria','type'=>'joini','join'=>array('InstTags AS InstTags% ON InstTags%.InstID=Instances.ID AND InstTags%.Pos=1','Tags AS Tags% ON Tags%.ID=InstTags%.TagID'),'subtype'=>'text','ord'=>false), + +//-------------------------------- + + 'InstActivity.Statuses.First'=>array('field'=>'InstActivity.Statuses','name'=>'Stati ultima settimana','type'=>'joini','join'=>array('InstActivity AS InstActivity ON InstActivity.InstID=Instances.ID AND InstActivity.Pos=1'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID AND OrdInstActivity.Pos=1'),'ordselmore'=>1,'ordby'=>'OrdInstActivity.Statuses'), + + 'InstActivity.Logins.First'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity AS InstActivity ON InstActivity.InstID=Instances.ID AND InstActivity.Pos=1'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID AND OrdInstActivity.Pos=1'),'ordselmore'=>1,'ordby'=>'OrdInstActivity.Logins'), + + 'IntstActivity.Registrations.First'=>array('field'=>'InstActivity.Registrations','name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity AS InstActivity ON InstActivity.InstID=Instances.ID AND InstActivity.Pos=1'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID AND OrdInstActivity.Pos=1'),'ordselmore'=>1,'ordby'=>'OrdInstActivity.Registrations'), + +//-------------------------------- /*'InstActivity.Statuses.AVG'=>array('field'=>'InstActivity.Statuses','name'=>'Media stati ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','ord'=>true,'ordjoin'=>array('InstActivity AS OrdInstActivity ON OrdInstActivity.InstID=Instances.ID'),'ordselmore'=>'AVG(InstActivity.Statuses) AS avgstatuses'), 'InstActivity.Logins.AVG'=>array('field'=>'InstActivity.Logins','name'=>'Logins ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1','ord'=>false), @@ -182,10 +227,14 @@ foreach ($cols as $key=>$arr) { } } if (!array_key_exists('ord',$arr) || $arr['ord']==true) { + if (!array_key_exists('ordname',$arr)) + $name=$arr['name']; + else + $name=$arr['ordname']; if ($arr['type']=='joini') { - $ordfieldselopts.=''; + $ordfieldselopts.=''; } else { - $ordfieldselopts.=''; + $ordfieldselopts.=''; } } } @@ -194,8 +243,9 @@ $pblocks=0; foreach ($_POST as $key=>$val) if (preg_match('/^openpar-\d+$/',$key)===1) $pblocks++; -$i=0; -$ii=0; +$fi=0; +$ji=0; +$oi=0; $jsaddrows=''; $jssetrows=''; $jsordaddrows=''; @@ -207,22 +257,23 @@ $where=''; $order=''; foreach ($_POST as $key=>$val) { if (preg_match('/^openpar-\d+$/',$key)===1) { - $i++; + $fi++; if (preg_match('/^\(+$/',$val)===1) $where.=$val; - $jsaddrows.='addrow('.$i.',false);'.N; - $jssetrows.='setrow('.$i.','.json_encode($val); + $jsaddrows.='addrow('.$fi.',false);'.N; + $jssetrows.='setrow('.$fi.','.json_encode($val); } if (preg_match('/^fieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) { $tagk=$buf[1]; $type=$buf[2]; $subtype=$buf[3]; if (array_key_exists($tagk,$cols) && in_array($type,$types)) { - if (array_key_exists('wheremore',$cols[$tagk])) - $where.='('; - $where.=$cols[$tagk]['field']; + if (strpos($cols[$tagk]['field'],'%')!==false) + $ji++; + $where.=str_replace('%',$ji,$cols[$tagk]['field']); if ($type=='join' || $type=='joini') { foreach ($cols[$tagk]['join'] as $join) { + $join=str_replace('%',$ji,$join); if (!in_array($join,$joins)) $joins[]=$join; } @@ -246,8 +297,6 @@ foreach ($_POST as $key=>$val) { } if (preg_match('/^valuesel-\d+$/',$key)===1) { $where.=$val; - if (array_key_exists('wheremore',$cols[$tagk])) - $where.=' AND '.$cols[$tagk]['wheremore'].')'; $jssetrows.=','.json_encode($val); $jssetrows.=',""'; } @@ -256,9 +305,7 @@ foreach ($_POST as $key=>$val) { $where.='\'%'.myesc($link,$val).'%\''; else $where.='\''.myesc($link,$val).'\''; - if (array_key_exists('wheremore',$cols[$tagk])) - $where.=' AND '.$cols[$tagk]['wheremore'].')'; - $jssetrows.=',"NOMMITROVIHODETTO!"'; + $jssetrows.=',"NOMMITROVI!"'; $jssetrows.=','.json_encode($val); } if (preg_match('/^closepar-\d+$/',$key)===1) { @@ -267,45 +314,41 @@ foreach ($_POST as $key=>$val) { $jssetrows.=','.json_encode($val); } if (preg_match('/^andor-\d+$/',$key)===1 && preg_match('/^AND|OR$/',$val)===1) { - if ($i<$pblocks) + if ($fi<$pblocks) $where.=' '.$val.' '; $jssetrows.=','.json_encode($val).');'.N; } if (preg_match('/^ordfieldsel-\d+$/',$key)===1 && preg_match('/^(.+):(.+):(.+)$/',$val,$buf)===1) { - $ii++; + $oi++; $tagk=$buf[1]; $type=$buf[2]; $subtype=$buf[3]; if (array_key_exists($tagk,$cols) && in_array($type,$types)) { - if (!array_key_exists('ordby',$cols[$tagk])) { - $order.=$cols[$tagk]['field']; - if ($type=='join' || $type=='joini') { + if ($type=='join' || $type=='joini') { + if (!array_key_exists('ordjoin',$cols[$tagk])) { foreach ($cols[$tagk]['join'] as $join) if (!in_array($join,$joins)) $joins[]=$join; + } else { + foreach ($cols[$tagk]['ordjoin'] as $join) + if (!in_array($join,$joins)) + $joins[]=$join; } + } + if (!array_key_exists('ordby',$cols[$tagk])) { + $order.=$cols[$tagk]['field']; } else { -// qui si dà per scontato che se 'ordby' esiste esistono anche 'ordjoin' e 'ordselmore' - foreach ($cols[$tagk]['ordjoin'] as $join) - if (!in_array($join,$joins)) - $joins[]=$join; if (!in_array($cols[$tagk]['ordselmore'],$sels)) $sels[]=$cols[$tagk]['ordselmore']; $order.=$cols[$tagk]['ordby']; } - if (array_key_exists('wheremore',$cols[$tagk])) { - if ($where!='') - $where.=' AND '.$cols[$tagk]['wheremore']; - else - $where.=$cols[$tagk]['wheremore']; - } if (array_key_exists('havings',$cols[$tagk]) && !in_array($cols[$tagk]['havings'],$havings)) $havings[]=$cols[$tagk]['havings']; if (array_key_exists('selmore',$cols[$tagk]) && !in_array($cols[$tagk]['selmore'],$sels)) $sels[]=$cols[$tagk]['selmore']; - $jsordaddrows.='ordaddrow('.$ii.',false);'.N; - $jsordsetrows.='ordsetrow('.$ii.','.json_encode($val); + $jsordaddrows.='ordaddrow('.$oi.',false);'.N; + $jsordsetrows.='ordsetrow('.$oi.','.json_encode($val); } else { muoribene($dbg.'
Dati POST corrotti.
Puoi riprovare resettando i parametri o tornare al login.',true); } @@ -443,9 +486,9 @@ if (mysqli_num_rows($res)<1) { $i++; $buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']'); } - $out.='
'.$cols['Languages.NameIT']['name'].': '.implode('; ',$buf).'
'.N; + $out.='
'.$cols['InstLangs']['name'].': '.implode('; ',$buf).'
'.N; } else { - $out.='
'.$cols['Languages.NameIT']['name'].': Non definite
'.N; + $out.='
'.$cols['InstLangs']['name'].': Non definite
'.N; } $sres=mysqli_query($link,'SELECT * FROM InstOurLangs LEFT JOIN Languages ON Languages.ID=OurLangID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC') or muoribene(mysqli_error($link),true); @@ -456,9 +499,9 @@ if (mysqli_num_rows($res)<1) { $i++; $buf[]=$i.': '.hspech($srow['Code'].' ['.$srow['NameIT'].']'); } - $out.='
'.$cols['OurLanguages.NameIT']['name'].': '.implode('; ',$buf).'
'.N; + $out.='
'.$cols['InstOurLangs']['name'].': '.implode('; ',$buf).'
'.N; } else { - $out.='
'.$cols['OurLanguages.NameIT']['name'].': Non definite
'.N; + $out.='
'.$cols['InstOurLangs']['name'].': Non definite
'.N; } $sres=mysqli_query($link,'SELECT * FROM InstFinancing LEFT JOIN Financing ON Financing.ID=FinID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC') or muoribene(mysqli_error($link),true); @@ -469,9 +512,9 @@ if (mysqli_num_rows($res)<1) { $i++; $buf[]=$i.': '.hspech($srow['Type']); } - $out.='
'.$cols['Financing.Type']['name'].': '.implode('; ',$buf).'
'.N; + $out.='
'.$cols['InstFinancing']['name'].': '.implode('; ',$buf).'
'.N; } else { - $out.='
'.$cols['Financing.Type']['name'].': Non definite
'.N; + $out.='
'.$cols['InstFinancing']['name'].': Non definite
'.N; } $sres=mysqli_query($link,'SELECT * FROM InstPolicies LEFT JOIN Policies ON Policies.ID=PolID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC') or muoribene(mysqli_error($link),true); @@ -482,9 +525,9 @@ if (mysqli_num_rows($res)<1) { $i++; $buf[]=$i.': '.hspech($srow['Name']); } - $out.='
'.$cols['Policies.Name']['name'].': '.implode('; ',$buf).'
'.N; + $out.='
'.$cols['InstPolicies']['name'].': '.implode('; ',$buf).'
'.N; } else { - $out.='
'.$cols['Policies.Name']['name'].': Non definite
'.N; + $out.='
'.$cols['InstPolicies']['name'].': Non definite
'.N; } $sres=mysqli_query($link,'SELECT * FROM InstTags LEFT JOIN Tags ON Tags.ID=TagID WHERE InstID='.$row['IID'].' ORDER BY Pos ASC') or muoribene(mysqli_error($link),true); @@ -495,9 +538,9 @@ if (mysqli_num_rows($res)<1) { $i++; $buf[]=$i.': '.hspech($srow['Name']); } - $out.='
'.$cols['Tags.Name']['name'].': '.implode('; ',$buf).'
'.N; + $out.='
'.$cols['InstTags']['name'].': '.implode('; ',$buf).'
'.N; } else { - $out.='
'.$cols['Tags.Name']['name'].': Non definite
'.N; + $out.='
'.$cols['InstTags']['name'].': Non definite
'.N; } $out.='
'.$cols['Instances.Email']['name'].': '.nully($row['Email'],true,'email').'
'.N; $out.='
'.$cols['Instances.Software']['name'].': '.nully($row['Software'],false,'strip').'
'.N; @@ -523,6 +566,12 @@ if (mysqli_num_rows($res)<1) { $out.='
'; } +$filtpresopts=''.N; +$res=mysqli_query($link,'SELECT * FROM FilterPresets') + or muoribene(mysqli_error($link),true); +while ($row=mysqli_fetch_assoc($res)) + $filtpresopts.=''.N; + mysqli_close($link); ?> @@ -709,8 +758,10 @@ function addrow(index,refresh) { newcell3.innerHTML=''; newcell4.innerHTML=''; newcell5.innerHTML=''; - newcell6.innerHTML=''; - newcell7.innerHTML=''; + newcell6.innerHTML=''; + newcell6.style.width='22px'; + newcell7.innerHTML=''; + newcell7.style.width='22px'; if (refresh) { synctai(); popusels(index,false); @@ -729,8 +780,8 @@ function ordaddrow(index,refresh) { newcell3.style.width='1%'; newcell0.innerHTML=''; newcell1.innerHTML=''; - newcell2.innerHTML=''; - newcell3.innerHTML=''; + newcell2.innerHTML=''; + newcell3.innerHTML=''; if (refresh) synctoi(); } @@ -950,6 +1001,54 @@ function pupwait(on) { pup.style.display='none'; } } + +//function setrow(index,openparv,fieldselv,condselv,valueselv,valueinpv,closeparv,andorv) +function loadfiltpres() { + pupwait(true); + truncfil(); + let formdata=new FormData(); + formdata.append('act','loadfil'); + formdata.append('fid',document.getElementById('filtpres').value); + let xhr=new XMLHttpRequest(); + xhr.open('POST','loadsavepres.php'); + xhr.responseType='json'; + xhr.send(formdata); + xhr.onload=function() { + let jarr=xhr.response; + for (i=0; i0) + document.getElementById('filbut').value='Rimuovi tutti i criteri di ricerca'; + pupwait(false); + }; + xhr.onerror=function() { + alert('Request failed'); + }; +} +function savefiltpres() { + pupwait(true); + let formdata=new FormData(document.forms.f); + formdata.append('act','savefil'); + formdata.append('fid',document.getElementById('filtpres').value); + let xhr=new XMLHttpRequest(); + xhr.open('POST','loadsavepres.php'); + xhr.responseType='json'; + xhr.send(formdata); + xhr.onload=function() { + console.log(xhr.response); + pupwait(false); + }; + xhr.onerror=function() { + alert('Request failed'); + }; +} + //--> @@ -984,19 +1083,20 @@ function pupwait(on) { -
+
+
Preset di ricerca: 
-
+