/*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*/
'Admins.Email'=>array('field'=>'Admins.Email','name'=>'[Email admin invitat@]','type'=>'joini','join'=>array('Admins ON Admins.ID=Instances.GuestID'),'subtype'=>'text'),
'Instances.LastGuestEdit'=>array('field'=>'Instances.LastGuestEdit','name'=>'[Ultima modifica fatta dall’admin invitat@]','type'=>'time'),
'Localities.Name'=>array('field'=>'Localities.Name'.$dlang,'name'=>'[Località]','type'=>'joini','join'=>array('Localities ON Localities.ID=Instances.LocalityID'),'subtype'=>'text'),
//--------------------------------
'Instances.Email'=>array('field'=>'Instances.Email','name'=>'Email di contatto','type'=>'text'),
'InstLangs.LangID'=>array('field'=>'InstLangs%.LangID','name'=>'Una lingua dichiarata ►','type'=>'join','join'=>array('InstLangs AS InstLangs% ON InstLangs%.InstID=Instances.ID'),'ord'=>false),
'Languages.NameXX'=>array('field'=>'Languages%.Name'.$dlang,'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.Name'.$dlang.' 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 AS InstLangs ON InstLangs.InstID=Instances.ID AND InstLangs.Pos=1'),'ord'=>false),
'Languages.NameXX.First'=>array('field'=>'Languages.Name'.$dlang,'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.NameXX'=>array('field'=>'OurLanguages%.Name'.$dlang,'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.Name'.$dlang.' 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.NameXX.First'=>array('field'=>'OurLanguages.Name'.$dlang,'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.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.PolID'=>array('field'=>'InstPolicies%.PolID','name'=>'[Una policy] ►','type'=>'join','join'=>array('InstPolicies AS InstPolicies% ON InstPolicies%.InstID=Instances.ID'),'ord'=>false),
'Policies.Name'=>array('field'=>'Policies%.Name','name'=>'[Una policy]','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'=>'Policies','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'),
// Questi qui sotto sono disabilitati perché le policy non sono "pesate"
/*'InstPolicies.PolID.First'=>array('field'=>'InstPolicies.PolID','name'=>'[Policy 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'=>'[Policy 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.TagID'=>array('field'=>'InstTags%.TagID','name'=>'[Una tag] ►','type'=>'join','join'=>array('InstTags AS 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),
'IntstActivity.Registrations.AVG'=>array('field'=>'InstActivity.Registrations','name'=>'Registrazioni ultima settimana','type'=>'joini','join'=>array('InstActivity ON InstActivity.InstID=Instances.ID'),'subtype'=>'int','wheremore'=>'InstActivity.Pos=1','ord'=>false),*/