Salve a tutti ragazzi, lavoro da un paio di anni con joomla e da autodidatta cerco di capire qualcosa di php, ad oggi riesco a fare piccole modifiche ma ora sono davvero in un punto morto.
in pratica vorrei fare delle modifiche ad un modulo (joomla) che ha questo codice:
Codice PHP:
// no direct access
defined('_JEXEC') or die('Restricted access');
jimport('joomla.filesystem.file');
class modRseventsHelper
{
/**
* Method to get the events
*
* @access public
* @return array
*/
function getList(&$params)
{
$db =& JFactory::getDBO();
//check for rsevents
if(file_exists(JPATH_SITE.DS.'components'.DS.'com_rsevents'.DS.'helpers'.DS.'rsevents.php'))
require_once(JPATH_SITE.DS.'components'.DS.'com_rsevents'.DS.'helpers'.DS.'rsevents.php');
else return;
//get config
$db->setQuery("SELECT * FROM `#__rsevents_config`");
$rseventsConfigDb = $db->loadObjectList();
foreach ($rseventsConfigDb as $objConfig)
$rseventsConfig[$objConfig->ConfigName] = $objConfig->ConfigValue;
$where = "";
//get parameters
$current_time = time();
$locationIds = $params->get('locids','');
$categoryIds = $params->get('catids','');
$repeatingEvents = $params->get('repeatevents','0');
$itid = $params->get('itemid','');
$limit = (int)$params->get('evnumber');
if($limit == 0) $limit= 1000000;
$ordering = $params->get('ordering','0');
$order = ($ordering == 0) ? 'DESC' : 'ASC';
$target = ($params->get('target','0') == 0) ? '_blank' : '_self';
$todayevents = $params->get('today','1');
$tday = mktime(0,0,0,date('n'),date('j'),date('Y'));
if(is_array($locationIds)) $locids = implode(',', $locationIds); else $locids = $locationIds;
if(is_array($categoryIds)) $catids = implode(',', $categoryIds); else $catids = $categoryIds;
if ($todayevents == 1)
$where .= " AND e.EventStartDate >= '".$current_time."' ";
else $where .= " AND ((e.EventStartDate <= '".$tday."' AND e.EventEndDate >= '".$tday."') OR (e.EventStartDate >= '".$tday."' AND e.EventStartDate <= '".($tday+86400)."')) ";
if(!empty($locationIds))
$where .= " AND l.IdLocation IN (".$locids.") ";
if(!empty($categoryIds))
$where .= " AND c.IdCategory IN (".$catids.") ";
$where .= " AND e.published = 1 AND e.EventType = 1 ";
if($repeatingEvents == 1 ) $where .= " AND e.IdParent = 0 ";
else $where .= "";
$query = "SELECT e.IdEvent , e.EventName ,e.EventEnableRegistration, l.IdLocation , l.LocationName , e.EventStartDate , e.EventEndDate , e.EventIcon , c.IdCategory , c.CategoryName FROM #__rsevents_events e "
." LEFT JOIN #__rsevents_locations l ON e.IdLocation=l.IdLocation LEFT JOIN #__rsevents_events_cat ec ON ec.IdEvent = e.IdEvent LEFT JOIN #__rsevents_categories c ON c.IdCategory = ec.IdCategory WHERE 1=1 ".$where." GROUP BY e.IdEvent ORDER BY e.EventStartDate ".$order." LIMIT ".$limit;
$db->setQuery($query);
$rows = $db->loadObjectList();
$Itemid = JRequest::getVar('Itemid','','request');
if(!empty($Itemid))
{
if($itid == '' || empty($itid)) $itemId = '&Itemid='.$Itemid;
else $itemId = '&Itemid='.$itid;
} else $itemId='';
$i = 0;
$lists = array();
if(!empty($rows))
foreach ( $rows as $row )
{
$categnames = array();
$layout = $params->get('layout','{EventStartDate} - {EventName}');
$eventlink = JRoute::_('/eventi/event/'.$row->IdEvent.'-'.$row->EventName.'.html',false);
questo codice produce questo risultato.
ps :il codice continua, ma penso che le righe che ci interessano siano queste, con particolar riferimento alle ultime 3)
io vorrei invece arrivare a questa soluzione:
IMMAGINE CREATA CON PAINT!!! PURAMENTE INDICATIVA!
il problema a mio modo di vedere è che la variabile (ammesso che sia una variabile) del tempo, è unica e non è distinta per giorni mesi ed anni, nel codice è EventStartDate, ed ha formato (come si vede dalla prima immagine) d:m:Y h:m
A me interesserebbe estrapolare da questa data, solo il giorno ed il mese, assegnandole poi a dei div che mi consentano di inserirvi l'immagine del calendario.
grazie, spero di essere stato chiaro, e scusatemi per il post abbastanza lungo.
grazie ancora.