<?
////////////////////////////////////////////////////
// Conciliación: gestión de conciliación de activos
// Version: 1.0
//
// Copyright (C) 2014  Eustotem Multimedia, S.L.
//
// License: MIT, see LICENSE
////////////////////////////////////////////////////


class UserProcessing extends Process{
	public $retorno;
	
	function getYoutubeThumb($param, $format=NULL){
		$temp=str_replace("http://www.youtube.com/watch?v=","",$param);
		$cadena="<a href='$param' target='_blank'>";
		$cadena.="<img src='http://img.youtube.com/vi/".$temp."/2.jpg' border='0' />";
		$cadena.="</a>";
		$this->retorno->content=$cadena;
		return $this->retorno;
	}	
	
	function mungabunga($param, $format=NULL){
		$this->retorno->content=mb_strtoupper($param,"utf-8");
		$this->retorno->cell=strlen($param)>12 ? "background-color:#FC0;" : "";
		return $this->retorno;
	}
	
	function test($param, $format=NULL){
		$this->retorno->content=$param;
		return $this->retorno;
	}
	
	function convertLantLon($param){
		$temp=explode(",",$param);
		$localizacion=$temp[0];
		$idioma=$temp[1];
		$tabla=$temp[2];
		$sql="SELECT node.nivel,group_concat(extractLng(parent.titulo,'$idioma')) AS tit 
		FROM $tabla node, $tabla parent 
		WHERE node.lft BETWEEN parent.lft AND parent.rgt AND node.id={$localizacion} 
		GROUP by 'dummy' ORDER BY parent.lft;";
		$q=mysql_query($sql);
		if(mysql_num_rows($q)>0){
			$fg=mysql_fetch_assoc($q);
			return $fg['tit'];
		}
		return "";
	}
	
	function numberFormat($number, $decimals=2, $dec_point=NULL, $thousands_sep=NULL){
		$this->retorno=number_format($param, $decimals, $dec_point, $thousands_sep);
		return $this->retorno;
	}
	
	function prueba($param,$format=NULL){
		if((int)$param<2){
			$this->retorno->cell=' style="background-color:#00FF00;"';
			$this->retorno->content=$param;
		}else if((int)$param<5){
			$this->retorno->cell=' style="background-color:#FFFF00;"';
			$this->retorno->content=$param;
		}else if((int)$param<=8){
			$this->retorno->cell=' style="background-color:#FF0000;"';
			$this->retorno->content=$param;
		}else if((int)$param>8){
			$this->retorno->cell=' style="background-color:#003366;"';
			$this->retorno->content='<span style="font-weight:bold; color:#FFF">'.$param.'</span>';
		}
		return $this->retorno;
	}
	//////////////////////////////////////////////////////////////////
}
?>