$id) { $id = (integer) $id; $pwt->delWidget($id); } dcPage::addSuccessNotice( __('Posts widgets successfully delete.') ); http::redirect( $p_url ); } catch (Exception $e) { $core->error->add($e->getMessage()); } } # Combos $sortby_combo = array( __('Post title') => 'post_title', __('Post date') => 'post_dt', __('Widget title') => 'option_title', __('Widget date') => 'option_upddt', ); $order_combo = array( __('Descending') => 'desc', __('Ascending') => 'asc' ); # Filters $show_filters = false; $nb_per_page = 1; $sortby = !empty($_GET['sortby']) ? $_GET['sortby'] : 'post_dt'; $order = !empty($_GET['order']) ? $_GET['order'] : 'desc'; $page = !empty($_GET['page']) ? (integer) $_GET['page'] : 1; if (!empty($_GET['nb']) && (integer) $_GET['nb'] > 0) { if ($nb_per_page != $_GET['nb']) { $show_filters = true; } $nb_per_page = (integer) $_GET['nb']; } $params['limit'] = array((($page-1)*$nb_per_page), $nb_per_page); if ($sortby !== '' && in_array($sortby,$sortby_combo)) { if ($order !== '' && in_array($order,$order_combo)) { $params['order'] = $sortby.' '.$order; } if ($sortby != 'post_dt' || $order != 'desc') { $show_filters = true; } } # Get posts with text widget try { $posts = $pwt->getWidgets($params); $counter = $pwt->getWidgets($params, true); $posts_list = new postWidgetTextList( $core, $posts, $counter->f(0) ); } catch (Exception $e) { $core->error->add($e->getMessage()); } # Display echo ' '.__('Post widget text').''. dcPage::jsLoad( 'js/filter-controls.js' ). '\n".' '. dcPage::breadcrumb( array( html::escapeHTML($core->blog->name) => '', __('Posts widgets') => '' ) ). dcPage::notices().'

'.__('Show filters and display options').'

'. form::combo('sortby', $sortby_combo, $sortby).'

'. form::combo('order', $order_combo, $order).'

'.__('Show').'

'. form::hidden(array('p'), 'postWidgetText').'

'. $posts_list->display($page, $nb_per_page, '
'. '%s'. '
'. '

'. '

'. '

'. form::hidden(array('sortby'), $sortby). form::hidden(array('order'), $order). form::hidden(array('page'), $page). form::hidden(array('nb'), $nb_per_page). form::hidden(array('p'), 'postWidgetText'). $core->formNonce(). '
'. '
' ); # Footer dcPage::helpBlock('postWidgetText'); echo '

'.__('Configuration').' - postWidgetText - '.$core->plugins->moduleInfo('postWidgetText', 'version').'  '.__('postWidgetText').'

';