<?php
/*
  ===============================================================

  inGenio X
  http://ingenio.area421.com

  Created by 
  Julian Moreno Hidalgo (Software developer)
  Jesus Moreno Hidalgo (Communication's tree)

  inGenio X is a free software licensed under CC-GNU GPL

  ===============================================================
*/
	if (!defined("IGNX")) { die("Attempt..."); }

if (isset($_GET["vm"]))
{

	$vermas = $_GET["vm"];

	if ($vermas == 1)
	{
		$campo_ver = " AND votos>0";
		$campo_orden = "votos";
		$vermas_ruta = LEN_108;
	
	} else if ($vermas == 2)
	{
		$campo_ver = " AND lecturas>0";
		$campo_orden = "lecturas";
		$vermas_ruta = LEN_109;
		
	} else if ($vermas == 3)
	{
		$campo_ver = "";
		$campo_orden = "itemID";
		$vermas_ruta = LEN_110;
	}
	
	// Smarty
	$smarty->assign("vermas", $vermas);
	$smarty->assign("vermas_ruta", $vermas_ruta);

	$salida_vermas = array();
	$q = myquery("SELECT * FROM ".ITEMS." WHERE enabled=1 AND item_tipo=1 AND catID>0".$campo_ver." ORDER BY orden DESC, ".$campo_orden." DESC limit ".$sig.", ".CONFIG_11."","[var_vm=1]");
	$i=0;
	while ($row = myfetch($q))
	{
			
			include ("./ints/inc/inc_item_list.php");
			
			$indice_ini = $i/CONFIG_57;
			$indice_fin = ($i+1)/CONFIG_57;
				
			if (is_int($indice_ini))
			{
				
				$row["salida_gral_tr_ini"] = 1;
			}

			if (is_int($indice_fin))
			{
				
				$row["salida_gral_tr_fin"] = 1;
			}

			// ancho de celda
			$row["salida_gral_celda"] = 100/CONFIG_57;						

				$salida_vermas[] = $row;

	$i++;
	} // del while

	// Smarty
	$smarty->assign("salida_vermas",$salida_vermas);
	
	// paginas
	$q_todos = myquery("SELECT * FROM ".ITEMS." WHERE enabled=1 AND item_tipo=1 AND catID>0".$campo_ver."","[var_vm=2]");
	$cnt_items = mynumrows($q_todos);	
	$paginas = paginas_gral($cnt_items, $sig, $pag, CONFIG_11, RUTA_INICIO."len".IGUAL.$idioma_actual.AMPER."vm".IGUAL.$vermas.AMPER."sig".IGUAL);

	// Smarty
	$smarty->assign("total", $cnt_items);

	// Smarty
	$smarty->assign("paginas", $paginas);
	
}

?>