[30] | 1 | <?php |
---|
| 2 | |
---|
| 3 | $p=explode(basename(_DIR_PLUGINS)."/",str_replace('\\','/',realpath(dirname(dirname(__FILE__))))); |
---|
| 4 | define('_DIR_PLUGIN_WIDGET_CALENDAR',(_DIR_PLUGINS.end($p))); |
---|
| 5 | define('_WIDGET_CALENDAR_BACK_IN_TIME',4); |
---|
| 6 | |
---|
| 7 | global $WCalendar_independants,$WCalendar_lies,$WCalendar_statiques; |
---|
| 8 | $WCalendar_independants=array(); |
---|
| 9 | $WCalendar_lies=array(); |
---|
| 10 | $WCalendar_statiques=array(); |
---|
| 11 | |
---|
| 12 | function WCalendar_ajoute($titre,$suffixe){ |
---|
| 13 | global $WCalendar_independants; |
---|
| 14 | $WCalendar_independants[] = array('titre'=>$titre,'suffixe'=>$suffixe); |
---|
| 15 | } |
---|
| 16 | function 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 | } |
---|
| 21 | function WCalendar_ajoute_statique($titre,$suffixe){ |
---|
| 22 | global $WCalendar_statiques; |
---|
| 23 | $WCalendar_statiques[] = array('titre'=>$titre,'suffixe'=>$suffixe); |
---|
| 24 | } |
---|
| 25 | function 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 | |
---|
| 35 | function 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 | } |
---|
| 41 | function WCalendar_body($flux){ |
---|
| 42 | include_spip('inc/calendar_init'); |
---|
| 43 | return WCalendar_body_prive($flux); |
---|
| 44 | } |
---|
| 45 | |
---|
| 46 | function 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 | |
---|
| 59 | function 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 | ?> |
---|