* * @return void */ public function show() { global $INPUT; global $INFO; global $ID; global $lang; global $conf; $stime_days = $conf['subscribe_time'] / 60 / 60 / 24; // print intro echo p_locale_xhtml('subscr_form'); // list up current subscriptions echo '
'.$lang['subscr_m_not_subscribed'].'
'; } else { echo ''.hsc(prettyprint_id($sub['target'])).'
';
} else {
echo ''.hsc(prettyprint_id($sub['target'])).'
';
}
$sstl = sprintf($lang['subscr_style_'.$sub['style']], $stime_days);
if (!$sstl) $sstl = hsc($sub['style']);
echo ' ('.$sstl.') ';
echo ''.$lang['subscr_m_unsubscribe'].
''.prettyprint_id($ID).'
',
$ns => ''.prettyprint_id($ns).'
',
];
$styles = [
'every' => $lang['subscr_style_every'],
'digest' => sprintf($lang['subscr_style_digest'], $stime_days),
'list' => sprintf($lang['subscr_style_list'], $stime_days),
];
// create the form
$form = new Form(['id' => 'subscribe__form']);
$form->addTagOpen('div')->addClass('no');
$form->setHiddenField('id', $ID);
$form->setHiddenField('do', 'subscribe');
$form->setHiddenField('sub_action', 'subscribe');
$form->addFieldsetOpen($lang['subscr_m_subscribe']);
$value = (array_key_exists($INPUT->post->str('sub_target'), $targets)) ?
$INPUT->str('sub_target') : key($targets);
foreach ($targets as $val => $label) {
$data = ($value === $val) ? ['checked' => 'checked'] : [];
$form->addRadioButton('sub_target', $label)->val($val)->attrs($data);
}
$form->addFieldsetClose();
$form->addFieldsetOpen($lang['subscr_m_receive']);
$value = (array_key_exists($INPUT->post->str('sub_style'), $styles)) ?
$INPUT->str('sub_style') : key($styles);
foreach ($styles as $val => $label) {
$data = ($value === $val) ? ['checked' => 'checked'] : [];
$form->addRadioButton('sub_style', $label)->val($val)->attrs($data);
}
$form->addFieldsetClose();
$form->addButton('do[subscribe]', $lang['subscr_m_subscribe'])->attr('type', 'submit');
$form->addTagClose('div');
print $form->toHTML('Subscribe');
echo '