<?php

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

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

	static $command = array();
	static $connect;
	$command['connect'] = $connect = '';
	$in = array();
	if (!(is_array($a = (interdire_scripts(invalideur_session($Cache, statuts_articles_visibles(table_valeur($GLOBALS["visiteur_session"], (string)'statut', null))))))))
		$in[]= $a;
	else $in = array_merge($in, $a);
	$in1 = array();
	if (!(is_array($a = (@$Pile[0]['statut']))))
		$in1[]= $a;
	else $in1 = array_merge($in1, $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'] = 'articles';
		$command['id'] = '_items';
		$command['from'] = array('articles' => 'spip_articles');
		$command['type'] = array();
		$command['groupby'] = array();
		$command['select'] = array("articles.titre",
		"articles.id_article",
		"articles.lang",
		"articles.statut");
		$command['orderby'] = array('articles.titre');
		$command['join'] = array();
		$command['limit'] = '';
		$command['having'] = 
			array();
	}
	$command['where'] = 
			array(
			array('=', 'articles.id_rubrique', sql_quote(@$Pile[0]['id_rubrique'], '','bigint(21) NOT NULL DEFAULT \'0\'')), sql_in('articles.statut',sql_quote($in)), (!(is_array(@$Pile[0]['statut'])?count(@$Pile[0]['statut']):strlen(@$Pile[0]['statut'])) ? '' : ((is_array(@$Pile[0]['statut'])) ? sql_in('articles.statut',sql_quote($in1)) : 
			array('=', 'articles.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/plan/prive/squelettes/inclure/plan-articles.html','html_70bb82ca9a5aee39243c6051fb048b86','_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="article-' .
$Pile[$SP]['id_article'] .
'" class="item" data-jstree=\'{"type":"article"}\' data-objet="article">
					<a href="' .
generer_url_entite($Pile[$SP]['id_article'],'article') .
'"
						' .
(($t1 = strval(interdire_scripts(((((entites_html(table_valeur(@$Pile[0], (string)'lang', null),true) == spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']))) ?'' :' ') ? spip_htmlentities($Pile[$SP]['lang'] ? $Pile[$SP]['lang'] : $GLOBALS['spip_lang']):''))))!=='' ?
		('hreflang="' . $t1 . '"') :
		'') .
'
						title="' .
(($t1 = strval(_T(objet_info('article','texte_objet'))))!=='' ?
		($t1 . (	' ' .
	$Pile[$SP]['id_article'])) :
		'') .
'">
						' .
(($t1 = strval(interdire_scripts(filtre_puce_statut_dist($Pile[$SP]['statut'],'article'))))!=='' ?
		($t1 . ' ') :
		'') .
interdire_scripts(((($a = couper(supprimer_numero(typo($Pile[$SP]['titre']), "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/plan/prive/squelettes/inclure/plan-articles.html","profiler"._LOG_AVERTISSEMENT);
	return $t0;
}


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

	static $command = array();
	static $connect;
	$command['connect'] = $connect = '';
	$in = array();
	if (!(is_array($a = (interdire_scripts(invalideur_session($Cache, statuts_articles_visibles(table_valeur($GLOBALS["visiteur_session"], (string)'statut', null))))))))
		$in[]= $a;
	else $in = array_merge($in, $a);
	$in1 = array();
	if (!(is_array($a = (@$Pile[0]['statut']))))
		$in1[]= $a;
	else $in1 = array_merge($in1, $a);
	$command['pagination'] = array((isset($Pile[0]['debut_nb_items']) ? $Pile[0]['debut_nb_items'] : null), 1);
	if (!isset($command['table'])) {
		$command['table'] = 'articles';
		$command['id'] = '_nb_items';
		$command['from'] = array('articles' => 'spip_articles');
		$command['type'] = array();
		$command['groupby'] = array();
		$command['select'] = array("articles.id_article");
		$command['join'] = array();
		$command['limit'] = '';
		$command['having'] = 
			array();
	}
	$command['orderby'] = array(((!sql_quote($in) OR sql_quote($in)==="''") ? 0 : ('FIELD(articles.statut,' . sql_quote($in) . ')')));
	$command['where'] = 
			array(
			array('=', 'articles.id_rubrique', sql_quote(@$Pile[0]['id_rubrique'], '','bigint(21) NOT NULL DEFAULT \'0\'')), sql_in('articles.statut',sql_quote($in)), (!(is_array(@$Pile[0]['statut'])?count(@$Pile[0]['statut']):strlen(@$Pile[0]['statut'])) ? '' : ((is_array(@$Pile[0]['statut'])) ? sql_in('articles.statut',sql_quote($in1)) : 
			array('=', 'articles.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/plan/prive/squelettes/inclure/plan-articles.html','html_70bb82ca9a5aee39243c6051fb048b86','_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_article',$Pile[0]['@id_article'] = 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/plan/prive/squelettes/inclure/plan-articles.html","profiler"._LOG_AVERTISSEMENT);
	return $t0;
}

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

function html_70bb82ca9a5aee39243c6051fb048b86($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_70bb82ca9a5aee39243c6051fb048b86($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 articles">
		<li id="articles-rubrique-' .
			@$Pile[0]['id_rubrique'] .
			'"
			class="item group' .
			(!(table_valeur($Pile["vars"], (string)'lister', null))  ?
					(' ' . ' ' . 'jstree-closed') :
					'') .
			'"
			data-jstree=\'{"type":"box_article"}\' data-objet="article">
			<strong>' .
			objet_afficher_nb(table_valeur($Pile["vars"], (string)'total', null),'article') .
			'</strong>
')) :
				'') .
		'

			' .
		(($t3 = BOUCLE_itemshtml_70bb82ca9a5aee39243c6051fb048b86($Cache, $Pile, $doublons, $Numrows, $SP))!=='' ?
				('
				<ul class="menu-items articles">
			' . $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_70bb82ca9a5aee39243c6051fb048b86', $Cache, $page, '../plugins-dist/plan/prive/squelettes/inclure/plan-articles.html');
}
?>