Beispiel #1
0
?>
 Orders Returned (<?php 
echo $pages;
?>
 pages) </b></center>
<?php 
if ($count > $records_per_page) {
    // calculate number of pages & current page
    $q_string .= "&show=" . $_REQUEST['show'];
    echo "<center>";
    $label["navigation_page"] = str_replace("%CUR_PAGE%", $cur_page, $label["navigation_page"]);
    $label["navigation_page"] = str_replace("%PAGES%", $pages, $label["navigation_page"]);
    //	echo "<span > ".$label["navigation_page"]."</span> ";
    $nav = nav_pages_struct($result, $q_string, $count, $records_per_page);
    $LINKS = 40;
    render_nav_pages($nav, $LINKS, $q_string, $show_emp, $cat);
    echo "</center>";
}
//print_r($_REQUEST);
?>
<table width="100%" cellSpacing="1" cellPadding="3" align="center" bgColor="#d9d9d9" border="0">
<tr >
<td colspan="12"> <?php 
if ($_REQUEST['show'] != 'DE') {
    ?>
 With selected: <input type="submit" value='Complete' onclick="if (!confirmLink(this, 'Complete for all selected, are you sure?')) return false" name='mass_complete' > <?php 
    if ($_REQUEST['show'] != 'CA') {
        ?>
| <input type="submit" value='Cancel' name='mass_cancel'  onclick="if (!confirmLink(this, 'Cancel for all selected, are you sure?')) return false" > <?php 
    }
    if ($_REQUEST['show'] == 'CA') {
Beispiel #2
0
function list_ads($admin = false, $order, $offset, $list_mode = 'ALL', $user_id = '')
{
    ## Globals
    global $label;
    global $tag_to_field_id;
    $tag_to_field_id = ad_tag_to_field_id_init();
    ###########################################
    # Load in the form data, including column names
    # (dont forget LANGUAGE TOO)
    global $ad_tag_to_field_id;
    $records_per_page = 40;
    global $label;
    // languages array
    $order_str = $order;
    if ($order == '') {
        $order = " `order_id` ";
    } else {
        $order = " `{$order}` ";
    }
    global $action;
    // process search result
    if ($_REQUEST['action'] == 'search') {
        $q_string = generate_q_string(1);
        $where_sql = generate_search_sql(1);
    }
    // DATE_FORMAT(`adate`, '%d-%b-%Y') AS formatted_date
    $order = $_REQUEST['order_by'];
    if ($_REQUEST['ord'] == 'asc') {
        $ord = 'ASC';
    } elseif ($_REQUEST['ord'] == 'desc') {
        $ord = 'DESC';
    } else {
        $ord = 'DESC';
        // sort descending by default
    }
    if ($order == '') {
        $order = " `ad_date` ";
    } else {
        $order = " `{$order}` ";
    }
    global $BID;
    if ($list_mode == 'USER') {
        if (!is_numeric($user_id)) {
            $user_id = $_SESSION['MDS_ID'];
        }
        $sql = "Select *  FROM `ads` as t1, `orders` as t2 WHERE t1.ad_id=t2.ad_id AND t1.order_id > 0 AND t1.banner_id='" . $BID . "' AND t1.user_id='" . $user_id . "' AND (t2.status = 'completed' OR t2.status = 'expired') {$where_sql} ORDER BY {$order} {$ord} ";
    } elseif ($list_mode == 'TOPLIST') {
        //	$sql = "SELECT *, DATE_FORMAT(MAX(order_date), '%Y-%c-%d') as max_date, sum(quantity) AS pixels FROM orders, ads where ads.order_id=orders.order_id AND status='completed' and orders.banner_id='$BID' GROUP BY orders.user_id, orders.banner_id order by pixels desc ";
    } else {
        $sql = "Select *  FROM `ads` as t1, `orders` AS t2 WHERE t1.ad_id=t2.ad_id AND t1.banner_id='{$BID}' and t1.order_id > 0 {$where_sql} ORDER BY {$order} {$ord} ";
    }
    //echo "[".$sql."]";
    $result = mysql_query($sql) or die(mysql_error());
    ############
    # get the count
    $count = mysql_num_rows($result);
    if ($count > $records_per_page) {
        mysql_data_seek($result, $offset);
    }
    if ($count > 0) {
        if ($pages == 1) {
        } elseif ($list_mode != 'USER') {
            $pages = ceil($count / $records_per_page);
            $cur_page = $_REQUEST['offset'] / $records_per_page;
            $cur_page++;
            echo "<center>";
            //echo "Page $cur_page of $pages - ";
            $label["navigation_page"] = str_replace("%CUR_PAGE%", $cur_page, $label["navigation_page"]);
            $label["navigation_page"] = str_replace("%PAGES%", $pages, $label["navigation_page"]);
            echo "<span > " . $label["navigation_page"] . "</span> ";
            $nav = nav_pages_struct($result, $q_string, $count, $records_per_page);
            $LINKS = 10;
            render_nav_pages($nav, $LINKS, $q_string, $show_emp, $cat);
            echo "</center>";
        }
        $dir = dirname(__FILE__);
        $dir = preg_split('%[/\\\\]%', $dir);
        $blank = array_pop($dir);
        $dir = implode('/', $dir);
        include $dir . '/mouseover_box.htm';
        // edit this file to change the style of the mouseover box!
        echo '<script language="JAVASCRIPT">';
        include 'mouseover_js.inc.php';
        echo '</script>';
        ?>
		<table border='0' bgcolor='#d9d9d9' cellspacing="1" cellpadding="5" id="adslist" >
		<tr bgcolor="#EAEAEA">
		<?php 
        if ($admin == true) {
            echo '<td class="list_header_cell">&nbsp;</td>';
        }
        if ($list_mode == 'USER') {
            echo '<td class="list_header_cell">&nbsp;</td>';
        }
        echo_list_head_data(1, $admin);
        if ($list_mode == 'USER' || $admin) {
            echo '<td class="list_header_cell">' . $label['ads_inc_pixels_col'] . '</td>';
            echo '<td class="list_header_cell">' . $label['ads_inc_expires_col'] . '</td>';
            echo '<td class="list_header_cell" >' . $label['ad_list_status'] . '</td>';
        }
        ?>
		
		</tr>

		<?php 
        $i = 0;
        global $prams;
        while (($prams = mysql_fetch_array($result, MYSQL_ASSOC)) && $i < $records_per_page) {
            $i++;
            ?>
			  <tr bgcolor="ffffff" onmouseover="old_bg=this.getAttribute('bgcolor');this.setAttribute('bgcolor', '#FBFDDB', 0);" onmouseout="this.setAttribute('bgcolor', old_bg, 0);">
	
			  <?php 
            if ($admin == true) {
                echo '<td class="list_data_cell" >';
                ?>
			 <!--<input style="font-size: 8pt" type="button" value="Delete" onClick="if (!confirmLink(this, 'Delete, are you sure?')) {return false;} window.location='<?php 
                echo htmlentities($_SERVER['PHP_SELF']);
                ?>
?action=delete&ad_id=<?php 
                echo $prams['ad_id'];
                ?>
'"><br>!-->
				<input type="button" style="font-size: 8pt" value="Edit" onClick="window.location='<?php 
                echo htmlentities($_SERVER['PHP_SELF']);
                ?>
?action=edit&ad_id=<?php 
                echo $prams['ad_id'];
                ?>
'">

				<?php 
                echo '</td>';
            }
            if ($list_mode == 'USER') {
                echo '<td class="list_data_cell">';
                ?>
			 <!--<input style="font-size: 8pt" type="button" value="Delete" onClick="if (!confirmLink(this, 'Delete, are you sure?')) {return false;} window.location='<?php 
                echo htmlentities($_SERVER['PHP_SELF']);
                ?>
?action=delete&ad_id=<?php 
                echo $prams['ad_id'];
                ?>
'"><br>-->
				<input type="button" style="font-size: 8pt" value="Edit" onClick="window.location='<?php 
                echo htmlentities($_SERVER['PHP_SELF']);
                ?>
?ad_id=<?php 
                echo $prams['ad_id'];
                ?>
'">

				<?php 
                echo '</td>';
            }
            echo_ad_list_data($admin);
            if ($list_mode == 'USER' || $admin) {
                /////////////////
                echo '<td class="list_data_cell"><img src="get_order_image.php?BID=' . $BID . '&aid=' . $prams['ad_id'] . '"></td>';
                //////////////////
                echo '<td>';
                if ($prams['days_expire'] > 0) {
                    if ($prams['published'] != 'Y') {
                        $time_start = strtotime(gmdate('r'));
                    } else {
                        $time_start = strtotime($prams['date_published'] . " GMT");
                    }
                    $elapsed_time = strtotime(gmdate('r')) - $time_start;
                    $elapsed_days = floor($elapsed_time / 60 / 60 / 24);
                    $exp_time = $prams['days_expire'] * 24 * 60 * 60;
                    $exp_time_to_go = $exp_time - $elapsed_time;
                    $exp_days_to_go = floor($exp_time_to_go / 60 / 60 / 24);
                    $to_go = elapsedtime($exp_time_to_go);
                    $elapsed = elapsedtime($elapsed_time);
                    if ($prams['status'] == 'expired') {
                        $days = "<a href='orders.php'>" . $label['ads_inc_expied_stat'] . "</a>";
                    } elseif ($prams['date_published'] == '') {
                        $days = $label['ads_inc_nyp_stat'];
                    } else {
                        $days = str_replace('%ELAPSED%', $elapsed, $label['ads_inc_elapsed_stat']);
                        $days = str_replace('%TO_GO%', $to_go, $days);
                        //$days = "$elapsed elapsed<br> $to_go to go ";
                    }
                    //$days = $elapsed_time;
                    //print_r($prams);
                } else {
                    $days = $label['ads_inc_nev_stat'];
                }
                echo $days;
                echo '</td>';
                /////////////////
                if ($prams['published'] == 'Y') {
                    $pub = $label['ads_inc_pub_stat'];
                } else {
                    $pub = $label['ads_inc_npub_stat'];
                }
                if ($prams['approved'] == 'Y') {
                    $app = $label['ads_inc_app_stat'] . ', ';
                } else {
                    $app = $label['ads_inc_napp_stat'] . ', ';
                }
                //$label['ad_list_st_'.$prams['status']]."
                echo '<td class="list_data_cell">' . $app . $pub . "</td>";
            }
            ?>


		</tr>
		  <?php 
            //$prams[file_photo] = '';
            // $new_name='';
        }
        echo "</table>";
    } else {
        echo "<center><font size='2' face='Arial'><b>" . $label["ads_not_found"] . ".</b></font></center>";
    }
    return $count;
}