<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>I'll code 4 Food &#187; code</title>
	<atom:link href="http://blog.illcode4food.com/tag/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.illcode4food.com</link>
	<description>The Homeless Drunken Koder</description>
	<lastBuildDate>Fri, 06 Nov 2009 11:13:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Capturando click dentro de un InfoWindow de google maps</title>
		<link>http://blog.illcode4food.com/2009/07/15/capturando-click-dentro-de-un-infowindow-de-google-maps/</link>
		<comments>http://blog.illcode4food.com/2009/07/15/capturando-click-dentro-de-un-infowindow-de-google-maps/#comments</comments>
		<pubDate>Wed, 15 Jul 2009 12:03:56 +0000</pubDate>
		<dc:creator>Homeless Coder</dc:creator>
				<category><![CDATA[codigo]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://blog.illcode4food.com/?p=216</guid>
		<description><![CDATA[Puede sonar a tonteria, pero almenos a mi me ha costado un buen rato darme cuenta de como hacerlo, despues de desplegar un infowindow dentro de google maps no lograba capturar el click a cualquier enlace dentro de esa ventana, pero eso se puede arreglar vinculando el enlace en si una vez cargada la ventana [...]]]></description>
			<content:encoded><![CDATA[<p>Puede sonar a tonteria, pero almenos a mi me ha costado un buen rato darme cuenta de como hacerlo, despues de desplegar un infowindow dentro de google maps no lograba capturar el click a cualquier enlace dentro de esa ventana, pero eso se puede arreglar vinculando el enlace en si una vez cargada la ventana cuando se ha disparado el evento windowopen que se explica en la documentacion, seria algo como esto. Supongamos que tenemos dentro de el InfoWindow un enlace con el id &#8220;idEnlace&#8221; :
</p>
<pre name="code" class="javascript">var map = new GMap2(document.getElementById('#mapa'));
var marker = new GMarker(point);
GEvent.addListener(map, 'infowindowopen', function() {
	var enlace = document.getElementById('idEnlace');
	enlace.onclick = function(){
		alert('Has hecho click en el enlace de dentro de el InfoWindow!');
	}
});</pre>
<p>
Espero que sirva a alguien mas <img src='http://blog.illcode4food.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' />  Hasta otra!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.illcode4food.com/2009/07/15/capturando-click-dentro-de-un-infowindow-de-google-maps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>QueryManager Class Submit</title>
		<link>http://blog.illcode4food.com/2007/11/08/querymanager-class-submit/</link>
		<comments>http://blog.illcode4food.com/2007/11/08/querymanager-class-submit/#comments</comments>
		<pubDate>Thu, 08 Nov 2007 07:16:02 +0000</pubDate>
		<dc:creator>Homeless Coder</dc:creator>
				<category><![CDATA[codigo]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programacion]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://markcial.wordpress.com/2007/11/08/querymanager-class-submit/</guid>
		<description><![CDATA[Y aqui esta la mencionada clase QueryManager


class QueryManager {

&#160; private $_select = "SELECT %s FROM %s";
&#160; private $_where = " WHERE %s ";
&#160; private $_order = " ORDER BY %s ";
&#160; private $_limit = " LIMIT %s, %s ";

&#160; private $_insert = "INSERT INTO %s ";
&#160; private $_values = "( %s )VALUES( %s )";

&#160; private [...]]]></description>
			<content:encoded><![CDATA[<p>Y aqui esta la mencionada clase QueryManager</p>
<pre name="code" class="PHP">

class QueryManager {

&nbsp; private $_select = "SELECT %s FROM %s";
&nbsp; private $_where = " WHERE %s ";
&nbsp; private $_order = " ORDER BY %s ";
&nbsp; private $_limit = " LIMIT %s, %s ";

&nbsp; private $_insert = "INSERT INTO %s ";
&nbsp; private $_values = "( %s )VALUES( %s )";

&nbsp; private $_update = "UPDATE %s ";
&nbsp; private $_set = "SET %s ";

&nbsp; private $_delete = "DELETE FROM %s";

&nbsp; private $_sql_build = "";
&nbsp; private $_rsc;
&nbsp; private $_junk;
&nbsp; private $_data = array();
&nbsp; private $_pgn = array();
&nbsp; private $_page = 0;

&nbsp; public $table;
&nbsp; public $con;

&nbsp; function __construct($oCon, $sTable){
&nbsp;&nbsp;&nbsp; $this-&gt;table = $sTable;
&nbsp;&nbsp;&nbsp; $this-&gt;con = $oCon;
&nbsp; }

&nbsp; public function setPage($nPage){
&nbsp;&nbsp;&nbsp; $this-&gt;_page = $nPage;
&nbsp; }

&nbsp; public function getPage(){
&nbsp;&nbsp;&nbsp; return $this-&gt;_page;
&nbsp; }

&nbsp; public function length($sWhere="true"){
&nbsp;&nbsp;&nbsp; return mysql_query($this-&gt;buildCount( $sWhere ),$this-&gt;con) or die( mysql_error() );
&nbsp; }

&nbsp; public function getById($nId){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_rsc = mysql_query($this-&gt;buildSelect("id_$this-&gt;table=$nId"),$this-&gt;con) or die( mysql_error() );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_data = mysql_fetch_object($this-&gt;_rsc) or die( mysql_error() );
&nbsp;&nbsp;&nbsp;&nbsp; mysql_free_result($this-&gt;_rsc);
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_data;
&nbsp; }

&nbsp; public function getLast(){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_rsc = mysql_query($this-&gt;buildSelect("true", "id_$this-&gt;table desc", array(0,1)),$this-&gt;con) or die( mysql_error() );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_data = mysql_fetch_object($this-&gt;_rsc) or die( mysql_error() );
&nbsp;&nbsp;&nbsp;&nbsp; mysql_free_result($this-&gt;_rsc);
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_data;
&nbsp; }

&nbsp; public function select( $sWhere="true", $nPage=0, $nItemsPerPage=10, $sOrder=""){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_pgn["in"] = $nPage &gt; 0 ? ( $nPage * $nItemsPerPage + 1 ) : ( $nPage * $nItemsPerPage );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_pgn["out"] = $nItemsPerPage * ( $nPage + 1 );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_rsc = mysql_query( $this-&gt;buildSelect( $sWhere, $sOrder ), $this-&gt;con ) or die( mysql_error( ) );
&nbsp;&nbsp;&nbsp;&nbsp; while( $this-&gt;_junk = mysql_fetch_object( $this-&gt;_rsc ) ){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_data[] = $this-&gt;_junk;
&nbsp;&nbsp;&nbsp;&nbsp; };
&nbsp;&nbsp;&nbsp;&nbsp; mysql_free_result($this-&gt;_rsc);
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_data;
&nbsp; }

&nbsp; public function insert($aValues){
&nbsp;&nbsp;&nbsp;&nbsp; return mysql_query( $this-&gt;buildInsert( $aValues ),$this-&gt;con ) or die( mysql_error() );
&nbsp; }

&nbsp; public function update($nId,$aValues){
&nbsp;&nbsp;&nbsp;&nbsp; return mysql_query( $this-&gt;buildUpdate( $nId, $aValues ), $this-&gt;con ) or die( mysql_error() );
&nbsp; }

&nbsp; public function destroy($nId){
&nbsp;&nbsp;&nbsp;&nbsp; return mysql_query( $this-&gt;buildDelete( $nId ), $this-&gt;con ) or die( mysql_error() );
&nbsp; }

&nbsp; private function buildCount($sWhere){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build = sprintf($this-&gt;_select, "COUNT(*)", $this-&gt;table );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build .= sprintf($this-&gt;_where, $sWhere );
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_sql_build;
&nbsp; }

&nbsp; private function buildSelect($sWhere="true", $sOrder=""){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build = sprintf($this-&gt;_select, "*", $this-&gt;table );
&nbsp;&nbsp;&nbsp;&nbsp; if( !empty( $sWhere ) ){ $this-&gt;_sql_build .= sprintf($this-&gt;_where, $sWhere ); };
&nbsp;&nbsp;&nbsp;&nbsp; if( !empty( $sOrder ) ){ $this-&gt;_sql_build .= sprintf($this-&gt;_order, $sOrder ); };
&nbsp;&nbsp;&nbsp;&nbsp; if( !empty( $this-&gt;_pgn ) ){ $this-&gt;_sql_build .= sprintf($this-&gt;_limit, $this-&gt;_pgn["in"], $this-&gt;_pgn["out"] ); };
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_sql_build;
&nbsp; }

&nbsp; private function buildInsert( $aValues ){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build = sprintf($this-&gt;_insert, $this-&gt;table );
&nbsp;&nbsp;&nbsp;&nbsp; if(!empty( $aValues )){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sKeys = "";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sValues = "";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach( $aValues as $sKey=&gt;$sVal){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sKeys != "" ? $sKeys .= "," : false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sValues != "" ? $sValues .= "," : false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sKeys .= sprintf("%s", $sKey );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sValues .= sprintf("'%s'", $sVal );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build .= sprintf($this-&gt;_values, $sKeys, $sValues );
&nbsp;&nbsp;&nbsp;&nbsp; };
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_sql_build;
&nbsp; }

&nbsp; private function buildUpdate( $nId, $aValues ){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build = sprintf($this-&gt;_update, $this-&gt;table );
&nbsp;&nbsp;&nbsp;&nbsp; if(!empty( $aValues )){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sSentence = "";
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; foreach( $aValues as $sKey=&gt;$sVal){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sSentence != "" ? $sSentence .= "," : false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $sSentence .= sprintf( "%s='%s'", $sKey, $sVal );
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build .= sprintf($this-&gt;_set, $sSentence );
&nbsp;&nbsp;&nbsp;&nbsp; };
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build .= sprintf($this-&gt;_where, "id_$this-&gt;table=$nId" );
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_sql_build;
&nbsp; }

&nbsp; public function buildDelete($nId){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build = sprintf($this-&gt;_delete, $this-&gt;table );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build .= sprintf($this-&gt;_where, "id_$this-&gt;table=$nId" );
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_sql_build .= " LIMIT 1";
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_sql_build;
&nbsp; }

&nbsp; public function runQuery($sQuery){
&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_rsc = mysql_query( $sQuery ) or die( mysql_error() );
&nbsp;&nbsp;&nbsp;&nbsp; while( $this-&gt;_junk = mysql_fetch_object( $this-&gt;_rsc ) ){
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $this-&gt;_data[] = $this-&gt;_junk;
&nbsp;&nbsp;&nbsp;&nbsp; };
&nbsp;&nbsp;&nbsp;&nbsp; mysql_free_result($this-&gt;_rsc);
&nbsp;&nbsp;&nbsp;&nbsp; return $this-&gt;_data;
&nbsp; }
}
?&gt;
</pre>
<p>El tema de getById es si en la tabla se define el id asi : id_`nombre de la tabla`, si alguien quiere adaptarselo al gusto que toquetee.</p>
<p>Y ahora espero pedradas o algun consejo, hasta otra</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.illcode4food.com/2007/11/08/querymanager-class-submit/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
