cal: added user config
parent
c9880c2372
commit
7043257896
19
cal/cal.php
19
cal/cal.php
|
@ -45,11 +45,30 @@ function cal_addon_settings_post ( &$a, &$b )
|
||||||
{
|
{
|
||||||
if (! local_user())
|
if (! local_user())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!x($_POST,'cal-submit'))
|
||||||
|
return;
|
||||||
|
|
||||||
|
set_pconfig(local_user(),'cal','enable',intval($_POST['cal-enable']));
|
||||||
}
|
}
|
||||||
function cal_addon_settings ( &$a, &$s )
|
function cal_addon_settings ( &$a, &$s )
|
||||||
{
|
{
|
||||||
if (! local_user())
|
if (! local_user())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$enabled = get_pconfig(local_user(), 'cal', 'enable');
|
||||||
|
$checked = (($enabled) ? ' checked="checked" ' : '');
|
||||||
|
$url = $a->get_baseurl().'/cal/'.$a->user['nickname'].'/export/ical';
|
||||||
|
|
||||||
|
$s .= '<h3>'.t('Export Events').'</h3>';
|
||||||
|
$s .= '<p>'.t('If this is enabled, you public events will be available at').' <strong>'.$url.'</strong></p>';
|
||||||
|
$s .= '<div id="cal-enable-wrapper">';
|
||||||
|
$s .= '<label id="cal-enable-label" for="cal-checkbox">'. t('Enable calendar export') .'</label>';
|
||||||
|
$s .= '<input id="cal-checkbox" type="checkbox" name="cal-enable" value="1" ' . $checked . '/>';
|
||||||
|
$s .= '</div><div class="clear"></div>';
|
||||||
|
$s .= '<div class="settings-submit-wrapper" ><input type="submit" name="cal-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
|
||||||
|
$s .= '</div><div class="clear"></div>';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue