Mi problema surge cuando instalo el modulo [URL="http://www.bloogie.es/joomla-extensions/blog-calendar"]blog_calendar[/URL], este modulo muestra un calendario en la web y cuando pinchas en un dia, te muestra los articulos creados ese dia, he conseguido cambiarlo y que me muestre los articuloS (o eventos) que tienen una fecha_inicio igual al dia que se pinche.
Pero lo que tambien quiero hacer es que un evento se muestre no solo por su fecha_inicio si no tambien por su fecha_fin, osea que si el dia que se pincha en el calendario esta entre fecha_inicio y fecha_fin se muestre, en teoria parece facil pero mi problema llega en esta parte del codigo:
Código:
HE intentado muchas cosas como por ejemplo:$nullDate = $db->getNullDate(); $date[0]= mktime(0,0,0,$month, 1,$year); $date[1]= mktime(0,0,0, $month+1, 1, $year); $date[0]= new JDate($date[0], $offset); $date[1]= new JDate($date[1], $offset); $date[0]= $date[0]->toMySQL(); $date[1]= $date[1]->toMySQL(); $dateNow = new JDate(); $now = $dateNow->toMySQL(); if($type == 0){ //query for the calendar $where= 'a.state = 1' . ' AND ( a.fecha_inicio >= '. $db->Quote($date[0]) .' AND a.fecha_inicio < '. $db->Quote($date[1]) . ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )' . ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )' ; $query ='SELECT a.id,a.catid,a.created,a.publish_up,a.publish_down,a.state,a.access, a.fecha_inicio'. ' FROM #__content AS a'. ' INNER JOIN #__categories AS cc ON cc.id = a.catid' . ' WHERE '. $where . ' AND a.language IN (\''.JFactory::getLanguage()->getTag().'\',\'*\')'. ($access ? ' AND a.access IN ('.$groups.')' : ''). //select only the content that the current user is allowed to see ' AND cc.published = 1' ; //($catCondition != '' ? $catCondition : '' ); //add the $catCondition if $catid exists }
Código:
$where = 'a.state = 1' . ' AND ( a.fecha_inicio >= '. $db->Quote($date[0]) .' AND a.fecha_inicio < '. $db->Quote($date[1]) . ' OR a.fecha_fin >= '. $db->Quote($date[1]) .' AND a.fecha_fin < '. $db->Quote($date[0]).' )' . ' AND ( a.publish_up = '.$db->Quote($nullDate).' OR a.publish_up <= '.$db->Quote($now).' )' . ' AND ( a.publish_down = '.$db->Quote($nullDate).' OR a.publish_down >= '.$db->Quote($now).' )' ;
Pero la raiz de mi problema es que no se como interpretar esta parte del codigo, no se que es date[0], ni date[1], me imagino que almacenara la fecha que se pincha en el calendario, pero por que 2 fechas??
Código:
$date[0]= mktime(0,0,0,$month, 1,$year); $date[1]= mktime(0,0,0, $month+1, 1, $year);