| Server IP : 64.202.187.69 / Your IP : 216.73.216.192 Web Server : Apache System : Linux 69.187.202.64.host.secureserver.net 3.10.0-1160.144.1.el7.tuxcare.els6.x86_64 #1 SMP Fri May 29 16:22:24 UTC 2026 x86_64 User : transmarket ( 1001) PHP Version : 7.2.34 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/transmarket/translator/controllers/ |
Upload File : |
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
include 'connection.php';
$data = array();
$data['status'] = 300;
$offset = 0;
$user_id = $_SESSION['tm_id'];
//ini_set('display_errors',1);
//error_reporting(E_ALL);
require_once('functions.self_assessment_test_sentnece_voting.php');
$sats_voting_obj = new Self_assessment_test_sentence_voting();
$voting_max_submit_time_mins = $sats_voting_obj->getSatsVotingMaxSubmitTimeMins();
$max_voting_count = $sats_voting_obj->getSelfAssessmentTestMaxNoOfVotingForSentnece();
if(isset($_POST['skip_id']) && $_POST['skip_id'] != '0') {
$skipped_sentence_id = base64_decode($_POST['skip_id']);
//insert skipped record in to skipped_sentence_suggestion_voting table
$sats_voting_obj->saveSkippedSatsVoting( $skipped_sentence_id, $user_id );
}
if (isset($_SESSION['tm_language_id']) && isset($_SESSION['tm_id'])) {
$language_id = $_SESSION['tm_language_id'];
if(isset($_POST['offset']))
$offset = $_POST['offset'];
// SQL for marking the voting failed if time more than 5 minutes of submission
$sats_voting_obj->makeSatsVotingFailedMaxSubmitTimeOver();
//get user skipped voting sentence ids
$skipped_voting_sentence_ids = $sats_voting_obj->getSkippedSatsVotingSentenceIdsByUserID( $user_id );
//checking currently assigned sentence for voting
$not_in_id_str = $sats_voting_obj->getCurrentlyAssignedSelfAssessmentTestSentenceIdsForVoting( $max_voting_count );
//get user success suggestion sentence ids and whose voting are not closed yet [skip these sentence ids to vote]
$not_in_user_success_suggestion_sentence_ids = $sats_voting_obj->getUserSuccessSatsSuggestionsSentenceIdsByUserID( $user_id );
//get user success voted sentence ids
$not_in_user_success_voting_sentence_ids = $sats_voting_obj->getUserSuccessSatsVotingSentenceIdsByUserID( $user_id );
//Pick one sentence for voting
$result = $sats_voting_obj->pickSelfAssessmentTestSentenceForVoting( $language_id, $user_id, $not_in_id_str, $not_in_user_success_suggestion_sentence_ids, $not_in_user_success_voting_sentence_ids, $skipped_voting_sentence_ids );
if ($result->num_rows > 0) {
$data['status'] = 200;
while ($row = $result->fetch_object()) {
//get original message by id
$resultSentence = $sats_voting_obj->getSelfAssessmentTestSentenceById( $row->id );
// get original message's translation suggestions by sentence id
$resultSuggestion = $sats_voting_obj->getSatsSuggestionsBySentenceId( $row->id );
//get user empty vote count
$user_empty_vote_count = $sats_voting_obj->get_user_empty_vote_count_by_satsv_sentence_id_and_user_id( $row->id, $user_id );
//check user empty vote count
if( $user_empty_vote_count == 0 ) {
//Insert initial user vote entry into self_assessment_test_sentence_voting table
$sats_voting_obj->saveInitialUserSatsVoteEntry( $row->id, $user_id, $voting_max_submit_time_mins );
}
$temp = array();
$data['suggestion'] = array();
$suggestion1 = array();
while ($rowSentence = $resultSentence->fetch_object()) {
$data['id'] = base64_encode($rowSentence->id);
$data['original_message'] = stripslashes($rowSentence->original_message);
}
while ($rowSuggestion = $resultSuggestion->fetch_object()) {
$suggestion = array();
$suggestion['suggestion_id'] = base64_encode($rowSuggestion->id);
$suggestion['translation_message'] = stripslashes($rowSuggestion->suggested_text);
array_push($data['suggestion'], $suggestion);
}
}
}
}
echo json_encode($data);