| 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;
$user_id = $_SESSION['tm_id'];
//ini_set('display_errors',1);
//error_reporting(E_ALL);
require_once('functions.test_voting.php');
$test_voting_obj = new Test_voting();
$test_voting_languages_ids_arr = $test_voting_obj->getTestVotingAllowedLanguagesIds();
require_once('functions.test_sentences_voting.php');
$test_sentence_voting_obj = new Test_sentences_voting();
//skip voting
if(isset($_POST['skip_id']) && $_POST['skip_id'] != '0') {
$skipped_sentence_id = $_POST['skip_id'];
$skipped_reason_id = $_POST['skipped_reason_id'];
//insert skipped record in to the skipped_test_sentences_voting db table
$test_sentence_voting_obj->saveSkippedTestSentencesVoting($skipped_sentence_id,$user_id,$skipped_reason_id);
//get skipped test sentence voting for the sentence
$skipped_voting_counts = $test_sentence_voting_obj->getSkippedTestSentenceVotingCountBySentenceId( $skipped_sentence_id );
//get maximum no. of skip voting require to skip test sentence from voting and user test
$max_no_of_skip_value = $test_sentence_voting_obj->maxNoOfSkipValueToSkipTestSentence();
//check if received skip voting are more than set max no. of skip value
if( $skipped_voting_counts >= $max_no_of_skip_value ) {
//update is skipped status
$test_sentence_voting_obj->updateSkippedTestSentenceStatus( $skipped_sentence_id );
}
}
//For spanish language only, Spanish - 87
if ( isset($_SESSION['tm_language_id']) && in_array($_SESSION['tm_language_id'], $test_voting_languages_ids_arr) && isset($_SESSION['tm_id']) ) {
// SQL for marking the voting failed if time more than 5 mins of submission
$test_sentence_voting_obj->makeTestSentenceVotingFailedMaxSubmitTimeOver();
$language_id = $_SESSION['tm_language_id'];
$max_votes_per_sentences = $test_sentence_voting_obj->acceptMaxVotesForTestSentence();
$max_vote_submit_time_mins = $test_sentence_voting_obj->maxVoteSubmitTimeMinutes();
//get user skipped voting sentence ids
$not_in_skipped_test_voting_sentence_ids = $test_sentence_voting_obj->getSkippedTestVotingSentenceIdsByUserID( $user_id );
//checking currently assigned sentence for voting
$not_in_id_str = $test_sentence_voting_obj->getCurrentlyAssignedTestSentenceIdsForVoting( $max_votes_per_sentences );
//Pick one sentence for voting
$result = $test_sentence_voting_obj->getTestSentenceVotingRow( $language_id, $user_id, $not_in_id_str, $not_in_skipped_test_voting_sentence_ids );
if ($result->num_rows > 0 ) {
$data['status'] = 200;
while ($row = $result->fetch_object()) {
//get user empty vote count
$user_empty_vote_count = $test_sentence_voting_obj->get_user_empty_test_sentence_vote_count($row->id, $user_id);
//check user empty vote count
if( $user_empty_vote_count == 0 ) {
//Insert initial user vote entry into test_voting_sentences_users_opinion table
$test_sentence_voting_obj->saveInitialUserTestSentenceVoteEntry( $row->id, $user_id, $max_vote_submit_time_mins );
}
$data['suggestion'] = array();
$data['sentence_id'] = $row->id;
$data['original_message'] = stripslashes($row->original_sentence);
$suggestion = array();
if( $row->suggestion_1 != '' ) {
$suggestion['suggestion_id'] = 1;
$suggestion['translation_message'] = stripslashes($row->suggestion_1);
array_push($data['suggestion'], $suggestion);
}
if( $row->suggestion_2 != '' ) {
$suggestion['suggestion_id'] = 2;
$suggestion['translation_message'] = stripslashes($row->suggestion_2);
array_push($data['suggestion'], $suggestion);
}
if( $row->suggestion_3 != '' ) {
$suggestion['suggestion_id'] = 3;
$suggestion['translation_message'] = stripslashes($row->suggestion_3);
array_push($data['suggestion'], $suggestion);
}
if( $row->suggestion_4 != '' ) {
$suggestion['suggestion_id'] = 4;
$suggestion['translation_message'] = stripslashes($row->suggestion_4);
array_push($data['suggestion'], $suggestion);
}
}
}
}
echo json_encode($data);