1KA_F2F/admin/survey/modules/mod_KOLEKTOR/class.KolektorResponse.php

97 lines
3.1 KiB
PHP
Raw Normal View History

<?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){
global $global_user_id;
// Dodaj respondenta v srv_user
$respondent_id = 20;
// Poslji email z vabilom na anketo
// Dodaj respondenta v kolektor bazo
$sql = sisplet_query("INSERT INTO kolektor_survey_response
(ank_id,
usr_id,
insert_time,
status,
respondent_id,
respondent_email,
respondent_funkcija,
respondent_projekt_id,
respondent_remote_activation,
respondent_message)
VALUES
('".$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']."')
");
if (!$sql){
echo mysqli_error($GLOBALS['connect_db']);
return false;
}
$response_id = mysqli_insert_id($GLOBALS['connect_db']);
if($response = new KolektorResponse($response_id)){
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>';
return $response;
}
else{
echo 'Napaka pri dodajanju odgovora!';
return false;
}
}
}
?>