62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
<?php
|
|
if (!defined('INCLUDE_DIR')) die('Fatal error');
|
|
|
|
class CaldavPlugin extends Plugin {
|
|
public $config_class = 'CaldavConfig';
|
|
|
|
public function getConfigurationForm() {
|
|
return array(
|
|
'calendar_url' => new TextboxField(array(
|
|
'label' => 'Calendar URL',
|
|
'configuration' => array(
|
|
'size' => 60,
|
|
'length' => 255
|
|
),
|
|
'required' => true
|
|
)),
|
|
'app_token' => new TextboxField(array(
|
|
'label' => 'App Token',
|
|
'configuration' => array(
|
|
'size' => 60,
|
|
'length' => 255
|
|
),
|
|
'required' => true,
|
|
'widget' => 'Password'
|
|
)),
|
|
);
|
|
}
|
|
|
|
public function getAgentActions() {
|
|
return array(
|
|
'create_calendar_entry' => array(
|
|
'label' => 'Create Calendar Entry',
|
|
'action' => 'createCalendarEntry'
|
|
)
|
|
);
|
|
}
|
|
|
|
public function createCalendarEntry($ticket) {
|
|
// Implementation will go here
|
|
}
|
|
}
|
|
|
|
class CaldavConfig extends PluginConfig {
|
|
public function getOptions() {
|
|
return array(
|
|
'calendar_url' => $this->getConfig('calendar_url'),
|
|
'app_token' => $this->getConfig('app_token')
|
|
);
|
|
}
|
|
|
|
public function pre_save($config, &$errors) {
|
|
if (!$config['calendar_url']) {
|
|
$errors['calendar_url'] = 'Calendar URL is required';
|
|
}
|
|
if (!$config['app_token']) {
|
|
$errors['app_token'] = 'App Token is required';
|
|
}
|
|
return true;
|
|
}
|
|
}
|
|
?>
|