ApPHP Calendar Pro - Example of Code

Show Plain Text »
  1. <?php
  2.  
  3. ## +-----------------------------------------------------------------------+
  4. ## | 1. Creating & Calling:                                                |
  5. ## +-----------------------------------------------------------------------+
  6. ## *** define a relative (virtual) path to calendar.class.php file  
  7. ## *** and other files (relatively to the current file)
  8. ## *** RELATIVE PATH ONLY *** Ex.: "", "calendar/" or "../calendar/"
  9. define("CALENDAR_DIR", "");                    
  10. require_once(CALENDAR_DIR."inc/connection.inc.php");
  11. require_once(CALENDAR_DIR."calendar.class.php");
  12.  
  13. ## *** create calendar object
  14. $objCalendar = new Calendar();
  15.  
  16. ## +-----------------------------------------------------------------------+
  17. ## | 2. General Settings:                                                  |
  18. ## +-----------------------------------------------------------------------+
  19. ## +-- Submission Settings & Debug Mode -----------------------------------
  20. ## *** set PostBack method: "get" or "post"
  21. $objCalendar->SetPostBackMethod("post");
  22. $objCalendar->Debug(false);
  23.  
  24. ## +-- Languages ----------------------------------------------------------
  25. ## *** set interface language (default - English)
  26. $objCalendar->SetInterfaceLang("en");    
  27.  
  28. ## +-- Week Settings ------------------------------------------------------
  29. ## *** set week day name length - "short" or "long"
  30. $objCalendar->SetWeekDayNameLength("long");
  31. ## *** set start day of the week: from 1 (Sunday) to 7 (Saturday)
  32. $objCalendar->SetWeekStartedDay("1");
  33. ## *** disable certain days of the week: from 1 (Sunday) to 7 (Saturday). Ex.: 1,2 or 7
  34. /// $objCalendar->SetDisabledDays(6,7);
  35. ## *** define showing a week number of the year
  36. $objCalendar->ShowWeekNumberOfYear(true);
  37.  
  38.  
  39. ## +-----------------------------------------------------------------------+
  40. ## | 3. Events & Categories Settings:                                      |
  41. ## +-----------------------------------------------------------------------+
  42. ## +-- Events Actions & Operations ----------------------------------------
  43. ## *** allow multiple occurrences for events in the same time slot: false|true - default
  44. $objCalendar->SetEventsMultipleOccurrences(true);
  45. ## *** allow editing events in the past
  46. /// $objCalendar->EditingEventsInPast(false);
  47. ## *** set (allow) calendar events operations
  48. $objCalendar->SetEventsOperations(array(
  49.    "add"=>true,
  50.    "edit"=>true,
  51.    "details"=>true,
  52.    "delete"=>true,
  53.    "delete_by_range"=>true,
  54.    "manage"=>true
  55. ));
  56.  
  57. ## +-- Categories Actions & Operations ------------------------------------
  58. ## *** set (allow) using categories
  59. $objCalendar->AllowCategories(true);
  60. ## *** set calendar categories settings
  61. $objCalendar->SetCategoriesOperations(array(
  62.    "add"=>true,
  63.    "edit"=>true,
  64.    "details"=>true,
  65.    "delete"=>true,
  66.    "manage"=>true,
  67.    "allow_colors"=>true,
  68.    "show_filter"=>true
  69. ));
  70.  
  71. ## +-- Locations Actions & Operations ------------------------------------
  72. ## *** set (allow) using locations
  73. $objCalendar->AllowLocations(true);
  74. ## *** set calendar locations operations
  75. $objCalendar->SetLocationsOperations(array(
  76.    "add"=>true,
  77.    "edit"=>true,
  78.    "details"=>true,
  79.    "delete"=>true,
  80.    "manage"=>true,
  81.    "allow_colors"=>true,
  82.    "show_filter"=>true
  83. ));
  84.  
  85. ## +-----------------------------------------------------------------------+
  86. ## | 4. Participants Settings:                                                  
  87. ## +-----------------------------------------------------------------------+
  88. ## +-- Participants Settings -----------------------------------------------------
  89. ## *** set participant ID (parameter must be a numeric value) who can access the events
  90. /// $participant_id = 0;
  91. /// $objCalendar->SetParticipantID($participant_id);    
  92. ## *** set (allow) calendar participants operations
  93. $objCalendar->AllowParticipants(true);
  94. ## *** set participants settings
  95. $objCalendar->SetParticipantsOperations(array(
  96.    "add"=>true,
  97.    "edit"=>true,
  98.    "details"=>true,
  99.    "delete"=>true,
  100.    "manage"=>true,
  101.    "assign_to_events"=>true
  102. ));
  103.  
  104. ## +-----------------------------------------------------------------------+
  105. ## | 5. Time Settings and Formatting:                                      |
  106. ## +-----------------------------------------------------------------------+
  107. ## +-- TimeZone Settings --------------------------------------------------
  108. ## *** set timezone
  109. ## *** (list of supported Timezones - http://us3.php.net/manual/en/timezones.php)
  110. $objCalendar->SetTimeZone("America/Los_Angeles");    
  111.  
  112. ## +-- Time Format & Settings ----------------------------------------------
  113. ## *** define time format - 24|AM/PM
  114. $objCalendar->SetTimeFormat("24");
  115. ## *** define allowed hours frame (from, to). Possible values: 0...24
  116. $objCalendar->SetAllowedHours(0, 22);
  117. ## *** define time slot - 15|30|45|60 minutes
  118. $objCalendar->SetTimeSlot("60");
  119. ## *** set showing times in Daily, Weekly and List views
  120. $objCalendar->ShowTime("true");
  121.  
  122. ## +-----------------------------------------------------------------------+
  123. ## | 6. Visual Settings:                                                   |
  124. ## +-----------------------------------------------------------------------+
  125. ## +-- Calendar Views -----------------------------------------------------
  126. ## *** set (allow) calendar Views
  127. $objCalendar->SetCalendarViews(array(
  128.    "daily"=>true,
  129.    "weekly"=>true,
  130.    "monthly"=>true,
  131.    "monthly_double"=>true,
  132.    "yearly"=>true,
  133.    "list_view"=>true
  134. ));                        
  135. ## *** set default calendar view - "daily"|"weekly"|"monthly"|"yearly"|"list_view"|"monthly_small"|"monthly_double"
  136. $objCalendar->SetDefaultView("monthly");    
  137.  
  138. ## +-- Calendar Actions -----------------------------------------------------
  139. ## *** set (allow) calendar actions
  140. $objCalendar->SetCalendarActions(array("statistics"=>true, "exporting"=>true, "printing"=>true));
  141.  
  142. ## *** set CSS style: "green"|"brown"|"blue" - default
  143. $objCalendar->SetCssStyle("blue");
  144. ## *** specify using of WYSIWYG editor
  145. $objCalendar->AllowWYSIWYG(true);
  146. ## *** set calendar width and height
  147. $objCalendar->SetCalendarDimensions("800px", "500px");
  148. ## *** set type of displaying for events
  149. $events_display_type = array("daily"=>"block", "weekly"=>"tooltip", "monthly"=>"inline");
  150. $objCalendar->SetEventsDisplayType($events_display_type);
  151. ## *** set Sunday color - true|false
  152. $objCalendar->SetSundayColor(true);    
  153. ## *** set calendar caption
  154. $objCalendar->SetCaption("ApPHP Calendar v".Calendar::Version());
  155.  
  156. ## +-----------------------------------------------------------------------+
  157. ## | 7. Draw Calendar:                                                     |
  158. ## +-----------------------------------------------------------------------+
  159. ## *** drawing calendar
  160. $objCalendar->Show();
  161.  
  162. ?>