Esempio n. 1
0
if (isset($_POST['update'])) {
    if (do_edit('campaign', $_POST, $_GET['id'])) {
        $edited = 1;
        MAD_Admin_Redirect::redirect('edit_campaign.php?edited=1&id=' . $_GET['id'] . '');
    } else {
        global $edited;
        $edited = 2;
    }
}
if ($edited != 2) {
    $editdata = get_campaign_detail($_GET['id']);
    $editdata['geo_targeting'] = $editdata['country_target'];
    $editdata['device_targeting'] = $editdata['device_target'];
    $editdata['channel_targeting'] = $editdata['channel_target'];
    $editdata['publication_targeting'] = $editdata['publication_target'];
    $main_cap = get_campaign_cap_detail($_GET['id']);
    $editdata['total_amount'] = $main_cap['total_amount'];
    $editdata['cap_type'] = $main_cap['cap_type'];
    $editdata['preload_country'] = 1;
    $editdata['placement_select'] = load_campaign_placement_array($_GET['id']);
    $editdata['channel_select'] = load_campaign_channel_array($_GET['id']);
    if ($editdata['campaign_end'] == '2090-12-12') {
        $editdata['end_date_type'] = 1;
    } else {
        $editdata['end_date_type'] = 2;
        $end_date = explode('-', $editdata['campaign_end']);
        $end_date_array['year'] = $end_date[0];
        $end_date_array['day'] = $end_date[2];
        $end_date_array['month'] = $end_date[1];
        $editdata['enddate_value'] = '' . $end_date_array['month'] . '/' . $end_date_array['day'] . '/' . $end_date_array['year'] . '';
    }
Esempio n. 2
0
function get_campaigns()
{
    global $maindb;
    $current_timestamp = time();
    global $user_detail;
    if (!check_permission_simple('view_all_campaigns', $user_detail['user_id'])) {
        $lq = "WHERE campaign_owner='" . $user_detail['user_id'] . "'";
    } else {
        $lq = '';
    }
    $usrres = mysql_query("select * from md_campaigns " . $lq . " ORDER BY campaign_id DESC", $maindb);
    while ($campaign_detail = mysql_fetch_array($usrres)) {
        $campaign_status = '';
        $cap_active = 0;
        $cap_detail = get_campaign_cap_detail($campaign_detail['campaign_id']);
        if ($cap_detail['cap_type'] > 0 && is_numeric($cap_detail['total_amount'])) {
            $cap_active = 1;
        }
        if ($campaign_detail['campaign_priority'] == 1) {
            $campaign_priority = '1';
        } else {
            if ($campaign_detail['campaign_priority'] == 2) {
                $campaign_priority = '2';
            } else {
                if ($campaign_detail['campaign_priority'] == 3) {
                    $campaign_priority = '3';
                } else {
                    if ($campaign_detail['campaign_priority'] == 4) {
                        $campaign_priority = '4';
                    } else {
                        if ($campaign_detail['campaign_priority'] == 5) {
                            $campaign_priority = '5';
                        }
                    }
                }
            }
        }
        if ($campaign_detail['campaign_type'] == 1) {
            $campaign_type = 'Direct Sold';
        } else {
            if ($campaign_detail['campaign_type'] == 2) {
                $campaign_type = 'Promotional';
            } else {
                if ($campaign_detail['campaign_type'] == 'network') {
                    $campaign_type = 'Network';
                }
            }
        }
        if ($campaign_detail['campaign_type'] == 'network') {
            $total_adunits = '-';
        } else {
            $total_adunits = mysql_num_rows(mysql_query("SELECT * FROM md_ad_units WHERE campaign_id='{$campaign_detail['campaign_id']}'", $maindb));
        }
        if ($campaign_detail['campaign_type'] != 'network' && $total_adunits < 1) {
            $campaign_status = 'No Ads';
            $statuscolor = '#000000';
        } else {
            if ($campaign_detail['campaign_status'] == 2) {
                $campaign_status = 'Paused';
                $statuscolor = '#FF9900';
            } else {
                if ($campaign_detail['campaign_start'] > date("Y-m-d")) {
                    $campaign_status = 'Not Started';
                    $statuscolor = '#000000';
                } else {
                    if ($campaign_detail['campaign_end'] <= date("Y-m-d")) {
                        $campaign_status = 'Ended';
                        $statuscolor = '#993300';
                    } else {
                        if ($campaign_detail['campaign_status'] == 1) {
                            $campaign_status = 'Active';
                            $statuscolor = '#009900;';
                        }
                    }
                }
            }
        }
        $campaign_reporting = get_campaign_reporting_metrics($campaign_detail['campaign_id']);
        if ($campaign_detail['campaign_type'] != 'network') {
            $campaign_reporting['total_requests'] = '-';
        } else {
            $campaign_reporting['total_requests'] = number_format($campaign_reporting['total_requests_sec']);
        }
        echo '<tr class="gradeA">
								<td><input type="checkbox" value="' . $campaign_detail['campaign_id'] . '" name="select_campaign[ ]"> ' . $campaign_detail['campaign_name'] . '</td>
								<td class="center">' . $campaign_type . '</td>
								<td class="center">' . $campaign_priority . '</td>
								<td class="center"><span style="color:' . $statuscolor . '">' . $campaign_status . '</span></td>
								<td class="center">' . $total_adunits . '</td>
								<td class="center">' . $campaign_reporting['total_requests'] . '</td>
								<td class="center">' . number_format($campaign_reporting['total_impressions']) . '</td>
								<td class="center">' . number_format($campaign_reporting['total_clicks']) . '</td>
								';
        echo '<td class="center"><span class="ticket ticket-info"><a href="edit_campaign.php?id=' . $campaign_detail['campaign_id'] . '" style="color:#FFF; text-decoration:none;">Edit </a></span>';
        if ($campaign_detail['campaign_type'] != 'network') {
            echo '&nbsp;<span class="ticket ticket-warning"><a href="view_adunits.php?id=' . $campaign_detail['campaign_id'] . '" style="color:#FFF; text-decoration:none;">View Ad Units</a></span>';
        }
        if ($cap_active == 1) {
            echo '&nbsp;<span class="ticket ticket-important"><a href="edit_running_limit.php?id=' . $campaign_detail['campaign_id'] . '" style="color:#FFF; text-decoration:none;">Change Cap</a></span>';
        }
        echo '&nbsp;<span class="ticket ticket-success"><a href="reporting.php?type=campaign&reporting_campaign=' . $campaign_detail['campaign_id'] . '" style="color:#FFF; text-decoration:none;">Reporting</a></span></td>';
        echo '</tr>	';
    }
}