2239 lines
94 KiB
PHP
2239 lines
94 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Moje ankete - nov prikaz direktorijev (19.9.2022)
|
|
*/
|
|
|
|
|
|
class SurveyListFolders {
|
|
|
|
|
|
public function __construct() {
|
|
global $admin_type, $global_user_id, $site_path;
|
|
|
|
|
|
}
|
|
|
|
|
|
// Prikazemo pogled s folderji
|
|
public function display() {
|
|
global $global_user_id;
|
|
global $lang;
|
|
|
|
|
|
echo '<div class="survey_list_folders">';
|
|
|
|
|
|
|
|
// Levi meni s folderji
|
|
echo ' <div class="left_menu">';
|
|
|
|
echo ' </div>';
|
|
|
|
|
|
|
|
|
|
// Desna vsebina
|
|
echo ' <div class="right_content">';
|
|
|
|
// Gumb za ustvarjanje ankete
|
|
echo '<div class="first_line">';
|
|
$this->new_anketa_div();
|
|
echo '</div>';
|
|
|
|
|
|
// Druga vrstica - filtri in iskanje
|
|
echo '<div class="second_line '.($this->isSearch == 1 ? 'advanced_search' : '').'">';
|
|
|
|
// Okno za search po mojeih anketah
|
|
echo ' <div id="searchMySurveys">';
|
|
$this->displaySearch();
|
|
echo ' </div>';
|
|
|
|
// Paginacija
|
|
echo ' <div class="pagination top">';
|
|
$this->displayPagiantion();
|
|
echo ' </div>';
|
|
|
|
// Filtri na desni
|
|
echo ' <div class="filters">';
|
|
|
|
// Preklop na pogled s folderji (samo ce imamo nov vmesnik)
|
|
//echo '<div id="folderSwitch">';
|
|
$this->displayFolderSwitch();
|
|
//echo '</div>';
|
|
|
|
// Gumb za filtriranje
|
|
//echo '<div id="filterButton">';
|
|
$this->displayFilterButton();
|
|
//echo '</div>';
|
|
|
|
// Gumb za sortiranje
|
|
echo ' <div id="sortButton">';
|
|
$this->displaySortButton();
|
|
echo ' </div>';
|
|
|
|
echo ' </div>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
// Izris seznama anket
|
|
echo '<div class="div_sl_new folders">';
|
|
|
|
// Loop po vseh folderjih prvega nivoja - samo na prvi strani
|
|
if($this->pageno == 1){
|
|
|
|
// Plus za dodajanje folderja
|
|
echo '<div class="folder_add_first"><a href="#" title="'.$lang['srv_mySurvey_create_folder'].'" onClick="create_folder(\''.$folder['id'].'\'); return false;">';
|
|
echo ' <span class="faicon add"></span><span>'.$lang['srv_mySurvey_create_folder'].'</span>';
|
|
echo '</a></div>';
|
|
|
|
$sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE usr_id='$global_user_id' AND parent='0' ORDER BY naslov ASC");
|
|
if(mysqli_num_rows($sql) > 0) {
|
|
while($row = mysqli_fetch_array($sql)){
|
|
echo '<div id="folder_holder_'.$row['id'].'" class="folder_holder level1">';
|
|
$this->displayNewFolder($row);
|
|
echo '</div>';
|
|
}
|
|
}
|
|
}
|
|
|
|
// Na koncu se izpisemo ankete ki niso v nobenem folderju
|
|
$row = array('id'=>0, 'naslov'=>$lang['srv_mySurvey_unallocated']);
|
|
echo '<div id="folder_holder_0" class="folder_holder level1">';
|
|
$this->displayNewFolder($row);
|
|
echo '</div>';
|
|
|
|
echo '<script type="text/javascript">surveyList_folder_init();</script>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
// Klik izven "Vec" - zapremo okno
|
|
echo '<script>
|
|
$(document).mouseup(function(e){
|
|
var container = $(".survey_other_box, .dots");
|
|
|
|
if (!container.is(e.target) && container.has(e.target).length === 0){
|
|
$(".survey_other_box").addClass("displayNone");
|
|
}
|
|
});
|
|
</script>';
|
|
|
|
echo ' </div>';
|
|
|
|
|
|
echo '</div>';
|
|
}
|
|
|
|
/** Kreacija nove ankete
|
|
*/
|
|
function new_anketa_div(){
|
|
global $lang;
|
|
global $admin_type;
|
|
global $site_url;
|
|
|
|
echo '<a href="'.$site_url.'admin/survey/index.php?a=ustvari_anketo" title="'.$lang['srv_create_survey'].'">';
|
|
echo ' <button class="large blue button_create">';
|
|
echo $lang['srv_create_survey'];
|
|
echo ' </button>';
|
|
echo '</a>';
|
|
|
|
// uporabniki z vklopljeno moznostjo imajo tudi hitro ustvarjanje ankete (brez vnosa imena in izbire skina)
|
|
$oneclickCreateMySurveys = UserSetting::getInstance()->getUserSetting('oneclickCreateMySurveys');
|
|
if ($oneclickCreateMySurveys == 1) {
|
|
echo '<div class="button_quick_create">';
|
|
echo ' <a href="#" onclick="newAnketaBlank();" title="'.$lang['one_click_create'].'">';
|
|
echo ' <span class="faicon add"></span><span>'.$lang['one_click_create'].'</span>';
|
|
echo ' </a>';
|
|
echo '</div>';
|
|
}
|
|
}
|
|
|
|
function displayNewSurveyList($folder=0) {
|
|
global $lang;
|
|
global $site_url;
|
|
global $global_user_id;
|
|
|
|
if (SRV_LIST_GET_AS_LIST == true) {
|
|
|
|
$ankete = $this->getSurveysAsListNew($folder);
|
|
|
|
echo '<input type="hidden" id="sortby" value="'.(isset($_POST['sortby']) ? $_POST['sortby'] : null).'">';
|
|
echo '<input type="hidden" id="sorttype" value="'.(isset($_POST['sorttype']) ? $_POST['sorttype'] : null).'">';
|
|
|
|
if ($count = count($ankete)) {
|
|
|
|
// Naslov za search
|
|
if($this->isSearch == 1){
|
|
if($count == 1)
|
|
$hits = $lang['s_hits_1'];
|
|
elseif($count == 2)
|
|
$hits = $lang['s_hits_2'];
|
|
elseif($count == 3 || $count == 4)
|
|
$hits = $lang['s_hits_34'];
|
|
else
|
|
$hits = $lang['s_hits'];
|
|
|
|
// Ce imamo vec kot 1000 zadetkov izpisemo samo 1000 in opozorilo
|
|
if($count < 1000)
|
|
$cnt_text = '<span class="italic">('.$count.' '.$hits.')</span>';
|
|
else
|
|
$cnt_text = '<span class="italic">('.$lang['s_hits_1000'].')</span>';
|
|
|
|
echo '<span class="search_title">'.$lang['s_search_mySurvey_title'].' '.$cnt_text.':</span>';
|
|
}
|
|
|
|
echo '<table id="surveyList_new">';
|
|
|
|
|
|
// HEADER VRSTICA
|
|
echo '<tr class="sl_header_new">';
|
|
|
|
// Naslov
|
|
echo '<td class="col1">';
|
|
echo $this->createOrderUrlNew(1, $lang['title']);
|
|
echo '</td>';
|
|
|
|
// Trajanje - status
|
|
echo '<td class="col2">';
|
|
echo $this->createOrderUrlNew(18, 'Status');
|
|
echo '</td>';
|
|
|
|
// Ustvarjeno
|
|
echo '<td class="col3">';
|
|
echo $this->createOrderUrlNew(10, $lang['srv_created']);
|
|
echo '</td>';
|
|
|
|
// Zadnji vnos
|
|
echo '<td class="col4">';
|
|
echo $this->createOrderUrlNew(16, $lang['srv_last_insrt']);
|
|
echo '</td>';
|
|
|
|
// Sprememba
|
|
echo '<td class="col5">';
|
|
echo $this->createOrderUrlNew(14, $lang['change']);
|
|
echo '</td>';
|
|
|
|
// Ostalo
|
|
echo '<td class="col6">';
|
|
echo $lang['more2'];
|
|
echo '</td>';
|
|
|
|
echo '</tr>';
|
|
|
|
|
|
// VRSTICE Z ANKETAMI
|
|
foreach ( $ankete as $anketa ) {
|
|
|
|
echo '<tr id="anketa_list_'.$anketa['id'].'" class="anketa_list '.($this->show_folders == 1 ? ' mySurvey_draggable' : '').'" anketa_id="'.$anketa['id'].'">';
|
|
|
|
|
|
// Aktivnost - neaktivna, aktivna, zakljucena
|
|
/*echo '<td class="col2">';
|
|
if ($anketa['active'] == 1) {
|
|
echo '<div class="dot blue" title="'.$lang['srv_anketa_active2'].'"></div>';
|
|
} else {
|
|
$sqlA = sisplet_query("SELECT sid FROM srv_activity WHERE sid='".$anketa['id']."'");
|
|
if (mysqli_num_rows($sqlA) > 0) {
|
|
# anketa je zaključena
|
|
echo '<div class="dot grey" title="'.$lang['srv_survey_non_active'].'"></div>';
|
|
} else {
|
|
# anketa je neaktivna
|
|
echo '<div class="dot grey" title="'.$lang['srv_survey_non_active_notActivated'].'"></div>';
|
|
}
|
|
}
|
|
echo '</td>';*/
|
|
|
|
|
|
// Naslov
|
|
echo '<td class="col1">';
|
|
|
|
if(strlen($anketa['naslov']) > 60)
|
|
$text = substr($anketa['naslov'],0,60);
|
|
else
|
|
$text = $anketa['naslov'];
|
|
|
|
// Ce gre za search moramo ustrezno pobarvati najden del besede
|
|
$text_searched = $text;
|
|
if($this->isSearch == 1 && $this->searchSettings['stype'] == '0'){
|
|
foreach($this->searchStringProcessed as $search_word){
|
|
|
|
// Pobarvamo najden niz v naslovu ankete
|
|
preg_match_all("/$search_word+/i", $text_searched, $matches);
|
|
if (is_array($matches[0]) && count($matches[0]) >= 1) {
|
|
|
|
// Drugace vcasih pobrise presledek, ne vem kako drugace resit:)
|
|
$text_searched = str_replace(' ', ' ', $text_searched);
|
|
|
|
$text_searched = str_replace($matches[0][0], '<span class="red">'.$matches[0][0].'</span>', $text_searched);
|
|
}
|
|
}
|
|
}
|
|
|
|
// Zgornja vrstica
|
|
echo '<div class="top_line">';
|
|
echo ' <a href="'.$site_url.'admin/survey/index.php?anketa='.$anketa['id'].'&a='.A_REDIRECTLINK.'" title="'.$text.'">'.$text_searched.'</a>';
|
|
echo '</div>';
|
|
|
|
// Spodnja vrstica
|
|
echo '<div class="bottom_line">';
|
|
|
|
if($anketa['mobile_created'] == '1')
|
|
echo '<span class="red spaceRight pointer" title="'.$lang['srv_mobile_survey'].'">M</span>';
|
|
|
|
if($anketa['survey_type'] == 0)
|
|
echo $lang['srv_vrsta_survey_type_0'];
|
|
elseif($anketa['survey_type'] == 1)
|
|
echo $lang['srv_vrsta_survey_type_1'];
|
|
elseif(SurveyInfo::checkSurveyModule('hierarhija', $anketa['id']))
|
|
echo $lang['srv_vrsta_survey_type_10'];
|
|
else
|
|
echo $lang['srv_vrsta_survey_type_2'];
|
|
|
|
echo ', '.$lang['srv_h_sl_stvprasanj'].': '. $anketa['variables'];
|
|
echo '</div>';
|
|
|
|
echo '</td>';
|
|
|
|
|
|
// Trajanje - status
|
|
echo '<td class="col2">';
|
|
|
|
if ($anketa['active'] == 1) {
|
|
$now = time();
|
|
$do = explode('.', $anketa['trajanjedo']);
|
|
$do = strtotime($do[0].'.'.$do[1].'.20'.$do[2]);
|
|
$trajanje = $do - $now;
|
|
$trajanje = floor($trajanje/60/60/24) + 1;
|
|
|
|
if($trajanje >= 0){
|
|
|
|
// Ce je aktivna za vec kot 2000 dni je trajna
|
|
if($trajanje > 2000){
|
|
$status_text = $lang['srv_trajna_anketa'];
|
|
}
|
|
else{
|
|
$status_text = $lang['more'].' '.$trajanje.' '.$lang['hour_days'];
|
|
}
|
|
}
|
|
else{
|
|
$status_text = $lang['srv_trajna_anketa'];
|
|
}
|
|
|
|
$status_color = 'green';
|
|
}
|
|
else {
|
|
$sqlA = sisplet_query("SELECT sid FROM srv_activity WHERE sid='".$anketa['id']."'");
|
|
|
|
if (mysqli_num_rows($sqlA) > 0) {
|
|
# anketa je zaključena
|
|
$status_text = $lang['srv_survey_list_closed'];
|
|
$status_color = 'blue';
|
|
}
|
|
else {
|
|
# anketa je neaktivna
|
|
$status_text = $lang['srv_survey_list_inpreparation'];
|
|
$status_color = 'gray';
|
|
}
|
|
}
|
|
|
|
echo ' <div class="status_box '.$status_color.'">'.$status_text.'</div>';
|
|
|
|
echo '</td>';
|
|
|
|
|
|
// Ustvarjeno
|
|
echo '<td class="col3">';
|
|
|
|
// Ce gre za search moramo ustrezno pobarvati najden del besede
|
|
$name_searched = $anketa['i_name'];
|
|
$surname_searched = $anketa['i_surname'];
|
|
if($this->isSearch == 1 && $this->searchSettings['stype'] == '1'){
|
|
foreach($this->searchStringProcessed as $search_word){
|
|
|
|
// Pobarvamo najden niz v imenu
|
|
preg_match_all("/$search_word+/i", $name_searched, $matches);
|
|
if (is_array($matches[0]) && count($matches[0]) >= 1) {
|
|
foreach ($matches[0] as $match) {
|
|
$name_searched = str_replace($match, '<span class="red">'.$match.'</span>', $name_searched);
|
|
}
|
|
}
|
|
|
|
// Pobarvamo najden niz v priimku
|
|
preg_match_all("/$search_word+/i", $surname_searched, $matches);
|
|
if (is_array($matches[0]) && count($matches[0]) >= 1) {
|
|
foreach ($matches[0] as $match) {
|
|
$surname_searched = str_replace($match, '<span class="red">'.$match.'</span>', $surname_searched);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$i_time = substr($anketa['i_time'], 0, 8);
|
|
$i_time = explode('.', $i_time);
|
|
|
|
echo '<div class="top_line">';
|
|
echo $i_time[0].'.'.$i_time[1].'.20'.$i_time[2];
|
|
echo '</div>';
|
|
|
|
echo '<div class="bottom_line">';
|
|
echo $name_searched.' '.$surname_searched;
|
|
echo '</div>';
|
|
|
|
echo '</td>';
|
|
|
|
|
|
// Zadnji vnos
|
|
echo '<td class="col4">';
|
|
|
|
echo '<div class="top_line">';
|
|
if($anketa['answers'] > 0){
|
|
$v_time = substr($anketa['v_time_last'], 0, 8);
|
|
$v_time = explode('.', $v_time);
|
|
|
|
// Nimamo parapodatkov
|
|
if($anketa['v_time_last'] == '00.00.00 0:00')
|
|
echo $lang['srv_survey_list_no_paradata'];
|
|
else
|
|
echo $v_time[0].'.'.$v_time[1].'.20'.$v_time[2];
|
|
}
|
|
else{
|
|
echo '/';
|
|
}
|
|
echo '</div>';
|
|
|
|
echo '<div class="bottom_line">';
|
|
echo $lang['srv_info_answers_no'].': '.$anketa['answers'];
|
|
echo '</div>';
|
|
|
|
echo '</td>';
|
|
|
|
|
|
// Sprememba
|
|
echo '<td class="col5">';
|
|
|
|
echo '<div class="top_line">';
|
|
$e_time = substr($anketa['e_time'], 0, 8);
|
|
$e_time = explode('.', $e_time);
|
|
echo $e_time[0].'.'.$e_time[1].'.20'.$e_time[2];
|
|
echo '</div>';
|
|
|
|
echo '<div class="bottom_line">';
|
|
echo ' <span id="edit_user_'.$anketa['id'].'" euid="'.$anketa['edit_uid'].'" onclick="surveyList_user(\'e\',\'#edit_user_'.$anketa['id'].'\');">'.$anketa['e_email'].'</span>';
|
|
echo '</div>';
|
|
|
|
echo '</td>';
|
|
|
|
|
|
// Ostalo
|
|
echo '<td class="col6 other_link">';
|
|
|
|
echo ' <span class="faicon dots" onClick="surveyList_show_more(\''.$anketa['id'].'\');"></span>';
|
|
|
|
// Hover okno
|
|
echo ' <div class="survey_other_box_holder">';
|
|
echo ' <div id="survey_other_box_'.$anketa['id'].'" class="survey_other_box displayNone"><ul>';
|
|
|
|
echo ' <li><a href="index.php?anketa='.$anketa['id'].'&a=testiranje"><span class="faicon test"></span>'.$lang['srv_testiranje'].'</a></li>';
|
|
echo ' <li><a href="index.php?anketa='.$anketa['id'].'&a=vabila"><span class="faicon publish"></span>'.$lang['srv_vabila'].'</a></li>';
|
|
echo ' <li><a href="index.php?anketa='.$anketa['id'].'&a=data"><span class="faicon data"></span>'.$lang['srv_podatki'].'</a></li>';
|
|
echo ' <li><a href="index.php?anketa='.$anketa['id'].'&a=analysis"><span class="faicon chart"></span>'.$lang['srv_analiza'].'</a></li>';
|
|
|
|
echo ' <li><div class="line"></li>';
|
|
|
|
echo ' <li><input type="checkbox" id="lib_private_'.$anketa['id'].'" '.($anketa['lib_usr'] == 1 ? 'checked="checked"' : '').' onclick="surveyList_myknjiznica_new(\''.$anketa['id'].'\'); return false;"><label for="lib_private_'.$anketa['id'].'">'.$lang['srv_moja_knjiznica'].'</label></li>';
|
|
if ($this->g_adminType == 0){
|
|
echo ' <li><input type="checkbox" id="lib_public_'.$anketa['id'].'" '.($anketa['lib_glb'] == 1 ? 'checked="checked"' : '').' onclick="surveyList_knjiznica_new(\''.$anketa['id'].'\'); return false;"><label for="lib_public_'.$anketa['id'].'">'.$lang['srv_javna_knjiznica'].'</label></li>';
|
|
}
|
|
|
|
echo ' </ul></div>';
|
|
echo ' </div>';
|
|
|
|
echo '</td>';
|
|
|
|
|
|
echo '</tr>';
|
|
}
|
|
|
|
echo '</table>';
|
|
}
|
|
else{
|
|
// Naslov za prazen search
|
|
if($this->isSearch == 1)
|
|
echo '<span class="search_title">'.$lang['s_search_mySurvey_nothing'].'.</span>';
|
|
}
|
|
}
|
|
}
|
|
|
|
function displayNewFolder($folder){
|
|
global $lang;
|
|
global $global_user_id;
|
|
global $admin_type;
|
|
|
|
// Izris nerazvrscenih anket
|
|
if($folder['id'] == 0){
|
|
echo '<div class="folder_title open droppable" id="folder_0" folder_id="0">';
|
|
|
|
echo '<span class="faicon folder_arrow_icon" onClick="toggle_folder(\''.$folder['id'].'\'); return false;"></span>';
|
|
|
|
echo ' <span>'.$folder['naslov'].'</span>';
|
|
|
|
// Dodaten div za klik za razpiranje
|
|
echo '<div class="folder_clickable" onClick="toggle_folder(\''.$folder['id'].'\'); return false;"></div>';
|
|
|
|
// Ikona za dodajanje folderja
|
|
echo '</div>';
|
|
|
|
|
|
echo '<div id="folder_content_0" class="folder_content">';
|
|
$this->displayNewSurveyList($folder=0);
|
|
echo '</div>';
|
|
}
|
|
else{
|
|
echo '<div class="folder_title '.($folder['open'] == 1 ? 'open' : 'closed').' mySurvey_draggable droppable" id="folder_'.$folder['id'].'" folder_id="'.$folder['id'].'">';
|
|
|
|
// Puscica za odpiranje/zapiranje
|
|
echo '<span class="faicon folder_arrow_icon" onClick="toggle_folder(\''.$folder['id'].'\'); return false;"></span>';
|
|
|
|
// Ikona mape
|
|
echo '<span class="faicon folder_icon"></span>';
|
|
|
|
// Naslov folderja
|
|
echo '<div id="folder_title_text_'.$folder['id'].'" class="folder_title_text" onClick="edit_title_folder(\''.$folder['id'].'\'); return false;">'.$folder['naslov'].'</div>';
|
|
|
|
|
|
echo '<div class="map_holder_control">';
|
|
|
|
// Ikona za dodajanje folderja
|
|
echo '<a href="#" title="'.$lang['srv_mySurvey_create_subfolder'].'" onClick="create_folder(\''.$folder['id'].'\'); return false;"><span class="faicon add"></span></a>';
|
|
|
|
// Ikona za brisanje folderja
|
|
echo '<a href="#" title="'.$lang['srv_mySurvey_delete_folder'].'" onClick="delete_folder(\''.$folder['id'].'\'); return false;"><span class="faicon remove"></span></a>';
|
|
|
|
// Ikona za kopiranje folderja - samo admini
|
|
if($admin_type == 0)
|
|
echo '<a href="#" title="'.$lang['srv_mySurvey_copy_folder'].'" onClick="copy_folder(\''.$folder['id'].'\'); return false;"><span class="faicon copy"></span></a>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
// Dodaten div za klik za razpiranje
|
|
echo '<div class="folder_clickable" onClick="toggle_folder(\''.$folder['id'].'\'); return false;"></div>';
|
|
|
|
|
|
echo '</div>';
|
|
|
|
|
|
echo '<div id="folder_content_'.$folder['id'].'" class="folder_content '.($folder['open'] == 1 ? '' : ' closed').' '.($folder['parent'] != 0 ? ' subfolder' : '').'">';
|
|
|
|
$this->displayNewSurveyList($folder['id']);
|
|
|
|
// Izpisemo se vse folderje znotraj trenutnega folderja
|
|
$sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE usr_id='$global_user_id' AND parent='".$folder['id']."' ORDER BY id DESC");
|
|
if(mysqli_num_rows($sql) > 0) {
|
|
while($row = mysqli_fetch_array($sql)){
|
|
echo '<div id="folder_holder_'.$row['id'].'" class="folder_holder">';
|
|
$this->displayNewFolder($row);
|
|
echo '</div>';
|
|
}
|
|
}
|
|
|
|
echo '</div>';
|
|
}
|
|
}
|
|
|
|
|
|
/** Prikažemo navigacijo po straneh rezultatov
|
|
*
|
|
*/
|
|
function displayPagiantion() {
|
|
global $site_url, $lang;
|
|
|
|
//$this->max_pages = 100;
|
|
|
|
# ali sploh izrisujemo paginacijo
|
|
if ($this->max_pages > 1) {
|
|
|
|
if ($this->onlyPhone == false) {
|
|
$baseUrl = $site_url."admin/survey/index.php?pageno=";
|
|
} else {
|
|
$baseUrl = $site_url."admin/survey/index.php?a=phoneSurveys&pageno=";
|
|
}
|
|
|
|
# povezava na prejšnjo stran
|
|
$prev_page = $this->pageno - 1;
|
|
if($prev_page >= 1) {
|
|
echo '<a href="'.$baseUrl.$prev_page.'"><div class="arrow left"><span class="faicon pagination_left"></span></div></a>';
|
|
}
|
|
else {
|
|
# brez href povezave
|
|
echo '<div class="arrow left disabledPage"><span class="faicon pagination_left"></span></div>';
|
|
}
|
|
|
|
# povezave za vmesne strani
|
|
$middle = $this->max_pages / 2;
|
|
$skipped = false;
|
|
for($a = 1; $a <= $this->max_pages; $a++) {
|
|
if ($this->max_pages < ((SRV_LIST_GROUP_PAGINATE+1) * 2) || $a <= SRV_LIST_GROUP_PAGINATE || $a > ($this->max_pages-SRV_LIST_GROUP_PAGINATE)
|
|
|| ( abs($a-$this->pageno) < SRV_LIST_GROUP_PAGINATE)) {
|
|
if ($skipped == true) {
|
|
|
|
echo '<div class="spacePage">. . .</div>';
|
|
|
|
$skipped = false;
|
|
}
|
|
|
|
if($a == $this->pageno) {
|
|
# brez href povezave
|
|
echo '<div class="page_number currentPage">'.$a.'</div>';
|
|
}
|
|
else {
|
|
echo '<a href="'.$baseUrl.$a.'"><div class="page_number">'.$a.'</div></a>';
|
|
}
|
|
}
|
|
else {
|
|
$skipped = true;
|
|
}
|
|
}
|
|
|
|
# povezava na naslednjo stran
|
|
$next_page = $this->pageno + 1;
|
|
if($next_page <= $this->max_pages) {
|
|
echo '<a href="'.$baseUrl.$next_page.'"><div class="arrow right"><span class="faicon pagination_right"></span></div></a>';
|
|
}
|
|
else {
|
|
# brez href povezave
|
|
echo '<div class="arrow right disabledPage"><span class="faicon pagination_right"></span></div>';
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
// Prikazemo gumb za sortiranje seznama anket
|
|
private function displaySortButton(){
|
|
global $lang, $site_url;
|
|
|
|
echo $lang['orderby'];
|
|
|
|
echo '<div id="sortSettings">';
|
|
|
|
echo '<ul>';
|
|
|
|
if($this->sorttype == 2){
|
|
$sort = 1;
|
|
$img_src = 'sort_ascending';
|
|
}
|
|
else{
|
|
$sort = 2;
|
|
$img_src = 'sort_descending';
|
|
}
|
|
|
|
echo '<li '.($this->sortby == 1 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'1\',\''.($this->sortby != 1 ? '1' : $sort).'\')">'.$lang['sort_by_title'].' <span class="faicon '.($this->sortby != 1 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 6 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'6\',\''.($this->sortby != 6 ? '1' : $sort).'\')">'.$lang['sort_by_qcount'].' <span class="faicon '.($this->sortby != 6 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 5 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'5\',\''.($this->sortby != 5 ? '1' : $sort).'\')">'.$lang['sort_by_answercount'].' <span class="faicon '.($this->sortby != 5 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 16 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'16\',\''.($this->sortby != 16 ? '1' : $sort).'\')">'.$lang['sort_by_insert'].' <span class="faicon '.($this->sortby != 16 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 14 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'14\',\''.($this->sortby != 14 ? '1' : $sort).'\')">'.$lang['sort_by_edit'].' <span class="faicon '.($this->sortby != 14 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 18 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'18\',\''.($this->sortby != 18 ? '1' : $sort).'\')">Status <span class="faicon '.($this->sortby != 18 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 7 ? ' class="active"' : '').'><a href="#" onClick="surveyList_goTo(\'7\',\''.($this->sortby != 7 ? '1' : $sort).'\')"><li '.($this->sortby == 7 ? ' class="active"' : '').'>'.$lang['sort_by_author'].' <span class="faicon '.($this->sortby != 7 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
echo '<li '.($this->sortby == 11 ? ' class="active"' : '').' style="border:0;"><a href="#" onClick="surveyList_goTo(\'11\',\''.($this->sortby != 11 ? '1' : $sort).'\')">'.$lang['sort_by_editor'].' <span class="faicon '.($this->sortby != 11 ? 'sort_unsorted' : $img_src).'"></span></a></li>';
|
|
|
|
echo '</ul>';
|
|
|
|
echo '</div>';
|
|
}
|
|
|
|
// Prikazemo gumb za filtriranje seznama anket
|
|
private function displayFilterButton(){
|
|
global $lang, $site_url, $admin_languages;
|
|
|
|
echo '<div id="filterButton" '.(($this->user_id || $this->lang_id != 0 || $this->gdpr != 0) ? 'class="active"' : '').'>';
|
|
|
|
echo $lang['srv_analiza_filter'];
|
|
|
|
echo '<div id="filterSettings">';
|
|
echo '<ul>';
|
|
|
|
# filter po uporabniku
|
|
echo '<li>';
|
|
|
|
echo '<span class="filter_title">'.$lang['srv_list_author'].'</span>';
|
|
|
|
// Ce preklapljamo v searchu moramo refreshati celo stran (druga js funkcija)
|
|
$reload = ($this->isSearch == 1) ? '_reload' : '';
|
|
|
|
echo '<span class="filter_line"><input type="radio" name="filter_mySurveys" id="filter_mySurveys_0" value="0" '.(!$this->user_id ? 'checked="checked"' : '').' onclick="surveyList_user'.$reload.'(\'clr\',\'0\');"> <label for="filter_mySurveys_0">'.$lang['srv_list_all_surveys'].'</label></span>';
|
|
echo '<span class="filter_line"><input type="radio" name="filter_mySurveys" id="filter_mySurveys_1" value="1" '.($this->user_id ? 'checked="checked"' : '').' onclick="surveyList_user'.$reload.'(\'uid\',\''.$this->g_uid.'\');"> <label for="filter_mySurveys_1">'.$lang['srv_list_my_surveys'].'</label></span>';
|
|
|
|
echo '</li>';
|
|
|
|
|
|
# filter po jeziku
|
|
echo '<li>';
|
|
|
|
echo '<span class="filter_title">'.$lang['srv_sl_set_language'].'</span>';
|
|
|
|
echo '<span class="filter_line"><input type="radio" name="filter_language" id="filter_language_0" value="0" '.((int)$this->lang_id == 0 ? 'checked="checked"' : '').' onclick="surveyList_language'.$reload.'(\'0\');"> <label for="filter_language_0">'.$lang['srv_sl_set_language_all'].'</label></span>';
|
|
echo '<span class="filter_line"><input type="radio" name="filter_language" id="filter_language_1" value="1" '.((int)$this->lang_id == 1 ? 'checked="checked"' : '').' onclick="surveyList_language'.$reload.'(\'1\');"> <label for="filter_language_1">'.$admin_languages['1'].'</label></span>';
|
|
echo '<span class="filter_line"><input type="radio" name="filter_language" id="filter_language_2" value="2" '.((int)$this->lang_id == 2 ? 'checked="checked"' : '').' onclick="surveyList_language'.$reload.'(\'2\');"> <label for="filter_language_2">'.$admin_languages['2'].'</label></span>';
|
|
|
|
echo '</li>';
|
|
|
|
|
|
# filter po GDPR anketah
|
|
echo '<li>';
|
|
|
|
echo '<span class="filter_title">'.$lang['srv_gdpr'].'</span>';
|
|
|
|
echo '<span class="filter_line"><input type="radio" name="filter_gdpr" id="filter_gdpr_0" value="0" '.((int)$this->gdpr == 0 ? 'checked="checked"' : '').' onclick="surveyList_gdpr'.$reload.'(\'0\');"> <label for="filter_gdpr_0">'.$lang['srv_list_all_surveys'].'</label></span>';
|
|
echo '<span class="filter_line"><input type="radio" name="filter_gdpr" id="filter_gdpr_1" value="1" '.((int)$this->gdpr == 1 ? 'checked="checked"' : '').' onclick="surveyList_gdpr'.$reload.'(\'1\');"> <label for="filter_gdpr_1">'.$lang['srv_list_gdpr_gdpr'].'</label></span>';
|
|
|
|
echo '</li>';
|
|
|
|
|
|
echo '</ul>';
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
}
|
|
|
|
// Prikazemo preklop med navadnim pogledom in pogledom s folderji
|
|
private function displayFolderSwitch(){
|
|
global $lang, $global_user_id;
|
|
|
|
// Preverimo, ce je funkcionalnost v paketu, ki ga ima uporabnik
|
|
$userAccess = UserAccess::getInstance($global_user_id);
|
|
|
|
// Ce ni na voljo
|
|
if(!$userAccess->checkUserAccess('my_survey_folders')){
|
|
echo '<div title="'.$lang['srv_mySurvey_show_folders_desc'].'" id="folderSwitch" class="user_access_locked" onClick="popupUserAccess(\'my_survey_folders\');">';
|
|
echo $lang['srv_mySurvey_show_folders'];
|
|
echo '</div>';
|
|
}
|
|
else{
|
|
echo '<div title="'.$lang['srv_mySurvey_show_folders_desc'].'" id="folderSwitch" onClick="switchFolder(\''.$this->show_folders.'\');">';
|
|
echo ' <span>'.$lang['srv_mySurvey_show_folders'].'</span>';
|
|
|
|
// Stikalo za folderje
|
|
if($this->show_folders == 1)
|
|
echo ' <div class="switch_folders on"></div>';
|
|
else
|
|
echo ' <div class="switch_folders off"></div>';
|
|
|
|
echo '</div>';
|
|
}
|
|
}
|
|
|
|
private function displaySettingsUrl() {
|
|
global $lang;
|
|
|
|
echo '<span class="sl_setting_link"><a href="#" onclick="show_surveyListSettings(); return false;"> '.$lang['settings'].'</a></span>';
|
|
|
|
echo '<div id="survey_ListQickInfo" class="displayNone"></div>';
|
|
}
|
|
|
|
// Prikazemo nastavitve za napredno iskanje ce iscemo po anketah
|
|
private function displaySearchSettings(){
|
|
global $lang;
|
|
global $site_url;
|
|
|
|
// NAPREDNE NASTAVITVE ISKANJA
|
|
$show_advanced_search = false;
|
|
if($this->searchSettings['sstatus'] != '0'
|
|
|| $this->searchSettings['sidatefrom'] != ''
|
|
|| $this->searchSettings['sidateto'] != ''
|
|
|| $this->searchSettings['sedatefrom'] != ''
|
|
|| $this->searchSettings['sedateto'] != ''){
|
|
|
|
$show_advanced_search = true;
|
|
}
|
|
|
|
echo '<form method="GET" id="1kasf2" action="'.$site_url.'admin/survey/index.php">';
|
|
|
|
|
|
// Zgornja vrstica z geslom in gumbom za iskanje
|
|
echo '<div class="search_settings_top">';
|
|
|
|
// Posebej imamo skrito polje s parametri da jih ohranimo pri ajax klicih
|
|
echo '<input type="hidden" id="searchParams" name="searchParams" value="'.$this->getSearchParams().'" />';
|
|
|
|
// Iskano geslo
|
|
echo '<div class="search_text">';
|
|
echo ' <input type="text" name="search" id="searchMySurveyText" value="'.htmlentities($this->searchString).'" placeholder="'.$lang['s_search'].'" />';
|
|
echo '</div>';
|
|
|
|
// Iskanje po naslovu ali avtorju ali besedilu
|
|
echo '<div class="search_type">';
|
|
echo ' <select name="stype" id="stype">';
|
|
echo ' <option value="0" '.($this->searchSettings['stype'] == '0' ? ' selected="selected"' : '').'>'.$lang['s_title'].'</option>';
|
|
echo ' <option value="1" '.($this->searchSettings['stype'] == '1' ? ' selected="selected"' : '').'>'.$lang['s_author'].'</option>';
|
|
echo ' <option value="2" '.($this->searchSettings['stype'] == '2' ? ' selected="selected"' : '').'>'.$lang['s_text'].'</option>';
|
|
echo ' </select>';
|
|
echo '</div>';
|
|
|
|
// Gumb isci
|
|
echo '<div class="search_button">';
|
|
echo ' <a href="#" onclick="$(\'#1kasf2\').submit(); return false;"><button class="medium blue">'.$lang['s_search'].'</button></a>';
|
|
echo '</div>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
// Gumba za napredne nastavitve
|
|
echo '<div class="search_settings_advanced_buttons">';
|
|
|
|
echo ' <button type="button" id="advanced_settings_button" class="white-black small '.($show_advanced_search ? 'active': '').'" onClick="showAdvancedSearch(); return false;">';
|
|
echo ' <span class="faicon search"></span>'.$lang['s_advanced'];
|
|
echo ' </button>';
|
|
|
|
// Gumb nazaj na moje ankete
|
|
echo ' <a href="'.$site_url.'admin/survey/index.php?a=pregledovanje"><button type="button" class="white-black small">';
|
|
echo ' <span class="faicon clipboard_notes"></span>'.$lang['s_search_mySurvey_back'];
|
|
echo ' </button></a>';
|
|
|
|
echo '</div>';
|
|
|
|
|
|
// Okno z naprednimi nastavitvami
|
|
echo '<div id="advancedSearch" class="search_settings_advanced" '.($show_advanced_search ? '' : ' style="display:none;"').'>';
|
|
|
|
// Status ankete (aktivna, neaktivna, zakljucena)
|
|
echo '<div class="setting_holder">';
|
|
echo ' <span class="setting_title">'.$lang['s_activity'].': </span>';
|
|
echo ' <div class="setting_line"><input type="radio" name="sstatus" id="sstatus_0" value="0" '.($this->searchSettings['sstatus'] == '0' ? ' checked="checked"' : '').'><label for="sstatus_0">'.$lang['s_all_surveys'].'</label></div>';
|
|
echo ' <div class="setting_line"><input type="radio" name="sstatus" id="sstatus_1" value="1" '.($this->searchSettings['sstatus'] == '1' ? ' checked="checked"' : '').'><label for="sstatus_1">'.$lang['s_active_surveys'].'</label></div>';
|
|
echo ' <div class="setting_line"><input type="radio" name="sstatus" id="sstatus_2" value="2" '.($this->searchSettings['sstatus'] == '2' ? ' checked="checked"' : '').'><label for="sstatus_2">'.$lang['s_nonactive_surveys'].'</label></div>';
|
|
echo '</div>';
|
|
|
|
// Datum ustvarjanja ankete
|
|
echo '<div class="setting_holder">';
|
|
echo ' <span class="setting_title">'.$lang['s_itime'].': </span>';
|
|
echo ' <div class="setting_line"><span>'.$lang['srv_activate_duration_manual_from'].' <input type="text" id="sidatefrom" name="sidatefrom" value="'.$this->searchSettings['sidatefrom'].'" autocomplete="off" size="12" /></span></div>';
|
|
echo ' <div class="setting_line"><span>'.$lang['srv_activate_duration_manual_to'].' <input type="text" id="sidateto" name="sidateto" value="'.$this->searchSettings['sidateto'].'" autocomplete="off" size="12" /></span></div>';
|
|
echo '</div>';
|
|
|
|
// Datum zadnjega urejanja ankete
|
|
echo '<div class="setting_holder">';
|
|
echo ' <span class="setting_title">'.$lang['s_etime'].': </span>';
|
|
echo ' <div class="setting_line"><span>'.$lang['srv_activate_duration_manual_from'].' <input type="text" id="sedatefrom" name="sedatefrom" value="'.$this->searchSettings['sedatefrom'].'" autocomplete="off" size="12" /></span></div>';
|
|
echo ' <div class="setting_line"><span>'.$lang['srv_activate_duration_manual_to'].' <input type="text" id="sedateto" name="sedateto" value="'.$this->searchSettings['sedateto'].'" autocomplete="off" size="12" /></span></div>';
|
|
echo '</div>';
|
|
|
|
// Metaadmin lahko dodatno omeji search po avtorju
|
|
if(Dostop::isMetaAdmin()){
|
|
echo '<div class="setting_holder">';
|
|
echo ' <span class="setting_title">'.$lang['s_search_metaadmin'].': </span>';
|
|
echo ' <div class="setting_line"><input type="text" name="onlyAuthor" id="onlyAuthor" value="'.htmlentities($this->searchSettings['onlyAuthor']).'" placeholder="'.$lang['s_search'].'"></div>';
|
|
echo '</div>';
|
|
}
|
|
|
|
echo '</div>';
|
|
|
|
|
|
// JS za koledar
|
|
echo '<script type="text/javascript">
|
|
var srv_site_url = \''.$site_url.'\';
|
|
$(document).ready(function () {
|
|
$("#sidatefrom, #sidateto, #sedatefrom, #sedateto").datepicker({
|
|
showOtherMonths: true,
|
|
selectOtherMonths: true,
|
|
changeMonth: true,
|
|
changeYear: true,
|
|
dateFormat: "dd.mm.yy",
|
|
showAnim: "slideDown",
|
|
showOn: "both",
|
|
buttonText: ""
|
|
});
|
|
});
|
|
</script>';
|
|
|
|
echo '<input style="display: none;" value="Išči" type="submit">';
|
|
|
|
echo '</form>';
|
|
}
|
|
|
|
// Prikazemo search okno za iskanje po anketah
|
|
public function displaySearch(){
|
|
global $lang;
|
|
global $site_url;
|
|
|
|
echo '<form method="GET" id="1kasmysurvey" action="'.$site_url.'admin/survey/index.php">';
|
|
|
|
echo '<input id="searchMySurvey" type="text" value="" placeholder="'.$lang['s_search_mySurvey'].'" name="search" />';
|
|
|
|
echo ' <button class="medium white-black" onclick="$(\'#1kasmysurvey\').submit(); return false;">';
|
|
echo $lang['s_search2'];
|
|
echo ' </button>';
|
|
|
|
echo '</form>';
|
|
}
|
|
|
|
|
|
/** polovimo nastavitve prikaza za posameznega uporabnika
|
|
*
|
|
*/
|
|
private function getSettings($display_default = false) {
|
|
|
|
$defaultOrder = $this->dataFields;
|
|
$resultArray = array();
|
|
$izBaze = false;
|
|
|
|
if ($this->g_uid > 0) {
|
|
$saved_surveyList_string = UserSetting::getInstance()->getUserSetting('survey_list_order');
|
|
$saved_surveyList_visible_string = UserSetting::getInstance()->getUserSetting('survey_list_visible');
|
|
$saved_surveyList_visible = array_unique(explode(",",$saved_surveyList_visible_string));
|
|
if (isset($saved_surveyList_string) && $saved_surveyList_string != "" && !$display_default ) {
|
|
$saved_surveyList_order = array_unique(explode(",",$saved_surveyList_string));
|
|
$izBaze = true;
|
|
// uporabimo shranjene nastavitve
|
|
foreach ( $saved_surveyList_order as $order) {
|
|
if (in_array($order,$saved_surveyList_visible))
|
|
{
|
|
$defaultOrder[$order]['visible'] = 1;
|
|
} else {
|
|
$defaultOrder[$order]['visible'] = 0;
|
|
}
|
|
if (isset($defaultOrder[$order]['order_by']) && isset($defaultOrder[$order]))
|
|
{
|
|
$resultArray[$defaultOrder[$order]['order_by']] = $defaultOrder[$order];
|
|
if (isset($defaultOrder[$order]))
|
|
{
|
|
unset($defaultOrder[$order]);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// za vse ostalo uporabimo privzete nastavitve
|
|
foreach ( $defaultOrder as $order)
|
|
{
|
|
if ($izBaze)
|
|
{
|
|
$order['visible'] = 0; // ponastavimo vidnost ?e imamo iz baze
|
|
}
|
|
if (isset($order['order_by']))
|
|
{
|
|
$resultArray[$order['order_by']] = $order;
|
|
}
|
|
}
|
|
return $resultArray;
|
|
}
|
|
|
|
private function getSurveysAsList() {
|
|
|
|
$result = array();
|
|
|
|
// ce imas hkrati dostop do ankete (srv_dostop) in preko managerskega dostopa (srv_dostop_manage) se brez DISTINCT podvajajo ankete
|
|
$stringSurveyList = "SELECT DISTINCT sa.id, sa.folder, '1' as del, sa.naslov, sa.active, sa.edit_time, ";
|
|
$stringSurveyList .= ( $this->settingsArray['lib_glb']['visible'] == 1 ) ? 'sal.lib_glb AS lib_glb, ' :'';
|
|
$stringSurveyList .= ( $this->settingsArray['lib_usr']['visible'] == 1 ) ? 'sal.lib_usr AS lib_usr, ' : '';
|
|
$stringSurveyList .= ( $this->settingsArray['e_name']['visible'] == 1 || $this->settingsArray['e_surname']['visible'] == 1 || $this->settingsArray['e_email']['visible'] == 1 )
|
|
? "sa.edit_uid, sal.e_name AS e_name, sal.e_surname AS e_surname, sal.e_email AS e_email, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['i_name']['visible'] == 1 || $this->settingsArray['i_surname']['visible'] == 1 || $this->settingsArray['i_email']['visible'] == 1 )
|
|
? "sa.insert_uid, sal.i_name AS i_name, sal.i_surname AS i_surname, sal.i_email AS i_email, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['edit_time']['visible'] == 1 ) ? "date_format(edit_time, '%d.%m.%y %k:%i') AS e_time, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['insert_time']['visible'] == 1 ) ? "date_format(insert_time, '%d.%m.%y %k:%i') AS i_time, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['vnos_time_first']['visible'] == 1 || $this->settingsArray['vnos_time_last']['visible'] == 1)
|
|
? "date_format(sal.a_first, '%d.%m.%y %k:%i') AS v_time_first, date_format(sal.a_last, '%d.%m.%y %k:%i') AS v_time_last, " : '';
|
|
|
|
$stringSurveyList .= "sal.answers as answers, "; // vedno prestejemo odgovore
|
|
$stringSurveyList .= ( $this->settingsArray['variables']['visible'] == 1 ) ? "sal.variables as variables, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['trajanjeod']['visible'] == 1 ) ? "date_format(sa.starts, '%d.%m.%y') as trajanjeod, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['trajanjedo']['visible'] == 1 ) ? "date_format(sa.expire, '%d.%m.%y') as trajanjedo, " : '';
|
|
$stringSurveyList .= ( $this->settingsArray['approp']['visible'] == 1 ) ? "approp, " : '';
|
|
$stringSurveyList .= "sd.canEdit, sa.survey_type "; // tega pustim tukaj, da ni problemov z vejico
|
|
|
|
$stringSurveyList .= "FROM srv_anketa sa ";
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_survey_list AS sal ON sal.id = sa.id " ;
|
|
|
|
# kdo lahko ureja anketo (briše)
|
|
// tega substringy se ne da dodatno razbit z prepareSubquery, ker selectamo 2 elementa...
|
|
$stringSurveyList .= "LEFT OUTER JOIN (SELECT 1 AS canEdit, ank_id FROM srv_dostop WHERE FIND_IN_SET('edit', dostop ) ='1' AND aktiven = '1' AND uid = '$this->g_uid' OR uid IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT user FROM srv_dostop_manage WHERE manager = '".$this->g_uid."'")).")) AS sd ON sd.ank_id = sa.id " ;
|
|
#$stringSurveyList .= "LEFT OUTER JOIN (SELECT ank_id, FIND_IN_SET('edit', dostop ) AS canEdit FROM srv_dostop WHERE aktiven = '1' AND uid = '$this->g_uid') AS sd ON sd.ank_id = sa.id " ;
|
|
|
|
$stringSurveyList .= "WHERE sa.backup='0' AND sa.id>0 AND active >= '0' AND invisible = '0' ";
|
|
//$stringSurveyList .= $this->getFolderCondition();
|
|
|
|
$stringSurveyList .= $this->getLanguageLimit();
|
|
$stringSurveyList .= $this->getDostopAnketa();
|
|
$stringSurveyList .= $this->getOrderString();
|
|
$stringSurveyList .= $this->getLimitString();
|
|
|
|
$sqlSurveyList = sisplet_query($stringSurveyList);
|
|
if (!$sqlSurveyList) {
|
|
print_r("ERROR in query:");
|
|
print_r($stringSurveyList);
|
|
echo mysqli_error($GLOBALS['connect_db']);
|
|
}
|
|
$ids = array();
|
|
while ($rowSurveyList = mysqli_fetch_assoc($sqlSurveyList)) {
|
|
$result[] = $rowSurveyList;
|
|
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
// Dobimo seznam anket za nov prikaz (starega se naceloma ne uporablja vec)
|
|
private function getSurveysAsListNew($folder=0) {
|
|
|
|
$result = array();
|
|
|
|
// ce imas hkrati dostop do ankete (srv_dostop) in preko managerskega dostopa (srv_dostop_manage) se brez DISTINCT podvajajo ankete
|
|
$stringSurveyList = "SELECT DISTINCT sa.id, sa.folder, '1' as del, sa.naslov, sa.active, sa.mobile_created, sa.edit_time, ";
|
|
$stringSurveyList .= 'sal.lib_glb AS lib_glb, ';
|
|
$stringSurveyList .= 'sal.lib_usr AS lib_usr, ';
|
|
$stringSurveyList .= "sa.edit_uid, sal.e_name AS e_name, sal.e_surname AS e_surname, sal.e_email AS e_email, ";
|
|
$stringSurveyList .= "sa.insert_uid, sal.i_name AS i_name, sal.i_surname AS i_surname, sal.i_email AS i_email, ";
|
|
$stringSurveyList .= "date_format(edit_time, '%d.%m.%y %k:%i') AS e_time, ";
|
|
$stringSurveyList .= "date_format(insert_time, '%d.%m.%y %k:%i') AS i_time, ";
|
|
$stringSurveyList .= "date_format(sal.a_first, '%d.%m.%y %k:%i') AS v_time_first, date_format(sal.a_last, '%d.%m.%y %k:%i') AS v_time_last, ";
|
|
|
|
$stringSurveyList .= "sal.answers as answers, "; // vedno prestejemo odgovore
|
|
$stringSurveyList .= "sal.variables as variables, ";
|
|
$stringSurveyList .= "date_format(sa.starts, '%d.%m.%y') as trajanjeod, ";
|
|
$stringSurveyList .= "date_format(sa.expire, '%d.%m.%y') as trajanjedo, ";
|
|
$stringSurveyList .= "approp, ";
|
|
$stringSurveyList .= "sd.canEdit, sa.survey_type "; // tega pustim tukaj, da ni problemov z vejico
|
|
|
|
if($folder > 0)
|
|
$stringSurveyList .= ", sf.folder as mysurvey_folder ";
|
|
|
|
// Ce searchamo po besedah dodamo se uvod, zakljucek, naslove vprasanj in vrednosti vprasanj
|
|
if($this->isSearch == 1 && $this->searchSettings['stype'] == '2'){
|
|
$stringSurveyList .= ", sa.introduction AS introduction, sa.conclusion AS conclusion ";
|
|
|
|
$stringSurveyList .= ", sg.id AS sg_id, sg.ank_id AS sg_ank_id ";
|
|
$stringSurveyList .= ", ss.id AS ss_id, ss.naslov AS ss_naslov, ss.gru_id AS ss_gru_id ";
|
|
$stringSurveyList .= ", sv.id AS sv_id, sv.naslov AS sv_naslov, sv.spr_id AS sv_spr_id ";
|
|
}
|
|
|
|
|
|
$stringSurveyList .= "FROM srv_anketa sa ";
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_survey_list AS sal ON sal.id = sa.id " ;
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_library_anketa AS sla ON sla.ank_id = sa.id " ;
|
|
|
|
# kdo lahko ureja anketo (briše)
|
|
// tega substringy se ne da dodatno razbit z prepareSubquery, ker selectamo 2 elementa...
|
|
$stringSurveyList .= "LEFT OUTER JOIN (SELECT 1 AS canEdit, ank_id FROM srv_dostop WHERE FIND_IN_SET('edit', dostop ) ='1' AND aktiven = '1' AND uid = '$this->g_uid' OR uid IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT user FROM srv_dostop_manage WHERE manager = '".$this->g_uid."'")).")) AS sd ON sd.ank_id = sa.id " ;
|
|
#$stringSurveyList .= "LEFT OUTER JOIN (SELECT ank_id, FIND_IN_SET('edit', dostop ) AS canEdit FROM srv_dostop WHERE aktiven = '1' AND uid = '$this->g_uid') AS sd ON sd.ank_id = sa.id " ;
|
|
|
|
if($folder > 0)
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_mysurvey_anketa AS sf ON sf.ank_id = sa.id ";
|
|
|
|
// Ce iscemo po kljucnih besedah moramo dodat se tabele srv_grupa, srv_spremenljivka in srv_vrednost
|
|
if($this->isSearch == 1 && $this->searchSettings['stype'] == '2'){
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_grupa AS sg ON sg.ank_id = sa.id ";
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_spremenljivka AS ss ON ss.gru_id = sg.id ";
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_vrednost AS sv ON sv.spr_id = ss.id ";
|
|
}
|
|
|
|
// Ce iscemo po imenu ankete moramo dodat se tabele srv_nice_links za lepe linke
|
|
if($this->isSearch == 1 && $this->searchSettings['stype'] == '0'){
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_nice_links AS nl ON sa.id = nl.ank_id ";
|
|
}
|
|
|
|
$stringSurveyList .= "WHERE sa.backup='0' AND sa.id>0 AND active >= '0' AND invisible = '0' ";
|
|
|
|
//$stringSurveyList .= $this->getFolderCondition();
|
|
//$stringSurveyList .= $this->getLibraryCondition(); // Tega ni vec ker imamo nove folderje v mojih anketah
|
|
if($folder > 0)
|
|
$stringSurveyList .= "AND sf.usr_id='$this->g_uid' AND sf.folder='$folder' ";
|
|
elseif($folder == 0)
|
|
$stringSurveyList .= "AND NOT EXISTS (SELECT * FROM srv_mysurvey_anketa sma WHERE sma.ank_id=sa.id AND sma.usr_id='$this->g_uid') ";
|
|
|
|
|
|
// GDPR filter
|
|
if($this->gdpr == 1)
|
|
$stringSurveyList .= "AND EXISTS (SELECT * FROM srv_gdpr_anketa sgdpr WHERE sgdpr.ank_id=sa.id) ";
|
|
elseif($this->gdpr == 2)
|
|
$stringSurveyList .= "AND NOT EXISTS (SELECT * FROM srv_gdpr_anketa sgdpr WHERE sgdpr.ank_id=sa.id) ";
|
|
|
|
|
|
// Ce izvajamo search po anketah
|
|
if($this->isSearch == 1){
|
|
// Filter glede na search
|
|
$stringSurveyList .= $this->getSearchString();
|
|
|
|
// Filter glede na jezik ankete
|
|
$stringSurveyList .= $this->getLanguageLimit();
|
|
// Filter glede na dostop do ankete
|
|
$stringSurveyList .= $this->getDostopAnketa();
|
|
// Vrstni red anket
|
|
$stringSurveyList .= $this->getOrderString();
|
|
|
|
// Ce iscemo po kljucnih besedah moramo na koncu grupirat po anketi
|
|
if($this->searchSettings['stype'] == '2'){
|
|
//$stringSurveyList .= " GROUP BY id";
|
|
//$stringSurveyList .= " LIMIT 1000";
|
|
}
|
|
else{
|
|
// Limit anket
|
|
//$stringSurveyList .= $this->getLimitString();
|
|
$stringSurveyList .= " LIMIT 1000";
|
|
}
|
|
}
|
|
else{
|
|
// Filter glede na jezik ankete
|
|
$stringSurveyList .= $this->getLanguageLimit();
|
|
// Filter glede na dostop do ankete
|
|
$stringSurveyList .= $this->getDostopAnketa();
|
|
// Vrstni red anket
|
|
$stringSurveyList .= $this->getOrderString();
|
|
// Limit anket
|
|
$stringSurveyList .= $this->getLimitString();
|
|
}
|
|
|
|
|
|
$sqlSurveyList = sisplet_query($stringSurveyList);
|
|
if (!$sqlSurveyList) {
|
|
print_r("ERROR in query:");
|
|
print_r($stringSurveyList);
|
|
echo mysqli_error($GLOBALS['connect_db']);
|
|
}
|
|
|
|
while ($rowSurveyList = mysqli_fetch_assoc($sqlSurveyList)) {
|
|
$result[$rowSurveyList['id']] = $rowSurveyList;
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
|
|
// Enostaven seznam anket za mobilno aplikacijo
|
|
public function getSurveysSimple($ank_id = 0, $limit = '', $mobile_created = -1, $include_folders=false) {
|
|
|
|
$result = array();
|
|
|
|
// ce imas hkrati dostop do ankete (srv_dostop) in preko managerskega dostopa (srv_dostop_manage) se brez DISTINCT podvajajo ankete
|
|
$stringSurveyList = "SELECT DISTINCT sa.id, sa.folder, '1' as del, sa.naslov, sa.active, sa.mobile_created, sa.block_ip, ";
|
|
//$stringSurveyList .= 'sal.lib_glb AS lib_glb, ';
|
|
//$stringSurveyList .= 'sal.lib_usr AS lib_usr, ';
|
|
$stringSurveyList .= "sa.edit_uid, sal.e_name AS e_name, sal.e_surname AS e_surname, sal.e_email AS e_email, ";
|
|
$stringSurveyList .= "sa.insert_uid, sal.i_name AS i_name, sal.i_surname AS i_surname, sal.i_email AS i_email, ";
|
|
$stringSurveyList .= "date_format(edit_time, '%d.%m.%y %k:%i') AS e_time, ";
|
|
$stringSurveyList .= "date_format(insert_time, '%d.%m.%y %k:%i') AS i_time, ";
|
|
$stringSurveyList .= "date_format(sal.a_first, '%d.%m.%y %k:%i') AS v_time_first, date_format(sal.a_last, '%d.%m.%y %k:%i') AS v_time_last, ";
|
|
|
|
$stringSurveyList .= "sal.answers as answers, "; // vedno prestejemo odgovore
|
|
$stringSurveyList .= "sal.approp as approp, "; // vedno prestejemo odgovore
|
|
$stringSurveyList .= "sal.variables as variables, ";
|
|
$stringSurveyList .= "date_format(sa.starts, '%d.%m.%y') as trajanjeod, ";
|
|
$stringSurveyList .= "date_format(sa.expire, '%d.%m.%y') as trajanjedo, ";
|
|
$stringSurveyList .= "sa.survey_type "; // tega pustim tukaj, da ni problemov z vejico
|
|
|
|
$stringSurveyList .= "FROM srv_anketa sa ";
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_survey_list AS sal ON sal.id = sa.id " ;
|
|
$stringSurveyList .= "LEFT OUTER JOIN srv_library_anketa AS sla ON sla.ank_id = sa.id " ;
|
|
|
|
# kdo lahko ureja anketo (briše)
|
|
// tega substringy se ne da dodatno razbit z prepareSubquery, ker selectamo 2 elementa...
|
|
$stringSurveyList .= "LEFT OUTER JOIN (SELECT 1 AS canEdit, ank_id FROM srv_dostop WHERE FIND_IN_SET('edit', dostop ) ='1' AND aktiven = '1' AND uid = '$this->g_uid' OR uid IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT user FROM srv_dostop_manage WHERE manager = '".$this->g_uid."'")).")) AS sd ON sd.ank_id = sa.id " ;
|
|
|
|
$stringSurveyList .= "WHERE sa.backup='0' AND sa.id>0 AND active >= '0' AND invisible = '0' ";
|
|
|
|
if($mobile_created == 1)
|
|
$stringSurveyList .= "AND sa.mobile_created='".$mobile_created."' ";
|
|
|
|
if(!$include_folders)
|
|
$stringSurveyList .= "AND NOT EXISTS (SELECT * FROM srv_mysurvey_anketa sma WHERE sma.ank_id=sa.id AND sma.usr_id='$this->g_uid') ";
|
|
|
|
// Ce imamo podan ank_id vrnemo samo za 1 anketo
|
|
if($ank_id > 0)
|
|
$stringSurveyList .= "AND sa.id='".$_GET['ank_id']."' ";
|
|
|
|
//$stringSurveyList .= $this->getLanguageLimit();
|
|
$stringSurveyList .= $this->getDostopAnketa();
|
|
//$stringSurveyList .= $this->getOrderString();
|
|
//$stringSurveyList .= $this->getLimitString();
|
|
|
|
//$stringSurveyList .= 'ORDER BY upper(naslov) ASC';
|
|
|
|
//zacasno zaradi aplikacije
|
|
if($mobile_created == 1)
|
|
$stringSurveyList .= "ORDER BY edit_time DESC";
|
|
else
|
|
$stringSurveyList .= 'ORDER BY sal.a_last DESC';
|
|
|
|
//@Uros dodal, da vrne samo doloceno stevilo zadnjih anktivnih anket, ce je nastavljeno
|
|
if($limit != '' && $limit != 0)
|
|
$stringSurveyList .= ' limit '.$limit;
|
|
|
|
$sqlSurveyList = sisplet_query($stringSurveyList);
|
|
while ($rowSurveyList = mysqli_fetch_assoc($sqlSurveyList)) {
|
|
|
|
// Pretvorimo vse v utf - drugace vcasih ne dela json_encode
|
|
foreach($rowSurveyList as $key => $val){
|
|
//$rowSurveyList[$key] = utf8_encode($val);
|
|
$rowSurveyList[$key] = mb_convert_encoding($val, 'HTML-ENTITIES', "UTF-8");
|
|
}
|
|
|
|
$result[] = $rowSurveyList;
|
|
}
|
|
return $result;
|
|
}
|
|
|
|
private function createOrderUrl($id=null, $txt) {
|
|
|
|
if (!isset($id) || $id == null || $id == "") {
|
|
$id=1;
|
|
}
|
|
|
|
if ($this->sortby != $id ) {
|
|
$img_src = 'sort_unsorted';
|
|
$result='<div onClick="surveyList_goTo(\''.$id.'\',\'1\')">'.$txt.'</div>';
|
|
} else {
|
|
|
|
if ($this->sorttype == 2) {
|
|
$img_src = 'sort_ascending';
|
|
$result='<div onClick="surveyList_goTo(\''.$id.'\',\'1\')" class="red">'.$txt.'<span class="faicon '.$img_src.'" title=""></span></div>';
|
|
} else {
|
|
$img_src = 'sort_descending';
|
|
|
|
$result='<div onClick="surveyList_goTo(\''.$id.'\',\'2\')" class="red">'.$txt.'<span class="faicon '.$img_src.'" title=""></span></div>';
|
|
}
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
private function createOrderUrlNew($id=null, $txt) {
|
|
global $site_url;
|
|
|
|
if (!isset($id) || $id == null || $id == "") {
|
|
$id=1;
|
|
}
|
|
|
|
if ($this->sortby != $id ) {
|
|
$result='<div onClick="surveyList_goTo(\''.$id.'\',\'1\')">'.$txt.'</div>';
|
|
}
|
|
else {
|
|
|
|
if ($this->sorttype == 2) {
|
|
$result='<div class="active" onClick="surveyList_goTo(\''.$id.'\',\'1\')">'.$txt.'<span class="active faicon after sort_up_arrow icon-orange"/></div>';
|
|
}
|
|
else {
|
|
$result='<div class="active" onClick="surveyList_goTo(\''.$id.'\',\'2\')">'.$txt.'<span class="active faicon after sort_down_arrow icon-orange"/></div>';
|
|
}
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
private function echoText($text, $type = 'text', $id = null,$options=array()) {
|
|
global $lang;
|
|
global $site_url;
|
|
|
|
if ( $type == 'text') {
|
|
$result = ( isset($text) && $text != null && $text != "") ? $text : " ";
|
|
} elseif ($type == 'naslov') {
|
|
$result = '<strong><a href="'.$site_url.'admin/survey/index.php?anketa='.$id.'&a='.A_REDIRECTLINK.'" title="'.$text.'">'.$text.'</a></strong>';
|
|
} elseif ($type == 'active') {
|
|
$result = '<a href="/" onclick="anketa_active(\''.$id.'\',\''.(int)$text.'\',\'true\'); return false;">' .
|
|
'<span class="faicon '.((int)$text==1?'star_on':'star_off').'" alt="'.(int)$text.'" title="'.((int)$text==1?$lang['srv_anketa_active']:$lang['srv_anketa_noactive']).'"> </span>'.
|
|
'</a>';
|
|
} elseif ($type == 'delete') {
|
|
if ((int)$options['anketa_canEdit'] > 0) {
|
|
$result = '<a href="/" onclick="anketa_delete_list(\''.$id.'\', \''.$lang['srv_anketadeleteconfirm'].'\'); return false;">' .
|
|
'<span class="faicon delete_circle icon-orange_link" title="'.$lang['srv_anketa_delete'].'"></span>'.
|
|
'</a>';
|
|
} else {
|
|
$result=' ';
|
|
}
|
|
} elseif ($type == 'lib_glb') {
|
|
if ($this->g_adminType == 0) {
|
|
// samo admin lahko dodaja in odstranjuje v sistemsko knjiznico
|
|
$result = '<a href="/" onclick="surveyList_knjiznica(\''.$id.'\'); return false;">'.
|
|
'<span class="sprites library_admin_'.((int)$text==1?'on':'off').'" title="'.((int)$text==1?$lang['srv_ank_lib_off']:$lang['srv_ank_lib_on']).'"></span>'.
|
|
'</a>';
|
|
} else {
|
|
$result = '<a href="/" onclick="surveyList_knjiznica_noaccess(\''.$lang['srv_list_library_no_access'].'\'); return false;">'.
|
|
'<span class="sprites library_admin_'.((int)$text==1?'on':'off').'" title="'.((int)$text==1?$lang['srv_ank_lib_off']:$lang['srv_ank_lib_on']).'"></span>'.
|
|
'</a>';
|
|
}
|
|
} elseif ($type == 'lib_usr') {
|
|
$result = '<a href="/" onclick="surveyList_myknjiznica(\''.$id.'\'); return false;">'.
|
|
'<span class="sprites '.((int)$text==1?'library_on':'library_off').'" title="'.((int)$text==1?$lang['srv_ank_mylib_off']:$lang['srv_ank_mylib_on']).'"></span>'.
|
|
'</a>';
|
|
} elseif ($type == 'survey_type') {
|
|
if ($text == '3') {
|
|
$text = '2';
|
|
}
|
|
|
|
$result = $lang['srv_vrsta_survey_type_'.$text];
|
|
|
|
} elseif ($type == 'euid' || $type == 'iuid') {
|
|
$text = iconv("iso-8859-2", "utf-8",$text);
|
|
if ($options['anketa_is_copy']) {
|
|
$result = $lang['srv_survey_is_copy'];
|
|
} else {
|
|
$result = ( isset($text) && $text != null && $text != "")
|
|
? '<span class="as_link"'.($type == 'euid' ? ' onclick="surveyList_user(\'e\',this);" euid="'.$options['anketa_e_uid'].'"': ' onclick="surveyList_user(\'i\',this);" iuid="'.$options['anketa_i_uid'].'"').'>'.$text.'</span>' :
|
|
" ";
|
|
|
|
// echoText($text, 'text', $id, $options );
|
|
}
|
|
} else {
|
|
|
|
$this->echoText($text, 'text', $id, $options );
|
|
}
|
|
|
|
echo (isset($result) && $result != "" && $result != null) ? $result : " ";
|
|
}
|
|
|
|
/**
|
|
* polovimo shranjene ?irine za polja
|
|
*/
|
|
private function getCssSetings() {
|
|
global $global_user_id;
|
|
$result_old_data = array();
|
|
if ($this->g_uid > 0) {
|
|
// najprej iz nastavitev preberemo obstoje?e shranjene ?irine
|
|
$saved_old_data_string = UserSetting::getInstance()->getUserSetting('survey_list_widths');
|
|
|
|
if (isset($saved_old_data_string) && $saved_old_data_string != null && $saved_old_data_string != "" ) {
|
|
$old_data = array_unique(explode(";",$saved_old_data_string));
|
|
foreach ( $old_data as $tmp_old_data ) {
|
|
$_tmp_old_data = array_unique(explode(",",$tmp_old_data));
|
|
$result_old_data[$_tmp_old_data[0]] = $_tmp_old_data[1];
|
|
}
|
|
}
|
|
}
|
|
return $result_old_data;
|
|
}
|
|
|
|
/** Izrišemo div z nastavitvami
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $display_default
|
|
*/
|
|
public function displaySettings($display_default = false) {
|
|
global $site_url, $lang;
|
|
|
|
# izpisemo dive
|
|
$settingsArray = $this->getSettings();
|
|
echo '<div id="survey_list_inner">';
|
|
echo '<input type="hidden" id="sortby" value="'.$_POST['sortby'].'">';
|
|
echo '<input type="hidden" id="sorttype" value="'.$_POST['sorttype'].'">';
|
|
$grupaName = "";
|
|
$zastopaneGrupe = array();
|
|
|
|
echo '<div class="floatLeft" style="width:auto !important"><ul id="sortable" style="width:auto !important;">';
|
|
foreach ( $settingsArray as $opcija ) {
|
|
// preverimo ali je nova grupa
|
|
if ((!isset($opcija['header_grupa']) && $grupaName != "") || // nismo več v grupi stara še obstaja
|
|
( isset($opcija['header_grupa']) && $grupaName != "" && $opcija['header_grupa'] != $grupaName)) { // smo v grupi ampak ime ni enako prejšnjemu
|
|
echo '</ul>';
|
|
echo '</div>';
|
|
echo '<div class="clr"></div>';
|
|
echo '</li>';
|
|
$grupaName = "";
|
|
}
|
|
// preverimo ali naredimo novo grupo (Vnesel / urejal)
|
|
if (isset($opcija['header_grupa']) && $grupaName == "") { // smo v grupi polj pod in imamo podpolja: ime priimek, email, datum
|
|
// imamo začtek grupe
|
|
echo '<li class="sortable_group">';
|
|
echo '<div style="width:20px; float:left;">';
|
|
echo '<img class="parent movable" src="'.$site_url.'admin/survey/icons/icons/move_updown.png" alt="move" vartical-align="middle" />';
|
|
echo '</div>';
|
|
echo '<div id="group_holder" style="float:left;">';
|
|
echo '<ul id="sortableGroup" name="'.$opcija['header_grupa'].'">';
|
|
$grupaName = $opcija['header_grupa'];
|
|
$zastopaneGrupe[] = $opcija['header_grupa'];
|
|
}
|
|
if (!isset($opcija['header_grupa'])) {
|
|
echo '<li id="'.$opcija['id'].'" class="sortable_noGroup"><span class="">';
|
|
echo '<img class="parent movable" src="'.$site_url.'admin/survey/icons/icons/move_updown.png" alt="move" vartical-align="middle" />';
|
|
// ?e je viden ali ?e je id = 1 (ime ankete) potem dodamo checkbox (imena ankete ne moremo izklju?it)
|
|
echo '<input name="sl_fields" id="sl_fields_'.$opcija['id'].'" value="'.$opcija['id'].'" type="checkbox" '.($opcija['visible'] == 1 || $opcija['id'] == 1 ? 'checked="checked"':'').' '.($opcija['id'] == 1 ? 'disabled="disabled"':'').'>';
|
|
echo $lang['srv_h_'.$opcija['header_field']];
|
|
echo '</span>';
|
|
echo '</li>';
|
|
} else {
|
|
echo '<li id="'.$opcija['id'].'" class="sortable_noGroup"><span class="">';
|
|
echo '<img class="sub_child movable" src="'.$site_url.'admin/survey/icons/icons/move_updown.png" alt="move" vartical-align="middle" />';
|
|
// ?e je viden ali ?e je id = 1 (ime ankete) potem dodamo checkbox (imena ankete ne moremo izklju?it)
|
|
echo '<input name="sl_fields" id="sl_fields_'.$opcija['id'].'" value="'.$opcija['id'].'" type="checkbox" '.($opcija['visible'] == 1 || $opcija['id'] == 1 ? 'checked="checked"':'').' '.($opcija['id'] == 1 ? 'disabled="disabled"':'').'>';
|
|
echo $lang['srv_'.$opcija['header_grupa']]. " - ";
|
|
echo $lang['srv_h_'.$opcija['header_field']];
|
|
echo '</span>';
|
|
echo '</li>';
|
|
}
|
|
}
|
|
// na koncu ?e preverimo ali imamo kon?ano grupo ?ene nardimo zaključna diva
|
|
if ($grupaName != "") {
|
|
echo '</ul>';
|
|
echo '</div>';
|
|
echo '<div class="clr"></div>';
|
|
|
|
echo '</li>';
|
|
$grupaName = "";
|
|
}
|
|
|
|
echo '</ul></div>';
|
|
|
|
echo '<div class="floatRight sl_div_error_holder" style="margin-right:10px; width:420px;">';
|
|
echo '<div id="div_error" class="red sl_div_error"><img src="icons/icons/error.png" alt="" vartical-align="middle" />'.$lang['srv_sl_error_msg'].'</div>';
|
|
echo '<div style="margin-top:20px;">'.$lang['srv_sl_setting_show'].'<input id="rows_per_page" value="'.$this->rec_per_page.'" type="text" />'.$lang['srv_sl_setting_records'];
|
|
echo '</div>';
|
|
echo '<div style="margin-top:20px;">';
|
|
echo ' <div class="floatLeft spaceRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="default_surveyListSettings(); return false;"><span><img src="'.$site_url.'admin/survey/icons/icons/page_white_gear.png" alt="" vartical-align="middle" />'.$lang['srv_default'].'</span></a></div></div>';
|
|
echo ' <div class="floatLeft spaceRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_gray" href="#" onclick="cancle_surveyListSettings(); return false;"><span><img src="'.$site_url.'admin/survey/icons/icons/cog_back.png" alt="" vartical-align="middle" />'.$lang['srv_cancel'].'</span></a></div></div>';
|
|
echo ' <div class="floatLeft spaceRight"><div class="buttonwrapper"><a class="ovalbutton ovalbutton_orange" href="#" onclick="save_surveyListSettings(); return false;"><span><img src="'.$site_url.'admin/survey/icons/icons/cog_save.png" alt="" vartical-align="middle" />'.$lang['save'].'</span></a></div></div>';
|
|
echo '<div class="clr"></div>';
|
|
echo '</div>';
|
|
echo '</div>';
|
|
|
|
echo '<div class="clr"></div>';
|
|
echo '</div>';
|
|
echo '<script type="text/javascript">';
|
|
// echo '$(function() {';
|
|
echo '$(document).ready(function() {';
|
|
echo '$("#sortable").sortable({ axis: "y", handle: "img.parent"}).stop();';
|
|
// echo '$("#sortable").disableSelection();';
|
|
foreach ( $zastopaneGrupe as $grupa ) {
|
|
echo '$("[name='.$grupa.']").sortable({ axis: "y", handle: "img.sub_child", zIndex: 5 }).stop();';
|
|
}
|
|
// $("#sortableGroup").sortable();
|
|
// $("#sortableGroup").disableSelection();
|
|
|
|
echo '})';
|
|
echo '</script>';
|
|
}
|
|
|
|
public function displayListQickInfo() {
|
|
# prikažemo hitri povzetek anket uporabnika
|
|
|
|
# preštejemo zadnje ankete v 12 urah
|
|
$ank1hour = "SELECT id FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND sa.active >= 0 AND invisible = '0' AND (sa.insert_time > (DATE_SUB(CURDATE(), INTERVAL 1 HOUR)) || sa.edit_time > (DATE_SUB(CURDATE(), INTERVAL 1 HOUR)) ) ".$this->getDostopAnketa();
|
|
$ank12hour = "SELECT id FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND sa.active >= 0 AND invisible = '0' AND (sa.insert_time > (DATE_SUB(CURDATE(), INTERVAL 12 HOUR)) || sa.edit_time > (DATE_SUB(CURDATE(), INTERVAL 12 HOUR)) ) ".$this->getDostopAnketa();
|
|
$ank24hour = "SELECT id FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND sa.active >= 0 AND invisible = '0' AND (sa.insert_time > (DATE_SUB(CURDATE(), INTERVAL 24 HOUR)) || sa.edit_time > (DATE_SUB(CURDATE(), INTERVAL 23 HOUR)) ) ".$this->getDostopAnketa();
|
|
|
|
$qry1hour = sisplet_query($ank1hour);
|
|
$qry12hour = sisplet_query($ank12hour);
|
|
$qry24hour = sisplet_query($ank24hour);
|
|
|
|
$cnt1hour = mysqli_num_rows($qry1hour);
|
|
$cnt12hour = mysqli_num_rows($qry12hour);
|
|
$cnt24hour = mysqli_num_rows($qry24hour);
|
|
|
|
|
|
}
|
|
|
|
|
|
// Vrne stevilo vseh anket
|
|
public function countSurveys() {
|
|
return count($this->surveys_ids);
|
|
}
|
|
|
|
// Vrne stevilo vseh anket v rootu (ce imamo folderje)
|
|
public function countRootSurveys() {
|
|
global $global_user_id;
|
|
|
|
// Poiscemo vse ankete v custom folderjih
|
|
$sql = sisplet_query("SELECT ank_id FROM srv_mysurvey_anketa WHERE usr_id='$global_user_id'");
|
|
|
|
// Vrnemo razliko v stevilu anket (odstejemo ankete v custom folderjih)
|
|
$survey_count = count($this->surveys_ids);
|
|
if(mysqli_num_rows($sql) > 0)
|
|
$survey_count -= mysqli_num_rows($sql);
|
|
|
|
return $survey_count;
|
|
}
|
|
|
|
/** Anketam ki so potekle popravimo aktivnost
|
|
*
|
|
*/
|
|
public function checkSurveyExpire() {
|
|
//v primeru maza moramo sporociti vsem aplikacijam deaktivacijo ankete
|
|
if(Common::checkModule('maza')){
|
|
$maza = new MAZA();
|
|
$maza -> maza_check_expired_surveys();
|
|
}
|
|
|
|
# Anketam ki so potekle popravimo aktivnost
|
|
sisplet_query("UPDATE srv_anketa SET active = '0' WHERE active = '1' AND expire < CURDATE()");
|
|
// vsilimo refresh podatkov
|
|
SurveyInfo :: getInstance()->resetSurveyData();
|
|
}
|
|
|
|
/** GETERS && SETTERS **/
|
|
/* GETERS */
|
|
private function getParentFolder() { return $this->parentFolder; }
|
|
private function getCurrentFolder() { return $this->currentFolder; }
|
|
public function getDef_Rows_per_page() { return SRV_LIST_REC_PER_PAGE; }
|
|
|
|
/** vrne sql pogoj za folderje na podlagi trenutnega folderja */
|
|
private function getFolderCondition () {
|
|
if ($this->folderCondition == null) {
|
|
$resultString = " AND 0";
|
|
#$this->folders = array();
|
|
$folderArray = $this->getFolderTreeAsArray($this->getCurrentFolder());
|
|
if ( count( $folderArray ) > 0) {
|
|
$prefix="";
|
|
$resultString = " AND sa.folder IN (";
|
|
foreach ($folderArray as $fid => $fname) {
|
|
$resultString .= $prefix.$fid;
|
|
$prefix=",";
|
|
}
|
|
$resultString .=") ";
|
|
}
|
|
$this->folderCondition = $resultString;
|
|
}
|
|
return $this->folderCondition;
|
|
}
|
|
|
|
/** vrne array z folderjem in subfolderji (če je SRV_LIST_GET_SUB_FOLDERS = true) */
|
|
function getFolderTreeAsArray($parent) {
|
|
# če ni dodan parent ga dodamo
|
|
if (!isset($this->folders[$parent])) {
|
|
$parentSql = sisplet_query('SELECT id, naslov FROM srv_folder WHERE id="'.$parent.'";');
|
|
if (mysqli_num_rows($parentSql)>0) {
|
|
$rowParent = mysqli_fetch_assoc($parentSql);
|
|
$this->folders[$rowParent['id']] = $rowParent['naslov'];
|
|
}
|
|
}
|
|
if (SRV_LIST_GET_SUB_FOLDERS || $parent == 0) {
|
|
$result = sisplet_query('SELECT id, naslov FROM srv_folder WHERE parent="'.$parent.'";');
|
|
while ($row = mysqli_fetch_array($result)) {
|
|
$this->folders[$row['id']] = $row['naslov'];
|
|
$this->getFolderTreeAsArray($row['id']);
|
|
}
|
|
}
|
|
return $this->folders;
|
|
}
|
|
|
|
/** vrne sql pogoj za ankete v moji knjiznici na podlagi trenutnega folderja */
|
|
private function getLibraryCondition () {
|
|
|
|
if ($this->currentLibrary == null) {
|
|
$resultString = '';
|
|
}
|
|
else{
|
|
$children = array();
|
|
$children = $this->getLibraryChildren($this->currentLibrary, $children);
|
|
|
|
$childrenString = '';
|
|
if(!empty($children))
|
|
$childrenString = ','.implode(',', $children);
|
|
|
|
//$resultString = " AND sla.ank_id=sa.id AND sla.folder='".$this->currentLibrary."'";
|
|
$resultString = " AND sla.ank_id=sa.id AND sla.folder IN (".$this->currentLibrary . $childrenString.")";
|
|
}
|
|
|
|
$this->libraryCondition = $resultString;
|
|
|
|
return $this->libraryCondition;
|
|
}
|
|
|
|
private function getLibraryChildren($folder_id, $children){
|
|
|
|
// Pridobimo vse childe
|
|
$sql = sisplet_query("SELECT id, parent FROM srv_library_folder WHERE parent='".$folder_id."'");
|
|
|
|
// Izstopni pogoj
|
|
if(mysqli_num_rows($sql) == 0)
|
|
return ($children);
|
|
|
|
while($row = mysqli_fetch_array($sql)){
|
|
$children[] = $row['id'];
|
|
$children2 = $this->getLibraryChildren($row['id'], $children);
|
|
|
|
$children = array_merge($children, $children2);
|
|
}
|
|
|
|
return array_unique($children);
|
|
}
|
|
|
|
/** vrne sql string za omejevanje dostopa uporabniku */
|
|
function getLanguageLimit() {
|
|
global $global_admin_type;
|
|
|
|
if ((int)$this->lang_id > 0) {
|
|
return " AND lang_admin ='".(int)$this->lang_id."'";
|
|
}
|
|
}
|
|
|
|
/** vrne sql string za omejevanje dostopa uporabniku */
|
|
function getDostopAnketa() {
|
|
global $global_admin_type;
|
|
global $global_user_id;
|
|
|
|
if ($this->dostopCondition == null) {
|
|
// posebej za managerje, ki vidijo ankete svojih uporabnikov
|
|
$manage = '';
|
|
|
|
#generalni dostop glede na tip uporabnikov --> $admin_type <= $row['dostop']
|
|
# posebej dostop za vsazga userja posebej --> sisplet_query("SELECT * FROM srv_dostop WHERE ank_id = '$anketa' AND uid='$uid'") -> if (mysqli_num_rows($sql) > 0)
|
|
if ($this->user_id == null) {
|
|
if ($this->g_adminType == 1 || $this->g_adminType == 0)
|
|
$manage = " OR uid IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT user FROM srv_dostop_manage WHERE manager = '".$this->g_uid."' ")).") ";
|
|
|
|
$this->dostopCondition = (SRV_LIST_CHECK_DOSTOP ? " AND (sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop WHERE uid='".$this->g_uid."' $manage"))."))" : "");
|
|
}
|
|
else {
|
|
if ($this->g_adminType == 1 || $this->g_adminType == 0)
|
|
$manage = " OR uid IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT user FROM srv_dostop_manage WHERE manager = '".$this->g_uid."'")).") ";
|
|
|
|
$this->dostopCondition = (SRV_LIST_CHECK_DOSTOP ? " AND (insert_uid = '".$this->user_id."') AND (sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop WHERE uid='".$this->g_uid."' $manage"))."))" : "");
|
|
}
|
|
|
|
# če ni admin odstranimo ankete kjer je uporabnik označen samo kot anketar
|
|
if ( true /*$this->g_adminType != '0'*/ ) {
|
|
$this->dostopCondition .= " AND sa.id".($this->onlyPhone == false ? " NOT":"")." IN"
|
|
." (SELECT ank_id FROM srv_dostop AS sd WHERE sd.aktiven = '1' AND sd.uid = '$this->g_uid' AND FIND_IN_SET('phone',sd.dostop )>0 AND FIND_IN_SET('edit',sd.dostop ) = 0) ";
|
|
}
|
|
else {
|
|
}
|
|
}
|
|
|
|
|
|
// meta admin vidi kao spet vse
|
|
if ( Dostop::isMetaAdmin() ) {
|
|
|
|
if ($this->user_id == null) {
|
|
$this->dostopCondition = (SRV_LIST_CHECK_DOSTOP ? " AND (sa.dostop >= '".$this->g_adminType."' OR sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop WHERE uid='".$this->g_uid."' $manage"))."))" : "");
|
|
}
|
|
// filtriranje
|
|
else {
|
|
$manage = " OR uid IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT user FROM srv_dostop_manage WHERE manager = '".$this->g_uid."'")).") ";
|
|
$this->dostopCondition = (SRV_LIST_CHECK_DOSTOP ? " AND (insert_uid = '".$this->user_id."') AND (sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop WHERE uid='".$this->g_uid."' $manage"))."))" : "");
|
|
}
|
|
|
|
// Včasih se za meta admina nekaj porusi in ne prikaze nobene ankete...
|
|
//$this->dostopCondition = '';
|
|
}
|
|
|
|
return $this->dostopCondition;
|
|
}
|
|
|
|
/** vrne order string za SQL s katerim sortiramo */
|
|
private function getOrderString() {
|
|
|
|
if (!isset($this->sortby) || (int)$this->sortby == 0) {
|
|
$this->sortby = SRV_LIST_ORDER_BY;
|
|
}
|
|
|
|
if (isset($this->order_by_options[$this->sortby])) {
|
|
$order_by = $this->order_by_options[$this->sortby];
|
|
} else {
|
|
$order_by = $this->order_by_options[SRV_LIST_ORDER_BY];
|
|
}
|
|
|
|
// UPPER damo, ker drugace sortira najprej vlke crke potem pa male
|
|
if($this->sortby == 1 || $this->sortby == 7 || $this->sortby == 11){
|
|
// Zamenjamo nacin sortiranja pri besedilu (drugace zacnemo od zadaj)
|
|
$sorttype = ($this->sorttype == 1) ? 2 : 1;
|
|
$result = " ORDER BY upper(" . $order_by . ") " . $this->sort_types_options[$sorttype];
|
|
}
|
|
// Dodamo opcije sortiranja pri statusu (18), ker ni dovolj sortiranje po "expired"
|
|
elseif($this->sortby == 18){
|
|
$sorttypeReverse = ($this->sorttype == 1) ? 2 : 1;
|
|
$result = " ORDER BY
|
|
sa.active ".$this->sort_types_options[$this->sorttype].",
|
|
(SELECT IF(COUNT(sac.sid) > 0, 1, 0) FROM srv_activity sac WHERE sac.sid=sa.id) ".$this->sort_types_options[$this->sorttype].",
|
|
".$order_by." ".$this->sort_types_options[$sorttypeReverse];
|
|
}
|
|
else
|
|
$result = " ORDER BY " . $order_by . " ".$this->sort_types_options[$this->sorttype];
|
|
|
|
return $result;
|
|
}
|
|
|
|
/** vrne Limit string za SQL s katerim prika?emo posamezno stran */
|
|
private function getLimitString() {
|
|
$result = " LIMIT " . ($this->pageno * $this->rec_per_page - $this->rec_per_page) . ", " . $this->rec_per_page;
|
|
return $result;
|
|
}
|
|
|
|
// vrne sql string za search po anketah glede na nastavitve searcha
|
|
private function getSearchString(){
|
|
|
|
$search_text = mysqli_real_escape_string($GLOBALS['connect_db'], $this->searchString);
|
|
$search_text = stripslashes(stripslashes($search_text));
|
|
|
|
// Vse gre v lowerstring
|
|
$search_text = strtolower($search_text);
|
|
|
|
// Ce gre za string v narekovajih
|
|
if($search_text[0] == '"' && $search_text[strlen($search_text) - 1] == '"'){
|
|
$search_text = trim($search_text, '"');
|
|
$this->searchStringProcessed[] = $search_text;
|
|
$search_text = '%'.$search_text.'%';
|
|
}
|
|
else{
|
|
// Sklanjamo po search besedi - ce gre za search po naslovu ali kljucnih besedah
|
|
if ($this->searchSettings['stype'] == '0' || $this->searchSettings['stype'] == '2') {
|
|
|
|
// odstrani vse zvezdice in pluse in skrajsaj besede za dva znaka, dodaj *.
|
|
$search_text = explode (" ", $search_text);
|
|
|
|
for ($a=0; $a<sizeof($search_text); $a++) {
|
|
if (strlen ($search_text[$a]) > 5)
|
|
$search_text[$a] = substr ($search_text[$a], 0, -2);
|
|
elseif (strlen ($search_text[$a]) > 2)
|
|
$search_text[$a] = substr ($search_text[$a], 0, -1);
|
|
else
|
|
$search_text[$a] = $search_text[$a];
|
|
|
|
$this->searchStringProcessed[$a] = $search_text[$a];
|
|
$search_text[$a] = '%'.$search_text[$a].'%';
|
|
}
|
|
|
|
$search_text = implode(" ", $search_text);
|
|
}
|
|
else{
|
|
$this->searchStringProcessed[] = $search_text;
|
|
$search_text = '%'.$search_text.'%';
|
|
}
|
|
}
|
|
|
|
// Search po avtorju
|
|
if($this->searchSettings['stype'] == '1'){
|
|
$result = " AND (i_name LIKE '".$search_text."' OR i_surname LIKE '".$search_text."' OR i_email LIKE '".$search_text."')";
|
|
}
|
|
// Search po kljucnih besedah znotraj vprasanj (naslovi vprasanj in vrednosti)
|
|
elseif($this->searchSettings['stype'] == '2'){
|
|
$result = " AND (LOWER(introduction) LIKE LOWER('".$search_text."')
|
|
OR LOWER(conclusion) LIKE LOWER('".$search_text."')
|
|
OR LOWER(ss.naslov) LIKE LOWER('".$search_text."')
|
|
OR LOWER(sv.naslov) LIKE LOWER('".$search_text."'))";
|
|
}
|
|
// Search po naslovu
|
|
else{
|
|
$result = " AND (LOWER(sa.naslov) LIKE LOWER('".$search_text."') OR LOWER(sa.akronim) LIKE LOWER('".$search_text."') OR LOWER(nl.link) LIKE LOWER('".$search_text."'))";
|
|
}
|
|
|
|
// Search po statusu (aktivne, neaktivne)
|
|
if($this->searchSettings['sstatus'] == '1')
|
|
$result .= " AND active > '0'";
|
|
if($this->searchSettings['sstatus'] == '2')
|
|
$result .= " AND active = '0'";
|
|
|
|
// Search po datumu ustvarjanja (od)
|
|
if($this->searchSettings['sidatefrom'] != ''){
|
|
$date = date('Y-m-d H:i:s', strtotime($this->searchSettings['sidatefrom']));
|
|
$result .= " AND insert_time >= '".$date."'";
|
|
}
|
|
// Search po datumu ustvarjanja (do)
|
|
if($this->searchSettings['sidateto'] != ''){
|
|
$date = date('Y-m-d H:i:s', strtotime($this->searchSettings['sidateto']));
|
|
$result .= " AND insert_time <= '".$date."'";
|
|
}
|
|
|
|
// Search po datumu zadnjega urejanja (od)
|
|
if($this->searchSettings['sedatefrom'] != ''){
|
|
$date = date('Y-m-d H:i:s', strtotime($this->searchSettings['sedatefrom']));
|
|
$result .= " AND edit_time >= '".$date."'";
|
|
}
|
|
// Search po datumu zadnjega urejanja (do)
|
|
if($this->searchSettings['sedateto'] != ''){
|
|
$date = date('Y-m-d H:i:s', strtotime($this->searchSettings['sedateto']));
|
|
$result .= " AND edit_time <= '".$date."'";
|
|
}
|
|
|
|
// Dodaten search po avtorju samo za metaadmine
|
|
if($this->searchSettings['onlyAuthor'] != ''){
|
|
$onlyAuthorString = mysqli_real_escape_string($GLOBALS['connect_db'], $this->searchSettings['onlyAuthor']);
|
|
$onlyAuthorString = stripslashes(stripslashes($onlyAuthorString));
|
|
|
|
$result .= " AND (i_name LIKE '%".$onlyAuthorString."%'
|
|
OR i_surname LIKE '%".$onlyAuthorString."%'
|
|
OR i_email LIKE '%".$onlyAuthorString."%')";
|
|
}
|
|
|
|
return $result;
|
|
}
|
|
|
|
// Dobimo vse parametri searcha
|
|
private function getSearchParams(){
|
|
global $site_url;
|
|
|
|
$params = '';
|
|
|
|
if($this->isSearch == 1){
|
|
$params .= 'search='.urlencode($this->searchString);
|
|
|
|
if(!empty($this->searchSettings)){
|
|
foreach($this->searchSettings as $key => $val){
|
|
$params .= '&'.$key.'='.urlencode($val);
|
|
}
|
|
}
|
|
}
|
|
|
|
return $params;
|
|
}
|
|
|
|
|
|
/**
|
|
* shranimo širine celic
|
|
*/
|
|
public function saveCssSettings($data) {
|
|
$new_data = array();
|
|
if (isset($data) && $data != null) {
|
|
$new_data = $this->getCssSetings();
|
|
// nato popravimo vrednost
|
|
$_tmp_new_data = array_unique(explode(",",$data));
|
|
$new_data[$_tmp_new_data[0]] = $_tmp_new_data[1];
|
|
// nato zdru?imo v primerno obliko in shranimo
|
|
$saveString = "";
|
|
$saveStringPrefix = "";
|
|
if (isset($new_data) && $new_data != null && count($new_data) > 0) {
|
|
foreach ( $new_data as $tmp_new_key => $tmp_new_data ) {
|
|
$saveString .= $saveStringPrefix.$tmp_new_key.",".$tmp_new_data;
|
|
$saveStringPrefix = ";";
|
|
}
|
|
}
|
|
UserSetting::getInstance()->setUserSetting('survey_list_widths', $saveString);
|
|
} else {
|
|
UserSetting::getInstance()->setUserSetting('survey_list_widths', "");
|
|
}
|
|
// shranimo
|
|
UserSetting::getInstance()->saveUserSetting('survey_list_widths', $saveString);
|
|
}
|
|
/* SETERS */
|
|
private function setParentFolder($parentFolder = 0) { $this->parentFolder = $parentFolder; }
|
|
private function setCurrentFolder($currentFolder = 0) { $this->currentFolder = $currentFolder; }
|
|
|
|
private function UpdateSystemLibrary () {
|
|
global $lang, $site_url;
|
|
|
|
$anketa = $_POST['anketa'];
|
|
|
|
echo '<a href="/" onclick="surveyList_knjiznica(\''.$anketa.'\'); return false;">';
|
|
|
|
$sql = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='0'");
|
|
if (mysqli_num_rows($sql) == 0) {
|
|
$sql1 = sisplet_query("SELECT * FROM srv_library_folder WHERE uid='0' AND tip='1' AND parent='0' AND lang='$lang[id]'");
|
|
$row1 = mysqli_fetch_array($sql1);
|
|
sisplet_query("INSERT INTO srv_library_anketa (ank_id, uid, folder) VALUES ('$anketa', '0', '$row1[id]')");
|
|
echo '<span class="sprites library_admin_on" title="'.$lang['srv_ank_lib_on'].'"></span>';
|
|
} else {
|
|
sisplet_query("DELETE FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='0'");
|
|
echo '<span class="sprites library_admin_off" title="'.$lang['srv_ank_lib_off'].'"></span>';
|
|
}
|
|
|
|
echo '</a>';
|
|
}
|
|
|
|
private function UpdateUserLibrary () {
|
|
global $global_user_id, $site_url, $lang;
|
|
|
|
$anketa = $_POST['anketa'];
|
|
|
|
echo '<a href="/" onclick="surveyList_myknjiznica(\''.$anketa.'\'); return false;">';
|
|
|
|
$sql = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='$global_user_id'");
|
|
if (mysqli_num_rows($sql) > 0) {
|
|
sisplet_query("DELETE FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='$global_user_id'");
|
|
echo '<span class="sprites library_off" title="'.$lang['srv_ank_mylib_off'].'"></span>';
|
|
} else {
|
|
$sql1 = sisplet_query("SELECT * FROM srv_library_folder WHERE uid='$global_user_id' AND tip='1' AND parent='0'");
|
|
$row1 = mysqli_fetch_array($sql1);
|
|
sisplet_query("INSERT INTO srv_library_anketa (ank_id, uid, folder) VALUES ('$anketa', '$global_user_id', '$row1[id]')");
|
|
echo '<span class="sprites library_on" title="'.$lang['srv_ank_mylib_on'].'"></span>';
|
|
}
|
|
|
|
echo '</a>';
|
|
}
|
|
|
|
private function UpdateSystemLibraryNew () {
|
|
global $lang, $site_url;
|
|
|
|
$anketa = $_POST['anketa'];
|
|
|
|
$sql = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='0'");
|
|
|
|
if (mysqli_num_rows($sql) == 0) {
|
|
$sql1 = sisplet_query("SELECT * FROM srv_library_folder WHERE uid='0' AND tip='1' AND parent='0' AND lang='$lang[id]'");
|
|
$row1 = mysqli_fetch_array($sql1);
|
|
|
|
sisplet_query("INSERT INTO srv_library_anketa (ank_id, uid, folder) VALUES ('$anketa', '0', '$row1[id]')");
|
|
sisplet_query("UPDATE srv_survey_list SET lib_glb='1' WHERE id='$anketa'");
|
|
}
|
|
else {
|
|
sisplet_query("DELETE FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='0'");
|
|
sisplet_query("UPDATE srv_survey_list SET lib_glb='0' WHERE id='$anketa'");
|
|
}
|
|
}
|
|
|
|
private function UpdateUserLibraryNew () {
|
|
global $global_user_id, $site_url;
|
|
|
|
$anketa = $_POST['anketa'];
|
|
|
|
$sql = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='$global_user_id'");
|
|
|
|
if (mysqli_num_rows($sql) > 0) {
|
|
sisplet_query("DELETE FROM srv_library_anketa WHERE ank_id='$anketa' AND uid='$global_user_id'");
|
|
sisplet_query("UPDATE srv_survey_list SET lib_usr='0' WHERE id='$anketa'");
|
|
}
|
|
else {
|
|
$sql1 = sisplet_query("SELECT * FROM srv_library_folder WHERE uid='$global_user_id' AND tip='1' AND parent='0'");
|
|
$row1 = mysqli_fetch_array($sql1);
|
|
|
|
sisplet_query("INSERT INTO srv_library_anketa (ank_id, uid, folder) VALUES ('$anketa', '$global_user_id', '$row1[id]')");
|
|
sisplet_query("UPDATE srv_survey_list SET lib_usr='1' WHERE id='$anketa'");
|
|
}
|
|
}
|
|
|
|
private function DisplayInfo () {
|
|
global $global_user_id, $site_url;
|
|
|
|
$anketa = $_POST['anketa'];
|
|
SurveyInfo::getInstance()->SurveyInit($anketa);
|
|
|
|
SurveyInfo::DisplayInfoBox();
|
|
}
|
|
|
|
// ajax, ki poskrbi za vse update glelde razvrscanja mojih anket v folderje
|
|
private function updateMySurveyFolders(){
|
|
global $global_user_id, $site_url, $lang;
|
|
|
|
// Prenesli smo anketo v drug folder
|
|
if($_GET['a'] == 'survey_dropped'){
|
|
$parent = isset($_POST['parent']) ? $_POST['parent'] : '0';
|
|
$drag_survey = isset($_POST['drag_survey']) ? $_POST['drag_survey'] : '0';
|
|
|
|
// Ce smo spustili v root folder samo pobrisemo anketo
|
|
if($parent == '0'){
|
|
$sql = sisplet_query("DELETE FROM srv_mysurvey_anketa WHERE ank_id='".$drag_survey."' AND usr_id='$global_user_id'");
|
|
}
|
|
else{
|
|
// Razpremo parent folder
|
|
$sql = sisplet_query("UPDATE srv_mysurvey_folder SET open='1' WHERE id='".$parent."' AND usr_id='$global_user_id'");
|
|
|
|
$sql = sisplet_query("INSERT INTO srv_mysurvey_anketa (ank_id, usr_id, folder) VALUES ('".$drag_survey."', '".$global_user_id."', '".$parent."') ON DUPLICATE KEY UPDATE folder='".$parent."'");
|
|
}
|
|
}
|
|
|
|
// Prenesli smo celoten folder v drug folder
|
|
elseif($_GET['a'] == 'folder_dropped'){
|
|
$parent = isset($_POST['parent']) ? $_POST['parent'] : '0';
|
|
$drag_folder = isset($_POST['drag_folder']) ? $_POST['drag_folder'] : '0';
|
|
|
|
// Preverimo da nismo slucajno prenesli v child folder - ne pustimo, ker drugace se zadeva porusi
|
|
$sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE id='".$parent."' AND parent='".$drag_folder."' AND usr_id='$global_user_id'");
|
|
if(mysqli_num_rows($sql) == 0){
|
|
// Razpremo parent folder
|
|
$sql = sisplet_query("UPDATE srv_mysurvey_folder SET open='1' WHERE id='".$parent."' AND usr_id='$global_user_id'");
|
|
|
|
$sql = sisplet_query("UPDATE srv_mysurvey_folder SET parent='".$parent."' WHERE id='".$drag_folder."' AND usr_id='$global_user_id'");
|
|
}
|
|
}
|
|
|
|
// prikazemo/skrijemo ankete znotraj folderja
|
|
elseif($_GET['a'] == 'folder_toggle'){
|
|
$folder = isset($_POST['folder']) ? $_POST['folder'] : '0';
|
|
$open = isset($_POST['open']) ? $_POST['open'] : '0';
|
|
|
|
$sql = sisplet_query("UPDATE srv_mysurvey_folder SET open='".$open."' WHERE id='".$folder."' AND usr_id='$global_user_id'");
|
|
}
|
|
|
|
// Ustvarili smo nov folder
|
|
elseif($_GET['a'] == 'folder_create'){
|
|
$parent = isset($_POST['parent']) ? $_POST['parent'] : '0';
|
|
|
|
// Razpremo parent folder
|
|
$sql = sisplet_query("UPDATE srv_mysurvey_folder SET open='1' WHERE id='".$parent."' AND usr_id='$global_user_id'");
|
|
|
|
$sql = sisplet_query("INSERT INTO srv_mysurvey_folder (usr_id, parent, naslov) VALUES ('".$global_user_id."','".$parent."', '".$lang['srv_mySurvey_new_folder']."')");
|
|
|
|
$new_folder_id = mysqli_insert_id($GLOBALS['connect_db']);
|
|
|
|
$SL = new SurveyList();
|
|
$SL->getSurveys();
|
|
|
|
echo '<input type="hidden" id="new_added_folder" value="'.$new_folder_id.'">';
|
|
}
|
|
|
|
// Pobrisali smo obstojec folder
|
|
elseif($_GET['a'] == 'folder_delete'){
|
|
$folder = isset($_POST['folder']) ? $_POST['folder'] : '0';
|
|
|
|
//Pobrisemo ankete ki so bile znotraj folderja
|
|
$sql = sisplet_query("DELETE FROM srv_mysurvey_anketa WHERE folder='".$folder."' AND usr_id='$global_user_id'");
|
|
|
|
// Na koncu se pobrisemo prazen folder
|
|
$sql = sisplet_query("DELETE FROM srv_mysurvey_folder WHERE id='".$folder."' AND usr_id='$global_user_id'");
|
|
|
|
// Rekurzivno pobrisemo vse poddirektorije z anketami - TODO!!!
|
|
}
|
|
|
|
// Preimenovali smo obstojec folder
|
|
elseif($_GET['a'] == 'folder_rename'){
|
|
$folder = isset($_POST['folder']) ? $_POST['folder'] : '0';
|
|
$text = isset($_POST['text']) ? $_POST['text'] : '';
|
|
$text = strip_tags($text);
|
|
|
|
$sql = sisplet_query("UPDATE srv_mysurvey_folder SET naslov='".$text."' WHERE id='".$folder."' AND usr_id='$global_user_id'");
|
|
}
|
|
|
|
// Kopiramo obstojec folder z vsemi anketami
|
|
elseif($_GET['a'] == 'folder_copy'){
|
|
|
|
$folder = isset($_POST['folder']) ? $_POST['folder'] : '0';
|
|
if($folder > 0)
|
|
$this->copyMySurveyFolder($folder);
|
|
}
|
|
}
|
|
|
|
// Kopiramo obstojec folder z vsemi folderji in anketami (rekurzivno)
|
|
private function copyMySurveyFolder($folder_id, $parent=0){
|
|
global $global_user_id;
|
|
|
|
$sql = sisplet_query("SELECT * FROM srv_mysurvey_folder WHERE id='".$folder_id."' AND usr_id='".$global_user_id."'");
|
|
if(mysqli_num_rows($sql) == 0)
|
|
return;
|
|
|
|
$row = mysqli_fetch_array($sql);
|
|
|
|
// Najprej ustvarimo kopijo folderja
|
|
if($parent == 0)
|
|
$sql2 = sisplet_query("INSERT INTO srv_mysurvey_folder (usr_id, parent, naslov, open) VALUES ('".$global_user_id."', '".$row['parent']."', '".$row['naslov']."_copy', '1')");
|
|
else
|
|
$sql2 = sisplet_query("INSERT INTO srv_mysurvey_folder (usr_id, parent, naslov, open) VALUES ('".$global_user_id."', '".$parent."', '".$row['naslov']."_copy', '1')");
|
|
|
|
$new_folder_id = mysqli_insert_id($GLOBALS['connect_db']);
|
|
|
|
// Loop cez ankete v folderju
|
|
$sqlA = sisplet_query("SELECT * FROM srv_mysurvey_anketa WHERE folder='".$folder_id."'");
|
|
while($rowA = mysqli_fetch_array($sqlA)){
|
|
|
|
// Kopiramo anketo
|
|
$sas = new SurveyAdminSettings();
|
|
$ank_id = $sas->anketa_copy($rowA['ank_id']);
|
|
|
|
// Kopirano anketo vstavimo v nov folder
|
|
$sql2 = sisplet_query("INSERT INTO srv_mysurvey_anketa (ank_id, usr_id, folder) VALUES ('".$ank_id."', '".$global_user_id."', '".$new_folder_id."')");
|
|
}
|
|
|
|
// Na koncu rekurzivno kopiramo se vse notranje folderje
|
|
$sqlF = sisplet_query("SELECT id FROM srv_mysurvey_folder WHERE parent='".$folder_id."' AND usr_id='".$global_user_id."'");
|
|
while($rowF = mysqli_fetch_array($sqlF)){
|
|
|
|
$this->copyMySurveyFolder($rowF['id'], $new_folder_id);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
|
|
/** Funkcija ki kiče podfunkcije za ajax del
|
|
*
|
|
*/
|
|
public function Ajax() {
|
|
switch ( $_GET['a'] ) {
|
|
case 'surveyList_knjiznica':
|
|
$this->UpdateSystemLibrary();
|
|
break;
|
|
case 'surveyList_myknjiznica':
|
|
$this->UpdateUserLibrary();
|
|
break;
|
|
case 'surveyList_myknjiznica_new':
|
|
$this->UpdateUserLibraryNew();
|
|
break;
|
|
case 'surveyList_knjiznica_new':
|
|
$this->UpdateSystemLibraryNew();
|
|
break;
|
|
case 'surveyList_display_info':
|
|
$this->DisplayInfo();
|
|
break;
|
|
case 'survey_dropped':
|
|
case 'folder_dropped':
|
|
case 'folder_create':
|
|
case 'folder_delete':
|
|
case 'folder_toggle':
|
|
case 'folder_rename':
|
|
case 'folder_copy':
|
|
$this->updateMySurveyFolders();
|
|
break;
|
|
case 'language_change':
|
|
$this->switch_language();
|
|
break;
|
|
default:
|
|
print_r($_POST);
|
|
print_r($_GET);
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
/** Osveži datoteko z dodatnimi podatki anket
|
|
* za tiste ankete ki so bile spremenjene ali so imele kakšne vnose
|
|
*/
|
|
private function refreshData() {
|
|
|
|
# polovimo vse obstoječe podatke v združeni datoteki
|
|
if (count($this->surveys_ids)>0 ) {
|
|
|
|
// Metaadmin updata samo svoje ankete (drugace jih je prevec in lahko zasteka)
|
|
if(Dostop::isMetaAdmin()){
|
|
|
|
# polovimo seznam metaadminovih anket
|
|
$meta_surveys_ids = array();
|
|
$dostopCondition = (SRV_LIST_CHECK_DOSTOP ? " AND (insert_uid = '".$this->user_id."') AND (sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop WHERE uid='".$this->g_uid."'"))."))" : "");
|
|
$stringSurveyList = "SELECT id, backup, active, folder, dostop FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND sa.active >= 0 AND sa.invisible = '0' ".$dostopCondition;
|
|
$sqlSurveyList = sisplet_query($stringSurveyList);
|
|
while ( $rowSurveyList = mysqli_fetch_assoc($sqlSurveyList)) {
|
|
$meta_surveys_ids[$rowSurveyList['id']] = $rowSurveyList['id'];
|
|
}
|
|
|
|
$to_update = $meta_surveys_ids;
|
|
|
|
if(!empty($meta_surveys_ids)){
|
|
|
|
# poiščemmo katere ankete so OK, in jih odstranimo iz seznama anket potrebnih za update
|
|
$sqlSurveyList = sisplet_query("SELECT id
|
|
FROM srv_survey_list
|
|
WHERE id IN (".implode(',', $meta_surveys_ids).")
|
|
AND updated = '0' AND last_updated IS NOT NULL
|
|
");
|
|
while ( $rowSurveyList = mysqli_fetch_assoc($sqlSurveyList)) {
|
|
if (isset($to_update[$rowSurveyList['id']])) {
|
|
unset($to_update[$rowSurveyList['id']]);
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
else{
|
|
$to_update = $this->surveys_ids;
|
|
|
|
# poiščemmo katere ankete so OK, in jih odstranimo iz seznama anket potrebnih za update
|
|
$sqlSurveyList = sisplet_query("SELECT id
|
|
FROM srv_survey_list
|
|
WHERE id IN (".implode(',', $this->surveys_ids).")
|
|
AND updated = '0' AND last_updated IS NOT NULL
|
|
");
|
|
while ( $rowSurveyList = mysqli_fetch_assoc($sqlSurveyList)) {
|
|
if (isset($to_update[$rowSurveyList['id']])) {
|
|
unset($to_update[$rowSurveyList['id']]);
|
|
}
|
|
}
|
|
}
|
|
|
|
# če je treba kaj updejtat
|
|
if (count($to_update) > 0) {
|
|
$stringUpdateList =
|
|
" SELECT sa.id, "
|
|
|
|
. ' IF(ISNULL(sla1.lib_glb),0,sla1.lib_glb) AS lib_glb,'
|
|
. ' IF(ISNULL(sla2.lib_usr),0,sla2.lib_usr) AS lib_usr,'
|
|
|
|
. " us3.vnos_time_first AS v_time_first, us3.vnos_time_last AS v_time_last,"
|
|
. ' IF(ISNULL(us3.answers),0,us3.answers) as answers,'
|
|
. ' IF(ISNULL(g.variables),0,g.variables) as variables,'
|
|
. ' IF(ISNULL(us5.approp),0,us5.approp) as approp'
|
|
|
|
. ' FROM srv_anketa sa'
|
|
|
|
. " LEFT OUTER JOIN ( SELECT ank_id, uid, COUNT(*) AS lib_glb FROM srv_library_anketa as sla WHERE sla.uid = '0' AND sla.ank_id IN (".implode(',', $to_update).") GROUP BY ank_id )
|
|
AS sla1 ON sla1.ank_id = sa.id"
|
|
. " LEFT OUTER JOIN ( SELECT ank_id, uid, COUNT(*) AS lib_usr FROM srv_library_anketa as sla WHERE sla.uid = '".$this->g_uid."' AND sla.ank_id IN (".implode(',', $to_update).") GROUP BY ank_id )
|
|
AS sla2 ON sla2.ank_id = sa.id"
|
|
|
|
. ' LEFT OUTER JOIN ( SELECT us3.ank_id, COUNT(us3.ank_id) as answers, MIN( us3.time_insert ) as vnos_time_first, MAX( us3.time_insert ) as vnos_time_last, preview FROM srv_user as us3 WHERE us3.ank_id IN ('.implode(',', $to_update).') AND us3.preview = \'0\' AND us3.deleted=\'0\' AND us3.testdata=\'0\' AND (us3.last_status=\'5\' OR us3.last_status=\'6\') AND us3.lurker=\'0\' GROUP BY us3.ank_id )
|
|
AS us3 ON us3.ank_id = sa.id'
|
|
|
|
. ' LEFT OUTER JOIN ( SELECT g.ank_id, COUNT(s.gru_id) as variables FROM srv_grupa g, srv_spremenljivka s WHERE g.id = s.gru_id AND g.ank_id IN ('.implode(',', $to_update).') GROUP BY g.ank_id )
|
|
AS g ON g.ank_id = sa.id'
|
|
|
|
. ' LEFT OUTER JOIN ( SELECT us5.ank_id, COUNT(us5.ank_id) as approp, preview FROM srv_user as us5 WHERE last_status IN (' . $this->appropriateStatus . ') AND us5.ank_id IN ('.implode(',', $to_update).') AND us5.preview =\'0\' AND us5.deleted=\'0\' GROUP BY us5.ank_id )
|
|
AS us5 ON us5.ank_id = sa.id'
|
|
|
|
. ' WHERE sa.id IN ('.implode(',', $to_update).')';
|
|
|
|
$sqlUpdateList = sisplet_query($stringUpdateList);
|
|
if (!$sqlUpdateList) echo mysqli_error($GLOBALS['connect_db']);
|
|
|
|
if (mysqli_num_rows($sqlUpdateList) > 0) {
|
|
|
|
// Po novem zakesiramo podatke iz tabele "users" posebej (da ne zaklene zgornji query tabele za dalj casa)
|
|
$users = array();
|
|
$sqlUsers = sisplet_query("SELECT sa.id AS ank_id, sa.edit_uid, us1.name AS e_name, us1.surname AS e_surname, us1.email AS e_email,
|
|
sa.insert_uid, us2.name AS i_name, us2.surname AS i_surname, us2.email AS i_email
|
|
FROM srv_anketa sa
|
|
LEFT OUTER JOIN users AS us1 ON us1.id = sa.edit_uid
|
|
LEFT OUTER JOIN users AS us2 ON us2.id = sa.insert_uid
|
|
WHERE sa.id IN (".implode(',', $to_update).")");
|
|
while($rowUsers = mysqli_fetch_array($sqlUsers)){
|
|
$users[$rowUsers['ank_id']] = $rowUsers;
|
|
}
|
|
|
|
$values = array();
|
|
while ( $row = mysqli_fetch_assoc($sqlUpdateList)) {
|
|
|
|
$row['i_name'] = mysqli_real_escape_string($GLOBALS['connect_db'], $users[$row['id']]['i_name']);
|
|
$row['i_surname'] = mysqli_real_escape_string($GLOBALS['connect_db'], $users[$row['id']]['i_surname']);
|
|
$row['i_email'] = mysqli_real_escape_string($GLOBALS['connect_db'], $users[$row['id']]['i_email']);
|
|
$row['e_name'] = mysqli_real_escape_string($GLOBALS['connect_db'], $users[$row['id']]['e_name']);
|
|
$row['e_surname'] = mysqli_real_escape_string($GLOBALS['connect_db'], $users[$row['id']]['e_surname']);
|
|
$row['e_email'] = mysqli_real_escape_string($GLOBALS['connect_db'], $users[$row['id']]['e_email']);
|
|
|
|
$values[] = "('$row[id]','$row[lib_glb]','$row[lib_usr]','$row[answers]','$row[variables]','$row[approp]','$row[i_name]','$row[i_surname]','$row[i_email]','$row[e_name]','$row[e_surname]','$row[e_email]','$row[v_time_first]','$row[v_time_last]','0', NOW())";
|
|
}
|
|
|
|
$updateString = "INSERT INTO srv_survey_list (id, lib_glb, lib_usr, answers, variables, approp, i_name, i_surname, i_email, e_name, e_surname, e_email, a_first, a_last, updated, last_updated) "
|
|
." VALUES ".implode(',', $values)." ON DUPLICATE KEY UPDATE id=VALUES(id), lib_glb=VALUES(lib_glb), lib_usr=VALUES(lib_usr), answers=VALUES(answers), variables=VALUES(variables), approp=VALUES(approp), i_name=VALUES(i_name), i_surname=VALUES(i_surname), i_email=VALUES(i_email), e_name=VALUES(e_name), e_surname=VALUES(e_surname), e_email=VALUES(e_email), a_first=VALUES(a_first), a_last=VALUES(a_last), updated='0', last_updated=NOW()";
|
|
|
|
sisplet_query($updateString);
|
|
|
|
}
|
|
sisplet_query("COMMIT");
|
|
}
|
|
}
|
|
|
|
# polovimo nastavitve uporabnika
|
|
$this->settingsArray = $this->getSettings();
|
|
|
|
|
|
# koliko imamo strani
|
|
$this->max_pages = (int)$this->rec_per_page > 0 ? ceil($this->countSurveys() / $this->rec_per_page) : 1;
|
|
|
|
# ce imamo direktorije, imamo manj strani zaradi anket v direktorijih
|
|
if($this->show_folders == 1 && $this->max_pages > 1){
|
|
$this->max_pages = ceil($this->countRootSurveys() / $this->rec_per_page);
|
|
}
|
|
|
|
# katera je trenutna stran
|
|
if (isset($_GET['pageno']) && (int)$_GET['pageno'] > 0) {
|
|
# izbrana stran ne more biti večja, kot pa imamo vseh strani
|
|
$this->pageno = min((int)$_GET['pageno'], $this->max_pages );
|
|
}
|
|
}
|
|
|
|
function setFilter() {
|
|
if (isset($_POST['sl_filter']) && trim($_POST['sl_filter']) != "") {
|
|
$this->filter = trim($_POST['sl_filter']);
|
|
}
|
|
}
|
|
|
|
public function countPhoneSurveys() {
|
|
# če ni admin odstranimo ankete kjer je uporabnik označen samo kot anketar
|
|
|
|
$stringSurveyList = "SELECT count(*) FROM srv_anketa sa WHERE sa.backup='0' AND sa.id > 0 AND sa.active >= 0 AND sa.invisible = '0' "
|
|
.$this->getFolderCondition();
|
|
if ($this->g_adminType != '0') {
|
|
$stringSurveyList .= " AND sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop AS sd WHERE sd.aktiven = '1' AND sd.uid = '$this->g_uid' AND FIND_IN_SET('phone',sd.dostop )>0 AND FIND_IN_SET('edit',sd.dostop ) = 0")).")";
|
|
} else {
|
|
$stringSurveyList .= " AND sa.id IN (".SurveyCopy::prepareSubquery(sisplet_query("SELECT ank_id FROM srv_dostop AS sd WHERE sd.aktiven = '1' AND FIND_IN_SET('phone',sd.dostop )>0 AND FIND_IN_SET('edit',sd.dostop ) = 0")).")";
|
|
}
|
|
|
|
$sqlSurveyList = sisplet_query($stringSurveyList);
|
|
[$count] = mysqli_fetch_row($sqlSurveyList);
|
|
|
|
return (int)$count;
|
|
}
|
|
|
|
// Preklopimo jezik
|
|
private function switch_language(){
|
|
global $global_user_id;
|
|
|
|
$lang = $_POST['lang'];
|
|
|
|
sisplet_query("UPDATE users SET lang = '$lang' WHERE id = '$global_user_id'");
|
|
}
|
|
}
|
|
?>
|