2022-07-06 12:37:25 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
|
|
class KolektorResponse {
|
|
|
|
|
|
|
|
|
|
|
|
private $response = array();
|
|
|
|
|
|
|
|
|
|
|
|
function __construct($response_id){
|
|
|
|
global $site_url;
|
|
|
|
global $lang;
|
|
|
|
|
|
|
|
// Dobimo podatke responsa
|
|
|
|
$sql = sisplet_query("SELECT * FROM kolektor_survey_response WHERE id='".$response_id."'");
|
|
|
|
|
|
|
|
if(mysqli_num_rows($sql) == 0){
|
|
|
|
echo 'Napaka! Odgovor ne obstaja.';
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
$row = mysqli_fetch_array($sql);
|
|
|
|
$this->response = $row;
|
|
|
|
}
|
|
|
|
|
|
|
|
public function getStatus(){
|
|
|
|
return $this->response['status'];
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Dodajanje responsa
|
|
|
|
public static function addResponse($response_data){
|
2022-07-25 12:21:16 +02:00
|
|
|
global $global_user_id;
|
2022-07-06 12:37:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Dodaj respondenta v srv_user
|
2022-07-25 12:21:16 +02:00
|
|
|
$respondent_id = 20;
|
2022-07-06 12:37:25 +02:00
|
|
|
|
|
|
|
|
|
|
|
// Poslji email z vabilom na anketo
|
|
|
|
|
|
|
|
|
|
|
|
// Dodaj respondenta v kolektor bazo
|
|
|
|
$sql = sisplet_query("INSERT INTO kolektor_survey_response
|
2022-07-25 12:21:16 +02:00
|
|
|
(ank_id,
|
|
|
|
usr_id,
|
|
|
|
insert_time,
|
|
|
|
status,
|
|
|
|
respondent_id,
|
|
|
|
respondent_email,
|
|
|
|
respondent_funkcija,
|
|
|
|
respondent_projekt_id,
|
|
|
|
respondent_remote_activation,
|
|
|
|
respondent_message)
|
2022-07-06 12:37:25 +02:00
|
|
|
VALUES
|
2022-07-25 12:21:16 +02:00
|
|
|
('".$response_data['ank_id']."',
|
|
|
|
'".$global_user_id."',
|
|
|
|
NOW(),
|
|
|
|
'0',
|
|
|
|
'".$respondent_id."',
|
|
|
|
'".$response_data['respondent_email']."',
|
|
|
|
'".$response_data['respondent_funkcija']."',
|
|
|
|
'".$response_data['respondent_projekt_id']."',
|
|
|
|
'".$response_data['respondent_remote_activation']."',
|
|
|
|
'".$response_data['respondent_message']."')
|
2022-07-06 12:37:25 +02:00
|
|
|
");
|
2022-07-25 12:21:16 +02:00
|
|
|
if (!$sql){
|
|
|
|
echo mysqli_error($GLOBALS['connect_db']);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2022-07-06 12:37:25 +02:00
|
|
|
|
|
|
|
$response_id = mysqli_insert_id($GLOBALS['connect_db']);
|
|
|
|
|
2022-07-25 12:21:16 +02:00
|
|
|
if($response = new KolektorResponse($response_id)){
|
2022-07-26 10:14:04 +02:00
|
|
|
|
|
|
|
echo '<div class="popup_close"><a href="#" onclick="window.location.reload();">✕</a></div>';
|
|
|
|
|
|
|
|
echo '<h2>Dodajanje novega respondenta</h2>';
|
|
|
|
|
|
|
|
echo 'Anketa uspešno sprožena in email uspešno poslan respondentu ('.$response_data['respondent_email'].').';
|
|
|
|
|
|
|
|
// Gumb koncaj
|
|
|
|
echo '<div class="button_holder">';
|
|
|
|
echo ' <button class="medium white-blue" type="button" onClick="window.location.reload();">Zapri</button>';
|
|
|
|
echo '</div>';
|
|
|
|
|
2022-07-06 12:37:25 +02:00
|
|
|
return $response;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
echo 'Napaka pri dodajanju odgovora!';
|
|
|
|
return false;
|
2022-07-25 12:21:16 +02:00
|
|
|
}
|
2022-07-06 12:37:25 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|