delPeriodPosts($id); $per->delPeriod($id); } dcPage::addSuccessNotice( __('Periods removed.') ); if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { $core->adminurl->redirect('admin.plugin.periodical', ['part' => 'periods']); } } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Delete periods related posts links (without delete periods) if ($action == 'emptyperiods' && !empty($_POST['periods'])) { try { foreach($_POST['periods'] as $id) { $id = (integer) $id; $per->delPeriodPosts($id); } dcPage::addSuccessNotice( __('Periods emptied.') ); if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { $core->adminurl->redirect('admin.plugin.periodical', ['part' => 'periods']); } } catch (Exception $e) { $core->error->add($e->getMessage()); } } $combo_action = [ __('empty periods') => 'emptyperiods', __('delete periods') => 'deleteperiods' ]; # Filters $p_filter = new adminGenericFilter($core, 'periodical'); $p_filter->add('part', 'periods'); $params = $p_filter->params(); # Get periods try { $periods = $per->getPeriods($params); $counter = $per->getPeriods($params, true); $period_list = new adminPeriodicalList($core, $periods, $counter->f(0)); } catch (Exception $e) { $core->error->add($e->getMessage()); } # Display echo '' . __('Periodical') . '' . dcPage::jsLoad(dcPage::getPF('periodical/js/checkbox.js')) . $p_filter->js($core->adminurl->get('admin.plugin.periodical', ['part' => 'periods'])) . '' . '' . dcPage::breadcrumb([ html::escapeHTML($core->blog->name) => '', __('Periodical') => '' ]) . dcPage::notices() . '

' . __('New period') . '

'; # Filters $p_filter->display('admin.plugin.periodical', form::hidden('p', 'periodical') . form::hidden('part', 'periods')); # Periods list $period_list->periodDisplay($p_filter, '
' . '%s' . '
' . '

' . '

' . __('Selected periods action:') . ' ' . form::combo('action', $combo_action) . '

' . $core->adminurl->getHiddenFormFields('admin.plugin.periodical', array_merge(['p' => 'periodical'], $p_filter->values(true))) . $core->formNonce() . '
' . '
' ); dcPage::helpBlock('periodical'); echo '';