[ Index ]
 

Code source de e107 0.7.8

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/e107_plugins/calendar_menu/ -> calendar_shortcodes.php (source)

   1  <?php
   2  /*
   3  + ----------------------------------------------------------------------------+
   4  |     e107 website system
   5  |
   6  |     ©Steve Dunstan 2001-2002
   7  |     http://e107.org
   8  |     jalist@e107.org
   9  |
  10  |     Released under the terms and conditions of the
  11  |     GNU General Public License (http://gnu.org).
  12  |
  13  |     $Source: /cvsroot/e107/e107_0.7/e107_plugins/calendar_menu/calendar_shortcodes.php,v $
  14  |     $Revision: 1.13 $
  15  |     $Date: 2006/11/16 10:24:14 $
  16  |     $Author: e107coders $
  17  |
  18  | 10.11.06 - mods for next CVS release
  19  +----------------------------------------------------------------------------+
  20  */
  21  
  22  if (!defined('e107_INIT')) { exit; }
  23  include_once(e_HANDLER.'shortcode_handler.php');
  24  $calendar_shortcodes = $tp -> e_sc -> parse_scbatch(__FILE__);
  25  /*
  26  // TIME SWITCH BUTTONS ------------------------------------------------
  27  SC_BEGIN PREV_MONTH
  28      global $PREV_MONTH, $previous, $months, $prevmonth;
  29      return "<a href='".e_SELF."?".$previous."'>&lt;&lt; ".$months[($prevmonth-1)]."</a>";
  30  SC_END
  31  
  32  SC_BEGIN NEXT_MONTH
  33      global $NEXT_MONTH, $next, $months, $nextmonth;
  34      return "<a href='".e_SELF."?".$next."'> ".$months[($nextmonth-1)]." &gt;&gt;</a>";
  35  SC_END
  36  
  37  SC_BEGIN CURRENT_MONTH
  38      global $CURRENT_MONTH, $pref, $months, $month, $year;
  39      if($pref['eventpost_dateformat'] == 'my') {
  40          $CURRENT_MONTH = $months[($month-1)]." ".$year;
  41      } else {
  42          $CURRENT_MONTH = $year." ".$months[($month-1)];
  43      }
  44      return $CURRENT_MONTH;
  45  SC_END
  46  
  47  SC_BEGIN PREV_YEAR
  48      global $PREV_YEAR, $prevlink, $py;
  49      return "<a href='".e_SELF."?".$prevlink."'>&lt;&lt; ".$py."</a>";
  50  SC_END
  51  
  52  SC_BEGIN NEXT_YEAR
  53      global $NEXT_YEAR, $nextlink, $ny;
  54      return "<a href='".e_SELF."?".$nextlink."'>".$ny." &gt;&gt;</a>";
  55  SC_END
  56  
  57  SC_BEGIN MONTH_LIST
  58      global $MONTH_LIST, $year, $monthjump, $monthabb;
  59      $MONTH_LIST = "";
  60      for ($ii = 0; $ii < 12; $ii++)
  61      {
  62          $m = $ii + 1;
  63          $monthjump = mktime(0, 0, 0, $m, 1, $year);
  64          $MONTH_LIST .= "<a href='".e_SELF."?".$monthjump."'>".$monthabb[$ii]."</a> &nbsp;";
  65      }
  66      return $MONTH_LIST;
  67  SC_END
  68  
  69  
  70  
  71  // NAVIGATION BUTTONS ------------------------------------------------
  72  SC_BEGIN NAV_BUT_ALLEVENTS
  73      global $NAV_BUT_ALLEVENTS;
  74      $allevents = (e_PAGE == "event.php" ? EC_LAN_96 : EC_LAN_93);
  75      return "<input class='button' type='submit' style='width:140px;' name='viewallevents' value='".$allevents."' title='".$allevents."' />";
  76  SC_END
  77  
  78  SC_BEGIN NAV_BUT_VIEWCAT
  79      global $NAV_BUT_VIEWCAT;
  80      //return "<input type='hidden' name='do' value='vc' /><input class='button' type='submit' style='width:140px;' name='viewcat' value='".EC_LAN_92."' />";
  81      return "<input type='hidden' name='do' value='vc' />";
  82  SC_END
  83  
  84  SC_BEGIN NAV_BUT_SUBSCRIPTION
  85      global $NAV_BUT_SUBSCRIPTION, $pref;
  86      if (($pref['eventpost_asubs']>0) && USER)
  87      {
  88          $NAV_BUT_SUBSCRIPTION = "<input class='button' type='submit' style='width:140px;' name='subs' value='".EC_LAN_123."' />";
  89      }
  90      return $NAV_BUT_SUBSCRIPTION;
  91  SC_END
  92  
  93  SC_BEGIN NAV_BUT_ENTEREVENT
  94          global $NAV_BUT_ENTEREVENT, $pref, $prop;
  95      $NAV_BUT_ENTEREVENT = "<input type='hidden' name='enter_new_val' value='".$prop."' />";
  96      if (check_class($pref['eventpost_admin']) || getperms('0')){
  97          // start no admin preference
  98          $NAV_BUT_ENTEREVENT .= "<input class='button' type='submit' style='width:140px;' name='doit' value='".EC_LAN_94."' />";
  99      }
 100      return $NAV_BUT_ENTEREVENT;
 101  SC_END
 102  
 103  SC_BEGIN NAV_LINKCURRENTMONTH
 104      global $NAV_LINKCURRENTMONTH, $month, $nowmonth, $year, $nowyear, $current, $ds;
 105      $NAV_LINKCURRENTMONTH = "";
 106      if ($month != $nowmonth || $year != $nowyear || $ds == 'one'){
 107          $NAV_LINKCURRENTMONTH = "<input class='button' type='button' style='width:140px;' name='cur' value='".EC_LAN_40."' onclick=\"javascript:document.location='".e_SELF."?$current'\" />";
 108      }
 109      return $NAV_LINKCURRENTMONTH;
 110  SC_END
 111  
 112  SC_BEGIN NAV_CATEGORIES
 113      global $NAV_CATEGORIES, $sql, $pref, $_POST, $cal_super;
 114      $NAV_CATEGORIES = "<select name='event_cat_ids' class='tbox' style='width:140px;' onchange='this.form.submit()' ><option class='tbox' value='all'>".EC_LAN_97."</option>";
 115      $event_cat_id = ( isset($_POST['event_cat_ids']) && $_POST['event_cat_ids'] ? $_POST['event_cat_ids'] : null);
 116  
 117      $cal_arg = ($cal_super ? "" : " find_in_set(event_cat_class,'".USERCLASS_LIST."') ");
 118      $sql->db_Select("event_cat", "*", $cal_arg);
 119      while ($row = $sql->db_Fetch()){
 120          if ($row['event_cat_id'] == $event_cat_id){
 121              $NAV_CATEGORIES .= "<option class='tbox' value='".$row['event_cat_id']."' selected='selected'>".$row['event_cat_name']."</option>";
 122          }else{
 123              $NAV_CATEGORIES .= "<option value='".$row['event_cat_id']."'>".$row['event_cat_name']."</option>";
 124          }
 125      }
 126      $NAV_CATEGORIES .= "</select>";
 127      return $NAV_CATEGORIES;
 128  SC_END
 129  
 130  
 131  
 132  // CALENDAR SHOWEVENT ------------------------------------------------------------
 133  SC_BEGIN SHOWEVENT_IMAGE
 134      global $SHOWEVENT_IMAGE, $ev;
 135      if($ev['event_cat_icon'] && file_exists(e_PLUGIN."calendar_menu/images/".$ev['event_cat_icon'])){
 136          $img = "<img style='border:0' src='".e_PLUGIN."calendar_menu/images/".$ev['event_cat_icon']."' alt='' height='".$ev['imagesize']."' width='".$ev['imagesize']."' />";
 137      }else{
 138          $img = "<img src='".THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif")."' alt='' style='border:0; vertical-align:middle;' />";
 139      }
 140      return $img;
 141      //return "<img style='border:0' src='".e_PLUGIN."calendar_menu/images/".$ev['event_cat_icon']."' alt='' height='".$ev['imagesize']."' width='".$ev['imagesize']."' />";
 142  SC_END
 143  
 144  SC_BEGIN SHOWEVENT_INDICAT
 145      global $SHOWEVENT_INDICAT, $ev;
 146      return $ev['indicat'];
 147  SC_END
 148  
 149  SC_BEGIN SHOWEVENT_HEADING
 150      global $SHOWEVENT_HEADING, $ev, $datearray, $c;
 151      $linkut = mktime(0 , 0 , 0 , $datearray['mon'], $c, $datearray['year']);
 152      if(isset($ev['fulltopic']) && $ev['fulltopic'])
 153      {  // Used on first day
 154          $show_title = $ev['event_title'];
 155      }
 156      else
 157      {
 158          if (strlen($ev['event_title']) > 10)
 159          {
 160            $show_title = substr($ev['event_title'], 0, 10) . "...";
 161          }
 162          else
 163          {
 164            $show_title = $ev['event_title'];
 165          }
 166      }
 167      if($ev['startofevent'])
 168      {
 169        if (isset($ev['is_recent']))
 170        {
 171          return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
 172        }
 173        else
 174        {
 175          return "<b><a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='mediumtext'>".$show_title."</span></a></b>";
 176        }
 177      }
 178      else
 179      {
 180        return "<a title='{$ev['event_title']}' href='".e_PLUGIN."calendar_menu/event.php?".$linkut.".event.".$ev['event_id']."'><span class='smalltext'>".$show_title."</span></a>";
 181      }
 182  SC_END
 183  
 184  SC_BEGIN CALENDAR_CALENDAR_RECENT_ICON
 185    global $ev;
 186    if (!isset($ev['is_recent'])) return "";
 187  //  $recent_icon = e_PLUGIN."calendar_menu/images/recent_icon.png";
 188    $recent_icon = e_IMAGE."generic/".IMODE."/new.png";
 189    if (file_exists($recent_icon))
 190      {
 191        return "<img style='border:0' src='".$recent_icon."' alt='' /> ";
 192      }
 193    return "R";
 194  SC_END
 195  
 196  
 197  
 198  // CALENDAR CALENDAR ------------------------------------------------------------
 199  SC_BEGIN CALENDAR_CALENDAR_HEADER_DAY
 200      global $CALENDAR_CALENDAR_HEADER_DAY, $day, $pref, $week;
 201      if(isset($pref['eventpost_lenday']) && $pref['eventpost_lenday'])
 202      {
 203        return "<strong>".substr($day,0,$pref['eventpost_lenday'])."</strong>";
 204      }
 205      else
 206      {
 207         return "<strong>".$day."</strong>";
 208      }
 209  SC_END
 210  
 211  SC_BEGIN CALENDAR_CALENDAR_DAY_TODAY_HEADING
 212      global $CALENDAR_CALENDAR_DAY_TODAY_HEADING, $startt, $c, $days;
 213      return "<b><a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a></b> <span class='smalltext'>[".EC_LAN_TODAY."]</span>";
 214  SC_END
 215  
 216  SC_BEGIN CALENDAR_CALENDAR_DAY_EVENT_HEADING
 217      global $CALENDAR_CALENDAR_DAY_EVENT_HEADING, $startt, $c, $days;
 218      return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt.".one'>".$days[($c-1)]."</a>";
 219  SC_END
 220  
 221  SC_BEGIN CALENDAR_CALENDAR_DAY_EMPTY_HEADING
 222      global $CALENDAR_CALENDAR_DAY_EMPTY_HEADING, $startt, $c, $days;
 223      return "<a href='".e_PLUGIN."calendar_menu/event.php?".$startt."'>".$days[($c-1)]."</a>";
 224  SC_END
 225  
 226  
 227  // EVENT LIST ------------------------------------------------
 228  SC_BEGIN EVENTLIST_CAPTION
 229      global $EVENTLIST_CAPTION, $ds, $months, $selected_mon, $dayslo, $selected_day, $monthstart;
 230      if ($ds == 'one')
 231      {
 232          $EVENTLIST_CAPTION = EC_LAN_111.$months[$selected_mon-1]." ".$selected_day;
 233      }
 234      elseif ($ds != 'event')
 235      {
 236          $EVENTLIST_CAPTION = EC_LAN_112.$months[date("m", $monthstart)-1];
 237      }
 238      return $EVENTLIST_CAPTION;
 239  SC_END
 240  
 241  
 242  
 243  // EVENT ARCHIVE ------------------------------------------------------------
 244  SC_BEGIN EVENTARCHIVE_CAPTION
 245      global $EVENTARCHIVE_CAPTION, $num;
 246      if ($num == 0) 
 247      {
 248          $EVENTARCHIVE_CAPTION = EC_LAN_137;
 249      }
 250      else
 251      {
 252          $EVENTARCHIVE_CAPTION = str_replace("-NUM-", $num, EC_LAN_62);
 253      }
 254      return $EVENTARCHIVE_CAPTION;
 255  SC_END
 256  
 257  SC_BEGIN EVENTARCHIVE_DATE
 258      global $EVENTARCHIVE_DATE, $thisevent, $ecal_class;
 259      $startds = $ecal_class->event_date_string($thisevent['event_start']);
 260      $EVENTARCHIVE_DATE = "<a href='event.php?".$thisevent['event_start'].".event.".$thisevent['event_id']."'>".$startds."</a>";
 261      return $EVENTARCHIVE_DATE;
 262  SC_END
 263  
 264  SC_BEGIN EVENTARCHIVE_DETAILS
 265      global $EVENTARCHIVE_DETAILS, $thisevent, $tp;
 266      $number = 40;
 267      $rowtext = $tp->toHTML($thisevent['event_details'], TRUE, "nobreak");
 268      $rowtext = strip_tags($rowtext);
 269      $words = explode(" ", $rowtext);
 270      $EVENTARCHIVE_DETAILS = implode(" ", array_slice($words, 0, $number));
 271      if(count($words) > $number){
 272          $EVENTARCHIVE_DETAILS .= " ".EC_LAN_133." ";
 273      }
 274      return $EVENTARCHIVE_DETAILS;
 275  SC_END
 276  
 277  SC_BEGIN EVENTARCHIVE_EMPTY
 278      global $EVENTARCHIVE_EMPTY;
 279      return EC_LAN_37;
 280  SC_END
 281  
 282  SC_BEGIN EVENTARCHIVE_HEADING
 283      global $EVENTARCHIVE_HEADING, $thisevent;
 284      $EVENTARCHIVE_HEADING = $thisevent['event_title'];
 285      return $EVENTARCHIVE_HEADING;
 286  SC_END
 287  
 288  
 289  
 290  
 291  // EVENT SHOWEVENT ------------------------------------------------------------
 292  
 293  SC_BEGIN EVENT_RECENT_ICON
 294    global $thisevent, $ecal_class;
 295    if (($ecal_class->max_recent_show == 0) || (time() - $thisevent['event_datestamp']) > $ecal_class->max_recent_show) return "";
 296  // Can use the generic icon, or a calendar-specific one  
 297    $recent_icon = e_IMAGE."generic/".IMODE."/new.png";
 298  //  $recent_icon = e_PLUGIN."calendar_menu/images/recent_icon.png";
 299    if (file_exists($recent_icon))
 300      {
 301        return "<img style='border:0' src='".$recent_icon."' alt='' /> ";
 302      }
 303    return "";
 304  SC_END
 305  
 306  SC_BEGIN EVENT_HEADING_DATE
 307      global $thisevent, $ecal_class;
 308      $startds = $ecal_class->event_date_string($thisevent['event_start']);
 309      return $startds;
 310  SC_END
 311  
 312  SC_BEGIN EVENT_DATE_START
 313      global $thisevent, $ecal_class;
 314      $startds = $ecal_class->event_date_string($thisevent['event_start']);
 315      return $startds;
 316  SC_END
 317  
 318  SC_BEGIN EVENT_TIME_START
 319      global $thisevent, $ecal_class;
 320      if ($thisevent['event_allday'] == 1) return "";
 321      $startds = $ecal_class->time_string($thisevent['event_start']);
 322      return $startds;
 323  SC_END
 324  
 325  SC_BEGIN EVENT_DATE_END
 326      global $thisevent, $ecal_class;
 327      if ($thisevent['event_allday'] ||($thisevent['event_end'] == $thisevent['event_start'])) return "";
 328      $endds = $ecal_class->event_date_string($thisevent['event_end']);
 329      return $endds;
 330  SC_END
 331  
 332  SC_BEGIN EVENT_TIME_END
 333      global $thisevent, $ecal_class;
 334      if ($thisevent['event_allday'] ||($thisevent['event_end'] == $thisevent['event_start'])) return "";
 335      $endds = $ecal_class->time_string($thisevent['event_end']);
 336      return $endds;
 337  SC_END
 338  
 339  SC_BEGIN EVENT_TITLE
 340      global $thisevent;
 341      return $thisevent['event_title'];
 342  SC_END
 343  
 344  SC_BEGIN EVENT_CAT_ICON
 345    global $thisevent;
 346    if ($thisevent['event_cat_icon'] && file_exists(e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon']))
 347      {
 348        return "<img style='border:0' src='".e_PLUGIN."calendar_menu/images/".$thisevent['event_cat_icon']."' alt='' /> ";
 349      }
 350      else
 351      {
 352          return "";
 353      }
 354  SC_END
 355  
 356  SC_BEGIN EVENT_ID
 357      global $thisevent;
 358      return "calevent".$thisevent['event_id'];
 359  SC_END
 360  
 361  SC_BEGIN EVENT_DISPLAYSTYLE
 362      global $EVENT_DISPLAYSTYLE, $ds;
 363      if (($ds=="event") || ($ds=="one")){
 364          $EVENT_DISPLAYSTYLE = "show";
 365      }else{
 366          $EVENT_DISPLAYSTYLE = "none";
 367      }
 368      return $EVENT_DISPLAYSTYLE;
 369  SC_END
 370  
 371  SC_BEGIN EVENT_DETAILS
 372      global $EVENT_DETAILS, $thisevent, $tp;
 373      return $tp->toHTML($thisevent['event_details'], TRUE);
 374  SC_END
 375  
 376  SC_BEGIN EVENT_CATEGORY
 377      global $EVENT_CATEGORY, $thisevent;
 378          $EVENT_CATEGORY = $thisevent['event_cat_name'];
 379      return $EVENT_CATEGORY;
 380  SC_END
 381  
 382  SC_BEGIN EVENT_LOCATION
 383      global $EVENT_LOCATION, $thisevent;
 384      if ($thisevent['event_location'] == ""){
 385          $EVENT_LOCATION = "";
 386      }else{
 387          $EVENT_LOCATION = $thisevent['event_location'];
 388      }
 389      return $EVENT_LOCATION;
 390  SC_END
 391  
 392  SC_BEGIN EVENT_AUTHOR
 393      global $EVENT_AUTHOR, $event_author_id, $event_author_name;
 394      if(USER){
 395          $EVENT_AUTHOR = "<a href='".e_BASE."user.php?id.".$event_author_id."'>".$event_author_name."</a>";
 396      }else{
 397          $EVENT_AUTHOR = $event_author_name;
 398      }
 399      return $EVENT_AUTHOR;
 400  SC_END
 401  
 402  SC_BEGIN EVENT_CONTACT
 403      global $EVENT_CONTACT, $thisevent,$tp;
 404      if ($thisevent['event_contact'] == ""){
 405          //$EVENT_CONTACT = EC_LAN_38; // Not Specified ;
 406      $EVENT_CONTACT = "";
 407      }else{
 408          $EVENT_CONTACT = $tp->toHTML($thisevent['event_contact'],TRUE);
 409      }
 410      return $EVENT_CONTACT;
 411  SC_END
 412  
 413  SC_BEGIN EVENT_THREAD
 414    global $EVENT_THREAD, $thisevent;
 415    return (isset($thisevent['event_thread']) && ($thisevent['event_thread'] != "")) ? "<a href='{$thisevent['event_thread']}'><img src='".e_PLUGIN."forum/images/".IMODE."/e.png' alt='' style='border:0; vertical-align:middle;' width='16' height='16' /></a> <a href='{$thisevent['event_thread']}'>".EC_LAN_39."</a>" : "";
 416  SC_END
 417  
 418  SC_BEGIN EVENT_OPTIONS
 419      global $EVENT_OPTIONS, $thisevent, $event_author_name, $cal_super;
 420      if (USERNAME == $event_author_name || $cal_super){
 421          $EVENT_OPTIONS = "<a href='event.php?ed.".$thisevent['event_id']."'><img style='border:0;' src='".e_IMAGE."admin_images/edit_16.png' title='".EC_LAN_35."' alt='".EC_LAN_35 . "'/></a>&nbsp;&nbsp;<a href='".e_PLUGIN."calendar_menu/event.php?de.".$thisevent['event_id']."'><img style='border:0;' src='".e_IMAGE."admin_images/delete_16.png' title='".EC_LAN_36."' alt='".EC_LAN_36."'/></a>";
 422      }
 423      return $EVENT_OPTIONS;
 424  SC_END
 425  
 426  
 427  
 428  
 429  SC_BEGIN NEXT_EVENT_TIME
 430    global $cal_row, $ecal_class;
 431    if ($cal_row['event_allday'] != 1) return $ecal_class->time_string($cal_row['event_start']); else return '';
 432  SC_END
 433  
 434  SC_BEGIN NEXT_EVENT_DATE
 435    global $cal_row, $ecal_class;
 436    return $ecal_class->next_date_string($cal_row['event_start']);
 437  SC_END
 438  
 439  SC_BEGIN NEXT_EVENT_TITLE
 440    global $pref, $cal_row;
 441    if (isset($pref['eventpost_namelink']) && ($pref['eventpost_namelink'] == '2') && (isset($cal_row['event_thread']) && ($cal_row['event_thread'] != "")))
 442        {
 443          $fe_event_title = "<a href='".$cal_row['event_thread']."'>";
 444        }
 445        else
 446        { 
 447          $fe_event_title = "<a href='".e_PLUGIN."calendar_menu/event.php?".$cal_row['event_start'].".event.".$cal_row['event_id']."'>";
 448        }
 449      $fe_event_title .= $cal_row['event_title']."</a>";
 450    return $fe_event_title;
 451  SC_END
 452  
 453  SC_BEGIN NEXT_EVENT_ICON
 454    global $pref, $cal_row, $ecal_dir;
 455    $fe_icon_file = "";
 456    if ($pref['eventpost_showcaticon'] == 1)
 457    {
 458      if($cal_row['event_cat_icon'] && file_exists($ecal_dir."images/".$cal_row['event_cat_icon']))
 459      {
 460        $fe_icon_file = $ecal_dir."images/".$cal_row['event_cat_icon'];
 461      }
 462      else
 463      {
 464        $fe_icon_file = THEME."images/".(defined("BULLET") ? BULLET : "bullet2.gif");
 465      }
 466    }
 467    return $fe_icon_file;
 468  SC_END
 469  
 470  SC_BEGIN NEXT_EVENT_GAP
 471    global $cal_totev;
 472    if ($cal_totev) return "<br /><br />"; else return "";
 473  SC_END
 474  
 475  
 476  */
 477  ?>


Généré le : Sun Apr 1 01:23:32 2007 par Balluche grâce à PHPXref 0.7