Esempio n. 1
0
 $posts_awaiting_moderation_content = ob_get_contents();
 ob_clean();
 if (!empty($posts_awaiting_moderation_content)) {
     echo '<div class="items_container evo_content_block">';
     echo $posts_awaiting_moderation_content;
     echo '</div>';
 }
 /*
  * RECENTLY EDITED
  */
 // Create empty List:
 $ItemList = new ItemList2($Blog, NULL, NULL);
 // Filter list:
 $ItemList->set_filters(array('visibility_array' => get_visibility_statuses('keys', array('trash')), 'orderby' => 'datemodified', 'order' => 'DESC', 'posts' => 5));
 // Get ready for display (runs the query):
 $ItemList->display_init();
 if ($ItemList->result_num_rows) {
     // We have recent edits
     $nb_blocks_displayed++;
     if ($current_User->check_perm('blog_post_statuses', 'edit', false, $Blog->ID)) {
         // We have permission to add a post with at least one status:
         $block_item_Widget->global_icon(T_('Write a new post...'), 'new', '?ctrl=items&amp;action=new&amp;blog=' . $Blog->ID, T_('New post') . ' &raquo;', 3, 4, array('class' => 'action_icon btn-primary'));
     }
     echo '<div class="items_container evo_content_block">';
     $block_item_Widget->title = T_('Recently edited');
     $block_item_Widget->disp_template_replaced('block_start');
     while ($Item =& $ItemList->get_item()) {
         echo '<div class="dashboard_post dashboard_post_' . ($ItemList->current_idx % 2 ? 'even' : 'odd') . '" lang="' . $Item->get('locale') . '">';
         // We don't switch locales in the backoffice, since we use the user pref anyway
         // Load item's creator user:
         $Item->get_creator_User();
Esempio n. 2
0
/**
 * Dispaly posts awaiting moderation with the given status
 *
 * @param string visibility status
 * @param object block_item_Widget
 * @return boolean true if items were displayed, false otherwise
 */
function display_posts_awaiting_moderation($status, &$block_item_Widget)
{
    global $Blog, $current_User;
    // Create empty List:
    $ItemList = new ItemList2($Blog, NULL, NULL);
    // Filter list:
    $ItemList->set_filters(array('visibility_array' => array($status), 'orderby' => 'datemodified', 'order' => 'DESC', 'posts' => 5));
    // Get ready for display (runs the query):
    $ItemList->display_init();
    if (!$ItemList->result_num_rows) {
        // We don't have posts awaiting moderation with the given status
        return false;
    }
    switch ($status) {
        case 'draft':
            $block_title = T_('Recent drafts');
            break;
        case 'review':
            $block_title = T_('Recent posts to review');
            break;
        case 'protected':
            $block_title = T_('Recent member posts awaiting moderation');
            break;
        case 'community':
            $block_title = T_('Recent community posts awaiting moderation');
            break;
        default:
            $block_title = T_('Recent posts awaiting moderation');
            break;
    }
    $block_item_Widget->title = $block_title;
    $block_item_Widget->disp_template_replaced('block_start');
    while ($Item =& $ItemList->get_item()) {
        echo '<div class="dashboard_post dashboard_post_' . ($ItemList->current_idx % 2 ? 'even' : 'odd') . '" lang="' . $Item->get('locale') . '">';
        // We don't switch locales in the backoffice, since we use the user pref anyway
        // Load item's creator user:
        $Item->get_creator_User();
        $Item->status(array('before' => '<div class="floatright"><span class="note status_' . $Item->status . '"><span>', 'after' => '</span></span></div>'));
        echo '<div class="dashboard_float_actions">';
        $Item->edit_link(array('before' => ' ', 'after' => ' ', 'class' => 'ActionButton btn'));
        $Item->publish_link('', '', '#', '#', 'PublishButton');
        echo get_icon('pixel');
        echo '</div>';
        if ($Item->status !== 'draft' || $Item->creator_user_ID == $current_User->ID) {
            // Display Item permalink icon
            echo '<span style="float: left; padding-right: 5px; margin-top: 4px">' . $Item->get_permanent_link('#icon#') . '</span>';
        }
        echo '<h3 class="dashboard_post_title">';
        $item_title = $Item->dget('title');
        if (!strlen($item_title)) {
            $item_title = '[' . format_to_output(T_('No title')) . ']';
        }
        echo '<a href="?ctrl=items&amp;blog=' . $Blog->ID . '&amp;p=' . $Item->ID . '">' . $item_title . '</a>';
        echo ' <span class="dashboard_post_details">';
        echo '</span>';
        echo '</h3>';
        echo '</div>';
    }
    $block_item_Widget->disp_template_raw('block_end');
    return true;
}