source: trunk/spip/esqueleto-redcta/plugins/widget_calendar/inc/calendar.php @ 30

Last change on this file since 30 was 30, checked in by sebas, 17 years ago

nueva importacion del codigo del esqueleto de redcta con los plugins

File size: 2.5 KB
Line 
1<?php
2
3$p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\','/',realpath(dirname(dirname(__FILE__)))));
4define('_DIR_PLUGIN_WIDGET_CALENDAR',(_DIR_PLUGINS.end($p)));
5define('_WIDGET_CALENDAR_BACK_IN_TIME',4);
6
7global $WCalendar_independants,$WCalendar_lies,$WCalendar_statiques;
8$WCalendar_independants=array();
9$WCalendar_lies=array();
10$WCalendar_statiques=array();
11
12function WCalendar_ajoute($titre,$suffixe){
13        global $WCalendar_independants; 
14        $WCalendar_independants[] = array('titre'=>$titre,'suffixe'=>$suffixe);
15}
16function WCalendar_ajoute_lies($titre_debut,$suffixe_debut,$titre_fin,$suffixe_fin){
17        global $WCalendar_lies; 
18        $WCalendar_lies[] = array('titre1'=>$titre_debut,'suffixe1'=>$suffixe_debut,
19                                                                                                                'titre2'=>$titre_fin,'suffixe2'=>$suffixe_fin);
20}
21function WCalendar_ajoute_statique($titre,$suffixe){
22        global $WCalendar_statiques;   
23        $WCalendar_statiques[] = array('titre'=>$titre,'suffixe'=>$suffixe);
24}
25function WCalendar_statique_point_entree($suffixe, $dates = ""){
26        return "<div><div id='container$suffixe' style='z-index:5000;'></div>
27        <div style='display:none;'><textarea id='selected_date$suffixe' name='selected_date$suffixe'>$dates</textarea></div>
28        <a href='javascript:cal$suffixe.reset()'>Reset</a>"
29        //. "<a href='javascript:alert(cal$suffixe.getSelectedDates())'>what's selected?</a>"
30        . "</div>
31        ";
32}
33
34
35function WCalendar_header($flux,$onload=""){
36        global $init_functions;
37        $init_functions = $onload;
38        include_spip('inc/calendar_init');
39        return WCalendar_header_prive($flux);
40}
41function WCalendar_body($flux){
42        include_spip('inc/calendar_init');
43        return WCalendar_body_prive($flux);
44}
45
46function WCalendar_controller($date,$suffixe){
47        if (strcmp($date,format_mysql_date())==0)
48                $date=date("Y-m-d H:i:s");
49        $s = "<a href='javascript:void(null)' onclick='showCalendar$suffixe()'>
50        <img id='dateLink$suffixe' src='"._DIR_IMG_PACK."/cal-jour.gif' border='0' style='vertical-align:middle;margin:5px'/></a>
51        ";
52        $s .=
53          afficher_jour(jour($date), "id='jour$suffixe' name='jour$suffixe' size='1' class='fondl verdana1' onchange='changeDate$suffixe()'") .
54    afficher_mois(mois($date), "id='mois$suffixe' name='mois$suffixe' size='1' class='fondl verdana1' onchange='changeDate$suffixe()'") .
55    afficher_annee(annee($date), "id='annee$suffixe' name='annee$suffixe' size='1' class='fondl verdana1' onchange='changeDate$suffixe()'", date('Y')-_WIDGET_CALENDAR_BACK_IN_TIME);
56  return $s;
57}
58
59function WCalendar_statique_controller($dates,$suffixe){
60        if (is_array($dates))
61                $dates = implode(',',$dates);
62  return WCalendar_statique_point_entree($suffixe, $dates);
63}
64
65?>
Note: See TracBrowser for help on using the repository browser.