-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsettings.php
More file actions
47 lines (39 loc) · 1.61 KB
/
Copy pathsettings.php
File metadata and controls
47 lines (39 loc) · 1.61 KB
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
<?php
/**
* Copyright (c) 2012 Thomas Tanghus <thomas@tanghus.net>
* This file is licensed under the Affero General Public License version 3 or
* later.
* See the COPYING-README file.
*/
OCP\JSON::checkLoggedIn();
$errors = array();
$required_apps = array(
array('id' => 'tal', 'name' => 'TAL Page Templates'),
array('id' => 'journal', 'name' => 'Journal'),
array('id' => 'contacts', 'name' => 'Contacts'),
);
foreach($required_apps as $app) {
if(!OCP\App::isEnabled($app['id'])) {
$error = (string)$l->t('The %%s app isn\'t enabled! Please enable it here: <strong><a href="%%s?appid=%%s">Enable %%s app</a></strong>');
$errors[] = sprintf($error, $app['name'],OCP\Util::linkTo('settings', 'apps'), $app['id'], $app['name']);
}
}
$calendars = OC_Calendar_Calendar::allCalendars(OCP\User::getUser(), true);
if( count($calendars) == 0 ) {
$error = (string)$l->t('You have no calendars. Please add one at the <strong><a href="%%s">Calendar app</a></strong>');
$errors[] = sprintf($error, OCP\Util::linkTo('calendar', 'index.php'));
}
if(count($errors) > 0) {
$tmpl = new OCP\Template('journal', 'rtfm');
$tmpl->assign('errors',$errors, false);
} else {
$cid = OCP\Config::getUserValue(OCP\User::getUser(), 'journal', 'default_calendar', null);
$single_calendar = OCP\Config::getUserValue(OCP\User::getUser(), 'journal', 'single_calendar', false);
OCP\Util::addScript('journal', 'settings');
$tmpl = new OC_TALTemplate('journal', 'settings', 'user');
$tmpl->assign('calendars', $calendars);
$tmpl->assign('single_calendar', $single_calendar);
$tmpl->assign('cid', $cid);
}
return $tmpl->fetchPage();
?>