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
|
<?php
use Bitweaver\KernelTools;
$hourValues = [ 1, 2, 3, 4, 6, 12 ];
$hourOutput = [ 60, 30, 20, 15, 10, 5 ];
$gBitSmarty->assign( 'hourValues', $hourValues );
$gBitSmarty->assign( 'hourOutput', $hourOutput );
$firstDayValues = [ 7, 6, 5, 4, 3, 2, 1 ];
$firstDayOutput = [ KernelTools::tra( "Monday" ), KernelTools::tra( "Tuesday" ), KernelTools::tra( "Wednesday" ), KernelTools::tra( "Thursday" ), KernelTools::tra( "Friday" ), KernelTools::tra( "Saturday" ), KernelTools::tra( "Sunday" ) ];
$gBitSmarty->assign( 'firstDayValues', $firstDayValues );
$gBitSmarty->assign( 'firstDayOutput', $firstDayOutput );
$dayStart = range( 0, 12 );
$gBitSmarty->assign( 'dayStart', $dayStart );
$dayEnd = range( 24, 13 );
$gBitSmarty->assign( 'dayEnd', $dayEnd );
$calendarValues = [
'calendar_week_offset',
'calendar_hour_fraction',
'calendar_day_start',
'calendar_day_end',
];
$calendarChecks = [
'calendar_user_prefs',
'calendar_ajax_popups',
];
// This has to come after the set since we are loading what is selected.
$contentDefaults = [];
$calendarTypeDefaults = [];
$calendarTypesSelected = [];
global $gLibertySystem;
foreach( $gLibertySystem->mContentTypes as $cType ) {
$option = 'calendar_default_'.$cType['content_type_guid'];
$calendarChecks[] = $option;
$calendarTypeDefaults[$option] = $gLibertySystem->getContentTypeName( $cType['content_type_guid'] );
}
asort($calendarTypeDefaults);
$gBitSmarty->assign('calendarTypeDefaults', $calendarTypeDefaults);
// this function only exists if it's been included by the index.php page. if
// it's been included from anywhere else, we don't execute this section
if( function_exists( 'simple_set_value' ) && $gBitUser->isAdmin() && !empty( $_REQUEST['calendar_submit'] ) ) {
foreach( $calendarValues as $item ) {
simple_set_value( $item, CALENDAR_PKG_NAME );
}
foreach( $calendarChecks as $item ) {
simple_set_toggle( $item, CALENDAR_PKG_NAME );
}
foreach( $calendarTypeDefaults as $key => $val ) {
simple_set_toggle_array( 'defaultTypes', $key, CALENDAR_PKG_NAME);
}
}
// Build the list of what is selected. Has to come AFTER the set.
foreach( $calendarTypeDefaults as $key => $val) {
if ($gBitSystem->isFeatureActive($key) ){
$calendarTypesSelected[] = $key;
}
}
$gBitSmarty->assign('calendarTypesSelected', $calendarTypesSelected);
|