<?php

/*
 * Squelette : ../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html
 * Date :      Sun, 21 Jun 2020 17:06:05 GMT
 * Compile :   Thu, 09 Jul 2020 07:14:09 GMT
 * Boucles :   _items, _nb_items
 */ 

function BOUCLE_itemshtml_55efeee2904389e10473d5184db62c9e(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {

	static $command = array();
	static $connect;
	$command['connect'] = $connect = '';
	$in = array();
	if (!(is_array($a = (@$Pile[0]['statut']))))
		$in[]= $a;
	else $in = array_merge($in, $a);
	if (!isset($si_init)) { $command['si'] = array(); $si_init = true; }
	$command['si'][] = table_valeur($Pile["vars"], (string)'lister', null);

	if (!isset($command['table'])) {
		$command['table'] = 'syndic';
		$command['id'] = '_items';
		$command['from'] = array('syndic' => 'spip_syndic');
		$command['type'] = array();
		$command['groupby'] = array();
		$command['select'] = array("syndic.nom_site",
		"syndic.id_syndic",
		"syndic.statut",
		"syndic.url_site");
		$command['orderby'] = array('syndic.nom_site');
		$command['join'] = array();
		$command['limit'] = '';
		$command['having'] = 
			array();
	}
	$command['where'] = 
			array(
			array('=', 'syndic.id_rubrique', sql_quote(@$Pile[0]['id_rubrique'], '','bigint(21) NOT NULL DEFAULT \'0\'')), 
			array('REGEXP', 'syndic.statut', "'.*'"), (!(is_array(@$Pile[0]['statut'])?count(@$Pile[0]['statut']):strlen(@$Pile[0]['statut'])) ? '' : ((is_array(@$Pile[0]['statut'])) ? sql_in('syndic.statut',sql_quote($in)) : 
			array('=', 'syndic.statut', sql_quote(@$Pile[0]['statut'], '','varchar(10) NOT NULL DEFAULT \'0\'')))));
	if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime();
	$t0 = "";
	// REQUETE
	$iter = IterFactory::create(
		"SQL",
		$command,
		array('../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html','html_55efeee2904389e10473d5184db62c9e','_items',15,$GLOBALS['spip_lang'])
	);
	if (!$iter->err()) {
	
	$l1 = _T('public|spip|ecrire:info_sans_titre');$SP++;
	// RESULTATS
	while ($Pile[$SP]=$iter->fetch()) {

		$t0 .= (
'
				<li id="site-' .
$Pile[$SP]['id_syndic'] .
'" class="item" data-jstree=\'{"type":"site"}\' data-objet="site">
					<a href="' .
generer_url_entite($Pile[$SP]['id_syndic'],'site') .
'"
						title="' .
(($t1 = strval(_T(objet_info('site','texte_objet'))))!=='' ?
		($t1 . (	' ' .
	$Pile[$SP]['id_syndic'])) :
		'') .
'">
						' .
(($t1 = strval(interdire_scripts(filtre_puce_statut_dist($Pile[$SP]['statut'],'site'))))!=='' ?
		($t1 . ' ') :
		'') .
interdire_scripts(((($a = couper(typo(supprimer_numero(calculer_url($Pile[$SP]['url_site'],$Pile[$SP]['nom_site'], 'titre', $connect, false)), "TYPO", $connect, $Pile[0]),'80')) OR (is_string($a) AND strlen($a))) ? $a : $l1)) .
'
					</a>
				</li>
			');
	}
	$iter->free();
	}
	if (defined("_BOUCLE_PROFILER")
	AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER)
		spip_log(intval(1000*$timer)."ms BOUCLE_items @ ../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html","profiler"._LOG_AVERTISSEMENT);
	return $t0;
}


function BOUCLE_nb_itemshtml_55efeee2904389e10473d5184db62c9e(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {

	static $command = array();
	static $connect;
	$command['connect'] = $connect = '';
	$in = array();
	if (!(is_array($a = (@$Pile[0]['statut']))))
		$in[]= $a;
	else $in = array_merge($in, $a);
	$command['pagination'] = array((isset($Pile[0]['debut_nb_items']) ? $Pile[0]['debut_nb_items'] : null), 1);
	if (!isset($command['table'])) {
		$command['table'] = 'syndic';
		$command['id'] = '_nb_items';
		$command['from'] = array('syndic' => 'spip_syndic');
		$command['type'] = array();
		$command['groupby'] = array();
		$command['select'] = array("syndic.nom_site",
		"syndic.id_syndic");
		$command['orderby'] = array('syndic.nom_site');
		$command['join'] = array();
		$command['limit'] = '';
		$command['having'] = 
			array();
	}
	$command['where'] = 
			array(
			array('=', 'syndic.id_rubrique', sql_quote(@$Pile[0]['id_rubrique'], '','bigint(21) NOT NULL DEFAULT \'0\'')), 
			array('REGEXP', 'syndic.statut', "'.*'"), (!(is_array(@$Pile[0]['statut'])?count(@$Pile[0]['statut']):strlen(@$Pile[0]['statut'])) ? '' : ((is_array(@$Pile[0]['statut'])) ? sql_in('syndic.statut',sql_quote($in)) : 
			array('=', 'syndic.statut', sql_quote(@$Pile[0]['statut'], '','varchar(10) NOT NULL DEFAULT \'0\'')))));
	if (defined("_BOUCLE_PROFILER")) $timer = time()+(float)microtime();
	$t0 = "";
	// REQUETE
	$iter = IterFactory::create(
		"SQL",
		$command,
		array('../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html','html_55efeee2904389e10473d5184db62c9e','_nb_items',2,$GLOBALS['spip_lang'])
	);
	if (!$iter->err()) {
	
	// COMPTEUR
	$Numrows['_nb_items']['compteur_boucle'] = 0;
	$Numrows['_nb_items']['total'] = @intval($iter->count());
	$debut_boucle = isset($Pile[0]['debut_nb_items']) ? $Pile[0]['debut_nb_items'] : _request('debut_nb_items');
	if(substr($debut_boucle,0,1)=='@'){
		$debut_boucle = $Pile[0]['debut_nb_items'] = quete_debut_pagination('id_syndic',$Pile[0]['@id_syndic'] = substr($debut_boucle,1),1,$iter);
		$iter->seek(0);
	}
	$debut_boucle = intval($debut_boucle);
	$debut_boucle = (($tout=($debut_boucle == -1))?0:($debut_boucle));
	$debut_boucle = max(0,min($debut_boucle,floor(($Numrows['_nb_items']['total']-1)/(1))*(1)));
	$debut_boucle = intval($debut_boucle);
	$fin_boucle = min(($tout ? $Numrows['_nb_items']['total'] : $debut_boucle), $Numrows['_nb_items']['total'] - 1);
	$Numrows['_nb_items']['grand_total'] = $Numrows['_nb_items']['total'];
	$Numrows['_nb_items']["total"] = max(0,$fin_boucle - $debut_boucle + 1);
	if ($debut_boucle>0 AND $debut_boucle < $Numrows['_nb_items']['grand_total'] AND $iter->seek($debut_boucle,'continue'))
		$Numrows['_nb_items']['compteur_boucle'] = $debut_boucle;
	
	$SP++;
	// RESULTATS
	while ($Pile[$SP]=$iter->fetch()) {

		$Numrows['_nb_items']['compteur_boucle']++;
		if ($Numrows['_nb_items']['compteur_boucle'] <= $debut_boucle) continue;
		if ($Numrows['_nb_items']['compteur_boucle']-1 > $fin_boucle) break;
		$t0 .= (
'
	' .
vide($Pile['vars'][$_zzz=(string)'total'] = (isset($Numrows['_nb_items']['grand_total'])
			? $Numrows['_nb_items']['grand_total'] : $Numrows['_nb_items']['total'])) .
vide($Pile['vars'][$_zzz=(string)'lister'] = (((isset($Pile[0]['lister']) ? $Pile[0]['lister'] : '') == 'tout') OR ((isset($Numrows['_nb_items']['grand_total'])
			? $Numrows['_nb_items']['grand_total'] : $Numrows['_nb_items']['total']) <= plan_limiter_listes()))));
	}
	$iter->free();
	}
	if (defined("_BOUCLE_PROFILER")
	AND 1000*($timer = (time()+(float)microtime())-$timer) > _BOUCLE_PROFILER)
		spip_log(intval(1000*$timer)."ms BOUCLE_nb_items @ ../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html","profiler"._LOG_AVERTISSEMENT);
	return $t0;
}

//
// Fonction principale du squelette ../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html
// Temps de compilation total: 2.969 ms
//

function html_55efeee2904389e10473d5184db62c9e($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) {

	if (isset($Pile[0]["doublons"]) AND is_array($Pile[0]["doublons"]))
		$doublons = nettoyer_env_doublons($Pile[0]["doublons"]);

	$connect = '';
	$page = (
'
' .
(($t1 = BOUCLE_nb_itemshtml_55efeee2904389e10473d5184db62c9e($Cache, $Pile, $doublons, $Numrows, $SP))!=='' ?
		($t1 . (	'

' .
		(($t3 = strval(interdire_scripts((((entites_html(table_valeur(@$Pile[0], (string)'conteneur', null),true) == 'non')) ?'' :' '))))!=='' ?
				($t3 . (	'
	<ul class="menu-items sites syndic">
		<li id="syndic-rubrique-' .
			@$Pile[0]['id_rubrique'] .
			'"
			class="item group' .
			(!(table_valeur($Pile["vars"], (string)'lister', null))  ?
					(' ' . ' ' . 'jstree-closed') :
					'') .
			'"
			data-jstree=\'{"type":"box_site"}\' data-objet="site">
			<strong>' .
			objet_afficher_nb(table_valeur($Pile["vars"], (string)'total', null),'site') .
			'</strong>
')) :
				'') .
		'

			' .
		(($t3 = BOUCLE_itemshtml_55efeee2904389e10473d5184db62c9e($Cache, $Pile, $doublons, $Numrows, $SP))!=='' ?
				('
				<ul class="menu-items syndic">
			' . $t3 . '
				</ul>
			') :
				'') .
		'

' .
		(($t3 = strval(interdire_scripts((((entites_html(table_valeur(@$Pile[0], (string)'conteneur', null),true) == 'non')) ?'' :' '))))!=='' ?
				($t3 . '
		</li>
	</ul>
') :
				'') .
		'
')) :
		'') .
'
');

	return analyse_resultat_skel('html_55efeee2904389e10473d5184db62c9e', $Cache, $page, '../plugins-dist/sites/prive/squelettes/inclure/plan-syndic.html');
}
?>