<?php
require_once "../config/config.php";
require_once INCLUDE_DIR."/product_class.php";
require_once INCLUDE_DIR."/users_class.php";
$users=new users_class();
if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can view products and thankyou page tracking')==false)
{
Redirect('admin_nopermission.php',true);
}
$loProductClass = new product_class();
if(isset($_GET['productid']))
{
$query = 'SELECT pp.name, ppr.id FROM '.TABLE_PREFIX.'products pp
join '.TABLE_PREFIX.'productpaymentoptions ppr on ppr.productid=pp.id
WHERE pp.id='.$_GET['productid'];
$laQueryResult = $loProductClass->View($query,null,null);
}
//$laQueryResult[0]['name'];
// $laQueryResult[0]['id'];
$query = 'SELECT id,name FROM '.TABLE_PREFIX.'products WHERE IsDeleted=0';
$ProductData = $loProductClass->View($query,null,null);
echo($smarty->fetch('admin_header.php'));
echo "<div id=\"content\" class=\"setdiv\"> ";
if($message->IsMessageExists())
{
$lsmsg=$message->GetMessage();
echo "<div class=\"succmsg\" style=\"width:335px\">$lsmsg</div>";
}
echo "<div id=\"full-contentdiv\">";
echo "<div class=\"righttop\">";
echo "<h2 align=\"center\">";
if($laQueryResult[0]['name'] != '')
{
echo "Thankyou Page Tracking Code Of Product \"".$laQueryResult[0]['name']."\"";
}
echo "</h2>";
echo "</div>";
echo "<div class=\"whole-page clear\">";
?>
<div class='formformat' style='margin-bottom:5px;text-align:center !important;'>
<form action="" method="get" name="frmProduct" id="frmProduct">
<table border='0' cellspacing='0' cellpadding='0' align='center' style="">
<tr>
<td class='right-side-text' style="width:160px;">
<label>Please Select Product :</label>
</td>
<td class='left-side-text' style='width:auto;padding-right:10px;'>
<select id='productid' class='selectcss' style='width:auto' name='productid' onchange="this.form.submit();">
<option value="0" selected="selected">Select...</option>
<?php
foreach($ProductData as $key=>$value)
{
if($ProductData[$key]['id'] == $_GET['productid'])
{
echo '<option value="'.$ProductData[$key]['id'].'" selected>'.$ProductData[$key]['name'].'</option>';
}
else
{
echo '<option value="'.$ProductData[$key]['id'].'">'.$ProductData[$key]['name'].'</option>';
}
}
?>
</select>
</td>
</tr>
</table>
</form>
</div>
<?php
/****************************************************************************
* Updated By Jayesh : for display character based paging
*****************************************************************************/
echo "<div class='controlDiv'>";
echo PrintABCDPaging();
echo "</div>";
if(isset($_GET['letter']) and $_GET['letter'] != 'all')
{
$lsSearchLetter = $_GET['letter'];
}
else
{
$lsSearchLetter = '';
}
if(isset($_GET['productid']) and $_GET['productid'] != 0)
{
$sql = 'SELECT * FROM '.TABLE_PREFIX.'thankyoupage_tracking WHERE productpaymentoptionid ='.$laQueryResult[0]['id'].' AND trackingname LIKE "'.$lsSearchLetter.'%";';
}
else
{
$sql = 'SELECT * FROM '.TABLE_PREFIX.'thankyoupage_tracking WHERE productpaymentoptionid =0 AND trackingname LIKE "'.$lsSearchLetter.'%";';
}
//echo $sql;
// die;
# execute the sql query
$db->execute($sql);
# creates a new phpSortColumn object for ID´s
//$col_0 = new phpSortColumn("id", "ID");
#creates a new phpSortcolunm objects for name
$col_0 = new phpSortColumn("trackingname", "Tracking Name");
$col_1 = new phpSortColumn("trackingby", "Tracking By");
# creates a new phpSortColumn object for Tile
# add the columns to an array
$columns = array(0=>$col_0, 1=>$col_1);
# create a new phpSortable object with the abstracted db object
# and the array of column object
$sortable = new phpSortable($db, $columns);
# define the table format: cellpadding, cellspacing, border
$sortable->setTableFormat ("2", "2", "0");
# define the table title
$sortable->tableTitle = "";
# Encrypt Edit and Delete Link
$sortable->encryptlink = false;
# define the link for edit of entries
$sortable->editLink = "admin_thankyoupage_tracking_m.php?action=edit";
# open the edit page in a new window
//$sortable->editTarget = "_blank";
# window format for the edit page
// $sortable->editWindowFormat = "'width=300,height=400'";
# define the link for delete of entries
$quest="&";
if(isset($_GET) && !empty($_GET))
{
foreach($_GET as $keyname => $value) {
$quest.=$keyname."=".$value."&";
}
}
$sortable->deleteLink = "admin_thankyoupage_tracking_m.php?action=delete&productid=".$_GET['productid'].$quest;
if(isset($laQueryResult[0]['id']) and $laQueryResult[0]['id'] !='')
{
# define the link for add new entries
$sortable->addLink = "admin_thankyoupage_tracking_m.php?paymentoptionid=".$laQueryResult[0]['id'];
}
if($users->IsAdminhavePermission($_SESSION[SESSION_PREFIX.'Admin_UserID'],'Can manage products and thankyou page tracking')==false)
{
$sortable->showaddLink=false;
}
# define the hint to be displyed over the add button
$sortable->addText = "Add Tracking Code";
# define the key name to be attached to links
$sortable->urlKeyName = "id";
# define the column name of to be attached to links as key value
$sortable->tableKeyName = "id";
# define the prompt message to be diplayed on clicking the edit button
//$sortable->editPromptMsg = "Are you sure you want to edit this affiliate?";
# define the prompt message to be diplayed on clicking the delete button
$sortable->deletePromptMsg = "Are you sure you want to delete this tracking code?";
# define the message to be diplayed if there are no results found
$sortable->emptyMsg = "No tracking code found for the thank you page of the selected product. Please select another product from the drop down list given above.";
#define the deafult row number to be displayed
$sortable->defaultRowsNum = "10";
#define the path for the css file
$sortable->cssFilePath = ADMIN_CSS_DIR."/phpSortable.css";
#define the path for of the images directory
$sortable->imgFilePath = ADMIN_IMAGE_DIR."/phpgrid/";
# print the table
$sortable->printTable();
echo "</div>";
echo "</div>";
echo "</div>";
//For display footer.php
echo($smarty->fetch('admin_footer.php'));
?>