<?php include ("app_needed/config.php");
require_once("app_classes/module_campaigns.inc"); 
if(!$_SESSION[unique])
header("Location: ".APP_WEBSITE."/login.html");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?= language("CHARSET") ?>" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<title><?= language('PAGE_list_campaigns_title') ?> - <?= $config->get_value('platform_title') ?></title>
<link rel="shortcut icon" type="image/png" href="<?= $config->get_value('platform_favicon') ?>"/>
<link href="app_needed/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="app_needed/style.tipsy.css" type="text/css" />

</head>

<body>
<div id="wrapper">
	<?php include("module.header.php"); ?>
	<?php include ("module.menu.php"); ?>
	<div class="content">
		<div class="info">
        <div class="left">
		<h1><?= language('PAGE_list_campaigns_title') ?></h1>
        </div>
        <div class="right">
        <a href="new-campaign.html" class="btn"><?= language('BUTTON_new_campaign') ?></a>
        </div>
        <div class="clear"></div>
		</div>
        
      <div class="box  list_head">
         <div class="inside">
          <table width="100%" border="0">
           	  <tr>
            	  <td width="52%"><?= language('TABLE_campaign_name')?></td>
            	  <td width="18%"  class="none"><?= language('TABLE_status')?></td>
            	  <td width="14%"  class="none"><?= language('TABLE_created_date')?></td>
            	  <td width="16%"><?= language('TABLE_actions')?></td>
       	    </tr>
       	   </table>
        </div>
        </div>
        <?php 
		$sql = "SELECT * FROM `app_campaigns` WHERE `unique_user` = '".$_SESSION[unique]."' ORDER BY `date` DESC ";
		$result = mysql_query ($sql);
		while ($campaigns = mysql_fetch_array($result))
		{
			$campaign = new class_campaigns($campaigns[unique]);
			
		?>
      <div class="box list" id="<?= $campaign->get_unique() ?>">
          <table width="100%" border="0">
            <tr>
              <td width="52%"><strong><?= $campaign->get_name() ?></strong></td>
              <td width="18%" class="<?= $campaign->get_status() ?> none"><?php if($campaign->get_valid() == 1 || $campaign->get_valid() == 2) { ?><input type="checkbox" class="switcher" id="c<?= $campaign->get_unique() ?>" <?php if($campaign->get_valid() == 1) echo "checked"; ?> /><?php }else echo"<span>" .$campaign->get_status()."</span>";?></td>
              <td width="14%"  class="none"><?= $campaign->get_date() ?></td>
              <td width="16%"><a href="banner-<?= $campaign->get_unique() ?>.html"><img src="app_images/icon-edit.png" width="24" class="tip" title="<?= language('ICON_campaign_edit') ?>"  /></a> <a href="personal-daily-<?=$campaign->get_unique()?>.html"><img src="app_images/icon-stats.png" width="24" class="tip" title="<?= language('ICON_statistics') ?>"  /></a> <a href="javascript:delete_campaign('<?= $campaign->get_unique() ?>')"><img src="app_images/icon-delete.png" width="24" class="tip" title="<?= language('ICON_campaign_delete') ?>"  /></a></td>
            </tr>
        </table>
        </div>
        <?php } ?>
	</div>
</div>
<div id='confirm'>
<div class="left">
	<div class='title'><span><?= language('CONFIRM') ?></span></div>
	<div class='message'></div>
</div>
<div class="right">
	<div class='buttons'>
				<span class='no simplemodal-close'><?= language('NO') ?></span><span class='yes'><?= language('YES') ?></span>
               
	</div>
</div>
<div class="clear"></div>
	</div>
		<!-- preload the images -->
	<div style='display:none'>
		<img src='img/confirm/header.gif' alt='' />
		<img src='img/confirm/button.gif' alt='' />
	</div>

<script type="text/javascript" src="app_needed/jquery-1.9.0.min.js"></script>
<script type='text/javascript' src='app_needed/jquery.accordionmenu.js'></script>
<script type='text/javascript' src='app_needed/jquery.checkbox.js'></script>
<script type='text/javascript' src='app_needed/jquery.tipsy.js'></script>
<script type='text/javascript' src='app_needed/function.ajax.js'></script>
<script type='text/javascript' src='app_needed/simply-toast.min.js'></script>
<script type='text/javascript' src='app_needed/jquery.simplemodal.js'></script>
<script type='text/javascript' src='app_needed/functions.js'></script>
</body>
</html>
<?php mysql_close($conn); ?>