auth->makePermissions([ dcAuth::PERMISSION_USAGE, dcAuth::PERMISSION_CONTENT_ADMIN, ])); $pwt = new postWidgetText(); # Delete widgets if (!empty($_POST['save']) && !empty($_POST['widgets'])) { try { foreach ($_POST['widgets'] as $k => $id) { $id = (int) $id; $pwt->delWidget($id); } dcAdminNotices::addSuccessNotice( __('Posts widgets successfully delete.') ); if (!empty($_POST['redir'])) { http::redirect($_POST['redir']); } else { dcCore::app()->adminurl->redirect('admin.plugin.postWidgetText'); } } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } } # filters $filter = new adminGenericFilter(dcCore::app(), 'pwt'); $filter->add(dcAdminFilters::getPageFilter()); $params = $filter->params(); # Get posts with text widget try { $posts = $pwt->getWidgets($params); $counter = $pwt->getWidgets($params, true); $posts_list = new listPostWidgetText(dcCore::app(), $posts, $counter->f(0)); } catch (Exception $e) { dcCore::app()->error->add($e->getMessage()); } # Display echo ' ' . __('Post widget text') . '' . dcPage::jsLoad(dcPage::getPF('postWidgetText/js/index.js')) . $filter->js(dcCore::app()->adminurl->get('admin.plugin.postWidgetText')) . ' ' . dcPage::breadcrumb([ __('Plugins') => '', __('Posts widgets') => '' ]) . dcPage::notices(); $filter->display('admin.plugin.postWidgetText', form::hidden('p', 'postWidgetText')); $posts_list->display( $filter->page, $filter->nb, '
' . '%s' . '
' . '

' . '

' . '

' . dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.postWidgetText', array_merge(['p' => 'postWidgetText'], $filter->values(true))) . dcCore::app()->formNonce() . '
' . '
' ); # Footer dcPage::helpBlock('postWidgetText'); echo '';