[ Calendar presentation]

>The documentation is not really good yet :wink:

You should not modify the code in inc_calendrier... but you can make your own calendrier.css and redefine the styles there, this should already give you a good control over he style.

What do you exactly want to change?

The next part is a bit technical (php) and is perhaps not the best solution, depending on whatyou want to achieve.

If you really want to modify the generated html code. It is possible. You have to declare your own filtres:
agenda_memo
and
agenda_affiche

Do not start from scratch, they are defined in inc_filtres, so copy them, for what you want to do, you will probably have to modify, in agenda_affiche, the call:

include('ecrire/inc_calendrier.php3');
return http_calendrier_init('', $type, '', '', '', $evt);

Here again, you can start from the existing inc_calendrier.

copy it to your root directory and name it something else: inc_calendario.php3 for example. Change what you want in the design there.

You should know that the $evt array is an array of event in a format similar to ical:
('CATEGORIES' => ...,
'DTSTART' => ...,
'DTEND' => ...,
'DESCRIPTION' => ...,
'SUMMARY' => ...,
'URL' => ...)

the in your mes_fonctions.php3, make your own copies of the filter:

function agenda_visualizar($i)
{
  $args = func_get_args();
  $nb = array_shift($args); // nombre d'evenements (on pourrait l'afficher)
  $sinon = array_shift($args);
  if (!$nb) return $sinon;
  $type = array_shift($args);
  $agenda = agenda_memo(0);
  $evt = array();
  foreach (($args ? $args : array_keys($agenda)) as $k) {
      if (is_array($agenda[$k]))
foreach($agenda[$k] as $d => $v) {
  $evt[$d] = $evt[$d] ? (array_merge($evt[$d], $v)) : $v;
}
    }
  if ($type != 'periode')
      $evt = array('', $evt);
  else
      {
$d = array_keys($evt);
$mindate = min($d);
$min = substr($mindate,6,2);
$max = $min + ((strtotime(max($d)) - strtotime($mindate)) / (3600 * 24));
if ($max < 31) $max = 0;
$evt = array('', $evt, $min, $max);
$type = 'mois';
      }
    include('inc_calendario.php');
    return http_calendrier_init('', $type, '', '', '', $evt);
}

This seems really complicated, but you probabley do not have to go so far. Playing with the css should already give you some good control on the style.

Pierre

_______________________________________________
spip-en@rezo.net - http://listes.rezo.net/mailman/listinfo/spip-en

Sorry for double post.
Hi Pierre,
i solved my problem going a little deeper through the code. As i didn't want most of the elements showed in the calendar, just days with or without links, a CSS solution was not the best. So I started, wrongly as you suggest, to modify code in inc_calendrier.php3. Soon after I realized it was not the way.

In my opinion the best way to customize it is to give to the original agenda_affiche a new type and then write a function http_calendrier_mytype that will do the job.
This is how I solved my problems.

I call the function with these parameters:
agenda_affiche{<:aucun_article:>, 'minimale'}

and I write in mes_fonctions.php a function http_calendrier_minimale(........)

It works great!!!

Ciao
Renato