Welcome to mirror list, hosted at ThFree Co, Russian Federation.

neweventform.php « ajax « calendar « apps - github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 7099ea718e97a9ba27322a30e52cba1849ecc87d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
 * Copyright (c) 2011 Georg Ehrke <ownclouddev at georgswebsite dot de>
 * This file is licensed under the Affero General Public License version 3 or
 * later.
 * See the COPYING-README file.
 */

require_once('../../../lib/base.php');

$l10n = new OC_L10N('calendar');

if(!OC_USER::isLoggedIn()) {
	die('<script type="text/javascript">document.location = oc_webroot;</script>');
}

$calendar_options = OC_Calendar_Calendar::allCalendars(OC_User::getUser());
$category_options = OC_Calendar_Object::getCategoryOptions($l10n);
$repeat_options = OC_Calendar_Object::getRepeatOptions($l10n);
$startday   = substr($_GET['d'], 0, 2);
$startmonth = substr($_GET['d'], 2, 2);
$startyear  = substr($_GET['d'], 4, 4);
$starttime  = $_GET['t'];
$allday = $starttime == 'allday';
if($starttime != 'undefined' && !is_nan($starttime) && !$allday){
	$startminutes = '00';
}elseif($allday){
	$starttime = '0';
	$startminutes = '00';
}else{
	$starttime = date('H');
	if(strlen($starttime) == 2 && $starttime <= 9){
		$starttime = substr($starttime, 1, 1);
	}
	$startminutes = date('i');
}

$endday      = $startday;
$endmonth    = $startmonth;
$endyear     = $startyear;
$endtime     = $starttime;
$endminutes  = $startminutes;
if($endtime == 23) {
	if($startday == date(t, mktime($starttime, $startminutes, 0, $startmonth, $startday, $startyear))){
		$datetimestamp = mktime(0, 0, 0, $startmonth, $startday, $startyear);
		$datetimestamp = $datetimestamp + 86400;
		$endmonth = date("m", $datetimestamp);
		$endday = date("d", $datetimestamp);
		$endyear = date("Y", $datetimestamp);
	}else{
		$endday++;
		if($endday <= 9){
			$endday = "0" . $endday;
		}
	}
	$endtime = 0;
} else {
	$endtime++;
}

$tmpl = new OC_Template('calendar', 'part.newevent');
$tmpl->assign('calendar_options', $calendar_options);
$tmpl->assign('category_options', $category_options);
$tmpl->assign('startdate', $startday . '-' . $startmonth . '-' . $startyear);
$tmpl->assign('starttime', ($starttime <= 9 ? '0' : '') . $starttime . ':' . $startminutes);
$tmpl->assign('enddate', $endday . '-' . $endmonth . '-' . $endyear);
$tmpl->assign('endtime', ($endtime <= 9 ? '0' : '') . $endtime . ':' . $endminutes);
$tmpl->assign('allday', $allday);
$tmpl->printpage();
?>