| Current Path : /home2/wtmwscom/public_html/member/ |
| Current File : /home2/wtmwscom/public_html/member/feedback_answer.php |
<?php
$title = "Feedback Answer";
include 'header.php';
$uid = $_SESSION['userid'];
$plan_type = $_SESSION['plan_type'];
$user = mysqli_fetch_object(mysqli_query($connection, "SELECT uid, date(reg_date) AS reg_date, type, plan_type, is_paid, hold_payment, block_task FROM user WHERE uid = '$uid'"));
//include_once('lib/ps_pagination.php');
$holiday_array = array("2017-01-26" => "Repblic day holiday", "2017-02-24" => "Maha Shivaratri holiday");
$today_day = date('l');
$today_date = date('Y-m-d');
/* if($user->is_paid==0){
$date_today = new DateTime($today_date);
$date_reg = new DateTime($user->reg_date);
$free_task_expire = $date_today->diff($date_reg)->format("%a") > 5 ? TRUE : FALSE;
} */
$current_time = DateTime::createFromFormat('H:i:s', date('H:i:s'));
$start_time = DateTime::createFromFormat('H:i:s', "00:00:00");
$end_time = DateTime::createFromFormat('H:i:s', "01:00:00");
if ($user->block_task == 1) {
setMessage("Feedback query could not be assigned. Thankyou!", 'alert-msg success');
$isTaskStop = TRUE;
} elseif ($user->is_paid == 0) {
setMessage("Free Id's Feedback query could not be assigned. Thankyou!", 'alert-msg success');
$isTaskStop = TRUE;
} elseif ($today_day == "Sunday" || $today_day == "Saturday") {
setMessage("Today is $today_day. Thankyou!", 'alert-msg success');
$isTaskStop = TRUE;
} elseif (array_key_exists($today_date, $holiday_array)) { // check current time inbetween 12am and 3am
setMessage("Today is " . $holiday_array[$today_date] . ". Thankyou!", 'alert-msg success');
$isTaskStop = TRUE;
} elseif ($current_time > $start_time && $current_time < $end_time) { // check current time inbetween 12am and 3am
setMessage("Your Feedback query starts from 1:00 AM. Thankyou!", 'alert-msg success');
$isTaskStop = TRUE;
} else {
$isTaskStop = FALSE;
$result = mysqli_query($connection, "SELECT e1.*, e2.query AS query, e2.id AS query_id FROM feedback_query_answer e1 INNER JOIN feedback_query e2 ON e1.feedback_query_id = e2.id WHERE e1.uid = '$uid' AND date(e1.datetime) = '" . date('Y-m-d') . "'");
if (mysqli_num_rows($result) == 1) {
//insert_today_task($uid);
$row_feedback = mysqli_fetch_object($result);
$query = $row_feedback->query;
$answer = $row_feedback->answer;
$query_id = $row_feedback->query_id;
} else {
$sql = "SELECT * FROM feedback_query WHERE feedback_date <= '" . date('Y-m-d') . "' AND status='1' ORDER BY feedback_date DESC LIMIT 1";
$result = mysqli_query($connection, $sql);
$row_feedback = mysqli_fetch_object($result);
$query = $row_feedback->query;
$query_id = $row_feedback->id;
$answer = "";
}
}
?>
<h1>Today's Feedback </h1>
<?php echo getMessage(); ?>
<section>
<?php if (!$isTaskStop) : ?>
<form action="feedback_answer_model.php" method="post">
<div class="">
<div class="col-md-10 text-primary"><h4>Query </h4>
<div class="lead">
<?php echo $query; ?> ?
</div>
</div>
</div>
<div class="">
<div class="col-md-10 text-primary">
<h4>Your Feedback</h4>
<div class="">
<textarea <?php echo empty($answer) ? '' : 'readonly="readonly"' ;?> class="form-control" name="answer" placeholder="Type your product feedback here" required="required" maxlength="5000" rows="10">
<?php echo $answer;?>
</textarea>
<input type="hidden" name="query_id" value="<?php echo $query_id;?>" />
</div>
</div>
</div>
<div class="col-md-10">
<hr/>
<?php if(empty($answer)) : ?>
<button type="submit" class="btn btn-primary">Submit</button>
<?php endif;?>
</div>
</form>
<?php endif; ?>
<!-- <div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Please wait ...</h4>
</div>
<div class="modal-body">
<h1 id="countdown" style="text-align: center; color: red; font-size: larger">
</h1>
</div>
</div>
</div>
</div>-->
</section>
<!--<script>
function updateCampaignStatus(campaign_user_id, status, page_url) {
//var r = confirm("Do you want to view link has record id " + campaign_user_id);
var r = true;
$('#myModal').modal({backdrop: "static"});
processCountDown();
if (r) {
$.post("campaign_user_status.php", {campaign_user_id: campaign_user_id, status: status, }, function(data) {
//alert(data);
//$( "#myModal" ).dialog( "open" );
//location.reload();
});
}
if (status == 1) {
//var win = window.open(page_url, '_blank');
var win = window.open(page_url);
win.focus();
}
}
var countDownSecond = 5;
// get tag element
var countdown = document.getElementById('countdown');
// update the tag with id "countdown" every 1 second
function processCountDown() {
setInterval(function() {
// format countdown string + set tag value
countdown.innerHTML = '<span class="seconds">' + countDownSecond + ' </span>';
if (countDownSecond == 0) {
//alert(" clearInterval() called")
$('#myModal').modal('hide');
clearInterval();
location.reload();
}
countDownSecond = countDownSecond - 1;
}, 1000);
}
var idListCounter = 0;
var maxCheckLimit = 10;
function checkSelectedCounter(thisObj) {
if (idListCounter >= maxCheckLimit) {
$(thisObj).prop("checked", false);
alert("You can select maximum " + maxCheckLimit + " ads in one shot!");
} else {
idListCounter += 1;
}
// if(idListCounter < maxCheckLimit && $(thisObj).prop("checked")){
// idListCounter +=1;
// } else if(! $(thisObj).prop("checked")) {
// idListCounter -=1;
// }
//alert(" counter"+idListCounter);
}
</script>-->
<?php include 'footer.php'; ?>