/** * Display the edited items results table * * @param array Params */ function items_edited_results_block($params = array()) { // Make sure we are not missing any param: $params = array_merge(array('edited_User' => NULL, 'results_param_prefix' => 'actv_postedit_', 'results_title' => T_('Posts edited by the user'), 'results_no_text' => T_('User has not edited any posts')), $params); if (!is_logged_in()) { // Only logged in users can access to this function return; } global $current_User; if (!$current_User->check_perm('users', 'edit')) { // Check minimum permission: return; } $edited_User = $params['edited_User']; if (!$edited_User) { // No defined User, probably the function is calling from AJAX request $user_ID = param('user_ID', 'integer', 0); if (empty($user_ID)) { // Bad request, Exit here return; } $UserCache =& get_UserCache(); if (($edited_User =& $UserCache->get_by_ID($user_ID, false)) === false) { // Bad request, Exit here return; } } global $DB; param('user_tab', 'string', '', true); param('user_ID', 'integer', 0, true); $edited_versions_SQL = new SQL(); $edited_versions_SQL->SELECT('DISTINCT( iver_itm_ID )'); $edited_versions_SQL->FROM('T_items__version'); $edited_versions_SQL->WHERE('iver_edit_user_ID = ' . $DB->quote($edited_User->ID)); $SQL = new SQL(); $SQL->SELECT('*'); $SQL->FROM('T_items__item '); $SQL->WHERE('( ( post_lastedit_user_ID = ' . $DB->quote($edited_User->ID) . ' ) OR ( post_ID IN ( ' . $edited_versions_SQL->get() . ' ) ) )'); $SQL->WHERE_and('post_creator_user_ID != ' . $DB->quote($edited_User->ID)); // Create result set: $edited_items_Results = new Results($SQL->get(), $params['results_param_prefix'], 'D'); $edited_items_Results->Cache =& get_ItemCache(); $edited_items_Results->title = $params['results_title']; $edited_items_Results->no_results_text = $params['results_no_text']; // Get a count of the post which current user can delete $deleted_posts_edited_count = count($edited_User->get_deleted_posts('edited')); if ($edited_items_Results->total_rows > 0 && $deleted_posts_edited_count > 0) { // Display actino icon to delete all records if at least one record exists & current user can delete at least one item created by user $edited_items_Results->global_icon(sprintf(T_('Delete all post edited by %s'), $edited_User->login), 'delete', '?ctrl=user&user_tab=activity&action=delete_all_posts_edited&user_ID=' . $edited_User->ID . '&' . url_crumb('user'), ' ' . T_('Delete all'), 3, 4); } // Initialize Results object items_results($edited_items_Results, array('field_prefix' => 'post_', 'display_ord' => false, 'display_history' => false)); if (is_ajax_content()) { // init results param by template name if (!isset($params['skin_type']) || !isset($params['skin_name'])) { debug_die('Invalid ajax results request!'); } $edited_items_Results->init_params_by_skin($params['skin_type'], $params['skin_name']); } $display_params = array('before' => '<div class="results" style="margin-top:25px" id="edited_posts_result">'); $edited_items_Results->display($display_params); if (!is_ajax_content()) { // Create this hidden div to get a function name for AJAX request echo '<div id="' . $params['results_param_prefix'] . 'ajax_callback" style="display:none">' . __FUNCTION__ . '</div>'; } }
/* ** * Callback to add filters on top of the result set * function filter_on_post_title( & $Form ) { global $pagenow, $post_filter; $Form->hidden( 'filter_on_post_title', 1 ); $Form->text( 'post_filter', $post_filter, 20, T_('Task title'), '', 60 ); } $ItemList->filters_callback = 'filter_on_post_title'; */ $ItemList->title = T_('Post list'); // Initialize Results object items_results($ItemList, array('tab' => $tab)); if ($ItemList->is_filtered()) { // List is filtered, offer option to reset filters: $ItemList->global_icon(T_('Reset all filters!'), 'reset_filters', '?ctrl=items&blog=' . $Blog->ID . '&filter=reset', T_('Reset filters'), 3, 3); } if ($current_User->check_perm('blog_post_statuses', 'edit', false, $Blog->ID)) { // We have permission to add a post with at least one status: switch ($tab) { case 'pages': $label = T_('New page'); $title = T_('Create a new page...'); $new_ptyp_ID = 1000; $perm = 'page'; break; case 'intros': $label = T_('New intro');
<?php /** * This is the template that displays user's items * * This file is not meant to be called directly. * It is meant to be called by an include in the main.page.php template. * * b2evolution - {@link http://b2evolution.net/} * Released under GNU GPL License - {@link http://b2evolution.net/about/license.html} * @copyright (c)2003-2013 by Francois Planque - {@link http://fplanque.com/} * * @package evoskins */ if (!defined('EVO_MAIN_INIT')) { die('Please, do not access this page directly.'); } global $user_ID, $viewed_User, $display_params, $user_ItemList; // Default params: $params = array_merge(array('user_itemlist_title' => T_('Posts created by %s'), 'user_itemlist_no_results' => T_('User has not created any posts')), $params); $user_ItemList->title = sprintf($params['user_itemlist_title'], $viewed_User->get_identity_link(array('link_text' => 'link'))); $user_ItemList->no_results_text = $params['user_itemlist_no_results']; // Initialize Results object items_results($user_ItemList, array('field_prefix' => $user_ItemList->param_prefix, 'display_permalink' => false, 'display_title_flag' => false, 'display_ord' => false, 'display_history' => false, 'display_blog' => false, 'display_author' => false, 'display_visibility_actions' => false, 'display_actions' => false)); $user_ItemList->display($display_params);