rotation_type = array('priority' => __('Priority', AAS_TEXT_DOMAIN) , 'random' => __('Random',AAS_TEXT_DOMAIN) ); $this->available_devices = array( 'pc' => __('PC', AAS_TEXT_DOMAIN) , 'mobile' => __('Mobile', AAS_TEXT_DOMAIN) , 'tablet' => __('Tablet', AAS_TEXT_DOMAIN) , ); add_action('init' , array(&$this,'zone_register')); add_action( 'save_post', array(&$this,'zone_save_meta') ); add_filter('post_updated_messages', array(&$this,'zone_updated_messages') ); add_filter( 'manage_edit-zone_columns', array(&$this, 'set_custom_edit_zone_columns' ) ); add_filter( 'manage_edit-zone_sortable_columns', array(&$this,'zone_manage_sortable_columns') ); add_action( 'manage_zone_posts_custom_column' , array(&$this, 'custom_zone_column' ), 10, 2 ); } function zone_register(){ $labels = array( 'name' => _x( 'Zones', 'post type general name', AAS_TEXT_DOMAIN ), 'singular_name' => _x( 'Zone', 'post type singular name', AAS_TEXT_DOMAIN ), 'menu_name' => _x( 'Zones', 'admin menu', AAS_TEXT_DOMAIN ), 'name_admin_bar' => _x( 'Zone', 'add new on admin bar', AAS_TEXT_DOMAIN ), 'add_new' => _x( 'Add New', 'book', AAS_TEXT_DOMAIN ), 'add_new_item' => __( 'Add New Zone', AAS_TEXT_DOMAIN ), 'new_item' => __( 'New Zone', AAS_TEXT_DOMAIN ), 'edit_item' => __( 'Edit Zone', AAS_TEXT_DOMAIN ), 'view_item' => __( 'View Zone', AAS_TEXT_DOMAIN), 'all_items' => __( 'All Zones', AAS_TEXT_DOMAIN ), 'search_items' => __( 'Search Zones', AAS_TEXT_DOMAIN ), 'parent_item_colon' => __( 'Parent Zones:', AAS_TEXT_DOMAIN ), 'not_found' => __( 'No zones found.', AAS_TEXT_DOMAIN ), 'not_found_in_trash' => __( 'No zones found in Trash.', AAS_TEXT_DOMAIN ) ); $args = array( 'labels' => $labels, 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'show_in_menu' => false, 'query_var' => false, 'rewrite' => false, 'capability_type' => 'post', 'has_archive' => false, 'hierarchical' => false, 'menu_position' => null, 'exclude_from_search' => true, 'register_meta_box_cb' => array(&$this , 'zone_add_meta_box'), 'supports' => array( 'title' ) ); register_post_type( 'zone', $args ); } function zone_updated_messages( $messages ) { global $post, $post_ID; $messages['zone'] = array( 0 => '', // Unused. Messages start at index 1. 1 => __('Zone updated.' , AAS_TEXT_DOMAIN) , 6 => __('Zone published.' , AAS_TEXT_DOMAIN) , 8 => __('Zone submitted.' , AAS_TEXT_DOMAIN), 9 => sprintf( __('Zone scheduled for: %1$s.' , AAS_TEXT_DOMAIN), date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ) ), 10 => __('Zone draft updated.', AAS_TEXT_DOMAIN) ); return $messages; } function zone_add_meta_box(){ add_meta_box( 'aas_zone', __( 'Zone Details', AAS_TEXT_DOMAIN ), array(&$this,'zone_meta_box'), 'zone' , 'normal' , 'high' ); add_meta_box( 'aas_zone_overview', __( 'Zone Overview', AAS_TEXT_DOMAIN ), array(&$this,'zone_overview_box'), 'zone' , 'side' , 'high' ); add_meta_box( 'aas_zone_campaign', __( 'Attached Campaigns', AAS_TEXT_DOMAIN ), array(&$this,'zone_campaign_box'), 'zone' , 'side' , 'default' ); } function zone_meta_box($post){ wp_nonce_field( 'zone_meta_box', 'zone_meta_box_nonce' ); $size = explode('x',get_post_meta($post->ID , 'zone_size' ,true)); $zone_size['width'] = isset($size[0]) ? $size[0] : ''; $zone_size['height'] = isset($size[1]) ? $size[1] : ''; $zone_d_price = get_post_meta($post->ID , 'zone_default_price' ,true); $zone_s_price = get_post_meta($post->ID , 'zone_special_price' ,true); $zone_rotation = get_post_meta($post->ID , 'zone_rotation' ,true); $devices = get_post_meta($post->ID , 'zone_devices' ,true); ?>









>

$price): ?>

#

get_var("SELECT COUNT(ID) FROM $wpdb->posts WHERE post_parent IN (SELECT post_id from {$wpdb->prefix}postmeta WHERE meta_key = 'campaign_displaying' AND meta_value={$post->ID}) AND post_type = 'ads_banner'"); ?>

ID)->payment + @AAS_Log::get_log_by('zone_id' , $post->ID,'c')->payment;?>

ID, '_ctr',true) . '%';?>

ID, '_total_click',true);?>

ID, '_total_view',true);?>

ID.'"]';?>

get_col("SELECT post_id from {$wpdb->prefix}postmeta WHERE meta_key = 'campaign_displaying' AND meta_value={$post->ID}"); foreach($camIds as $id): $cam = get_post($id); $status = $cam->post_status == 'publish' ? 'green' : 'red'; ?>

post_title;?>

0) update_post_meta( $post_id, '_ctr' , round($_total_click*100/$_total_view, 2 ) ); else update_post_meta( $post_id, '_ctr' , 0 ); } function set_custom_edit_zone_columns($columns) { $date = $columns['date']; unset( $columns['date'] ); $columns['width'] = __('Width',AAS_TEXT_DOMAIN); $columns['height'] = __('Height',AAS_TEXT_DOMAIN); $columns['ctr'] = __('CTR',AAS_TEXT_DOMAIN); $columns['click'] = __('Clicks',AAS_TEXT_DOMAIN); $columns['impression'] = __('Impressions',AAS_TEXT_DOMAIN); $columns['campaign'] = __('Attached Campaign',AAS_TEXT_DOMAIN); $columns['shortcode'] = __('Shortcode',AAS_TEXT_DOMAIN); $columns['date'] = $date; return $columns; } function custom_zone_column( $column, $post_id ) { switch ( $column ) { case 'width': $size = explode('x',get_post_meta($post_id, 'zone_size', true)); echo $size[0]; break; case 'height': $size = explode('x',get_post_meta($post_id, 'zone_size', true)); echo $size[1]; break; case 'ctr': echo (float)get_post_meta($post_id , '_ctr' , true) . '%'; break; case 'click': echo (int)get_post_meta($post_id , '_total_click' , true); break; case 'impression': echo (int)get_post_meta($post_id , '_total_view' , true); break; case 'campaign' : global $wpdb; $camIds=$wpdb->get_col("SELECT post_id from {$wpdb->prefix}postmeta WHERE meta_key = 'campaign_displaying' AND meta_value={$post_id}"); foreach($camIds as $id): $cam = get_post($id); ?> post_title;?>