<?php
global $user;
$userId = $user->uid;
/* start with default */
$myresult = "";
/* All Includes - start */
include_once('db.php');
include_once('valid-scripts/validateData.php');
/* All Includes - end */
/* Build All required Variables - start */
$alias = $_GET['alias'];
$product = $_GET['product'];
$product = strtolower(substr($product,0,-1));
$master_table = $product.'_master';
$rating_master_table = $product.'_rating_master';
$rating_table = $product.'_rating';
$numProperties = 15;
/* Build All required Variables - end */
/* Add all Styles required - start */
$myresult .= '<link href="/jquery.rating.css" type="text/css" rel="stylesheet"/>';
/* Add all Styles required - end */
/* Show Hide Variables/parameters - start */
include_once('all_include_files/show_hide.php');
/* Show Hide Variables/parameters - end */
/* All Javascript - start */
//$myresult .= '<script src="/jquery.rating.js" type="text/javascript" language="javascript"></script>';
?>
<style>
#tabs {
//font-size: 90%;
//margin: 20px 0;
margin: 2px 0;
}
#tabs ul {
float: right;
background: #E3FEFA;
width: 600px;
//padding-top: 4px;
}
#tabs li {
margin-left: 8px;
list-style: none;
}
* html #tabs li {
display: inline; /* ie6 double float margin bug */
}
#tabs li,
#tabs li a {
float: left;
}
#tabs ul li a {
text-decoration: none;
//padding: 8px;
color: #0073BF;
font-weight: bold;
}
#tabs ul li.active {
background: #CEE1EF url(/all_include_files/img/nav-right.gif) no-repeat right top;
}
#tabs ul li.active a {
background: url(/all_include_files/img/nav-left.gif) no-repeat left top;
color: #333333;
}
#tabs div {
//background: #CEE1EF;
clear: both;
//padding: 20px;
min-height: 200px;
}
#tabs div h3 {
text-transform: uppercase;
margin-bottom: 10px;
letter-spacing: 1px;
#tabs div p {
line-height: 150%;
}
</style>
<script src="/jquery.rating.js" type="text/javascript" language="javascript"></script>
<script src="/jquery.metadata.js" type="text/javascript" language="javascript"></script>
<script type='text/javascript'>
function openComment(number)
{
alert('working');
$('#comment'+number).css('display','');
}
$('.star').rating({
callback: function(value, link){
alert(value);
}
});
$(document).ready(function() {
//$('#tabs div').hide();
//$('#tabs div:first').show();
$('#tabs ul li:first').addClass('active');
$('#tabs ul li a').click(function()
{
$('#tabs ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).show();
return false;
});
$("#clickit").click(function() {
$.post("/mobile/tablechange.php",{ p1:'<?php echo $brand ?>',p2:'<?php echo $model ?>',userid:'<?php echo $userid ?>' } ,function(data){
$("#changetable").html(data);
});
});
$('div.expandable p').expander({
slicePoint: 200, // default is 100
expandText: 'more »', // default is 'read more...'
collapseTimer: 0, // re-collapses after 5 seconds; default is 0, so no re-collapsing
userCollapseText: '[^]' // default is '[collapse expanded text]'
});
});
</script>
<?php
/* All Javascript - end */
/* Form Processing after submit - start */
/* Form Processing after submit - end */
/* Actual Form or Page - start */
/*fetch all data needed */
/* initial query */
$result_product = query_product_table($product,$alias);
/*fetch property names of product */
$product_properties = master_table($master_table);
/*rating table query */
$master_rating_properties = master_rating_table($rating_master_table);
/*get user ratings*/
$user_ratings = user_ratings($userId,$alias,$rating_table);
$myresult .= '<div class=\'Services\'>';
//$myresult .="<form name ='form1' id='form1' method = 'POST' action='".$_SERVER['php_self'] ."'>";
if(!$result_product)
{ header('Location: /page-not-found'); }
else
{
$row_product = mysql_fetch_array($result_product);
$myresult .= "<h3 class='newstyle'>".$row_product['alias']." <a style='float:right;padding-right:20px;color:white;text-decoration:underline;' href='/'>Back</a> </h3>";
/* start actual product display - start*/
$myresult .= "<div class=\"product\">";
/* start table 1*/
$myresult .= '<table border=\'0\' cellspacing=\'0\' cellpadding=\'0\' style=\'width:580px; table-layout:fixed;\'>';
$myresult .= '<tr>';
$myresult .='<td valign=\'top\'>';
/* start table 2*/
$myresult .='<table width=\'100%\' border=\'0\' cellspacing=\'0\' cellpadding=\'0\'>';
$myresult .= '<tr>';
$myresult .= '<td valign=\'top\' style=\'width:164px;\'>';
/* start table 3*/
$myresult .= '<table style=\'width:164px;\' border=\'0\' cellspacing=\'0\' cellpadding=\'0\'>';
$myresult .= "<tr>";
/* start of the pic row */
$myresult .= '<td align=\'center\' class=\'various_product\'>';
if($row_product['pic'] != "")
{
$myresult .= '<ul id=\'mycarousel\' style=\'display:\';>';
$myresult .= '<li><a href=\'/all_image_scripts/origpicdisplay.php?product='.rawurlencode($product).'&alias='.rawurlencode($alias).'&picid=pic&p= \'rel=\'lightbox[roadtrip]\'><img src=\'/all_image_scripts/picdisplay1.php?product='.rawurlencode($product).'&alias='.rawurlencode($alias).'\'></img></a></li>';
for($p = 1; $p <= 4; $p++)
{
if($row_product['pic'.$p] != "")
{
$myresult .= '<li><a href=\'/all_image_scripts/origpicdisplay.php?product='.rawurlencode($product).'&alias='.rawurlencode($alias).'&picid=pic'.rawurlencode($p).'&p='.rawurlencode($p).'\' rel=\'lightbox[roadtrip]\'><img src=\'/all_image_scripts/thumbpicdisplay.php?product='.rawurlencode($product).'&alias='.rawurlencode($alias).'&picid=pic'.rawurlencode($p).'\'></img></a></li>';
}
}
$myresult .= '</ul>';
}
else
{
$myresult .= "<img width='50' height='70' src='/images/no-image.gif'></img>";
}
jcarousel_add('#mycarousel', array('horizontal' => TRUE,'scroll' => 1,'visible' => 1));
$myresult .= "</td>";
/* end display of pic td*/
$myresult .= "</tr>";
/* end display of pic tr*/
$myresult .= "</table></td>";
/* end display of pic table and earlier td - Still 1 open TR td table tr -hint*/
$myresult .= '<td style=\'width:450px;\'>';
/*table - 4*/
$myresult .= '<table width=\'100%\' border=\'0\' cellspacing=\'0\' cellpadding=\'0\' style=\'display:block;\'>';
/* Start showing property and values */
$myresult .= '<tr>';
$myresult .= '<td class=\'tick\'><img src=\'/images/ul_li_bg.gif\' width=\'12\' height=\'12\' /></td>';
$myresult .= '<td class=\'leftText\'>'.ucfirst($product).':</td>';
$myresult .= '<td class=\'rightText\'>'.$row_product['alias'] .'</td>';
$myresult .= "</tr>";
for($j = 3; $j <= 5 ; $j++){
if($product_properties['property'.$j.'_name'] != "")
{
if($row_product['property'.$j] != "")
{
$myresult .= '<tr>';
$myresult .= '<td class=\'tick\'><img src=\'/images/ul_li_bg.gif\' width=\'12\' height=\'12\' /></td>';
$myresult .= '<td class=\'leftText\'>'.$product_properties['property'.$j.'_name'].':</td>';
$myresult .= '<td class=\'rightText\'>'.$row_product['property'.$j] .'</td>';
$myresult .= '</tr>';
}
/* end if*/
}
/* end if*/
}
/* end for*/
/* show hide block */
$myresult .= '<tbody id=\'extra_properties\' style=\'display: none;\'>';
for($j = 6; $j <= 15 ; $j++){
if($product_properties['property'.$j.'_name'] != "")
{
if($row_product['property'.$j] != "")
{
$myresult .= '<tr>';
$myresult .= '<td class=\'tick\'><img src=\'/images/ul_li_bg.gif\' width=\'12\' height=\'12\' /></td>';
$myresult .= '<td class=\'leftText\'>'.$produtc_properties['property'.$j.'_name'].':</td>';
$myresult .= '<td class=\'rightText\'>'.$row_product['property'.$j] .'</td>';
$myresult .= '</tr>';
}
/* end if*/
}
/* end if*/
}
/* end for */
$myresult .= '</tbody>';
/* end show/hide tbody */
$myresult .= '<tr>';
$myresult .= '<td>';
$myresult .= ' ';
$myresult .= '</td>';
$myresult .= '<td>';
$myresult .= ' ';
$myresult .= '</td>';
$myresult .= '<td align=\'right\' style=\'text-align:right;text-decoration:underline;\'>';
$myresult .= '<a class=\'right_link\' href=\'javascript:showMore()\'>Show Additional Details...</a>';
$myresult .= '</td>';
$myresult .= '</tr>';
/* End showing property and values */
$showreview = 'display:';
/* review show hide */
/*$myresult .= '<tbody '.$showreview.'>';
$myresult .= '<tr>';
$myresult .= '<td colspan=\'2\'><span class=\'reviews\'>';
//check
//$numreviews = getreviewcount($brand,$model,'mobile_user_reviews');
if($numreviews > 0)
{
$myresult .= '<a href=\'mobilereviews?alias='.rawurlencode($alias).'\'> <span>$numreviews Reviews</span></a>';
}
else
{
$myresult .= " $numreviews Reviews";
}
$myresult .= "</span></td>";
$myresult .= "</tr>";
*/
$myresult .= "</tbody>";
/* review show hide - end */
/* count show hide */
$myresult .= '<tbody '.$showcount.'>';
$myresult .= '<tr>';
$myresult .= '<td colspan=\'2\'><span class=\'reviews\'>';
//check
//$totalvotes = gettotalvotes($row['property1'],$row['property2'],'mobile_rating');
$myresult .= "</td>";
$myresult .= "</tr>";
$myresult .= "</tbody>";
/* count show hide - end */
$myresult .= "</table></td>";
/* end table 4 */
$myresult .= '</tr>';
/* end 1 row and remaining tr , td ,table */
$myresult .= '</table></td>';
$myresult .= '</tr>';
/* remianing only 1 table */
/* ratings - positive last section starts here */
$max= array();
for ($l = 1 ; $l < 15; $l++){
if($row_product['property'.$l.'_avg']){
$maxarray = 0;
$maxarray = $row_product['property'.$l.'_avg'];
$max['rating'.$l.'_name'] = $maxarray;
}
}
if(count($max) >0 )
{
include('all_include_files/min_max_properties.php');
}
if(($row_product['freshness'] <= strtotime("-3 month")))
{ $image_type= 'old'; }
else if(($row_product['freshness'] <= strtotime("-2 month")))
{ $image_type= 'bitold'; }
else if(($row_product['freshness'] <= strtotime("-1 month")) || ($row_product['freshness'] > strtotime("-1 month")))
{ $image_type= 'new'; }
$img_name = $image_type;
$myresult .= "<tr>";
$myresult .= "<td>";
$myresult .= "<table width='100%' border='0'>";
$myresult .= "<tr>";
$myresult .= "<td width='170' class=\"ratingz\"><span><u>Overall rating</u></span></td>";
$myresult .= "<td width='150' class=\"ratingz\"><span><u>Positive</u></span></td>";
$myresult .= "<td width='150' class=\"ratingz\"><span><u>Negative</u></span></td>";
if($img_name == 'new'){
$images = "<img src='/sites/default/files/battery-discharging-100.png' width='40' height='40'></img>";
}
else if($img_name == 'bitold'){
$images = "<img src='/sites/default/files/battery-discharging-80.png' width='40' height='40'></img>";
}
else if($img_name == 'old'){
$images = "<img src='/sites/default/files/battery-discharging-0.png' width='40' height='40'></img>";
}
else {
$images = "";
}
$myresult .= "<td rowspan='2'><p ".$showbattery.">". $images ."</p></td>";
$myresult .= "</tr>";
$myresult .= "<tr>";
$myresult .= "<td>";
$i++;
for($k = 0.5; $k <= 10.0; $k+=0.5)
{
$overall = roundOff($row_product['overall_rating']);
if($overall == $k)
{
$chk ="checked";
}
else
{
$chk = "";
}
$myresult .= '<input class=\'star {split:2}\' type=\'radio\' value=\''. $k .'\' '.$chk.' title=\''. $k.' out of 10 \' disabled />';
}
$myresult .= '</td>';
$myresult .= '<td ><span>'.$positive.'</span></td>';
$myresult .= '<td ><span>'.$negative.'</span></td>';
$myresult .= '</tr>';
$myresult .= '</table></td>';
$myresult .= '</tr>';
/* ratings - positive last section ends here */
$myresult .= '<tr>';
if($row_product['description'] != ""){
if(words_count($row_product['description']) > 8){
$myresult .= '<td><p><span class=\'description\'><strong><u>Description</u>:</strong></span> <div class=\'expandable\'><p>'.$row_product['description'].'</div></p></p></td>';
}
else
{
$myresult .= '<td><p><span class=\'description\'><strong><u>Description</u>:</strong></span> '. $row_product['description'] .'</p></td>';
}
}
$myresult .= '</tr>';
$myresult .= '</table>';
/* end 1st table */
$myresult .= '</div>';
/* start actual product display - end*/
/*start the form to take ratings */
$myresult .= '<div id=\'tabs\'>';
$myresult .= '<ul>';
$myresult .= '<li><a href=\'#tab-1\'>Ratings</a></li>';
$myresult .= '<li><a href=\'#tab-2\'>Click here to rate</a></li>';
$myresult .= '</ul>';
$myresult .= '<div id=\'tab-1\'>';
/* actual rating table - start - jsut display ratings */
$myresult .= '<table id=\'rounded-corner\'>';
/* thead - start */
$myresult .= '<thead>';
$myresult .= '<tr>';
$myresult .= '<th width=\'30%\' class=\'rounded-company\' scope=\'col\'><span style=\'font: normal 18px Arial, Helvetica, sans-serif; color:#FFF;\'>Ratings</span></th>';
$myresult .= '<th width=\'70%\' colspan=\'2\'class=\'rounded-q4\' scope=\'col\'><a href=\'#rounded-corner\' id=\'clickit\' style=\'color:white;text-decoration:underline;\' $disabled ></a></th>
';
/*$myresult .= '<th width=\'70%\' colspan=\'2\'class=\'rounded-q4\' scope=\'col\'><a href=\'#rounded-corner\' id=\'clickit\' style=\'color:white;text-decoration:underline;\' $disabled >Click here to rate</a></th>
';*/
$myresult .= '</tr>';
$myresult .= '</thead>';
/* thead - end */
/* tbody - start */
$myresult .= '<tbody>';
/*start printing the table wth feature and ratings */
for ($i = 1 ; $i < $numProperties; $i++){
if($master_rating_properties['rating'.$i.'_name']){
$myresult .= '<tr>';
$myresult .= '<td width=\'22%\'>';
$indfeature = 0;
$indfeature = $row_product['property'.$i.'_avg'];
$myresult .= $master_rating_properties['rating'.$i.'_name'].' ( '.$indfeature .')';
$myresult .= '</td>';
$myresult .= '<td colspan=\'0\' width=\'38%\' >';
$tocheck = $indfeature;
for($k = 0.5; $k <= 10.0; $k+=0.5){
$tocheck = roundOff($tocheck);
if(($tocheck) == $k)
{ $chk = "checked"; }
else
{ $chk = ""; }
$myresult .= '<input class=\'star {split:2}\' type=\'radio\' name=\'drating'.$i.'\' id=\'drating'.$i.''.$k.'\' value=\''. $k .'\' '.$chk.' title=\''. $k.' out of 10 \' disabled \'/>';
}
/* for k loop end */
$myresult .= '</tr>';
}
/* end if loop */
}
/* end i for loop */
$myresult .= '</tbody>';
/* end tbody */
/* footer round corner start */
$myresult .= '<tfoot>';
$myresult .= '<tr>';
$myresult .= '<td class=\'rounded-foot-left\'> </td>';
$myresult .= '<td class=\'rounded-foot-right\' colspan=\'4\' >';
$myresult .= '</td>';
$myresult .= '</tr>';
$myresult .= '</tfoot>';
$myresult .= '</table>';
/*round corner table end */
$myresult .= '</div>';
/*end 1st tab */
/*start 2nd tab */
$myresult .= '<div id=\'tab-2\'>';
$myresult .= '<form name =\'form1\' id=\'form1\' method = \'POST\' action=\''.$_SERVER['php_self'] .'\'>';
/* actual rating table - start - actual rate/update */
$myresult .= '<table id=\'rounded-corner\'>';
/* thead - start */
$myresult .= '<thead>';
$myresult .= '<tr>';
$myresult .= '<th width=\'30%\' class=\'rounded-company\' scope=\'col\'><span style=\'font: normal 18px Arial, Helvetica, sans-serif; color:#FFF;\'>Ratings</span></th>';
$myresult .= '<th width=\'70%\' colspan=\'2\'class=\'rounded-q4\' scope=\'col\'></th>';
$myresult .= '</tr>';
$myresult .= '</thead>';
/* thead - end */
/* tbody - start */
$myresult .= '<tbody>';
unset($i);
/*start printing the table wth feature and ratings */
for ($i = 1 ; $i < $numProperties; $i++){
if($master_rating_properties['rating'.$i.'_name']){
$myresult .= '<tr>';
/*fetch ratings and comments - 1st make it to null */
$indfeature = 0;
$comment = '';
$indfeature = $user_ratings['rating'.$i];
if($indfeature == NULL){ $indfeature = 0; }
$comment = $user_ratings['rating'.$i.'_comment'];
$myresult .= '<td width=\'22%\'>';
$myresult .= $master_rating_properties['rating'.$i.'_name'].' ( '.$indfeature.' )';
$myresult .= '</td>';
$myresult .= '<td colspan=\'0\' width=\'38%\' >';
if(($userId != '0') && (is_array($user_ratings)))
{
$tocheck = $indfeature;
}
else
{
$tocheck = '0';
}
for($k = 0.5; $k <= 10.0; $k+=0.5){
$tocheck = roundOff($tocheck);
if(($tocheck) == $k)
{ $chk = "checked"; }
else
{ $chk = ""; }
$myresult .= '<input class=\'star {split:2}\' type=\'radio\' name=\'rating'.$i.'\' id=\'rating'.$i.''.$k.'\' value=\''. $k .'\' '.$chk.' title=\''. $k.' out of 10 \' '.$disabled.' \' />';
}
/* for k loop end */
$myresult .= '</td>';
$myresult .= '<td width=\'40%\'>';
$myresult .= '<input title=\'Reason for this Rating.. \'type=\'text\' size=\'25\' name=\'comment'.$i.'\' id=\'comment'.$i.'\' style=\'display:;\' maxlength=\'255\' value="'.$comment.'">';
$myresult .= '</td>';
$myresult .= '</tr>';
}
/* end if loop */
}
/* end i for loop */
$myresult .= '</tbody>';
/* end tbody */
/* footer round corner start */
$myresult .= '<tfoot>';
$myresult .= '<tr>';
$myresult .= '<td class=\'rounded-foot-left\'> </td>';
$myresult .= '<td class=\'rounded-foot-right\' colspan=\'4\' >';
if(($userId != '0') && (is_array($user_ratings)))
{
$myresult .= '<input type=\'button\' id=\'update_form\' value=\'Update\'>';
}
else
{
$myresult .= '<input type=\'button\' id=\'save_form\' value=\'Save\'>';
}
$myresult .= '</td>';
$myresult .= '</tr>';
$myresult .= '</tfoot>';
$myresult .= '</table>';
/*round corner table end */
$myresult .= '</form>';
/*end the form to take ratings */
$myresult .= '</div>';
/*end 2nd tab */
$myresult .= '</div>';
/*end tabs div */
/* actual rating table - end */
/* 1st form ends here id- ratings_form */
}
/* end of if loop result_product loop */
/* start table 3 - overall comment*/
$myresult .= '<table border=\'0\' cellspacing=\'0\' cellpadding=\'0\' style=\'width:580px; table-layout:fixed;\' id=\'rounded-corner\'>';
$myresult .= '<tbody>';
/* thead - start */
$myresult .= '<thead>';
$myresult .= '<tr>';
$myresult .= '<th width=\'100%\' colspan=\'2\' class=\'rounded-company\' scope=\'col\'><span style=\'font: normal 18px Arial, Helvetica, sans-serif; color:#FFF;\'>Overall Comments</span></th>';
$myresult .= '<th colspan=\'3\' class=\'rounded-q4\' scope=\'col\'></th>';
$myresult .= '</tr>';
$myresult .= '</thead>';
/* thead - end */
$myresult .= '<tr>';
$myresult .= '<td colspan=\'4\'>';
$myresult .= '<textarea title=\'OverAll Comment\' name=\'overall_comment\' cols=\'65\'></textarea>';
$myresult .= '</td>';
$myresult .= '</tr>';
$myresult .= '<tbody>';
$myresult .= '</table>';
/* end table 3 - overall comment*/
/* start table 4 - summary*/
$myresult .= '<table border=\'0\' cellspacing=\'0\' cellpadding=\'0\' style=\'width:580px; table-layout:fixed;\' id=\'rounded-corner\'>';
$myresult .= '<tbody>';
/* thead - start */
$myresult .= '<thead>';
$myresult .= '<tr>';
$myresult .= '<th colspan=\'2\' class=\'rounded-company\' scope=\'col\'><span style=\'font: normal 18px Arial, Helvetica, sans-serif; color:#FFF;\'>Your Opinion</span></th>';
$myresult .= '<th colspan=\'2\'class=\'rounded-q4\' scope=\'col\'></th>';
$myresult .= '</tr>';
$myresult .= '</thead>';
/* thead - end */
$myresult .= '<tr>';
$myresult .= '<td colspan=\'2\'>';
$myresult .= 'Do you Agree with the Ratings';
$myresult .= '</td>';
$myresult .= '<td colspan=\'2\'>';
$myresult .= 'Was the Information Helpful';
$myresult .= '</td>';
$myresult .= '</tr>';
$myresult .= '<tr>';
$myresult .= '<form name=\'form2\' id=\'form2\' method=\'post\'>';
$myresult .= '<td>';
$myresult .= '<input type=\'button\' class=\'agree\' value=\'agree\'>';
$myresult .= '</td>';
$myresult .= '<td>';
$myresult .= '<input type=\'button\' class=\'disagree\' value=\'disagree\'>';
$myresult .= '</td>';
$myresult .= '<input type=\'hidden\' name=\'agree_disagree\' id=\'agree_disagree\'>';
$myresult .= '</form>';
$myresult .= '<form name=\'form3\' id=\'form3\' method=\'post\'>';
$myresult .= '<td>';
$myresult .= '<input type=\'button\' class=\'helpful\' value=\'Helpful\'>';
$myresult .= '</td>';
$myresult .= '<td>';
$myresult .= '<input type=\'button\' class=\'nothelpful\' value=\'Not Helpful\'>';
$myresult .= '</td>';
$myresult .= '<input type=\'hidden\' name=\'help_nohelp\' id=\'help_nohelp\'>';
$myresult .= '</form>';
$myresult .= '</tr>';
$myresult .= '</tbody>';
$myresult .= '</table>';
/*end table 4 summary table */
$myresult .= '</div>';
/* Actual Form or Page - end */
echo $myresult;
//echo 'Product: '.$product;
//echo '<br/>Alias: '.$alias;
?>
hey this code is working fine for me . as required. the star class code is taken from
http://www.fyneworks.com/jquery/star-rating/ ... it works well.. but when i insert code to add tabs for content ,the starts is not visible at all. but when i check source code. the stars are actually there . dono whats the prob. any suggestions on this
this is the tabs code
$('#tabs div').hide();
('#tabs div:first').show();
$('#tabs ul li:first').addClass('active');
$('#tabs ul li a').click(function()
{
$('#tabs ul li').removeClass('active');
$(this).parent().addClass('active');
var currentTab = $(this).attr('href');
$('#tabs div').hide();
$(currentTab).show();
return false;
});