Location: PHPKode > projects > Basic Announce > Basic Announce Version 4.0/public/calendar.php
<?php
################################################################################
##              -= YOU MAY NOT REMOVE OR CHANGE THIS NOTICE =-                 #
## --------------------------------------------------------------------------- #
##  ApPHP AdminPanel Pro                                                       #
##  Developed by:  ApPHP <hide@address.com>                                      #
##  License:       GNU LGPL v.3                                                #
##  Site:          http://www.apphp.com/php-adminpanel/                        #
##  Copyright:     ApPHP AdminPanel (c) 2006-2011. All rights reserved.        #
##                                                                             #
################################################################################

    // Initialize the session.
    session_start();
    
    define("AP_PATH", "../");
    
    require_once("../inc/classes/session.class.php");	
    require_once("../inc/checkAdminPagePermissions.php");

	require_once("../inc/functions.inc.php");
    require_once("../inc/config.inc.php");
    require_once("../inc/settings.inc.php");
	require_once("../inc/languages/".$SETTINGS['site_language'].".php");
	
	if(!module_istalled('calendar')) redirect_to(AP_PATH."html/404.html");

    ## +---------------------------------------------------------------------------+
    ## | 1. Creating & Calling:                                                    | 
    ## +---------------------------------------------------------------------------+
    // include calendar class and other files
    $config = new Config();	
    define("_DATABASE_HOST", $config->getHost());
    define("_DATABASE_NAME", $config->getDatabase()); 
    define("_DATABASE_USER_NAME", $config->getUser());
    define("_DATABASE_PASSWORD", $config->getPassword());
    
    require_once("../modules/calendar/inc/connection.inc.php");
    require_once("../modules/calendar/calendar.class.php");
    
    ## *** create calendar object
    $objCalendar = new Calendar();
    ## *** show debug info - false|true
    $objCalendar->Debug(false);
    
    ## +---------------------------------------------------------------------------+
    ## | 2. General Settings:                                                      | 
    ## +---------------------------------------------------------------------------+
    ## *** set form submission type: "get" or "post"
    /// $objCalendar->SetSubmissionType("post");
    ## *** get current timezone
    /// echo $objCalendar->GetCurrentTimeZone();
    ## *** set timezone
    ## *** (list of supported Timezones - http://us3.php.net/manual/en/timezones.php)
    $objCalendar->SetTimeZone("America/Los_Angeles");    
    ## *** set week day name length - "short" or "long"
    $objCalendar->SetWeekDayNameLength("long");
    ## *** set start day of week: from 1 (Sanday) to 7 (Saturday)
    $objCalendar->SetWeekStartedDay("1");
    ## *** define showing a week number of year
    $objCalendar->ShowWeekNumberOfYear(true);

    ## +---------------------------------------------------------------------------+
    ## | 3. Visual Settings:                                                       | 
    ## +---------------------------------------------------------------------------+
    ## *** set CSS style: "green"|"blue" - default
    $objCalendar->SetCssStyle("blue");
    ## *** set calendar width and height
    $objCalendar->SetCalendarDimensions("800px", "500px");
    ## *** set default calendar view - "daily"|"weekly"|"monthly"|"yearly"
    $objCalendar->SetDefaultView("monthly");
    ## *** set calendar caption
    $objCalendar->SetCaption("Calendar");
    
    ##  *** set (allow) calendar operations
    $operations = array("add"=>false,
                        "delete"=>false);
    $objCalendar->SetOperations($operations);

	// handle template
    ob_start();
    $objCalendar->Show();    
    $calendar_content = ob_get_clean();
	
	$template = get_include_contents("templates/calendar.tpl");
	$template = str_replace("{SITE_NAME}", $SETTINGS['site_name'], $template);
	$template = str_replace("{TITLE}", lang('calendar'), $template);
	$template = str_replace("{STYLE}", "../styles/".$SETTINGS['css_style']."/style.css", $template);
	$template = str_replace("{CALENDAR}", $calendar_content, $template);

	echo $template;
	
?>
Return current item: Basic Announce