copyAd($ad->id);
}
}
Advman_Admin::add_notice('advman-notice-once', __("Ads copied"), false);
break;
case 'delete' :
foreach ($ads as $ad) {
if ($ad) {
$advman_engine->deleteAd($ad->id);
}
}
Advman_Admin::add_notice('advman-notice-once', __("Ads deleted"), false);
break;
}
}
} else {
$ad = Advman_Tools::get_current_ad();
if ($ad) {
Advman_Admin::ad_action($action, $ad);
}
}
$url = remove_query_arg(array('action', 'ad', 'network', '_wpnonce'));
wp_redirect($url);
}
}
function ad_list_action($action)
{
global $advman_engine;
// First, if there are no ads, redirect to the create screen
$ads = $advman_engine->getAds();
if (!$ads) {
wp_redirect(admin_url('admin.php?page=advman-ad-new'));
}
}
function process()
{
global $advman_slot_list;
$q = Advman_Tools::get_search_query();
echo '
' . __('Ads', 'advman');
if (!empty($q))
printf( ' ' . __('Search results for “%s”', 'advman') . '', $q );
echo '
';
$advman_slot_list->views();
$advman_slot_list->prepare_items();
?>
';
echo '.wp-list-table .column-id { width: 5%; }';
echo '.wp-list-table .column-name { width: 30%; }';
echo '.wp-list-table .column-type { width: 15%; }';
echo '.wp-list-table .column-format { width: 15%; }';
echo '.wp-list-table .column-active { width: 10%; }';
echo '.wp-list-table .column-def { width: 10%; }';
echo '.wp-list-table .column-date { width: 15%; }';
echo '';
}
/**
* Add contextual help for ad list screen
*/
function add_contextual_help() {
get_current_screen()->add_help_tab( array(
'id' => 'overview',
'title' => __('Overview'),
'content' =>
'' . __('This screen provides access to all of your ads. Each ad is listed in the table below. You can customize the display of this screen to suit your workflow.') . '
'
) );
get_current_screen()->add_help_tab( array(
'id' => 'screen-content',
'title' => __('Screen Content'),
'content' =>
'' . __('You can customize the display of this screen’s contents in a number of ways:') . '
' .
'' .
'- ' . __('You can hide/display columns based on your needs and decide how many ads to list per screen using the Screen Options tab.') . '
' .
'- ' . __('You can sort the list to order by name, type, format, etc. Click the title of the column to sort ascending. Click the title again to sort decending.') . '
' .
'- ' . __('You can filter the list of ads by ad status using the text links in the upper left to show All, Active, or Inactive ads. The default view is to show all ads.') . '
' .
'- ' . __('You can refine the list to show only ads of a specific type. Click the Filter button after making your selection.') . '
' .
'
'
) );
get_current_screen()->add_help_tab( array(
'id' => 'action-links',
'title' => __('Available Actions'),
'content' =>
'' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '
' .
'' .
'- ' . __('Edit takes you to the editing screen for that ad. You can also reach that screen by clicking on the ad name.') . '
' .
'- ' . __('Delete removes your ad from this list and permanently deletes it.') . '
' .
'- ' . __('Preview will show you what your rendered ad will look like if you display it on your site.') . '
' .
'
'
) );
get_current_screen()->add_help_tab( array(
'id' => 'bulk-actions',
'title' => __('Bulk Actions'),
'content' =>
'' . __('You can also perform actions on multiple ads at once. Select the ads you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply. Use the checkbox in the header to select or deselect all items.') . '
' .
'' .
'- ' . __('Copy makes a copy of the selected ads and adds them to the list') . '
' .
'- ' . __('Delete removes the selected ads from this list and permanently deletes them.') . '
' .
'
'
) );
get_current_screen()->set_help_sidebar(
'' . __('For more information:') . '
' .
'' . __('Plugin Page') . '
' .
'' . __('Support Forums') . '
'
);
}
function add_options() {
$option = 'per_page';
$args = array(
'label' => 'Ads',
'default' => 10,
'option' => 'ads_per_page'
);
add_screen_option( $option, $args );
}
}
?>