Exemple #1
0
 function get_column_info()
 {
     $columns = get_column_headers($this->_screen);
     $hidden = get_hidden_columns($this->_screen);
     $sortable = array();
     return array($columns, $hidden, $sortable);
 }
 /**
  * @access protected
  *
  * @return array
  */
 protected function get_column_info()
 {
     $columns = get_column_headers($this->_screen);
     $hidden = get_hidden_columns($this->_screen);
     $sortable = array();
     $primary = $this->get_default_primary_column_name();
     return array($columns, $hidden, $sortable, $primary);
 }
Exemple #3
0
 function prepare_items()
 {
     $columns = $this->get_columns();
     $sortable = $this->get_sortable_columns();
     $hidden = get_hidden_columns($this->screen);
     $this->_column_headers = array($columns, $hidden, $sortable);
     $this->items = $this->get_records();
     $total_items = $this->get_total_found_rows();
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $this->get_items_per_page('edit_stream_notifications_per_page', 20)));
 }
 /**
  * Gets the name of the primary column in the Entries screen
  *
  * @since 2.0.14
  *
  * @return string $primary_column
  */
 protected function get_primary_column_name()
 {
     $columns = get_column_headers($this->screen);
     $hidden = get_hidden_columns($this->screen);
     $primary_column = '';
     foreach ($columns as $column_key => $column_display_name) {
         if ('cb' != $column_key && !in_array($column_key, $hidden)) {
             $primary_column = $column_key;
             break;
         }
     }
     return $primary_column;
 }
 /**
  * Prepares the list of venues for displaying.
  *
  * Modifies the query based on the current view and screen options and
  * begins setting up columns.
  *
  * @since 1.0.0
  */
 function prepare_items()
 {
     global $wp_query, $wpdb;
     $screen = get_current_screen();
     $per_page = get_user_option('gigs_page_audiotheme_venues_per_page');
     $per_page = empty($per_page) ? 20 : $per_page;
     // Set up column headers.
     $columns = $this->get_columns();
     $hidden = get_hidden_columns($screen->id);
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     // Compile the WP_Query args based on the current view and user options.
     $args = array('post_type' => 'audiotheme_venue', 'order' => isset($_REQUEST['order']) && 'desc' === strtolower($_REQUEST['order']) ? 'desc' : 'asc', 'orderby' => !isset($_REQUEST['orderby']) ? 'title' : $_REQUEST['orderby'], 'posts_per_page' => $per_page);
     if (isset($_REQUEST['orderby'])) {
         switch ($_REQUEST['orderby']) {
             case 'gigs':
                 $args['meta_key'] = '_audiotheme_gig_count';
                 $args['orderby'] = 'meta_value_num';
                 break;
             case 'city':
             case 'contact_name':
             case 'contact_phone':
             case 'contact_email':
             case 'country':
             case 'phone':
             case 'state':
             case 'website':
                 $args['meta_key'] = '_audiotheme_' . $_REQUEST['orderby'];
                 $args['orderby'] = 'meta_value';
                 break;
         }
     }
     if (isset($_REQUEST['s'])) {
         $args['s'] = stripslashes($_REQUEST['s']);
     }
     $args['paged'] = $this->get_pagenum();
     // Run the query.
     $items = array();
     $wp_query = new WP_Query($args);
     if (isset($wp_query->posts) && count($wp_query->posts)) {
         foreach ($wp_query->posts as $post) {
             $items[$post->ID] = get_audiotheme_venue($post->ID);
         }
     }
     $this->items = $items;
     $this->set_pagination_args(array('total_items' => $wp_query->found_posts, 'per_page' => $per_page, 'total_pages' => $wp_query->max_num_pages));
 }
</div>

<div class="clear"></div>

<?php 
if ('all' == $cat_id) {
    $cat_id = '';
}
$args = array('category' => $cat_id, 'hide_invisible' => 0, 'orderby' => $sqlorderby, 'hide_empty' => 0);
if (!empty($_GET['s'])) {
    $args['search'] = $_GET['s'];
}
$links = get_bookmarks($args);
if ($links) {
    $link_columns = get_column_headers('link-manager');
    $hidden = get_hidden_columns('link-manager');
    ?>

<?php 
    wp_nonce_field('bulk-bookmarks');
    ?>
<table class="widefat fixed" cellspacing="0">
	<thead>
	<tr>
<?php 
    print_column_headers('link-manager');
    ?>
	</tr>
	</thead>

	<tfoot>
function flag_picturelist()
{
    // *** show picture list
    global $wpdb, $flagdb, $user_ID, $flag;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $flag->manage_page->search_result;
        // we didn't set a gallery or a pagination
        $act_gid = 0;
        $_GET['paged'] = 1;
        $page_links = false;
    } else {
        // GET variables
        $act_gid = $flag->manage_page->gid;
        // Load the gallery metadata
        $gallery = $flagdb->find_gallery($act_gid);
        if (!$gallery) {
            flagGallery::show_error(__('Gallery not found.', 'flash-album-gallery'));
            return;
        }
        // Check if you have the correct capability
        if (!flagAdmin::can_manage_this_gallery($gallery->author)) {
            flagGallery::show_error(__('Sorry, you have no access here', 'flash-album-gallery'));
            return;
        }
        // look for pagination
        if (!isset($_GET['paged']) || intval($_GET['paged']) < 1) {
            $_GET['paged'] = 1;
        }
        $_GET['paged'] = intval($_GET['paged']);
        $start = ($_GET['paged'] - 1) * 50;
        // get picture values
        $picturelist = $flagdb->get_gallery($act_gid, $flag->options['galSort'], $flag->options['galSortDir'], false, 50, $start);
        // build pagination
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $flagdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $flagdb->find_all_galleries();
    //get the columns
    $gallery_columns = flag_manage_gallery_columns();
    $hidden_columns = get_hidden_columns('flag-manage-images');
    $hidden_columns = array_filter($hidden_columns);
    if ($picturelist) {
        $a_hits = array();
        foreach ($picturelist as $p) {
            $a_hits[] = $p->hitcounter;
        }
        if (!array_sum($a_hits)) {
            $hidden_columns[] = 'views_likes';
            $hidden_columns[] = 'rating';
        }
    } else {
        $hidden_columns[] = 'views_likes';
        $hidden_columns[] = 'rating';
    }
    $num_columns = count($gallery_columns) - count($hidden_columns);
    ?>
<!--[if lt IE 8]>
	<style type="text/css">
		.custom_thumb {
			display : none;
		}
	</style>
<![endif]-->

<script type="text/javascript"> 
//<![CDATA[
function showDialog( windowId, height ) {
	var form = document.getElementById('updategallery');
	var elementlist = "";
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					if (elementlist == "")
						elementlist = form.elements[i].value;
					else
						elementlist += "," + form.elements[i].value ;
		}
	}
	jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
	jQuery("#" + windowId + "_imagelist").val(elementlist);
	// console.log (jQuery("#TB_imagelist").val());
	tb_show("", "#TB_inline?width=640&height=" + height + "&inlineId=" + windowId + "&modal=true", false);
}

function checkAll(form)
{
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]") {
				if(form.elements[i].checked == true)
					form.elements[i].checked = false;
				else
					form.elements[i].checked = true;
			}
		}
	}
}

function getNumChecked(form)
{
	var num = 0;
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					num++;
		}
	}
	return num;
}

// this function check for a the number of selected images, sumbmit false when no one selected
function checkSelected() {

	var numchecked = getNumChecked(document.getElementById('updategallery'));
	 
	if(numchecked < 1) { 
		alert('<?php 
    echo esc_js(__("No images selected", "flash-album-gallery"));
    ?>
');
		return false; 
	} 
	
	actionId = jQuery('#bulkaction').val();
	
	switch (actionId) {
		case "copy_to":
		case "move_to":
			showDialog('selectgallery', 120);
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', 120);
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', 160);
			return false;
			break;			
	}
	
	return confirm('<?php 
    echo sprintf(esc_js(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'flash-album-gallery')), "' + numchecked + '");
    ?>
');
}

jQuery(document).ready( function() {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('flag-manage-gallery'); 

});
//]]>
</script>

<div class="flag-wrap">

<?php 
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'flash-album-gallery'), esc_html(stripslashes(get_search_query())));
        ?>
</h2>
<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="media-search-input"><?php 
        _e('Search Images', 'flash-album-gallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="flag-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'flash-album-gallery');
        ?>
" class="button" />
</p>
</form>

<br style="clear: both;" />

<form id="updategallery" class="flagform" method="POST" action="<?php 
        echo esc_url($flag->manage_page->base_page . '&mode=edit&s=' . urlencode(get_search_query()));
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('flag_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
    } else {
        ?>

<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'flash-album-gallery');
        ?>
 : <?php 
        echo esc_html($gallery->title);
        ?>
</h2>
<select name="select_gid" style="width:180px; float: right; margin: -20px 3px 0 0;" onchange="window.location.href=this.options[this.selectedIndex].value">
	<option selected="selected"><?php 
        _e('Choose another gallery', 'flash-album-gallery');
        ?>
</option>
<?php 
        foreach ($gallerylist as $gal) {
            if ($gal->gid != $act_gid) {
                ?>
	<option value="<?php 
                echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=edit&amp;gid=" . $gal->gid, 'flag_editgallery');
                ?>
" ><?php 
                if ($flag->options['albSort'] == 'gid') {
                    echo $gal->gid . ' - ';
                }
                echo esc_html(stripslashes($gal->title));
                if ($flag->options['albSort'] == 'title') {
                    echo ' (' . $gal->gid . ')';
                }
                ?>
</option>
<?php 
            }
        }
        ?>
</select>

<form id="updategallery" class="flagform" method="POST" action="<?php 
        echo $flag->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . intval($_GET['paged']);
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('flag_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<div id="poststuff" class="metabox-holder">
	<?php 
        wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
        ?>
<div id="post-body"><div id="post-body-content"><div id="normal-sortables" class="meta-box-sortables ui-sortable" style="position: relative;">
	<div id="flagalleryset" class="postbox <?php 
        echo postbox_classes('flagalleryset', 'flag-manage-gallery');
        ?>
" >
		<div class="handlediv" title="Click to toggle"><br/></div>
		<h3 class="hndle"><span><?php 
        _e('Gallery settings', 'flash-album-gallery');
        ?>
</span></h3>
		<div class="inside">
			<table class="flag-form-table" >
				<tr>
					<th align="right" scope="row"><?php 
        _e('Title', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><input type="text" size="50" name="title" value="<?php 
        echo esc_html($gallery->title);
        ?>
"  /></td>
				</tr>
				<tr>
					<th align="right" valign="top" scope="row"><?php 
        _e('Description', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><textarea name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
        echo esc_html($gallery->galdesc);
        ?>
</textarea></td>
				</tr>
				<tr>
					<th align="right" scope="row"><?php 
        _e('Path', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left"><input <?php 
        if (IS_WPMU) {
            echo 'readonly = "readonly"';
        }
        ?>
 type="text" size="50" name="path" value="<?php 
        echo esc_attr($gallery->path);
        ?>
"  /></td>
				</tr>
				<tr>
					<th align="right" scope="row"><?php 
        _e('Author', 'flash-album-gallery');
        ?>
:</th>
					<td> </td>
					<td align="left">
					<?php 
        $editable_ids = $flag->manage_page->get_editable_user_ids($user_ID);
        if ($editable_ids && count($editable_ids) > 1) {
            wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author));
        } else {
            echo $act_author_user->display_name;
        }
        ?>
						<input type="hidden" name="previewpic" value="<?php 
        if (is_array($picturelist)) {
            echo $picturelist[0]->pid;
        }
        ?>
" />
					</td>
				</tr>
			</table>
			
			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
        _e("Scan Folder for new images", 'flash-album-gallery');
        ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
        _e("Save Changes", 'flash-album-gallery');
        ?>
" />
			</div>
			<div class="clear"></div>
		</div>
	</div>
</div></div></div>
</div> <!-- poststuff -->
<?php 
    }
    ?>

<div class="tablenav flag-tablenav">
	<?php 
    if ($page_links) {
        ?>
	<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $flagdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $flagdb->paged['objects_per_page'], $flagdb->paged['total_objects'])), number_format_i18n($flagdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
	<?php 
    }
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction" class="alignleft">
		<option value="no_action" ><?php 
    _e("No action", 'flash-album-gallery');
    ?>
</option>
		<option value="webview_images" ><?php 
    _e("Create images optimized for web", 'flash-album-gallery');
    ?>
</option>
		<option value="new_thumbnail" ><?php 
    _e("Create new thumbnails", 'flash-album-gallery');
    ?>
</option>
		<option value="resize_images" ><?php 
    _e("Resize images", 'flash-album-gallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'flash-album-gallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'flash-album-gallery');
    ?>
</option>
		<option value="copy_meta" ><?php 
    _e("Metadata to description", 'flash-album-gallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'flash-album-gallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'flash-album-gallery');
    ?>
</option>
		<option value="reset_counters"><?php 
    _e("Reset Views & Likes counters", 'flash-album-gallery');
    ?>
</option>
		<?php 
    do_action('flag_manage_images_bulkaction');
    ?>
	</select>
	<input class="button-secondary alignleft" style="margin-right:10px;" type="submit" name="showThickbox" value="<?php 
    _e("OK", 'flash-album-gallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />
	
<?php 
    if ($flag->options['galSort'] == "sortorder" && !$is_search) {
        ?>
	<a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&amp;mode=sort&amp;gid=" . $act_gid, 'flag_sortgallery');
        ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
        _e("Sort gallery", 'flash-album-gallery');
        ?>
</a>
<?php 
    }
    if (current_user_can('FlAG Upload images') && !$is_search) {
        ?>
	<a href="<?php 
        echo wp_nonce_url($flag->manage_page->base_page . "&amp;gid=" . $act_gid . "&amp;tabs=1", 'flag_addimages');
        ?>
" class="button-secondary alignleft" style="margin:1px 10px 0 0;"><?php 
        _e("Add Images", 'flash-album-gallery');
        ?>
</a>
<?php 
    }
    ?>
	<input type="submit" name="updatepictures" class="button-primary action alignleft"  value="<?php 
    _e("Save Changes", 'flash-album-gallery');
    ?>
" />
	</div>
</div>

<table id="flag-listimages" class="widefat fixed flag-table" cellspacing="0" >

	<thead>
	<tr>
<?php 
    foreach ($gallery_columns as $key => $value) {
        if (in_array($key, $hidden_columns)) {
            continue;
        }
        echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>';
    }
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    foreach ($gallery_columns as $key => $value) {
        if (in_array($key, $hidden_columns)) {
            continue;
        }
        if ($key == 'cb') {
            $value = '';
        }
        echo $cols = '<th class="manage-column column-' . $key . '">' . $value . '</td>';
    }
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    $counter = 0;
    if ($picturelist) {
        $rt = array(24.5, 45.7, 54.8, 59.3, 64.7, 68.90000000000001, 71.5, 73.7, 75.90000000000001, 77.09999999999999);
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!flagAdmin::can_manage_this_gallery($picture->author) && $is_search) {
                continue;
            }
            $hits = intval($picture->hitcounter);
            $votes = intval($picture->total_votes);
            $counter++;
            $pid = (int) $picture->pid;
            $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : 'alternate';
            $exclude = $picture->exclude ? 'checked="checked"' : '';
            $date = mysql2date(get_option('date_format'), $picture->imagedate);
            $time = mysql2date(get_option('time_format'), $picture->imagedate);
            ?>
		<tr id="picture-<?php 
            echo $pid;
            ?>
" class="<?php 
            echo $alternate;
            ?>
 iedit"  valign="top">
			<?php 
            foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
                $class = "class=\"{$gallery_column_key} column-{$gallery_column_key}\"";
                $style = '';
                if (in_array($gallery_column_key, $hidden_columns)) {
                    continue;
                }
                $attributes = "{$class}{$style}";
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
 
						<th <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL;
                        ?>
" id="thumb-<?php 
                        echo $pid;
                        ?>
" />
							</a>
						</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo $picture->filename;
                        ?>
							</a></strong>
							<br /><?php 
                        echo $date;
                        ?>
							<?php 
                        if (!empty($picture->meta_data['width'])) {
                            echo '<br />' . __('Image size: ', 'flash-album-gallery') . $picture->meta_data['width'] . 'x' . $picture->meta_data['height'];
                        } else {
                            $imgpath = WINABSPATH . $picture->path . "/" . $picture->filename;
                            $img = @getimagesize($imgpath);
                            if ($img) {
                                echo '<br />' . __('Image size: ', 'flash-album-gallery') . $img[0] . 'x' . $img[1];
                            }
                        }
                        ?>
							<?php 
                        if (!empty($picture->meta_data['thumbnail'])) {
                            echo '<br />' . __('Thumbnail size: ', 'flash-album-gallery') . $picture->meta_data['thumbnail']['width'] . 'x' . $picture->meta_data['thumbnail']['height'];
                        }
                        ?>
							<?php 
                        if (!empty($picture->meta_data['webview'])) {
                            echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . $picture->meta_data['webview'][0] . 'x' . $picture->meta_data['webview'][1];
                        } else {
                            echo '<br />' . __('Optimized size: ', 'flash-album-gallery') . __('not optimized ', 'flash-album-gallery');
                        }
                        ?>
							<p>
							<?php 
                        $actions = array();
                        $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'flash-album-gallery') . '</a>';
                        $actions['meta'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'flash-album-gallery') . '">' . __('Meta', 'flash-album-gallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="thickbox" href="' . FLAG_URLPATH . 'admin/manage_thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'flash-album-gallery') . '">' . __('Edit thumb', 'flash-album-gallery') . '</a>';
                        $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=flag-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'flag_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s"', 'flash-album-gallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete', 'flash-album-gallery') . '</a>';
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
                        foreach ($actions as $action => $link) {
                            ++$i;
                            $i == $action_count ? $sep = '' : ($sep = ' | ');
                            echo "<span class='{$action}'>{$link}{$sep}</span>";
                        }
                        echo '</div>';
                        ?>
</p>
						</td>
						<?php 
                        break;
                    case 'views_likes':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="hitcounter[<?php 
                        echo $pid;
                        ?>
]" type="text" value="<?php 
                        echo stripslashes($picture->hitcounter);
                        ?>
" /> /
							<input name="total_votes[<?php 
                        echo $pid;
                        ?>
]" type="text" value="<?php 
                        echo stripslashes($picture->total_votes);
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'rating':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<?php 
                        if ($votes == 0) {
                            $like = '0.0';
                        } else {
                            if ($votes < 11) {
                                $like = $rt[$votes - 1];
                            } else {
                                $like = round((100 - $rt[count($rt) - 1]) / ($hits > 0 ? $hits : 1) * ($votes <= $hits ? $votes : $hits), 1) + $rt[count($rt) - 1];
                            }
                        }
                        echo $like . '%';
                        ?>
						</td>
						<?php 
                        break;
                    case 'alt_title_desc':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo esc_html(stripslashes($picture->alttext));
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo esc_html(stripslashes($picture->description));
                        ?>
</textarea>
							<input name="link[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo esc_attr(stripslashes($picture->link));
                        ?>
" placeholder="(optional for skin) URL for linked button" /><br/>
						</td>
						<?php 
                        break;
                    case 'exclude':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><input name="exclude[<?php 
                        echo $pid;
                        ?>
]" type="checkbox" value="1" <?php 
                        echo $exclude;
                        ?>
 /></td>
						<?php 
                        break;
                        /* 
                        case 'views' :
                        						?>
                        						<td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td>
                        						<?php						
                        					break;
                        */
                    /* 
                    case 'views' :
                    						?>
                    						<td <?php echo $attributes; ?>><?php echo $picture->hitcounter; ?></td>
                    						<?php						
                    					break;
                    */
                    default:
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('flag_manage_gallery_custom_column', $gallery_column_key, $pid);
                        ?>
</td>
						<?php 
                        break;
                }
                ?>
			<?php 
            }
            ?>
		</tr>
		<?php 
        }
    }
    // In the case you have no capaptibility to see the search result
    if ($counter == 0) {
        echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>' . __('No entries found', 'flash-album-gallery') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
	<p class="submit"><input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e("Save Changes", 'flash-album-gallery');
    ?>
" /></p>
	</form>	
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #selectgallery -->
	<div id="selectgallery" style="display: none;" >
		<form id="form-select-gallery" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_thickbox_form');
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th>
		    		<?php 
    _e('Select the destination gallery:', 'flash-album-gallery');
    ?>
&nbsp;
		    		<select name="dest_gid" style="width:90%" >
		    			<?php 
    foreach ($gallerylist as $gallery) {
        if ($gallery->gid != $act_gid) {
            ?>
						<option value="<?php 
            echo $gallery->gid;
            ?>
" ><?php 
            echo $gallery->gid;
            ?>
 - <?php 
            echo esc_html($gallery->title);
            ?>
</option>
						<?php 
        }
    }
    ?>
		    		</select>
		    	</th>
		  	</tr>
		  	<tr align="right">
		    	<td class="submit">
		    		<input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php 
    _e("OK", 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="<?php 
    _e("Cancel", 'flash-album-gallery');
    ?>
" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'flash-album-gallery');
    ?>
:</strong>
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $flag->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $flag->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). Grand Flagallery will keep ratio size', 'flash-album-gallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flash-album-gallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" action="<?php 
    echo admin_url('admin.php?page=flag-manage-gallery&mode=edit&gid=' . $act_gid . '&paged=1');
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('flag_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'flash-album-gallery');
    ?>
</th>
				<td><input type="text" size="5" maxlength="5" name="thumbWidth" value="<?php 
    echo $flag->options['thumbWidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbHeight" value="<?php 
    echo $flag->options['thumbHeight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'flash-album-gallery');
    ?>
</small></td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'flash-album-gallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbFix" value="1" <?php 
    checked('1', $flag->options['thumbFix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'flash-album-gallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'flash-album-gallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'flash-album-gallery');
    ?>
&nbsp;" onclick="tb_remove()"/>
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('flag-manage-images');});	
	/* ]]> */
	</script>
	<?php 
}
 /**
  * Get a list of all, hidden and sortable columns, with filter applied
  *
  * @since 3.1.0
  * @access protected
  *
  * @return array
  */
 function get_column_info()
 {
     if (isset($this->_column_headers)) {
         return $this->_column_headers;
     }
     $columns = get_column_headers($this->screen);
     $hidden = get_hidden_columns($this->screen);
     $sortable_columns = $this->get_sortable_columns();
     /**
      * Filter the list table sortable columns for a specific screen.
      *
      * The dynamic portion of the hook name, $this->screen->id, refers
      * to the ID of the current screen, usually a string.
      *
      * @since 3.5.0
      *
      * @param array $sortable_columns An array of sortable columns.
      */
     $_sortable = apply_filters("manage_{$this->screen->id}_sortable_columns", $sortable_columns);
     $sortable = array();
     foreach ($_sortable as $id => $data) {
         if (empty($data)) {
             continue;
         }
         $data = (array) $data;
         if (!isset($data[1])) {
             $data[1] = false;
         }
         $sortable[$id] = $data;
     }
     $this->_column_headers = array($columns, $hidden, $sortable);
     return $this->_column_headers;
 }
Exemple #9
0
			<?php if ($page_links) echo "<div class='tablenav-pages'>$page_links</div>"; ?>
		<div class="clear"></div>
	</div>
	<div class="clear"></div>

	<table class="widefat" cellspacing="0">
		<thead>
		<tr><?php print_column_headers('ecart_page_ecart-customers'); ?></tr>
		</thead>
		<tfoot>
		<tr><?php print_column_headers('ecart_page_ecart-customers',false); ?></tr>
		</tfoot>
	<?php if (sizeof($Customers) > 0): ?>
		<tbody id="customers-table" class="list orders">
		<?php
			$hidden = get_hidden_columns('ecart_page_ecart-customers');

			$even = false;
			foreach ($Customers as $Customer):
			$CustomerName = (empty($Customer->firstname) && empty($Customer->lastname))?'('.__('no contact name','Ecart').')':"{$Customer->firstname} {$Customer->lastname}";
			?>
		<tr<?php if (!$even) echo " class='alternate'"; $even = !$even; ?>>
			<th scope='row' class='check-column'><input type='checkbox' name='selected[]' value='<?php echo $Customer->id; ?>' /></th>
			<td class="name column-name"><a class='row-title' href='<?php echo esc_url( add_query_arg(array('page'=>'ecart-customers','id'=>$Customer->id),admin_url('admin.php'))); ?>' title='<?php _e('Edit','Ecart'); ?> &quot;<?php echo esc_attr($CustomerName); ?>&quot;'><?php echo esc_html($CustomerName); ?></a><?php echo !empty($Customer->company)?"<br />".esc_html($Customer->company):""; ?></td>
			<td class="login column-login<?php echo in_array('login',$hidden)?' hidden':''; ?>"><?php echo esc_html($Customer->user_login); ?></td>
			<td class="email column-email<?php echo in_array('email',$hidden)?' hidden':''; ?>"><a href="mailto:<?php echo esc_attr($Customer->email); ?>"><?php echo esc_html($Customer->email); ?></a></td>

			<td class="location column-location<?php echo in_array('location',$hidden)?' hidden':''; ?>"><?php
				$location = '';
				$location = $Customer->city;
				if (!empty($location) && !empty($Customer->state)) $location .= ', ';
Exemple #10
0
 function get_column_info()
 {
     $columns = get_column_headers($this->_screen);
     $hidden = get_hidden_columns($this->_screen);
     $_sortable = $this->get_sortable_columns();
     foreach ($_sortable as $id => $data) {
         if (empty($data)) {
             continue;
         }
         $data = (array) $data;
         if (!isset($data[1])) {
             $data[1] = false;
         }
         $sortable[$id] = $data;
     }
     return array($columns, $hidden, $sortable);
 }
Exemple #11
0
    /**
     * Render the screen options tab.
     *
     * @since 3.3.0
     */
    public function render_screen_options()
    {
        global $wp_meta_boxes;
        $columns = get_column_headers($this);
        $hidden = get_hidden_columns($this);
        ?>
		<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="<?php 
        esc_attr_e('Screen Options Tab');
        ?>
">
		<form id="adv-settings" action="" method="post">
		<?php 
        if (isset($wp_meta_boxes[$this->id]) || $this->get_option('per_page') || $columns && empty($columns['_title'])) {
            ?>
			<h5><?php 
            _e('Show on screen');
            ?>
</h5>
		<?php 
        }
        if (isset($wp_meta_boxes[$this->id])) {
            ?>
			<div class="metabox-prefs">
				<?php 
            meta_box_prefs($this);
            if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) {
                if (isset($_GET['welcome'])) {
                    $welcome_checked = empty($_GET['welcome']) ? 0 : 1;
                    update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked);
                } else {
                    $welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
                    if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) {
                        $welcome_checked = false;
                    }
                }
                echo '<label for="wp_welcome_panel-hide">';
                echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked((bool) $welcome_checked, true, false) . ' />';
                echo _x('Welcome', 'Welcome panel') . "</label>\n";
            }
            ?>
				<br class="clear" />
			</div>
			<?php 
        }
        if ($columns) {
            if (!empty($columns['_title'])) {
                ?>
			<h5><?php 
                echo $columns['_title'];
                ?>
</h5>
			<?php 
            }
            ?>
			<div class="metabox-prefs">
				<?php 
            $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
            foreach ($columns as $column => $title) {
                // Can't hide these for they are special
                if (in_array($column, $special)) {
                    continue;
                }
                if (empty($title)) {
                    continue;
                }
                if ('comments' == $column) {
                    $title = __('Comments');
                }
                $id = "{$column}-hide";
                echo '<label for="' . $id . '">';
                echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
                echo "{$title}</label>\n";
            }
            ?>
				<br class="clear" />
			</div>
		<?php 
        }
        $this->render_screen_layout();
        $this->render_per_page_options();
        echo $this->_screen_settings;
        ?>
		<div><?php 
        wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false);
        ?>
</div>
		</form>
		</div>
		<?php 
    }
Exemple #12
0
    Shopp::_e('New Order');
    ?>
</h2>
	<?php 
}
?>

	<?php 
$this->notices();
?>


	<?php 
$totalsedit = isset($_GET['edit']) && 'totals' == $_GET['edit'];
$columns = get_column_headers($this->screen);
$hidden = get_hidden_columns($this->screen);
$colspan = count($columns);
$timestamp = empty($Purchase->created) ? current_time('timestamp') : $Purchase->created;
?>
	<div id="order">
		<div class="title">
			<div id="titlewrap">
				<span class="date"><?php 
echo Shopp::_d(get_option('date_format'), $timestamp);
?>
 <small><?php 
echo date(get_option('time_format'), $timestamp);
?>
</small>

				<div class="alignright">
 /**
  * Prints manage row for dynamic taxonomy
  *
  * @param Dynamic_Taxonomy_Handler $taxonomy_obj
  * @param string $style
  * @return unknown
  */
 public function dynamic_taxonomy_row($taxonomy_obj, $style)
 {
     $checkbox = "<input type='checkbox' name='taxonomies[]' id='taxonomy_{$taxonomy_obj->get_taxonomy_name()}' value='{$taxonomy_obj->get_taxonomy_name()}' />";
     $r = "<tr id='taxonomy-{$taxonomy_obj->get_taxonomy_name()}'{$style}>";
     $columns = get_column_headers('dynamic_taxonomy');
     $hidden = get_hidden_columns('dynamic_taxonomy');
     foreach ($columns as $column_name => $column_display_name) {
         $class = "class=\"{$column_name} column-{$column_name}\"";
         $style = '';
         if (in_array($column_name, $hidden)) {
             $style = ' style="display:none;"';
         }
         $attributes = "{$class}{$style}";
         switch ($column_name) {
             case 'cb':
                 $r .= "<th scope='row' class='check-column'>{$checkbox}</th>";
                 break;
             case 'taxonomy':
                 $r .= sprintf('<td %s>%s<br /><div class="row-actions"><span class="edit"><a href="%s">Edit</a> | </span><span class="delete"><a href="%s" class="submitdelete">Delete</a></span></div></td>', $attributes, $taxonomy_obj->get_taxonomy_name(), $this->get_edit_taxonomy_url($taxonomy_obj->get_taxonomy_name()), wp_nonce_url($this->get_manage_taxonomies_url(array('action' => 'delete', 'taxonomy' => $taxonomy_obj->get_taxonomy_name())), 'delete_taxonomy'));
                 break;
             case 'label':
                 $r .= "<td {$attributes}>{$taxonomy_obj->get_taxonomy_label()}</td>";
                 break;
             case 'object_types':
                 $obect_types = count($taxonomy_obj->get_object_types()) > 0 ? join(', ', $taxonomy_obj->get_object_types()) : "none";
                 $r .= "<td {$attributes}>{$obect_types}</td>";
                 break;
             default:
                 $r .= "<td {$attributes}>";
                 $r .= apply_filters('manage_users_custom_column', '', $column_name, $taxonomy_obj->get_taxonomy_name());
                 $r .= "</td>";
         }
     }
     $r .= '</tr>';
     return $r;
 }
Exemple #14
0
    /**
     * Renders the report table to the WP admin screen
     *
     * @author Jonathan Davis
     * @since 1.3
     *
     * @return void
     **/
    public function table()
    {
        extract($this->options, EXTR_SKIP);
        // Get only the records for this page
        $beginning = (int) ($paged - 1) * $per_page;
        $report = array_values($this->data);
        $report = array_slice($report, $beginning, $beginning + $per_page, true);
        unset($this->data);
        // Free memory
        ?>


			<table class="widefat" cellspacing="0">
				<thead>
				<tr><?php 
        ShoppUI::print_column_headers($this->screen);
        ?>
</tr>
				</thead>
			<?php 
        if (false !== $report && count($report) > 0) {
            ?>
				<tbody id="report" class="list stats">
				<?php 
            $columns = get_column_headers($this->screen);
            $hidden = get_hidden_columns($this->screen);
            $even = false;
            $records = 0;
            while (list($id, $data) = each($report)) {
                if ($records++ > $per_page) {
                    break;
                }
                ?>
					<tr<?php 
                if (!$even) {
                    echo " class='alternate'";
                }
                $even = !$even;
                ?>
>
				<?php 
                foreach ($columns as $column => $column_title) {
                    $classes = array($column, "column-{$column}");
                    if (in_array($column, $hidden)) {
                        $classes[] = 'hidden';
                    }
                    if (method_exists(get_class($this), $column)) {
                        ?>
							<td class="<?php 
                        echo esc_attr(join(' ', $classes));
                        ?>
"><?php 
                        echo call_user_func(array($this, $column), $data, $column, $column_title, $this->options);
                        ?>
</td>
						<?php 
                    } else {
                        ?>
							<td class="<?php 
                        echo esc_attr(join(' ', $classes));
                        ?>
">
							<?php 
                        do_action('shopp_manage_report_custom_column', $column, $column_title, $data);
                        ?>
							</td>
						<?php 
                    }
                }
                /* $columns */
                ?>
				</tr>
				<?php 
            }
            /* records */
            ?>

				<tr class="summary average">
					<?php 
            $averages = clone $this->totals;
            $first = true;
            foreach ($columns as $column => $column_title) {
                if ($first) {
                    $averages->id = $averages->period = $averages->{$column} = __('Average', 'Shopp');
                    $first = false;
                } else {
                    $value = isset($averages->{$column}) ? $averages->{$column} : null;
                    $total = isset($this->total) ? $this->total : 0;
                    if (null == $value) {
                        $averages->{$column} = '';
                    } elseif (0 === $total) {
                        $averages->{$column} = 0;
                    } else {
                        $averages->{$column} = $value / $total;
                    }
                }
                $classes = array($column, "column-{$column}");
                if (in_array($column, $hidden)) {
                    $classes[] = 'hidden';
                }
                ?>
						<td class="<?php 
                echo esc_attr(join(' ', $classes));
                ?>
">
							<?php 
                if (method_exists(get_class($this), $column)) {
                    echo call_user_func(array($this, $column), $averages, $column, $column_title, $this->options);
                } else {
                    do_action('shopp_manage_report_custom_column_average', $column, $column_title, $data);
                }
                ?>
						</td>
					<?php 
            }
            ?>
				</tr>
				<tr class="summary total">
					<?php 
            $first = true;
            foreach ($columns as $column => $column_title) {
                if ($first) {
                    $label = __('Total', 'Shopp');
                    $this->totals->id = $this->totals->period = $this->totals->{$column} = $label;
                    $first = false;
                }
                $classes = array($column, "column-{$column}");
                if (in_array($column, $hidden)) {
                    $classes[] = 'hidden';
                }
                ?>
						<td class="<?php 
                echo esc_attr(join(' ', $classes));
                ?>
">
							<?php 
                if (method_exists(get_class($this), $column)) {
                    echo call_user_func(array($this, $column), $this->totals, $column, $column_title, $this->options);
                } else {
                    do_action('shopp_manage_report_custom_column_total', $column, $column_title, $data);
                }
                ?>
						</td>
					<?php 
            }
            ?>
				</tr>

				</tbody>
			<?php 
        } else {
            ?>
				<tbody><tr><td colspan="<?php 
            echo count(get_column_headers($this->screen));
            ?>
"><?php 
            _e('No report data available.', 'Shopp');
            ?>
</td></tr></tbody>
			<?php 
        }
        ?>
			<tfoot>
			<tr><?php 
        ShoppUI::print_column_headers($this->screen, false);
        ?>
</tr>
			</tfoot>
			</table>
	<?php 
    }
/**
 * {@internal Missing Short Description}}
 *
 * @since unknown
 *
 * @param unknown_type $page
 */
function manage_columns_prefs($page) {
	$columns = get_column_headers($page);

	$hidden = get_hidden_columns($page);

	foreach ( $columns as $column => $title ) {
		// Can't hide these
		if ( 'cb' == $column || 'title' == $column || 'name' == $column || 'username' == $column || 'media' == $column || 'comment' == $column )
			continue;
		if ( empty($title) )
			continue;

		if ( 'comments' == $column )
			$title = __('Comments');
		$id = "$column-hide";
		echo '<label for="' . $id . '">';
		echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . (! in_array($column, $hidden) ? ' checked="checked"' : '') . ' />';
		echo "$title</label>\n";
	}
}
 /**
  * Prepares the list of gigs for displaying.
  *
  * Modifies the query based on the current view and screen options and
  * begins setting up columns.
  *
  * @since 1.0.0
  */
 function prepare_items()
 {
     global $wp_query;
     $screen = get_current_screen();
     $per_page = get_user_option('toplevel_page_audiotheme_gigs_per_page');
     $per_page = empty($per_page) ? 20 : $per_page;
     // Set up column headers.
     $columns = $this->get_columns();
     $hidden = get_hidden_columns($screen->id);
     $sortable = $this->get_sortable_columns();
     $this->_column_headers = array($columns, $hidden, $sortable);
     // Compile the WP_Query args based on the current view and user options.
     $args = array('post_type' => 'audiotheme_gig', 'order' => isset($_REQUEST['order']) && 'asc' === strtolower($_REQUEST['order']) ? 'asc' : 'desc', 'post_status' => isset($_REQUEST['post_status']) ? $_REQUEST['post_status'] : 'publish,draft', 'posts_per_page' => $per_page);
     if (empty($_REQUEST['m']) && ('upcoming' === $this->current_view || 'past' === $this->current_view)) {
         $args['meta_query'][] = array('key' => '_audiotheme_gig_datetime', 'value' => isset($_REQUEST['gig_date']) ? urldecode($_REQUEST['gig_date']) : current_time('mysql'), 'compare' => isset($_REQUEST['compare']) ? urldecode($_REQUEST['compare']) : '>=', 'type' => 'DATETIME');
         // Sort upcoming in ascending order by default.
         $args['order'] = 'upcoming' === $this->current_view && !isset($_REQUEST['order']) ? 'asc' : $args['order'];
     } elseif (!empty($_REQUEST['m'])) {
         $m = absint(substr($_REQUEST['m'], 4));
         $y = absint(substr($_REQUEST['m'], 0, 4));
         $start = sprintf('%s-%s-01 00:00:00', $y, zeroise($m, 2));
         $end = sprintf('%s 23:59:59', date('Y-m-t', mktime(0, 0, 0, $m, 1, $y)));
         $args['meta_query'][] = array('key' => '_audiotheme_gig_datetime', 'value' => array($start, $end), 'compare' => 'BETWEEN', 'type' => 'DATETIME');
         $args['order'] = isset($_REQUEST['order']) ? $args['order'] : 'asc';
     }
     if (!empty($_REQUEST['venue'])) {
         $args['connected_type'] = 'audiotheme_venue_to_gig';
         $args['connected_items'] = absint($_REQUEST['venue']);
     }
     if (isset($_REQUEST['orderby'])) {
         switch ($_REQUEST['orderby']) {
             case 'title':
                 $args['orderby'] = 'title';
                 break;
             case 'venue':
                 // Handled after the query is run.
                 break;
             default:
                 $args['meta_key'] = '_audiotheme_' . $_REQUEST['orderby'];
                 $args['orderby'] = 'meta_value';
                 break;
         }
     } else {
         $args['meta_key'] = '_audiotheme_gig_datetime';
         $args['orderby'] = 'meta_value';
     }
     if (isset($_REQUEST['s'])) {
         $args['s'] = $_REQUEST['s'];
     }
     $args['paged'] = $this->get_pagenum();
     // Run the query and fetch the connected venues.
     $items = array();
     $wp_query = new WP_Query($args);
     p2p_type('audiotheme_venue_to_gig')->each_connected($wp_query);
     if (isset($wp_query->posts) && count($wp_query->posts)) {
         foreach ($wp_query->posts as $post) {
             $items[$post->ID] = get_audiotheme_gig($post->ID);
         }
         // Sort by venue.
         if (!empty($_GET['orderby']) && 'venue' === $_GET['orderby']) {
             $items = audiotheme_sort_objects($items, array('venue', 'name'), $args['order'], true, 'gig_datetime');
         }
     }
     $this->items = $items;
     $this->set_pagination_args(array('total_items' => $wp_query->found_posts, 'per_page' => $per_page, 'total_pages' => $wp_query->max_num_pages));
 }
 /**
  * Prepares our data for display
  *
  * @since 1.2
  */
 function prepare_items()
 {
     global $wpdb;
     // get the current user ID
     $user = get_current_user_id();
     // get the current admin screen
     $screen = get_current_screen();
     // retrieve the "per_page" option
     $screen_option = $screen->get_option('per_page', 'option');
     // retrieve the value of the option stored for the current user
     $per_page = get_user_meta($user, $screen_option, true);
     // get the default value if none is set
     if (empty($per_page) || $per_page < 1) {
         $per_page = $screen->get_option('per_page', 'default');
     }
     // Get the date/time format that is saved in the options table
     $date_format = get_option('date_format');
     $time_format = get_option('time_format');
     // What page are we looking at?
     $current_page = $this->get_pagenum();
     // Use offset for pagination
     $offset = ($current_page - 1) * $per_page;
     // Get column headers
     $columns = $this->get_columns();
     $hidden = get_hidden_columns($this->screen);
     // Get sortable columns
     $sortable = $this->get_sortable_columns();
     // Build the column headers
     $this->_column_headers = array($columns, $hidden, $sortable);
     // Get entries search terms
     $search_terms = !empty($_POST['s']) ? explode(' ', $_POST['s']) : array();
     $searchand = $search = '';
     // Loop through search terms and build query
     foreach ($search_terms as $term) {
         $term = esc_sql($wpdb->esc_like($term));
         $search .= "{$searchand}((entries.subject LIKE '%{$term}%') OR (entries.sender_name LIKE '%{$term}%') OR (entries.sender_email LIKE '%{$term}%') OR (entries.emails_to LIKE '%{$term}%') OR (entries.data LIKE '%{$term}%'))";
         $searchand = ' AND ';
     }
     $search = !empty($search) ? " AND ({$search}) " : '';
     // Set our ORDER BY and ASC/DESC to sort the entries
     $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : 'date';
     $order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
     // Get the sorted entries
     $entries = $this->get_entries($orderby, $order, $per_page, $offset, $search);
     $data = array();
     // Loop trough the entries and setup the data to be displayed for each row
     foreach ($entries as $entry) {
         $data[] = array('entry_id' => $entry->entries_id, 'id' => $entry->entries_id, 'form' => stripslashes($entry->form_title), 'subject' => stripslashes($entry->subject), 'sender_name' => stripslashes($entry->sender_name), 'sender_email' => stripslashes($entry->sender_email), 'emails_to' => implode(',', unserialize(stripslashes($entry->emails_to))), 'date' => date("{$date_format} {$time_format}", strtotime($entry->date_submitted)), 'ip_address' => $entry->ip_address);
     }
     $where = '';
     // If the form filter dropdown is used
     if ($this->current_filter_action()) {
         $where .= 'AND form_id = ' . $this->current_filter_action();
     }
     // Get the month/year from the dropdown
     $m = isset($_POST['m']) ? (int) $_POST['m'] : 0;
     // Parse month/year and build the clause
     if ($m > 0) {
         $year = substr($m, 0, 4);
         $month = substr($m, -2);
         $where .= " AND YEAR(date_submitted) = {$year} AND MONTH(date_submitted) = {$month}";
     }
     // Get the month/year from the dropdown
     $today = isset($_GET['today']) ? (int) $_GET['today'] : 0;
     // Parse month/year and build the clause
     if ($today > 0) {
         $where .= " AND entries.date_submitted >= curdate()";
     }
     // Entry type filter
     $where .= $this->get_entry_status() && 'all' !== $this->get_entry_status() ? $wpdb->prepare(' AND entries.entry_approved = %s', $this->get_entry_status()) : '';
     // Always display approved entries, unless an Entries Type filter is set
     if (!$this->get_entry_status() || 'all' == $this->get_entry_status()) {
         $where .= $wpdb->prepare(' AND entries.entry_approved = %d', 1);
     }
     // How many entries do we have?
     $total_items = $wpdb->get_var("SELECT COUNT(*) FROM {$this->entries_table_name} AS entries WHERE 1=1 {$where}");
     // Add sorted data to the items property
     $this->items = $data;
     // Register our pagination
     $this->set_pagination_args(array('total_items' => $total_items, 'per_page' => $per_page, 'total_pages' => ceil($total_items / $per_page)));
 }
function cwp_post_row($a_post, $pending_comments, $mode, $page)
{
    global $post;
    static $rowclass;
    $global_post = $post;
    $post = $a_post;
    setup_postdata($post);
    $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
    $rowclass = apply_filters('cwp_post_row_class', $rowclass, $post, $page);
    global $current_user;
    $post_owner = $current_user->ID == $post->post_author ? 'self' : 'other';
    $edit_link = $page->get_edit_link($post->ID);
    $delete_link = add_query_arg('post', $post->ID, add_query_arg('action', 'delete', $page->get_page_url()));
    $trash_link = wp_nonce_url(add_query_arg('post', $post->ID, add_query_arg('action', 'trash', $page->get_page_url())), "trash-post_" . $post->ID);
    $untrash_link = wp_nonce_url(add_query_arg('post', $post->ID, add_query_arg('action', 'untrash', $page->get_page_url())), "untrash-post_" . $post->ID);
    $title = _draft_or_post_title();
    ?>
	<tr id='post-<?php 
    echo $post->ID;
    ?>
' class='<?php 
    echo trim($rowclass . ' author-' . $post_owner . ' status-' . $post->post_status);
    ?>
 iedit' valign="top">
	<?php 
    $posts_columns = get_column_headers('cwp_manage');
    $hidden = get_hidden_columns('edit');
    foreach ($posts_columns as $column_name => $column_display_name) {
        $class = "class=\"{$column_name} column-{$column_name}\"";
        $style = '';
        if (in_array($column_name, $hidden)) {
            $style = ' style="display:none;"';
        }
        $attributes = "{$class}{$style}";
        switch ($column_name) {
            case 'cb':
                ?>
		<th scope="row" class="check-column"><?php 
                if (current_user_can('edit_post', $post->ID)) {
                    ?>
<input type="checkbox" name="post[]" value="<?php 
                    the_ID();
                    ?>
" /><?php 
                }
                ?>
</th>
		<?php 
                break;
            case 'date':
                if ('0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name) {
                    $t_time = $h_time = __('Unpublished');
                    $time_diff = 0;
                } else {
                    $t_time = get_the_time(__('Y/m/d g:i:s A'));
                    $m_time = $post->post_date;
                    $time = get_post_time('G', true, $post);
                    $time_diff = time() - $time;
                    if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                        $h_time = sprintf(__('%s ago'), human_time_diff($time));
                    } else {
                        $h_time = mysql2date(__('Y/m/d'), $m_time);
                    }
                }
                echo '<td ' . $attributes . '>';
                if ('excerpt' == $mode) {
                    echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
                } else {
                    echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
                }
                echo '<br />';
                if ('publish' == $post->post_status) {
                    _e('Published');
                } elseif ('future' == $post->post_status) {
                    if ($time_diff > 0) {
                        echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
                    } else {
                        _e('Scheduled');
                    }
                } else {
                    _e('Last Modified');
                }
                echo '</td>';
                break;
            case 'title':
                $attributes = 'class="post-title column-title"' . $style;
                ?>
		<td <?php 
                echo $attributes;
                ?>
><strong><?php 
                if (current_user_can('edit_post', $post->ID)) {
                    ?>
<a class="row-title" href="<?php 
                    echo $edit_link;
                    ?>
" title="<?php 
                    echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title));
                    ?>
"><?php 
                    echo $title;
                    ?>
</a><?php 
                } else {
                    echo $title;
                }
                _post_states($post);
                ?>
</strong>
		<?php 
                if ('excerpt' == $mode) {
                    the_excerpt();
                }
                $actions = array();
                if (current_user_can('edit_post', $post->ID)) {
                    $actions['edit'] = '<a href="' . $edit_link . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
                }
                if (current_user_can('delete_post', $post->ID)) {
                    if ('trash' == $post->post_status) {
                        $actions['untrash'] = "<a title='" . esc_attr(__('Restore this post from the Trash')) . "' href='" . $untrash_link . "'>" . __('Restore') . "</a>";
                    } elseif (EMPTY_TRASH_DAYS) {
                        $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . $trash_link . "'>" . __('Trash') . "</a>";
                    }
                    if ('trash' == $post->post_status || !EMPTY_TRASH_DAYS) {
                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url($delete_link, 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
                    }
                }
                /*
                if ( current_user_can('delete_post', $post->ID) ) {
                	$actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post')) . "' href='" . wp_nonce_url($delete_link, 'delete-post_' . $post->ID) . "' onclick=\"if ( confirm('" . esc_js(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { return true;}return false;\">" . __('Delete') . "</a>";
                }
                */
                if (in_array($post->post_status, array('pending', 'draft'))) {
                    if (current_user_can('edit_post', $post->ID)) {
                        $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                    }
                } else {
                    $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                }
                $actions = apply_filters('post_row_actions', $actions, $post);
                $action_count = count($actions);
                $i = 0;
                echo '<div class="row-actions">';
                foreach ($actions as $action => $link) {
                    ++$i;
                    $i == $action_count ? $sep = '' : ($sep = ' | ');
                    echo "<span class='{$action}'>{$link}{$sep}</span>";
                }
                echo '</div>';
                get_inline_data($post);
                ?>
		</td>
		<?php 
                break;
            case 'categories':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><?php 
                $categories = get_the_category();
                if (!empty($categories)) {
                    $out = array();
                    foreach ($categories as $c) {
                        $out[] = "<a href='edit.php?category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
                    }
                    echo join(', ', $out);
                } else {
                    _e('Uncategorized');
                }
                ?>
</td>
		<?php 
                break;
            case 'tags':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><?php 
                $tags = get_the_tags($post->ID);
                if (!empty($tags)) {
                    $out = array();
                    foreach ($tags as $c) {
                        $out[] = "<a href='edit.php?tag={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
                    }
                    echo join(', ', $out);
                } else {
                    _e('No Tags');
                }
                ?>
</td>
		<?php 
                break;
            case 'comments':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><div class="post-com-count-wrapper">
		<?php 
                $pending_phrase = sprintf(__('%s pending'), number_format($pending_comments));
                if ($pending_comments) {
                    echo '<strong>';
                }
                comments_number("<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('%', 'comment count') . '</span></a>');
                if ($pending_comments) {
                    echo '</strong>';
                }
                ?>
		</div></td>
		<?php 
                break;
            case 'author':
                ?>
		<td <?php 
                echo $attributes;
                ?>
><a href="edit.php?author=<?php 
                the_author_meta('ID');
                ?>
"><?php 
                the_author();
                ?>
</a></td>
		<?php 
                break;
            case 'control_view':
                ?>
		<td><a href="<?php 
                the_permalink();
                ?>
" rel="permalink" class="view"><?php 
                _e('View');
                ?>
</a></td>
		<?php 
                break;
            case 'control_edit':
                ?>
		<td><?php 
                if (current_user_can('edit_post', $post->ID)) {
                    echo "<a href='{$edit_link}' class='edit'>" . __('Edit') . "</a>";
                }
                ?>
</td>
		<?php 
                break;
            case 'control_delete':
                ?>
		<td><?php 
                if (current_user_can('delete_post', $post->ID)) {
                    echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$id}", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>";
                }
                ?>
</td>
		<?php 
                break;
            case is_taxonomy($column_name):
                ?>
			<td <?php 
                echo $attributes;
                ?>
><?php 
                $tags = wp_get_object_terms($post->ID, $column_name);
                if (!empty($tags)) {
                    $out = array();
                    foreach ($tags as $c) {
                        $out[] = "<a href=\"" . $page->get_edit_term_link($column_name, $c) . '">' . $c->name . "</a>";
                    }
                    echo join(', ', $out);
                } else {
                    _e('No ' . $column_display_name);
                }
                ?>
</td>
			<?php 
                break;
            case function_exists($column_name):
                ?>
			
			<td>
			<?php 
                echo call_user_func_array($column_name, array($post));
                ?>
			</td>
			<?php 
                break;
            default:
                ?>
		<td <?php 
                echo $attributes;
                ?>
><?php 
                do_action('manage_posts_custom_column', $column_name, $post->ID);
                ?>
</td>
		<?php 
                break;
        }
    }
    ?>
	</tr>
	<?php 
    $post = $global_post;
}
Exemple #19
0
function nggallery_picturelist()
{
    // *** show picture list
    global $wpdb, $nggdb, $user_ID, $ngg;
    // Look if its a search result
    $is_search = isset($_GET['s']) ? true : false;
    $counter = 0;
    if ($is_search) {
        // fetch the imagelist
        $picturelist = $ngg->manage_page->search_result;
        // we didn't set a gallery or a pagination
        $act_gid = 0;
        $_GET['paged'] = 1;
        $page_links = false;
    } else {
        // GET variables
        $act_gid = $ngg->manage_page->gid;
        // Load the gallery metadata
        $gallery = $nggdb->find_gallery($act_gid);
        if (!$gallery) {
            nggGallery::show_error(__('Gallery not found.', 'nggallery'));
            return;
        }
        // Check if you have the correct capability
        if (!nggAdmin::can_manage_this_gallery($gallery->author)) {
            nggGallery::show_error(__('Sorry, you have no access here', 'nggallery'));
            return;
        }
        // look for pagination
        if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
            $_GET['paged'] = 1;
        }
        $start = ($_GET['paged'] - 1) * 50;
        // get picture values
        $picturelist = $nggdb->get_gallery($act_gid, $ngg->options['galSort'], $ngg->options['galSortDir'], false, 50, $start);
        // build pagination
        $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $nggdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
        // get the current author
        $act_author_user = get_userdata((int) $gallery->author);
    }
    // list all galleries
    $gallerylist = $nggdb->find_all_galleries();
    //get the columns
    $image_columns = ngg_manage_image_columns();
    $hidden_columns = get_hidden_columns('nggallery-manage-images');
    $num_columns = count($image_columns) - count($hidden_columns);
    $attr = nggGallery::current_user_can('NextGEN Edit gallery options') ? '' : 'disabled="disabled"';
    ?>
<script type="text/javascript"> 
<!--
function showDialog( windowId, title ) {
	var form = document.getElementById('updategallery');
	var elementlist = "";
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					if (elementlist == "")
						elementlist = form.elements[i].value
					else
						elementlist += "," + form.elements[i].value ;
		}
	}
	jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
	jQuery("#" + windowId + "_imagelist").val(elementlist);
    // now show the dialog
	jQuery( "#" + windowId ).dialog({
		width: 640,
        resizable : false,
		modal: true,
        title: title        
	});
    jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
}

jQuery(function (){
    // load a content via ajax
    jQuery('a.ngg-dialog').click(function() {
        if ( jQuery( "#spinner" ).length == 0)
            jQuery("body").append('<div id="spinner"></div>');
        var $this = jQuery(this);
        var results = new RegExp('[\\?&]w=([^&#]*)').exec(this.href);
	    var width  = ( results ) ? results[1] : 600;
        var results = new RegExp('[\\?&]h=([^&#]*)').exec(this.href);
	    var height = ( results ) ? results[1] : 440;
        jQuery('#spinner').fadeIn();
        var dialog = jQuery('<div style="display:hidden"></div>').appendTo('body');
        // load the remote content
        dialog.load(
            this.href, 
            {},
            function () {
                jQuery('#spinner').hide();
                dialog.dialog({
                    title: ($this.attr('title')) ? $this.attr('title') : '',
                    width: width,
                    height: height,
                    modal: true,
                    resizable: false,
                    close: function() { dialog.remove(); }
                }).width(width - 30).height(height - 30);
            }
        );
        //prevent the browser to follow the link
        return false;
    });
});

function checkAll(form)
{
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]") {
				if(form.elements[i].checked == true)
					form.elements[i].checked = false;
				else
					form.elements[i].checked = true;
			}
		}
	}
}

function getNumChecked(form)
{
	var num = 0;
	for (i = 0, n = form.elements.length; i < n; i++) {
		if(form.elements[i].type == "checkbox") {
			if(form.elements[i].name == "doaction[]")
				if(form.elements[i].checked == true)
					num++;
		}
	}
	return num;
}

// this function check for a the number of selected images, sumbmit false when no one selected
function checkSelected() {

	var numchecked = getNumChecked(document.getElementById('updategallery'));
	 
	if(numchecked < 1) { 
		alert('<?php 
    echo esc_js(__('No images selected', 'nggallery'));
    ?>
');
		return false; 
	} 
	
	actionId = jQuery('#bulkaction').val();
	
	switch (actionId) {
		case "copy_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Copy image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "move_to":
			showDialog('selectgallery', '<?php 
    echo esc_js(__('Move image to...', 'nggallery'));
    ?>
');
			return false;
			break;
		case "add_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Add new tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "delete_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Delete tags', 'nggallery'));
    ?>
');
			return false;
			break;
		case "overwrite_tags":
			showDialog('entertags', '<?php 
    echo esc_js(__('Overwrite', 'nggallery'));
    ?>
');
			return false;
			break;
		case "resize_images":
			showDialog('resize_images', '<?php 
    echo esc_js(__('Resize images', 'nggallery'));
    ?>
');
			return false;
			break;
		case "new_thumbnail":
			showDialog('new_thumbnail', '<?php 
    echo esc_js(__('Create new thumbnails', 'nggallery'));
    ?>
');
			return false;
			break;			
	}
	
	return confirm('<?php 
    echo sprintf(esc_js(__("You are about to start the bulk edit for %s images \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
');
}

jQuery(document).ready( function() {
	// close postboxes that should be closed
	jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
	postboxes.add_postbox_toggles('ngg-manage-gallery');

});

//-->
</script>
<div class="wrap">
<?php 
    screen_icon('nextgen-gallery');
    if ($is_search) {
        ?>
<h2><?php 
        printf(__('Search results for &#8220;%s&#8221;', 'nggallery'), esc_html(get_search_query()));
        ?>
</h2>
<form class="search-form" action="" method="get">
<p class="search-box">
	<label class="hidden" for="media-search-input"><?php 
        _e('Search Images', 'nggallery');
        ?>
:</label>
	<input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
	<input type="text" id="media-search-input" name="s" value="<?php 
        the_search_query();
        ?>
" />
	<input type="submit" value="<?php 
        _e('Search Images', 'nggallery');
        ?>
" class="button" />
</p>
</form>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;s=' . $_GET['s'];
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
    } else {
        ?>
<h2><?php 
        echo _n('Gallery', 'Galleries', 1, 'nggallery');
        ?>
 : <?php 
        echo nggGallery::i18n($gallery->title);
        ?>
</h2>

<br style="clear: both;" />

<form id="updategallery" class="nggform" method="POST" action="<?php 
        echo $ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $act_gid . '&amp;paged=' . $_GET['paged'];
        ?>
" accept-charset="utf-8">
<?php 
        wp_nonce_field('ngg_updategallery');
        ?>
<input type="hidden" name="page" value="manage-images" />

<?php 
        if (nggGallery::current_user_can('NextGEN Edit gallery options')) {
            ?>
<div id="poststuff">
	<?php 
            wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
            ?>
	<div id="gallerydiv" class="postbox <?php 
            echo postbox_classes('gallerydiv', 'ngg-manage-gallery');
            ?>
" >
		<h3><?php 
            _e('Gallery settings', 'nggallery');
            ?>
<small> (<?php 
            _e('Click here for more settings', 'nggallery');
            ?>
)</small></h3>
		<div class="inside">
			<table class="form-table" >
				<tr>
					<th align="left"><?php 
            _e('Title');
            ?>
:</th>
					<th align="left"><input <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery title');
            ?>
 type="text" size="50" name="title" value="<?php 
            echo $gallery->title;
            ?>
"  /></th>
					<th align="right"><?php 
            _e('Page Link to', 'nggallery');
            ?>
:</th>
					<th align="left">
					<select <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery page id');
            ?>
  name="pageid" style="width:95%">
						<option value="0" ><?php 
            _e('Not linked', 'nggallery');
            ?>
</option>
						<?php 
            parent_dropdown($gallery->pageid);
            ?>
					</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
            _e('Description');
            ?>
:</th> 
					<th align="left"><textarea  <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery description');
            ?>
 name="gallerydesc" cols="30" rows="3" style="width: 95%" ><?php 
            echo $gallery->galdesc;
            ?>
</textarea></th>
					<th align="right"><?php 
            _e('Preview image', 'nggallery');
            ?>
:</th>
					<th align="left">
						<select <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery preview pic');
            ?>
 name="previewpic" style="width:95%" >
							<option value="0" ><?php 
            _e('No Picture', 'nggallery');
            ?>
</option>
							<?php 
            if (is_array($picturelist)) {
                foreach ($picturelist as $picture) {
                    if ($picture->exclude) {
                        continue;
                    }
                    $selected = $picture->pid == $gallery->previewpic ? 'selected="selected" ' : '';
                    echo '<option value="' . $picture->pid . '" ' . $selected . '>' . $picture->pid . ' - ' . $picture->filename . '</option>' . "\n";
                }
            }
            ?>
						</select>
					</th>
				</tr>
				<tr>
					<th align="left"><?php 
            _e('Path', 'nggallery');
            ?>
:</th> 
					<th align="left"><input <?php 
            if (is_multisite()) {
                echo 'readonly = "readonly"';
            }
            ?>
 <?php 
            nggGallery::current_user_can_form('NextGEN Edit gallery path');
            ?>
 type="text" size="50" name="path" value="<?php 
            echo $gallery->path;
            ?>
"  /></th>
					<th align="right"><?php 
            _e('Author', 'nggallery');
            ?>
:</th>
					<th align="left"> 
					<?php 
            $editable_ids = $ngg->manage_page->get_editable_user_ids($user_ID);
            if ($editable_ids && count($editable_ids) > 1 && nggGallery::current_user_can('NextGEN Edit gallery author')) {
                wp_dropdown_users(array('include' => $editable_ids, 'name' => 'author', 'selected' => empty($gallery->author) ? 0 : $gallery->author));
            } else {
                echo $act_author_user->display_name;
            }
            ?>
					</th>
				</tr>
				<?php 
            if (current_user_can('publish_pages')) {
                ?>
				<tr>
					<th align="left">&nbsp;</th>
					<th align="left">&nbsp;</th>				
					<th align="right"><?php 
                _e('Create new page', 'nggallery');
                ?>
:</th>
					<th align="left"> 
					<select name="parent_id" style="width:95%">
						<option value="0"><?php 
                _e('Main page (No parent)', 'nggallery');
                ?>
</option>
						<?php 
                parent_dropdown();
                ?>
					</select>
					<input class="button-secondary action" type="submit" name="addnewpage" value="<?php 
                _e('Add page', 'nggallery');
                ?>
" id="group"/>
					</th>
				</tr>
				<?php 
            }
            ?>
                <?php 
            do_action('ngg_manage_gallery_settings', $act_gid);
            ?>
               
                
			</table>

			<div class="submit">
				<input type="submit" class="button-secondary" name="scanfolder" value="<?php 
            _e("Scan Folder for new images", 'nggallery');
            ?>
 " />
				<input type="submit" class="button-primary action" name="updatepictures" value="<?php 
            _e("Save Changes", 'nggallery');
            ?>
" />
			</div>

		</div>
	</div>
</div> <!-- poststuff -->
<?php 
        }
        ?>

<?php 
    }
    ?>

<div class="tablenav ngg-tablenav">
	<?php 
    if ($page_links) {
        ?>
	<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $nggdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $nggdb->paged['objects_per_page'], $nggdb->paged['total_objects'])), number_format_i18n($nggdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
	<?php 
    }
    ?>
	<div class="alignleft actions">
	<select id="bulkaction" name="bulkaction">
		<option value="no_action" ><?php 
    _e("Bulk actions", 'nggallery');
    ?>
</option>
		<option value="set_watermark" ><?php 
    _e("Set watermark", 'nggallery');
    ?>
</option>
		<option value="new_thumbnail" ><?php 
    _e("Create new thumbnails", 'nggallery');
    ?>
</option>
		<option value="resize_images" ><?php 
    _e("Resize images", 'nggallery');
    ?>
</option>
		<option value="recover_images" ><?php 
    _e("Recover from backup", 'nggallery');
    ?>
</option>
		<option value="delete_images" ><?php 
    _e("Delete images", 'nggallery');
    ?>
</option>
		<option value="import_meta" ><?php 
    _e("Import metadata", 'nggallery');
    ?>
</option>
		<option value="rotate_cw" ><?php 
    _e("Rotate images clockwise", 'nggallery');
    ?>
</option>
		<option value="rotate_ccw" ><?php 
    _e("Rotate images counter-clockwise", 'nggallery');
    ?>
</option>
		<option value="copy_to" ><?php 
    _e("Copy to...", 'nggallery');
    ?>
</option>
		<option value="move_to"><?php 
    _e("Move to...", 'nggallery');
    ?>
</option>
		<option value="add_tags" ><?php 
    _e("Add tags", 'nggallery');
    ?>
</option>
		<option value="delete_tags" ><?php 
    _e("Delete tags", 'nggallery');
    ?>
</option>
		<option value="overwrite_tags" ><?php 
    _e("Overwrite tags", 'nggallery');
    ?>
</option>
	</select>
	<input class="button-secondary" type="submit" name="showThickbox" value="<?php 
    _e('Apply', 'nggallery');
    ?>
" onclick="if ( !checkSelected() ) return false;" />
	
	<?php 
    if ($ngg->options['galSort'] == "sortorder" && !$is_search) {
        ?>
		<input class="button-secondary" type="submit" name="sortGallery" value="<?php 
        _e('Sort gallery', 'nggallery');
        ?>
" />
	<?php 
    }
    ?>
	
	<input type="submit" name="updatepictures" class="button-primary action"  value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
	</div>
</div>

<table id="ngg-listimages" class="widefat fixed" cellspacing="0" >

	<thead>
	<tr>
<?php 
    print_column_headers('nggallery-manage-images');
    ?>
	</tr>
	</thead>
	<tfoot>
	<tr>
<?php 
    print_column_headers('nggallery-manage-images', false);
    ?>
	</tr>
	</tfoot>
	<tbody>
<?php 
    if ($picturelist) {
        $thumbsize = '';
        if ($ngg->options['thumbfix']) {
            $thumbsize = 'width="' . $ngg->options['thumbwidth'] . '" height="' . $ngg->options['thumbheight'] . '"';
        }
        foreach ($picturelist as $picture) {
            //for search result we need to check the capatibiliy
            if (!nggAdmin::can_manage_this_gallery($picture->author) && $is_search) {
                continue;
            }
            $counter++;
            $pid = (int) $picture->pid;
            $alternate = !isset($alternate) || $alternate == 'alternate' ? '' : 'alternate';
            $exclude = $picture->exclude ? 'checked="checked"' : '';
            $date = mysql2date(get_option('date_format'), $picture->imagedate);
            $time = mysql2date(get_option('time_format'), $picture->imagedate);
            ?>
		<tr id="picture-<?php 
            echo $pid;
            ?>
" class="<?php 
            echo $alternate;
            ?>
 iedit"  valign="top">
			<?php 
            foreach ($image_columns as $image_column_key => $column_display_name) {
                $class = "class=\"{$image_column_key} column-{$image_column_key}\"";
                $style = '';
                if (in_array($image_column_key, $hidden_columns)) {
                    $style = ' style="display:none;"';
                }
                $attributes = "{$class}{$style}";
                switch ($image_column_key) {
                    case 'cb':
                        ?>
 
						<th <?php 
                        echo $attributes;
                        ?>
 scope="row"><input name="doaction[]" type="checkbox" value="<?php 
                        echo $pid;
                        ?>
" /></th>
						<?php 
                        break;
                    case 'id':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
 scope="row" style=""><?php 
                        echo $pid;
                        ?>
							<input type="hidden" name="pid[]" value="<?php 
                        echo $pid;
                        ?>
" />
						</td>
						<?php 
                        break;
                    case 'filename':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<strong><a href="<?php 
                        echo $picture->imageURL;
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<?php 
                        echo empty($picture->alttext) ? $picture->filename : stripslashes(nggGallery::i18n($picture->alttext));
                        ?>
							</a></strong>
							<br /><?php 
                        echo $date;
                        ?>
							<?php 
                        if (!empty($picture->meta_data)) {
                            ?>
							<br /><?php 
                            echo $picture->meta_data['width'];
                            ?>
 x <?php 
                            echo $picture->meta_data['height'];
                            ?>
 <?php 
                            _e('pixel', 'nggallery');
                            ?>
							
							<?php 
                        }
                        ?>
							<p>
							<?php 
                        $actions = array();
                        $actions['view'] = '<a class="thickbox" href="' . $picture->imageURL . '" title="' . esc_attr(sprintf(__('View "%s"'), $picture->filename)) . '">' . __('View', 'nggallery') . '</a>';
                        $actions['meta'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/showmeta.php?id=' . $pid . '" title="' . __('Show Meta data', 'nggallery') . '">' . __('Meta', 'nggallery') . '</a>';
                        $actions['custom_thumb'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/edit-thumbnail.php?id=' . $pid . '" title="' . __('Customize thumbnail', 'nggallery') . '">' . __('Edit thumb', 'nggallery') . '</a>';
                        $actions['rotate'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/rotate.php?id=' . $pid . '" title="' . __('Rotate', 'nggallery') . '">' . __('Rotate', 'nggallery') . '</a>';
                        if (current_user_can('publish_posts')) {
                            $actions['publish'] = '<a class="ngg-dialog" href="' . NGGALLERY_URLPATH . 'admin/publish.php?id=' . $pid . '&h=230" title="' . __('Publish this image', 'nggallery') . '">' . __('Publish', 'nggallery') . '</a>';
                        }
                        if (file_exists($picture->imagePath . '_backup')) {
                            $actions['recover'] = '<a class="confirmrecover" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=recoverpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_recoverpicture') . '" title="' . __('Recover', 'nggallery') . '" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Recover "%s" ?', 'nggallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Recover', 'nggallery') . '</a>';
                        }
                        $actions['delete'] = '<a class="submitdelete" href="' . wp_nonce_url("admin.php?page=nggallery-manage-gallery&amp;mode=delpic&amp;gid=" . $act_gid . "&amp;pid=" . $pid, 'ngg_delpicture') . '" class="delete column-delete" onclick="javascript:check=confirm( \'' . esc_attr(sprintf(__('Delete "%s" ?', 'nggallery'), $picture->filename)) . '\');if(check==false) return false;">' . __('Delete') . '</a>';
                        $action_count = count($actions);
                        $i = 0;
                        echo '<div class="row-actions">';
                        foreach ($actions as $action => $link) {
                            ++$i;
                            $i == $action_count ? $sep = '' : ($sep = ' | ');
                            echo "<span class='{$action}'>{$link}{$sep}</span>";
                        }
                        echo '</div>';
                        ?>
</p>
						</td>
						<?php 
                        break;
                    case 'thumbnail':
                        // generate the thumbnail size if the meta data available
                        if (is_array($size = $picture->meta_data['thumbnail'])) {
                            $thumbsize = 'width="' . $size['width'] . '" height="' . $size['height'] . '"';
                        }
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><a href="<?php 
                        echo $picture->imageURL;
                        if (strpos($picture->imageURL, '?')) {
                            echo '&';
                        } else {
                            echo '?';
                        }
                        echo mt_rand();
                        ?>
" class="thickbox" title="<?php 
                        echo $picture->filename;
                        ?>
">
								<img class="thumb" src="<?php 
                        echo $picture->thumbURL;
                        if (strpos($picture->thumbURL, '?')) {
                            echo '&';
                        } else {
                            echo '?';
                        }
                        echo mt_rand();
                        ?>
" <?php 
                        echo $thumbsize;
                        ?>
 id="thumb<?php 
                        echo $pid;
                        ?>
" />
							</a>
						</td>
						<?php 
                        break;
                    case 'alt_title_desc':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
>
							<input name="alttext[<?php 
                        echo $pid;
                        ?>
]" type="text" style="width:95%; margin-bottom: 2px;" value="<?php 
                        echo stripslashes($picture->alttext);
                        ?>
" /><br/>
							<textarea name="description[<?php 
                        echo $pid;
                        ?>
]" style="width:95%; margin-top: 2px;" rows="2" ><?php 
                        echo stripslashes($picture->description);
                        ?>
</textarea>
						</td>
						<?php 
                        break;
                    case 'exclude':
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><input name="exclude[<?php 
                        echo $pid;
                        ?>
]" type="checkbox" value="1" <?php 
                        echo $exclude;
                        ?>
 /></td>
						<?php 
                        break;
                    case 'tags':
                        $picture->tags = wp_get_object_terms($pid, 'ngg_tag', 'fields=names');
                        if (is_array($picture->tags)) {
                            $picture->tags = implode(', ', $picture->tags);
                        }
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><textarea name="tags[<?php 
                        echo $pid;
                        ?>
]" style="width:95%;" rows="2"><?php 
                        echo $picture->tags;
                        ?>
</textarea></td>
						<?php 
                        break;
                    default:
                        ?>
						<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('ngg_manage_image_custom_column', $image_column_key, $pid);
                        ?>
</td>
						<?php 
                        break;
                }
                ?>
			<?php 
            }
            ?>
		</tr>
		<?php 
        }
    }
    // In the case you have no capaptibility to see the search result
    if ($counter == 0) {
        echo '<tr><td colspan="' . $num_columns . '" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>
	
		</tbody>
	</table>
    <div class="tablenav">
    <input type="submit" class="button-primary action" name="updatepictures" value="<?php 
    _e('Save Changes', 'nggallery');
    ?>
" />
	<?php 
    if ($page_links) {
        ?>
	<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $nggdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $nggdb->paged['objects_per_page'], $nggdb->paged['total_objects'])), number_format_i18n($nggdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
	<?php 
    }
    ?>
    </div>
	</form>	
	<br class="clear"/>
	</div><!-- /#wrap -->

	<!-- #entertags -->
	<div id="entertags" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="entertags_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="entertags_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th><?php 
    _e("Enter the tags", 'nggallery');
    ?>
 : <input name="taglist" type="text" style="width:90%" value="" /></th>
		  	</tr>
		  	<tr align="right">
		    	<td class="submit">
		    		<input class="button-primary" type="submit" name="TB_EditTags" value="<?php 
    _e("OK", 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e("Cancel", 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#entertags -->

	<!-- #selectgallery -->
	<div id="selectgallery" style="display: none;" >
		<form id="form-select-gallery" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="selectgallery_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="selectgallery_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<th>
		    		<?php 
    _e('Select the destination gallery:', 'nggallery');
    ?>
&nbsp;
		    		<select name="dest_gid" style="width:90%" >
		    			<?php 
    foreach ($gallerylist as $gallery) {
        if ($gallery->gid != $act_gid) {
            ?>
						<option value="<?php 
            echo $gallery->gid;
            ?>
" ><?php 
            echo $gallery->gid;
            ?>
 - <?php 
            echo stripslashes($gallery->title);
            ?>
</option>
						<?php 
        }
    }
    ?>
		    		</select>
		    	</th>
		  	</tr>
		  	<tr align="right">
		    	<td class="submit">
		    		<input type="submit" class="button-primary" name="TB_SelectGallery" value="<?php 
    _e("OK", 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="<?php 
    _e("Cancel", 'nggallery');
    ?>
" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#selectgallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'nggallery');
    ?>
:</strong> 
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $ngg->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $ngg->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). NextGEN Gallery will keep ratio size', 'nggallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-images" />
        <table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'nggallery');
    ?>
</th>
				<td><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php 
    echo $ngg->options['thumbwidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php 
    echo $ngg->options['thumbheight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'nggallery');
    ?>
</small></td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'nggallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbfix" value="1" <?php 
    checked('1', $ngg->options['thumbfix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'nggallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

	<script type="text/javascript">
	/* <![CDATA[ */
	jQuery(document).ready(function(){columns.init('nggallery-manage-images');});	
	/* ]]> */
	</script>
	<?php 
}
Exemple #20
0
?>

	<?php 
$this->notices();
?>

	<?php 
ShoppScreenOrders::navigation();
?>

	<br class="clear" />

	<?php 
$totalsedit = isset($_GET['edit']) && 'totals' == $_GET['edit'];
$columns = get_column_headers($this->id);
$hidden = get_hidden_columns($this->id);
$colspan = count($columns);
?>
	<div id="order">
			<div class="title">
				<div id="titlewrap">
				<span class="date"><?php 
$datetime = $Purchase->exists() ? $Purchase->created : current_time('timestamp');
echo Shopp::_d(get_option('date_format'), $datetime);
?>
 <small><?php 
echo date(get_option('time_format'), $datetime);
?>
</small>

					<div class="alignright">
 /**
  * Get a list of all, hidden and sortable columns, with filter applied
  *
  * @since 3.1.0
  * @access protected
  *
  * @return array
  */
 function get_column_info()
 {
     if (isset($this->_column_headers)) {
         return $this->_column_headers;
     }
     $screen = convert_to_screen($this->_args['current_screen']);
     $columns = get_column_headers($screen);
     $hidden = get_hidden_columns($screen);
     $_sortable = apply_filters("manage_{$screen->id}_sortable_columns", $this->get_sortable_columns());
     $sortable = array();
     foreach ($_sortable as $id => $data) {
         if (empty($data)) {
             continue;
         }
         $data = (array) $data;
         if (!isset($data[1])) {
             $data[1] = false;
         }
         $sortable[$id] = $data;
     }
     $this->_column_headers = array($columns, $hidden, $sortable);
     return $this->_column_headers;
 }
Exemple #22
0
 /**
  * Meta box content
  * 
  * @global WP_Post $post
  * @since  1.0
  * @return void 
  */
 public function meta_box_content()
 {
     global $post;
     $screen = get_current_screen();
     $hidden_columns = get_hidden_columns($screen->id);
     foreach ($this->_get_taxonomies() as $taxonomy) {
         $id = 'box-' . $this->id . '-' . $taxonomy->name;
         $hidden = in_array($id, $hidden_columns) ? ' hide-if-js' : '';
         echo '<li id="' . $id . '" class="manage-column column-' . $id . ' control-section accordion-section' . $hidden . '">';
         echo '<h3 class="accordion-section-title" title="' . $taxonomy->label . '" tabindex="0">' . $taxonomy->label . '</h3>' . "\n";
         echo '<div class="accordion-section-content cas-rule-content" data-cas-module="' . $this->id . '" id="cas-' . $this->id . '-' . $taxonomy->name . '">';
         $terms = $this->_get_content(array('taxonomy' => $taxonomy->name));
         if ($taxonomy->hierarchical) {
             echo '<ul><li>' . "\n";
             echo '<label><input type="checkbox" name="cas_condition[' . $this->id . '][]" value="' . WPCACore::PREFIX . 'sub_' . $taxonomy->name . '" /> ' . __('Automatically select new children of a selected ancestor', WPCACore::DOMAIN) . '</label>' . "\n";
             echo '</li></ul>' . "\n";
         }
         echo '<ul><li>' . "\n";
         echo '<label><input class="cas-chk-all" type="checkbox" name="cas_condition[' . $this->id . '][]" value="' . $taxonomy->name . '" /> ' . $taxonomy->labels->all_items . '</label>' . "\n";
         echo '</li></ul>' . "\n";
         if (!$terms) {
             echo '<p>' . __('No items.') . '</p>';
         } else {
             //No need to use two queries before knowing there are items
             if (count($terms) < 20) {
                 $popular_terms = $terms;
             } else {
                 $popular_terms = $this->_get_content(array('taxonomy' => $taxonomy->name, 'orderby' => 'count', 'order' => 'DESC'));
             }
             $tabs = array();
             $tabs['popular'] = array('title' => __('Most Used'), 'status' => true, 'content' => $this->term_checklist($taxonomy, $popular_terms));
             $tabs['all'] = array('title' => __('View All'), 'status' => false, 'content' => $this->term_checklist($taxonomy, $terms, false, true));
             if ($this->searchable) {
                 $tabs['search'] = array('title' => __('Search'), 'status' => false, 'content' => '', 'content_before' => '<p><input data-cas-item_object="' . $taxonomy->name . '" class="cas-autocomplete-' . $this->id . ' cas-autocomplete quick-search" id="cas-autocomplete-' . $this->id . '-' . $taxonomy->name . '" type="search" name="cas-autocomplete" value="" placeholder="' . __('Search') . '" autocomplete="off" /><span class="spinner"></span></p>');
             }
             echo $this->create_tab_panels($this->id . '-' . $taxonomy->name, $tabs);
         }
         echo '<p class="button-controls">';
         echo '<span class="add-to-group"><input data-cas-condition="' . $this->id . '-' . $taxonomy->name . '" type="button" name="" id="cas-' . $this->id . '-' . $taxonomy->name . '-add" class="js-cas-condition-add button" value="' . __('Add to Group', WPCACore::DOMAIN) . '"></span>';
         echo '</p>';
         echo '</div>' . "\n";
         echo '</li>';
     }
 }
    /**
     * prints the individual row
     *
     * @param object $post
     * @param int $comment_pending_count
     * @param string $mode
     */
    protected function _manage_row($post, $comment_pending_count, $mode)
    {
        static $rowclass;
        $global_post = $post;
        setup_postdata($post);
        $rowclass = 'alternate' == $rowclass ? '' : 'alternate';
        $current_user = wp_get_current_user();
        $post_owner = $current_user->ID == $post->post_author ? 'self' : 'other';
        $edit_link = get_edit_post_link($post->ID);
        $title = _draft_or_post_title($post->ID);
        ?>
		<tr id='post-<?php 
        echo $post->ID;
        ?>
'	class='<?php 
        echo trim($rowclass . ' author-' . $post_owner . ' status-' . $post->post_status);
        ?>
 iedit'	valign="top">
			<?php 
        $posts_columns = get_column_headers($this->get_content_type());
        $hidden = get_hidden_columns($this->get_content_type());
        foreach ($posts_columns as $column_name => $column_display_name) {
            $class = "class=\"{$column_name} column-{$column_name}\"";
            $style = '';
            if (in_array($column_name, $hidden)) {
                $style = ' style="display:none;"';
            }
            $attributes = "{$class}{$style}";
            switch ($column_name) {
                case 'cb':
                    ?>
						<th scope="row" class="check-column"><?php 
                    if (current_user_can('edit_post', $post->ID)) {
                        ?>
<input	type="checkbox" name="post[]" value="<?php 
                        the_ID();
                        ?>
" /><?php 
                    }
                    ?>
</th>
						<?php 
                    break;
                    //end case 'cb'
                //end case 'cb'
                case 'date':
                    if ('0000-00-00 00:00:00' == $post->post_date && 'date' == $column_name) {
                        $t_time = $h_time = __('Unpublished');
                        $time_diff = 0;
                    } else {
                        $t_time = get_the_time(__('Y/m/d g:i:s A'));
                        $m_time = $post->post_date;
                        $time = get_post_time('G', true, $post);
                        $time_diff = time() - $time;
                        if ($time_diff > 0 && $time_diff < 24 * 60 * 60) {
                            $h_time = sprintf(__('%s ago'), human_time_diff($time));
                        } else {
                            $h_time = mysql2date(__('Y/m/d'), $m_time);
                        }
                    }
                    echo '<td ' . $attributes . '>';
                    if ('excerpt' == $mode) {
                        echo apply_filters('post_date_column_time', $t_time, $post, $column_name, $mode);
                    } else {
                        echo '<abbr title="' . $t_time . '">' . apply_filters('post_date_column_time', $h_time, $post, $column_name, $mode) . '</abbr>';
                    }
                    echo '<br />';
                    if ('publish' == $post->post_status) {
                        _e('Published');
                    } elseif ('future' == $post->post_status) {
                        if ($time_diff > 0) {
                            echo '<strong class="attention">' . __('Missed schedule') . '</strong>';
                        } else {
                            _e('Scheduled');
                        }
                    } else {
                        _e('Last Modified');
                    }
                    echo '</td>';
                    break;
                    //end case 'date'
                //end case 'date'
                case 'title':
                    $attributes = 'class="post-title column-title"' . $style;
                    ?>
						<td <?php 
                    echo $attributes;
                    ?>
><strong><?php 
                    if (current_user_can('edit_post', $post->ID) && $post->post_status != 'trash') {
                        ?>
<a	class="row-title" href="<?php 
                        echo $edit_link;
                        ?>
" title="<?php 
                        echo esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $title));
                        ?>
"><?php 
                        echo $title;
                        ?>
</a><?php 
                    } else {
                        echo $title;
                    }
                    _post_states($post);
                    ?>
</strong>
						<?php 
                    if ('excerpt' == $mode) {
                        the_excerpt();
                    }
                    $actions = array();
                    if ('trash' == $post->post_status && current_user_can('delete_post', $post->ID)) {
                        $actions['untrash'] = "<a title='" . esc_attr(__('Remove this post from the Trash')) . "' href='" . wp_nonce_url("post.php?action=untrash&amp;post={$post->ID}", 'untrash-post_' . $post->ID) . "'>" . __('Restore') . "</a>";
                        $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post={$post->ID}", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
                    } else {
                        if (current_user_can('edit_post', $post->ID)) {
                            $actions['edit'] = '<a href="' . get_edit_post_link($post->ID, true) . '" title="' . esc_attr(__('Edit this post')) . '">' . __('Edit') . '</a>';
                            //removing quickedit for now
                            //$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr(__('Edit this post inline')) . '">' . __('Quick&nbsp;Edit') . '</a>';
                        }
                        if (current_user_can('delete_post', $post->ID) && function_exists('wp_trash_post')) {
                            $actions['trash'] = "<a class='submitdelete' title='" . esc_attr(__('Move this post to the Trash')) . "' href='" . wp_nonce_url("post.php?action=trash&amp;post={$post->ID}", 'trash-post_' . $post->ID) . "'>" . __('Trash') . "</a>";
                        } else {
                            $actions['delete'] = "<a class='submitdelete' title='" . esc_attr(__('Delete this post permanently')) . "' href='" . wp_nonce_url("post.php?action=delete&amp;post={$post->ID}", 'delete-post_' . $post->ID) . "'>" . __('Delete Permanently') . "</a>";
                        }
                        if (in_array($post->post_status, array('pending', 'draft'))) {
                            if (current_user_can('edit_post', $post->ID)) {
                                $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('Preview &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('Preview') . '</a>';
                            }
                        } else {
                            $actions['view'] = '<a href="' . get_permalink($post->ID) . '" title="' . esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)) . '" rel="permalink">' . __('View') . '</a>';
                        }
                    }
                    $actions = apply_filters('post_row_actions', $actions, $post);
                    $action_count = count($actions);
                    $i = 0;
                    echo '<div class="row-actions">';
                    foreach ($actions as $action => $link) {
                        ++$i;
                        $i == $action_count ? $sep = '' : ($sep = ' | ');
                        echo "<span class='{$action}'>{$link}{$sep}</span>";
                    }
                    echo '</div>';
                    get_inline_data($post);
                    ?>
						</td>
						<?php 
                    break;
                    //end case 'title'
                //end case 'title'
                case 'categories':
                    ?>
						<td <?php 
                    echo $attributes;
                    ?>
><?php 
                    $categories = get_the_category();
                    if (!empty($categories)) {
                        $out = array();
                        foreach ($categories as $c) {
                            $out[] = "<a href='edit.php?category_name={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'category', 'display')) . "</a>";
                        }
                        echo join(', ', $out);
                    } else {
                        _e('Uncategorized');
                    }
                    ?>
</td>
						<?php 
                    break;
                    //end case 'categories'
                //end case 'categories'
                case 'tags':
                    ?>
						<td <?php 
                    echo $attributes;
                    ?>
><?php 
                    $tags = get_the_tags($post->ID);
                    if (!empty($tags)) {
                        $out = array();
                        foreach ($tags as $c) {
                            $out[] = "<a href='edit.php?tag={$c->slug}'> " . esc_html(sanitize_term_field('name', $c->name, $c->term_id, 'post_tag', 'display')) . "</a>";
                        }
                        echo join(', ', $out);
                    } else {
                        _e('No Tags');
                    }
                    ?>
						</td>
						<?php 
                    break;
                    //end case 'tags'
                //end case 'tags'
                case 'comments':
                    ?>
						<td <?php 
                    echo $attributes;
                    ?>
>
						<div class="post-com-count-wrapper">
						<?php 
                    if (!isset($pending_comments)) {
                        $pending_comments = 0;
                    }
                    $pending_phrase = sprintf(__('%s pending'), number_format($pending_comments));
                    if ($pending_comments) {
                        echo '<strong>';
                    }
                    comments_number("<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('0', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('1', 'comment count') . '</span></a>', "<a href='edit-comments.php?p={$post->ID}' title='{$pending_phrase}' class='post-com-count'><span class='comment-count'>" . _x('%', 'comment count') . '</span></a>');
                    if ($pending_comments) {
                        echo '</strong>';
                    }
                    ?>
						</div>
						</td>
						<?php 
                    break;
                    //end case 'comments'
                //end case 'comments'
                case 'author':
                    ?>
						<td <?php 
                    echo $attributes;
                    ?>
><a href="edit.php?author=<?php 
                    the_author_meta('ID');
                    ?>
"><?php 
                    the_author();
                    ?>
</a></td>
						<?php 
                    break;
                    //end case 'author'
                //end case 'author'
                case 'control_view':
                    ?>
						<td><a href="<?php 
                    the_permalink();
                    ?>
" rel="permalink"	class="view"><?php 
                    _e('View');
                    ?>
</a></td>
						<?php 
                    break;
                    //end case 'control_view'
                //end case 'control_view'
                case 'control_edit':
                    ?>
						<td><?php 
                    if (current_user_can('edit_post', $post->ID)) {
                        echo "<a href='{$edit_link}' class='edit'>" . __('Edit') . "</a>";
                    }
                    ?>
</td>
						<?php 
                    break;
                    //end case 'control_edit'
                //end case 'control_edit'
                case 'control_delete':
                    ?>
						<td><?php 
                    if (current_user_can('delete_post', $post->ID)) {
                        echo "<a href='" . wp_nonce_url("post.php?action=delete&amp;post={$post->ID}", 'delete-post_' . $post->ID) . "' class='delete'>" . __('Delete') . "</a>";
                    }
                    ?>
</td>
						<?php 
                    break;
                    //end case 'control_delete
                //end case 'control_delete
                default:
                    ?>
						<td <?php 
                    echo $attributes;
                    ?>
><?php 
                    do_action('manage_posts_custom_column', $column_name, $post->ID);
                    ?>
</td>
						<?php 
                    break;
            }
        }
        ?>
		</tr>
		<?php 
        $post = $global_post;
    }
Exemple #24
0
 /**
  * Get a list of all, hidden and sortable columns, with filter applied
  *
  * @since 3.1.0
  * @access protected
  *
  * @return array
  */
 protected function get_column_info()
 {
     // $_column_headers is already set / cached
     if (isset($this->_column_headers) && is_array($this->_column_headers)) {
         // Back-compat for list tables that have been manually setting $_column_headers for horse reasons.
         // In 4.3, we added a fourth argument for primary column.
         $column_headers = array(array(), array(), array(), $this->get_primary_column_name());
         foreach ($this->_column_headers as $key => $value) {
             $column_headers[$key] = $value;
         }
         return $column_headers;
     }
     $columns = get_column_headers($this->screen);
     $hidden = get_hidden_columns($this->screen);
     $sortable_columns = $this->get_sortable_columns();
     /**
      * Filter the list table sortable columns for a specific screen.
      *
      * The dynamic portion of the hook name, `$this->screen->id`, refers
      * to the ID of the current screen, usually a string.
      *
      * @since 3.5.0
      *
      * @param array $sortable_columns An array of sortable columns.
      */
     $_sortable = apply_filters("manage_{$this->screen->id}_sortable_columns", $sortable_columns);
     $sortable = array();
     foreach ($_sortable as $id => $data) {
         if (empty($data)) {
             continue;
         }
         $data = (array) $data;
         if (!isset($data[1])) {
             $data[1] = false;
         }
         $sortable[$id] = $data;
     }
     $primary = $this->get_primary_column_name();
     $this->_column_headers = array($columns, $hidden, $sortable, $primary);
     return $this->_column_headers;
 }
 /**
  * Outputs <td> tags based on an array of cell data.
  * 
  * @since 2.1
  * 
  * @param $headers Array of (CSS class => Cell data)
  */
 function table_cells($cells)
 {
     if (count($this->get_admin_table_columns())) {
         $columns = get_column_headers($this->plugin_page_hook);
         $hidden = get_hidden_columns($this->plugin_page_hook);
         foreach ($columns as $column_name => $column_display_name) {
             $class = "class=\"{$column_name} column-{$column_name}\"";
             $style = in_array($column_name, $hidden) ? ' style="display:none;"' : '';
             echo "\t\t<td {$class}{$style}>" . $cells[$column_name] . "</td>\n";
         }
     } elseif (is_array($cells) && count($cells)) {
         foreach ($cells as $class => $content) {
             $class = is_numeric($class) ? '' : " class='su-{$class}'";
             echo "\t\t<td{$class}>{$content}</td>\n";
         }
     }
 }
<?php print_column_headers('upload'); ?>
	</tr>
	</thead>

	<tfoot>
	<tr>
<?php print_column_headers('upload', false); ?>
	</tr>
	</tfoot>

	<tbody id="the-list" class="list:post">
<?php
add_filter('the_title','esc_html');
$alt = '';
$posts_columns = get_column_headers('upload');
$hidden = get_hidden_columns('upload');

while ( have_posts() ) : the_post();

if ( $is_trash && $post->post_status != 'trash' )
	continue;
elseif ( !$is_trash && $post->post_status == 'trash' )
	continue;

$alt = ( 'alternate' == $alt ) ? '' : 'alternate';
global $current_user;
$post_owner = ( $current_user->ID == $post->post_author ? 'self' : 'other' );
$att_title = _draft_or_post_title();
?>
	<tr id='post-<?php echo $id; ?>' class='<?php echo trim( $alt . ' author-' . $post_owner . ' status-' . $post->post_status ); ?>' valign="top">
 /**
  * Generates a list of attendees taking into account the Screen Options.
  * It's used both for the Email functionality, as for the CSV export.
  *
  * @param $event_id
  *
  * @return array
  */
 private function _generate_filtered_attendees_list($event_id)
 {
     if (empty($this->attendees_page)) {
         $this->attendees_page = 'tribe_events_page_tickets-attendees';
     }
     $columns = $this->attendees_table->get_columns();
     $hidden = get_hidden_columns($this->attendees_page);
     // We dont want to export html inputs or private data
     $hidden[] = 'cb';
     $hidden[] = 'provider';
     // remove the hidden fields from the final list of columns
     $hidden = array_filter($hidden);
     $hidden = array_flip($hidden);
     $export_columns = array_diff_key($columns, $hidden);
     $columns_names = array_filter(array_values($export_columns));
     $export_columns = array_filter(array_keys($export_columns));
     // Get the data
     $items = Tribe__Events__Tickets__Tickets::get_event_attendees($event_id);
     $rows = array($columns_names);
     //And echo the data
     foreach ($items as $item) {
         $row = array();
         foreach ($item as $key => $data) {
             if (in_array($key, $export_columns)) {
                 if ($key == 'check_in' && $data == 1) {
                     $data = __('Yes', 'tribe-events-calendar');
                 }
                 $row[$key] = $data;
             }
         }
         $rows[] = array_values($row);
     }
     return array_filter($rows);
 }
 /**
  * Prepares our data for display
  *
  * @since 1.2
  */
 function prepare_items()
 {
     global $wpdb;
     // get the current user ID
     $user = get_current_user_id();
     // get the current admin screen
     $screen = get_current_screen();
     // retrieve the "per_page" option
     $screen_option = $screen->get_option('per_page', 'option');
     // retrieve the value of the option stored for the current user
     $per_page = get_user_meta($user, $screen_option, true);
     // get the default value if none is set
     if (empty($per_page) || $per_page < 1) {
         $per_page = $screen->get_option('per_page', 'default');
     }
     // Get the date/time format that is saved in the options table
     $date_format = get_option('date_format');
     $time_format = get_option('time_format');
     // What page are we looking at?
     $current_page = $this->get_pagenum();
     // Use offset for pagination
     $offset = ($current_page - 1) * $per_page;
     // Get column headers
     $columns = $this->get_columns();
     $hidden = get_hidden_columns($this->screen);
     // Get sortable columns
     $sortable = $this->get_sortable_columns();
     // Build the column headers
     $this->_column_headers = array($columns, $hidden, $sortable);
     // Get entries search terms
     $search_terms = !empty($_POST['s']) ? explode(' ', $_POST['s']) : array();
     $searchand = $search = '';
     // Loop through search terms and build query
     foreach ($search_terms as $term) {
         $term = esc_sql($wpdb->esc_like($term));
         $search .= "{$searchand}((forms.form_title LIKE '%{$term}%') OR (forms.form_key LIKE '%{$term}%') OR (forms.form_email_subject LIKE '%{$term}%'))";
         $searchand = ' AND ';
     }
     $search = !empty($search) ? " AND ({$search}) " : '';
     // Set our ORDER BY and ASC/DESC to sort the entries
     $orderby = !empty($_GET['orderby']) ? $_GET['orderby'] : 'form_id';
     $order = !empty($_GET['order']) ? $_GET['order'] : 'desc';
     // Get the sorted entries
     $forms = $this->get_forms($orderby, $order, $per_page, $offset, $search);
     // Get entries totals
     $entries_total = $this->get_entries_count();
     $entries_today = $this->get_entries_today_count();
     $data = array();
     // Loop trough the entries and setup the data to be displayed for each row
     foreach ($forms as $form) {
         // Check if index exists first, not every form has entries
         $entries_total[$form->form_id] = isset($entries_total[$form->form_id]) ? $entries_total[$form->form_id] : 0;
         // Check if index exists first, not every form has entries today
         $entries_today[$form->form_id] = isset($entries_today[$form->form_id]) ? $entries_today[$form->form_id] : 0;
         $entries_counts = array('total' => $entries_total[$form->form_id], 'today' => $entries_today[$form->form_id]);
         $data[] = array('id' => $form->form_id, 'form_id' => $form->form_id, 'form_title' => stripslashes($form->form_title), 'entries' => $entries_counts);
     }
     // How many forms do we have?
     $total_items = $this->get_forms_count();
     // Add sorted data to the items property
     $this->items = $data;
     // Register our pagination
     $this->set_pagination_args(array('total_items' => $total_items->all, 'per_page' => $per_page, 'total_pages' => ceil($total_items->all / $per_page)));
 }
function nggallery_manage_gallery_main()
{
    global $ngg, $nggdb, $wp_query;
    //Build the pagination for more than 25 galleries
    if (!isset($_GET['paged']) || $_GET['paged'] < 1) {
        $_GET['paged'] = 1;
    }
    $start = ($_GET['paged'] - 1) * 25;
    $gallerylist = $nggdb->find_all_galleries('gid', 'asc', TRUE, 25, $start, false);
    $page_links = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'prev_text' => __('&laquo;'), 'next_text' => __('&raquo;'), 'total' => $nggdb->paged['max_objects_per_page'], 'current' => $_GET['paged']));
    ?>
	<script type="text/javascript"> 
	<!--
	function checkAll(form)
	{
		for (i = 0, n = form.elements.length; i < n; i++) {
			if(form.elements[i].type == "checkbox") {
				if(form.elements[i].name == "doaction[]") {
					if(form.elements[i].checked == true)
						form.elements[i].checked = false;
					else
						form.elements[i].checked = true;
				}
			}
		}
	}
	
	function getNumChecked(form)
	{
		var num = 0;
		for (i = 0, n = form.elements.length; i < n; i++) {
			if(form.elements[i].type == "checkbox") {
				if(form.elements[i].name == "doaction[]")
					if(form.elements[i].checked == true)
						num++;
			}
		}
		return num;
	}

	// this function check for a the number of selected images, sumbmit false when no one selected
	function checkSelected() {
	
		var numchecked = getNumChecked(document.getElementById('editgalleries'));
		 
		if(numchecked < 1) { 
			alert('<?php 
    echo esc_js(__('No images selected', 'nggallery'));
    ?>
');
			return false; 
		} 
		
		actionId = jQuery('#bulkaction').val();
		
		switch (actionId) {
			case "resize_images":
                showDialog('resize_images', '<?php 
    echo esc_js(__('Resize images', 'nggallery'));
    ?>
');
				return false;
				break;
			case "new_thumbnail":
				showDialog('new_thumbnail', '<?php 
    echo esc_js(__('Create new thumbnails', 'nggallery'));
    ?>
');
				return false;
				break;
		}
		
		return confirm('<?php 
    echo sprintf(esc_js(__("You are about to start the bulk edit for %s galleries \n \n 'Cancel' to stop, 'OK' to proceed.", 'nggallery')), "' + numchecked + '");
    ?>
');
	}

	function showDialog( windowId, title ) {
		var form = document.getElementById('editgalleries');
		var elementlist = "";
		for (i = 0, n = form.elements.length; i < n; i++) {
			if(form.elements[i].type == "checkbox") {
				if(form.elements[i].name == "doaction[]")
					if(form.elements[i].checked == true)
						if (elementlist == "")
							elementlist = form.elements[i].value
						else
							elementlist += "," + form.elements[i].value ;
			}
		}
		jQuery("#" + windowId + "_bulkaction").val(jQuery("#bulkaction").val());
		jQuery("#" + windowId + "_imagelist").val(elementlist);
        // now show the dialog
    	jQuery( "#" + windowId ).dialog({
    		width: 640,
            resizable : false,
    		modal: true,
            title: title      
    	});
        jQuery("#" + windowId + ' .dialog-cancel').click(function() { jQuery( "#" + windowId ).dialog("close"); });
	}
	
	function showAddGallery() {
    	jQuery( "#addGallery").dialog({
    		width: 640,
            resizable : false,
    		modal: true,
            title: '<?php 
    echo esc_js(__('Add new gallery', 'nggallery'));
    ?>
'          
    	});	   
        jQuery("#addGallery .dialog-cancel").click(function() { jQuery( "#addGallery" ).dialog("close"); });
	}
	//-->
	</script>
	<div class="wrap">
        <?php 
    screen_icon('nextgen-gallery');
    ?>
		<h2><?php 
    echo _n('Gallery', 'Galleries', 2, 'nggallery');
    ?>
</h2>
		<form class="search-form" action="" method="get">
		<p class="search-box">
			<label class="hidden" for="media-search-input"><?php 
    _e('Search Images', 'nggallery');
    ?>
:</label>
			<input type="hidden" id="page-name" name="page" value="nggallery-manage-gallery" />
			<input type="text" id="media-search-input" name="s" value="<?php 
    the_search_query();
    ?>
" />
			<input type="submit" value="<?php 
    _e('Search Images', 'nggallery');
    ?>
" class="button" />
		</p>
		</form>
		<form id="editgalleries" class="nggform" method="POST" action="<?php 
    echo $ngg->manage_page->base_page . '&amp;paged=' . $_GET['paged'];
    ?>
" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_bulkgallery');
    ?>
		<input type="hidden" name="page" value="manage-galleries" />
		
		<div class="tablenav">
			
			<div class="alignleft actions">
				<?php 
    if (function_exists('json_encode')) {
        ?>
				<select name="bulkaction" id="bulkaction">
					<option value="no_action" ><?php 
        _e("Bulk actions", 'nggallery');
        ?>
</option>
					<option value="delete_gallery" ><?php 
        _e("Delete", 'nggallery');
        ?>
</option>
                    <option value="set_watermark" ><?php 
        _e("Set watermark", 'nggallery');
        ?>
</option>
					<option value="new_thumbnail" ><?php 
        _e("Create new thumbnails", 'nggallery');
        ?>
</option>
					<option value="resize_images" ><?php 
        _e("Resize images", 'nggallery');
        ?>
</option>
					<option value="import_meta" ><?php 
        _e("Import metadata", 'nggallery');
        ?>
</option>
					<option value="recover_images" ><?php 
        _e("Recover from backup", 'nggallery');
        ?>
</option>
				</select>
				<input name="showThickbox" class="button-secondary" type="submit" value="<?php 
        _e('Apply', 'nggallery');
        ?>
" onclick="if ( !checkSelected() ) return false;" />
				<?php 
    }
    ?>
				<?php 
    if (current_user_can('NextGEN Upload images') && nggGallery::current_user_can('NextGEN Add new gallery')) {
        ?>
					<input name="doaction" class="button-secondary action" type="submit" onclick="showAddGallery(); return false;" value="<?php 
        _e('Add new gallery', 'nggallery');
        ?>
"/>
				<?php 
    }
    ?>
			</div>
			
		<?php 
    if ($page_links) {
        ?>
			<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $nggdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $nggdb->paged['objects_per_page'], $nggdb->paged['total_objects'])), number_format_i18n($nggdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
		<?php 
    }
    ?>
		
		</div>
		<table class="widefat" cellspacing="0">
			<thead>
			<tr>
<?php 
    print_column_headers('nggallery-manage-galleries');
    ?>
			</tr>
			</thead>
			<tfoot>
			<tr>
<?php 
    print_column_headers('nggallery-manage-galleries', false);
    ?>
			</tr>
			</tfoot>            
			<tbody>
<?php 
    if ($gallerylist) {
        //get the columns
        $gallery_columns = ngg_manage_gallery_columns();
        $hidden_columns = get_hidden_columns('nggallery-manage-images');
        $num_columns = count($gallery_columns) - count($hidden_columns);
        foreach ($gallerylist as $gallery) {
            $alternate = !isset($alternate) || $alternate == 'class="alternate"' ? '' : 'class="alternate"';
            $gid = $gallery->gid;
            $name = empty($gallery->title) ? $gallery->name : $gallery->title;
            $author_user = get_userdata((int) $gallery->author);
            ?>
		<tr id="gallery-<?php 
            echo $gid;
            ?>
" <?php 
            echo $alternate;
            ?>
 >
		<?php 
            foreach ($gallery_columns as $gallery_column_key => $column_display_name) {
                $class = "class=\"{$gallery_column_key} column-{$gallery_column_key}\"";
                $style = '';
                if (in_array($gallery_column_key, $hidden_columns)) {
                    $style = ' style="display:none;"';
                }
                $attributes = "{$class}{$style}";
                switch ($gallery_column_key) {
                    case 'cb':
                        ?>
        			<th scope="row" class="cb column-cb">
        				<?php 
                        if (nggAdmin::can_manage_this_gallery($gallery->author)) {
                            ?>
        					<input name="doaction[]" type="checkbox" value="<?php 
                            echo $gid;
                            ?>
" />
        				<?php 
                        }
                        ?>
        			</th>
        			<?php 
                        break;
                    case 'id':
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
 scope="row"><?php 
                        echo $gid;
                        ?>
</td>
					<?php 
                        break;
                    case 'title':
                        ?>
        			<td>
        				<?php 
                        if (nggAdmin::can_manage_this_gallery($gallery->author)) {
                            ?>
        					<a href="<?php 
                            echo wp_nonce_url($ngg->manage_page->base_page . '&amp;mode=edit&amp;gid=' . $gid, 'ngg_editgallery');
                            ?>
" class='edit' title="<?php 
                            _e('Edit');
                            ?>
" >
        						<?php 
                            echo nggGallery::i18n($name);
                            ?>
        					</a>
        				<?php 
                        } else {
                            ?>
        					<?php 
                            echo nggGallery::i18n($gallery->title);
                            ?>
        				<?php 
                        }
                        ?>
        			</td>
        			<?php 
                        break;
                    case 'description':
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo nggGallery::i18n($gallery->galdesc);
                        ?>
&nbsp;</td>
					<?php 
                        break;
                    case 'author':
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $author_user->display_name;
                        ?>
</td>
					<?php 
                        break;
                    case 'page_id':
                        ?>
        			<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $gallery->pageid;
                        ?>
</td>
        			<?php 
                        break;
                    case 'quantity':
                        ?>
        			<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        echo $gallery->counter;
                        ?>
</td>
        			<?php 
                        break;
                    default:
                        ?>
					<td <?php 
                        echo $attributes;
                        ?>
><?php 
                        do_action('ngg_manage_gallery_custom_column', $gallery_column_key, $gid);
                        ?>
</td>
					<?php 
                        break;
                }
            }
            ?>
		</tr>
		<?php 
        }
    } else {
        echo '<tr><td colspan="7" align="center"><strong>' . __('No entries found', 'nggallery') . '</strong></td></tr>';
    }
    ?>
			
			</tbody>
		</table>
        <div class="tablenav">
		<?php 
    if ($page_links) {
        ?>
			<div class="tablenav-pages"><?php 
        $page_links_text = sprintf('<span class="displaying-num">' . __('Displaying %s&#8211;%s of %s') . '</span>%s', number_format_i18n(($_GET['paged'] - 1) * $nggdb->paged['objects_per_page'] + 1), number_format_i18n(min($_GET['paged'] * $nggdb->paged['objects_per_page'], $nggdb->paged['total_objects'])), number_format_i18n($nggdb->paged['total_objects']), $page_links);
        echo $page_links_text;
        ?>
</div>
		<?php 
    }
    ?>
        </div>
		</form>
	</div>
	<!-- #addGallery -->
	<div id="addGallery" style="display: none;" >
		<form id="form-tags" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_addgallery');
    ?>
		<input type="hidden" name="page" value="manage-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
		  	<tr>
		    	<td>
					<strong><?php 
    _e('New Gallery', 'nggallery');
    ?>
:</strong> <input type="text" size="35" name="galleryname" value="" /><br />
					<?php 
    if (!is_multisite()) {
        ?>
					<?php 
        _e('Create a new , empty gallery below the folder', 'nggallery');
        ?>
  <strong><?php 
        echo $ngg->options['gallerypath'];
        ?>
</strong><br />
					<?php 
    }
    ?>
					<i>( <?php 
    _e('Allowed characters for file and folder names are', 'nggallery');
    ?>
: a-z, A-Z, 0-9, -, _ )</i>
				</td>
		  	</tr>
		  	<tr align="right">
		    	<td class="submit">
		    		<input class="button-primary" type="submit" name="addgallery" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#addGallery -->

	<!-- #resize_images -->
	<div id="resize_images" style="display: none;" >
		<form id="form-resize-images" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="resize_images_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="resize_images_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<td>
					<strong><?php 
    _e('Resize Images to', 'nggallery');
    ?>
:</strong> 
				</td>
				<td>
					<input type="text" size="5" name="imgWidth" value="<?php 
    echo $ngg->options['imgWidth'];
    ?>
" /> x <input type="text" size="5" name="imgHeight" value="<?php 
    echo $ngg->options['imgHeight'];
    ?>
" />
					<br /><small><?php 
    _e('Width x height (in pixel). NextGEN Gallery will keep ratio size', 'nggallery');
    ?>
</small>
				</td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_ResizeImages" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#resize_images -->

	<!-- #new_thumbnail -->
	<div id="new_thumbnail" style="display: none;" >
		<form id="form-new-thumbnail" method="POST" accept-charset="utf-8">
		<?php 
    wp_nonce_field('ngg_thickbox_form');
    ?>
		<input type="hidden" id="new_thumbnail_imagelist" name="TB_imagelist" value="" />
		<input type="hidden" id="new_thumbnail_bulkaction" name="TB_bulkaction" value="" />
		<input type="hidden" name="page" value="manage-galleries" />
		<table width="100%" border="0" cellspacing="3" cellpadding="3" >
			<tr valign="top">
				<th align="left"><?php 
    _e('Width x height (in pixel)', 'nggallery');
    ?>
</th>
				<td><input type="text" size="5" maxlength="5" name="thumbwidth" value="<?php 
    echo $ngg->options['thumbwidth'];
    ?>
" /> x <input type="text" size="5" maxlength="5" name="thumbheight" value="<?php 
    echo $ngg->options['thumbheight'];
    ?>
" />
				<br /><small><?php 
    _e('These values are maximum values ', 'nggallery');
    ?>
</small></td>
			</tr>
			<tr valign="top">
				<th align="left"><?php 
    _e('Set fix dimension', 'nggallery');
    ?>
</th>
				<td><input type="checkbox" name="thumbfix" value="1" <?php 
    checked('1', $ngg->options['thumbfix']);
    ?>
 />
				<br /><small><?php 
    _e('Ignore the aspect ratio, no portrait thumbnails', 'nggallery');
    ?>
</small></td>
			</tr>
		  	<tr align="right">
		    	<td colspan="2" class="submit">
		    		<input class="button-primary" type="submit" name="TB_NewThumbnail" value="<?php 
    _e('OK', 'nggallery');
    ?>
" />
		    		&nbsp;
		    		<input class="button-secondary dialog-cancel" type="reset" value="&nbsp;<?php 
    _e('Cancel', 'nggallery');
    ?>
&nbsp;" />
		    	</td>
			</tr>
		</table>
		</form>
	</div>
	<!-- /#new_thumbnail -->	

<?php 
}
    /**
     * Render the list table columns preferences.
     *
     * @since 4.4.0
     */
    public function render_list_table_columns_preferences()
    {
        $columns = get_column_headers($this);
        $hidden = get_hidden_columns($this);
        if (!$columns) {
            return;
        }
        $legend = !empty($columns['_title']) ? $columns['_title'] : __('Columns');
        ?>
		<fieldset class="metabox-prefs">
		<legend><?php 
        echo $legend;
        ?>
</legend>
		<?php 
        $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname');
        foreach ($columns as $column => $title) {
            // Can't hide these for they are special
            if (in_array($column, $special)) {
                continue;
            }
            if (empty($title)) {
                continue;
            }
            if ('comments' == $column) {
                $title = __('Comments');
            }
            $id = "{$column}-hide";
            echo '<label>';
            echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" value="' . $column . '"' . checked(!in_array($column, $hidden), true, false) . ' />';
            echo "{$title}</label>\n";
        }
        ?>
		</fieldset>
		<?php 
    }