/side_menu.inc.php

https://github.com/atutor/webcalendar · PHP · 48 lines · 36 code · 9 blank · 3 comment · 1 complexity · 563003dd8732603d41ea390e103329a9 MD5 · raw file

  1. <?php
  2. global $savant, $_config, $_base_href;
  3. ob_start();
  4. //Get the list of entries associated with the current user
  5. $sql = 'SELECT * from '.TABLE_PREFIX.'config WHERE name="webcalendar"';
  6. $result = mysql_query($sql, $db);
  7. while($row = mysql_fetch_array($result)){
  8. $webcalendar_url_db = $row[1];
  9. }
  10. $sql2 = "SELECT login from ".TABLE_PREFIX."members WHERE member_id ='$_SESSION[member_id]'";
  11. $result10 = mysql_query($sql2, $db);
  12. while($row2 = mysql_fetch_row($result10)){
  13. $this_login = $row2['0'];
  14. }
  15. $sql9 = "SELECT * from webcal_entry_user WHERE cal_login='$this_login'";
  16. $result9 = mysql_query($sql9, $db);
  17. $today = date("d-M-Y");
  18. echo '<span>'._AT('today_is').': <strong><a href="'.$_base_href.'mods/calendar/">'.$today.'</a></strong></span>';
  19. echo '<small><small> ('._AT('new_window').')</small></small>';
  20. echo '<ul style="margin-left:-2em;">';
  21. while($row = mysql_fetch_array($result9)){
  22. $today = date(Ymd);
  23. // Get ten approved entries associated with a user, from today onward.
  24. $sql10 = "SELECT A.*, B.* FROM webcal_entry AS A, webcal_entry_user AS B WHERE A.cal_id='".$row[0]."' AND A.cal_date >= '$today' AND A.cal_id = B.cal_id AND (B.cal_status = 'A' || A.cal_access = 'P') AND B.cal_login = '".$this_login."' LIMIT 10";
  25. $result10 = mysql_query($sql10, $db);
  26. while($row2 = mysql_fetch_assoc($result10)){
  27. #$this_date = split("*./4", $row2['cal_date']);
  28. $this_date = split(".*/4", $row2['cal_date']);
  29. $this_date = chunk_split($row2['cal_date'], 4, '-');
  30. $this_date = trim(chunk_split($this_date, 7, '-'), '-');
  31. echo '<li><a href="'.$webcalendar_url_db.'view_entry.php?id='.$row2['cal_id'].SEP.'date='.$row2['cal_date'].'" onclick="window.open(\' '.$webcalendar_url_db.'view_entry.php?id='.$row2['cal_id'].SEP.'date='.$row2['cal_date'].'\',\'calendarwin\',\'width=600,height=520,scrollbars=yes, resizable=yes\'); return false">'.$row2['cal_name'].'</a><br /><small><small> ('.$this_date.')</small></small></li>';
  32. }
  33. }
  34. echo '</ul>';
  35. $savant->assign('dropdown_contents', ob_get_contents());
  36. ob_end_clean();
  37. $savant->assign('title', _AT('current_calendar'));
  38. $savant->display('include/box.tmpl.php');
  39. ?>