示例#1
0
    /**
     * Creates the Calendar View
     */
    function display($tpl = null)
    {
        $app = JFactory::getApplication();
        //initialize variables
        $menu = $app->getMenu();
        $menuitem = $menu->getActive();
        $jemsettings = JemHelper::config();
        $params = $app->getParams();
        $settings = JemHelper::globalattribs();
        // Load css
        JemHelper::loadCss('calendar');
        JemHelper::loadCss('jem');
        JemHelper::loadCustomCss();
        JemHelper::loadCustomTag();
        $evlinkcolor = $params->get('eventlinkcolor');
        $evbackgroundcolor = $params->get('eventbackgroundcolor');
        $currentdaycolor = $params->get('currentdaycolor');
        $eventandmorecolor = $params->get('eventandmorecolor');
        $style = '
		div[id^=\'catz\'] a {color:' . $evlinkcolor . ';}
		div[id^=\'catz\'] {background-color:' . $evbackgroundcolor . ';}
		.eventcontent {background-color:' . $evbackgroundcolor . ';}
		.eventandmore {background-color:' . $eventandmorecolor . ';}
		.today .daynum {background-color:' . $currentdaycolor . ';}';
        $this->document->addStyleDeclaration($style);
        // add javascript (using full path - see issue #590)
        JHtml::_('script', 'media/com_jem/js/calendar.js');
        $rows = $this->get('Items');
        $currentweek = $this->get('Currentweek');
        $currentyear = Date("Y");
        $showweeknr = $params->get('showweeknr', true);
        //Set Page title
        $pagetitle = $params->def('page_title', $menuitem->title);
        $params->def('page_heading', $pagetitle);
        $pageclass_sfx = $params->get('pageclass_sfx');
        // Add site name to title if param is set
        if ($app->getCfg('sitename_pagetitles', 0) == 1) {
            $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
        } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
            $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
        }
        $this->document->setTitle($pagetitle);
        $this->document->setMetaData('title', $pagetitle);
        $cal = new activeCalendarWeek($currentyear, 1, 1);
        $cal->enableWeekNum(JText::_('COM_JEM_WKCAL_WEEK'), null, '', $showweeknr);
        // enables week number column with linkable week numbers
        $cal->setFirstWeekDay($params->get('firstweekday', 0));
        $this->rows = $rows;
        $this->params = $params;
        $this->jemsettings = $jemsettings;
        $this->settings = $settings;
        $this->currentweek = $currentweek;
        $this->cal = $cal;
        $this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
        parent::display($tpl);
    }
示例#2
0
<?php

require_once "../source/activecalendar.php";
require_once "../source/activecalendarweek.php";
$cal = new activeCalendarWeek();
$cal->enableWeekNum("Week");
?>
 
<?php 
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Active Calendar Class :: Example</title>
<link rel="stylesheet" type="text/css" href="<?php 
print @$_GET['css'];
?>
" />
</head>
<body>
<center>
<?php 
print $cal->showWeeks(12);
?>
<br />
<a href="../examples.php">Back to examples.php</a>
</center>
</body>
</html>
示例#3
0
<?php

require_once "../source/activecalendar.php";
require_once "../source/activecalendarweek.php";
$cal = new activeCalendarWeek(2008);
$cal->setFirstWeekDay(0);
// '0' -> start on Sunday
?>
 
<?php 
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Active Calendar Class :: Example</title>
<link rel="stylesheet" type="text/css" href="<?php 
print @$_GET['css'];
?>
" />
</head>
<body>
<center>
<?php 
print $cal->showWeeksByID(39, 1);
?>
<br />
<a href="../examples.php">Back to examples.php</a>
</center>
</body>
</html>
示例#4
0
<?php

require_once "../source/activecalendar.php";
require_once "../source/activecalendarweek.php";
$cal = new activeCalendarWeek(2008, 1, 1);
$cal->enableWeekNum("Week");
$cal->setFirstWeekDay(1);
// '1' -> start on Monday
?>
 
<?php 
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Active Calendar Class :: Example</title>
<link rel="stylesheet" type="text/css" href="<?php 
print @$_GET['css'];
?>
" />
</head>
<body>
<center>
<?php 
print $cal->showWeeksByID(39, 8);
?>
<br />
<a href="../examples.php">Back to examples.php</a>
</center>
</body>
</html>
示例#5
0
<?php

require_once "../source/activecalendar.php";
require_once "../source/activecalendarweek.php";
$cal = new activeCalendarWeek("2010", "2", "1");
$cal->enableWeekNum("Week");
$cal->setEventContent("2010", "2", "2", "Google", "http://www.google.com");
$cal->setEventContent("2010", "2", "11", "<img src=\"img/pager.png\" border=\"0\" alt=\"\" /> meeting");
$cal->setEventContent("2010", "2", "23", "<img src=\"img/ok.png\" border=\"0\" alt=\"\" /> birthday");
$multipleLinesEvent = array("Title: News", "Time: 16.00", "Status: ok");
for ($x = 1; $x <= 5; $x++) {
    $cal->setEventContent("2010", "3", $x, $multipleLinesEvent);
}
?>
 
<?php 
print "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>Active Calendar Class :: Example</title>
<link rel="stylesheet" type="text/css" href="<?php 
print @$_GET['css'];
?>
" />
</head>
<body>
<center>
<?php 
print $cal->showWeeks(6);
?>
示例#6
0
	/**
	 * Creates the Calendar View
	 */
	function display($tpl = null)
	{
		$app = JFactory::getApplication();

		// Load tooltips behavior
		JHtml::_('behavior.tooltip');

		// initialize variables
		$document     = JFactory::getDocument();
		$menu         = $app->getMenu();
		$menuitem     = $menu->getActive();
		$jemsettings  = JemHelper::config();
		$user         = JemFactory::getUser();
		$params       = $app->getParams();
		$top_category = (int)$params->get('top_category', 0);
		$jinput       = $app->input;
		$print        = $jinput->getBool('print', false);
		$this->param_topcat = $top_category > 0 ? ('&topcat='.$top_category) : '';

		// Load css
		JemHelper::loadCss('jem');
		JemHelper::loadCss('calendar');
		JemHelper::loadCustomCss();
		JemHelper::loadCustomTag();

		if ($print) {
			JemHelper::loadCss('print');
			$document->setMetaData('robots', 'noindex, nofollow');
		}

		$evlinkcolor = $params->get('eventlinkcolor');
		$evbackgroundcolor = $params->get('eventbackgroundcolor');
		$currentdaycolor = $params->get('currentdaycolor');
		$eventandmorecolor = $params->get('eventandmorecolor');

		$style = '
		div#jem .eventcontentinner a,
		div#jem .eventandmore a {
			color: ' . $evlinkcolor . ';
		}
		.eventcontentinner {
			background-color:'.$evbackgroundcolor .';
		}
		.eventandmore {
			background-color:'.$eventandmorecolor .';
		}
		.today .daynum {
			background-color:'.$currentdaycolor.';
		}';

		$document->addStyleDeclaration($style);

		// add javascript (using full path - see issue #590)
		JHtml::_('script', 'media/com_jem/js/calendar.js');

		$model = $this->getModel();
		$rows = $this->get('Items');
		$currentweek = $this->get('Currentweek');
		$currentyear =  Date("Y");

		// Set Page title
		$pagetitle = $params->def('page_title', $menuitem->title);
		$params->def('page_heading', $pagetitle);
		$pageclass_sfx = $params->get('pageclass_sfx');

		// Add site name to title if param is set
		if ($app->getCfg('sitename_pagetitles', 0) == 1) {
			$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
		}
		elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
			$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
		}

		$document->setTitle($pagetitle);
		$document->setMetaData('title', $pagetitle);

		// Check if the user has permission to add things
		$permissions = new stdClass();
		$catIds = $model->getCategories('all');
		$permissions->canAddEvent = $user->can('add', 'event', false, false, $catIds);
		$permissions->canAddVenue = $user->can('add', 'venue', false, false, $catIds);

		$itemid  = $jinput->getInt('Itemid', 0);
		$partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : '';
		$print_link = JRoute::_('index.php?option=com_jem&view=weekcal' . $partItemid . '&print=1&tmpl=component');

		// init calendar
		$cal = new activeCalendarWeek($currentyear,1,1);
		$cal->enableWeekNum(JText::_('COM_JEM_WKCAL_WEEK'),null,''); // enables week number column with linkable week numbers
		$cal->setFirstWeekDay($params->get('firstweekday', 0));
		$cal->enableDayLinks('index.php?option=com_jem&view=day' . $this->param_topcat);

		$this->rows          = $rows;
		$this->params        = $params;
		$this->jemsettings   = $jemsettings;
		$this->permissions   = $permissions;
		$this->currentweek   = $currentweek;
		$this->cal           = $cal;
		$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
		$this->print_link    = $print_link;

		parent::display($tpl);
	}