diff options
Diffstat (limited to 'admin/survey/classes/class.Library.php')
-rw-r--r-- | admin/survey/classes/class.Library.php | 722 |
1 files changed, 291 insertions, 431 deletions
diff --git a/admin/survey/classes/class.Library.php b/admin/survey/classes/class.Library.php index a509fcc..8e3538e 100644 --- a/admin/survey/classes/class.Library.php +++ b/admin/survey/classes/class.Library.php @@ -5,8 +5,6 @@ class Library { var $Branching;
var $tab = 2; // tab pove kater tab je odprt (od 4ih)
- var $tip = 1; // tip pove v bazi srv_library_folder za kater tip gre (0-vpra�anja, 1-ankete)
- var $prva = 0; // prva pove, ce je to library na prvi strani (1) ali v urejanju ankete (0)
// v odvisnosti od mode prilagajamu UI. (Mode je odvisen od tipa ankete - survey_type)
var $mode = -1; // mode: -1 -> library pri datotekah, 0 -> glasovanje, 1 -> forma, 2 -> ankata na več straneh, 3 -> ifi
@@ -32,28 +30,12 @@ class Library { if (isset($_options['tab'])) {
$this->tab = $_options['tab'];
- if ($this->tab <= 1)
- $this->tip = 0;
- else
- $this->tip = 1;
}
else if (isset($_POST['tab'])) {
$this->tab = ($_POST['tab'] == 0 || $_POST['tab'] == 'undefined') ? 0 : $_POST['tab'];
- if ($this->tab <= 1)
- $this->tip = 0;
- else
- $this->tip = 1;
}
else {
$this->tab = 0;
- $this->tip = 0;
- }
-
- if (isset($_options['prva'])) {
- $this->prva = $_options['prva'];
- }
- else {
- $this->prva = 0;
}
if (isset($_GET['tab'])) $this->tab = (int)$_GET['tab'];
@@ -72,99 +54,45 @@ class Library { if(isset($_GET['search']) && $_GET['search'] != ''){
$this->isSearch = 1;
$this->searchString = str_replace("\\", "", trim($_GET['search']));
-
- // Iscemo po naslovu ali vsebini
- $this->searchSettings['stype'] = (isset($_GET['stype'])) ? $_GET['stype'] : '0';
}
+
+ // Iscemo po naslovu ali vsebini
+ $this->searchSettings['stype'] = (isset($_GET['stype'])) ? $_GET['stype'] : '0';
}
-
- /**
- * @desc prikaze knjiznico znotraj ankete na desni
- */
- function display () {
- global $admin_type;
- global $global_user_id;
- global $lang;
-
- echo '<div id="library_title">';
- echo '<span class="faicon library"></span> '.$lang['srv_library'];
- echo '<a href="#" title="'.$lang['srv_zapri'].'" onclick="change_mode(\'toolboxback\', \'1\'); return false;"><span class="faicon close" style="float:right;"></span></a>';
- echo '</div>';
-
- $this->display_tabs();
-
- echo '<div id="library">';
-
- echo '<div id="libraryInner">';
- $this->display_folders();
- echo '</div><!-- id="libraryInner" -->';
-
- echo '</div><!-- id="library" -->';
- }
-
- /**
- * @desc prikaze tabe za izbiro
- */
- function display_tabs () {
- global $lang;
-
- echo '<p class="display_tabs">';
- echo '<span' . ($this->tab==0 || $this->tab==1 ? ' class="highlightTabBlackLeft"' : ' class="nohighlight"') . ' >';
- echo '<a href="/" onclick="display_knjiznica(\'0\'); return false;" title="'.$lang['srv_vprasanja'].'"><span>' . $lang['srv_vprasanja'] . '</span></a></span>';
- echo '<span' . ($this->tab==2 || $this->tab==3 ? ' class="highlightTabBlackRight"' : ' class="nohighlight"') . ' >';
- echo '<a href="/" onclick="display_knjiznica(\'2\'); return false;" title="'.$lang['srv_ankete'].'"><span>' . $lang['srv_ankete'] . '</span></a></span>';
- echo '</p>';
- }
-
+
function display_folders () {
global $global_user_id;
global $lang;
- // Knjiznica znotraj posamezne ankete
- if ($this->prva == 0) {
- $this->display_contentfolders(0, 0);
- $this->display_contentfolders(0, $global_user_id);
-
- if ($this->tip == 1) {
- echo '<p class="bold"><a href="index.php?a=knjiznica">'.$lang['srv_library_edit'].'</a><br>';
-
- $sql = sisplet_query("SELECT * FROM srv_library_anketa WHERE uid='".$global_user_id."' AND ank_id='".$this->SurveyAdmin->anketa."'");
- if (mysqli_num_rows($sql) == 0) {
- echo '<div class="buttonwrapper" style="float:left;">
- <a class="ovalbutton ovalbutton_orange btn_savesettings" onclick="add_to_my_library(); return false;" href="#"><span>'.$lang['srv_library_edit_add'].'</span></a>
- </div></p>';
- }
-
- } else {
- echo '<p>'.$lang['srv_library_q_txt'].'</p>';
- }
+ echo '<div class="advanced_search">';
+ echo ' <div id="searchLibrarySettings">';
+ $this->displaySearchSettings();
+ echo ' </div>';
+ echo '</div>';
+
+ // Na prvi strani imamo search
+ if($this->isSearch == 1){
+ echo '<div class="library_title">'.($this->tab == '3' ? $lang['srv_library_title_search_my'] : $lang['srv_library_title_search_public']).'</div>';
+ $this->display_contentfolders_searchList();
+ }
+ else{
+ echo '<div class="library_title">'.($this->tab == '3' ? $lang['srv_library_title_my'] : $lang['srv_library_title_public']).'</div>';
+ $this->display_contentfolders();
+ }
- //echo '<a style="padding:5px; background-color: white; bottom: 1px; position: absolute; right: 18px;" onclick="change_mode(\'toolboxback\', \'1\'); return false;" href="#">'.$lang['srv_zapri'].'</a>';
- }
- // Knjiznica na prvi strani zraven mojih anket
- else {
- // Na prvi strani imamo search
- if($this->isSearch == 1){
- echo '<div id="searchLibrarySettings">';
- $this->displaySearchSettings();
- echo '</div>';
-
- echo '<div class="clr"></div>';
-
- $this->display_contentfolders_searchList();
- }
- else{
- echo '<div id="searchLibrarySurveys">';
- $this->displaySearch();
- echo '</div>';
-
- echo '<div class="clr"></div>';
-
- $this->display_contentfolders();
- }
- }
+ // Klik izven "Vec" - zapremo okno
+ echo '<script>
+ $(document).mouseup(function(e){
+ var container = $(".library_more_box, .dots");
+
+ if (!container.is(e.target) && container.has(e.target).length === 0){
+ $(".library_more_box").addClass("displayNone");
+ }
+ });
+ </script>';
}
+
/**
* @desc prikaze folderje v knjiznici
@@ -189,198 +117,187 @@ class Library { $language = " AND lang='$lang[id]' ";
}
- $cookie = $_COOKIE['library_folders'];
+ $cookie = isset($_COOKIE['library_folders']) ? $_COOKIE['library_folders'] : '';
+
// da se v url lahko doda odprte folderje: &libfolder=131-147 (more vkljucevat tudi parente)
if (isset($_GET['libfolder'])) $cookie .= '-'.$_GET['libfolder'].'-';
if ($parent == 0) {
- // v skrite html elemente shranimo tab, in prva
+ // v skrite html elemente shranimo tab
echo '<input type="hidden" name="lib_tab" id="lib_tab" value="'.($this->tab == 0 || $this->tab == "" ? "0" : "$this->tab").'">';
- echo '<input type="hidden" name="lib_tip" id="lib_tip" value="'.($this->tip == 0 || $this->tip== "" ? "0" : "$this->tip").'">';
- echo '<input type="hidden" name="lib_prva" id="lib_prva" value="'.($this->prva == 0 || $this->prva== "" ? "0" : "$this->prva").'">';
echo '<ul title="'.($uid==0?$lang['srv_library_left']:$lang['srv_library_left_right']).'" style="padding-left:0;" class="'.($admin_type==0 || $uid == $global_user_id?'can_edit':'').'">'."\n";
}
- $sql = sisplet_query("SELECT id, naslov FROM srv_library_folder WHERE uid='$uid' AND parent = '$parent' AND tip='$this->tip' $language ORDER BY naslov");
+ $sql = sisplet_query("SELECT id, naslov FROM srv_library_folder WHERE uid='$uid' AND parent = '$parent' AND tip='1' $language ORDER BY naslov");
if (!$sql)
echo mysqli_error($GLOBALS['connect_db']);
if (mysqli_num_rows($sql) == 0 && $uid > 0 && $parent == 0) {
// za prvic ko pride user, da mu dodamo folder
- if ($this->tip == 0)
- $naslov = $lang['srv_moja_vprasanja'];
- else
- $naslov = $lang['srv_moje_ankete'];
+ $naslov = $lang['srv_moje_ankete'];
- sisplet_query("INSERT INTO srv_library_folder (uid, tip, naslov, parent, lang) VALUES ('$uid', '$this->tip', '$naslov', '0', '$lang[id]')");
+ sisplet_query("INSERT INTO srv_library_folder (uid, tip, naslov, parent, lang) VALUES ('$uid', '1', '$naslov', '0', '$lang[id]')");
- $sql = sisplet_query("SELECT id, naslov FROM srv_library_folder WHERE uid='$uid' AND parent = '$parent' AND tip='$this->tip' ORDER BY naslov");
+ $sql = sisplet_query("SELECT id, naslov FROM srv_library_folder WHERE uid='$uid' AND parent = '$parent' AND tip='1' ORDER BY naslov");
if (!$sql)
echo mysqli_error($GLOBALS['connect_db']);
}
while ($row = mysqli_fetch_array($sql)) {
+
if (strpos($cookie, '-'.$row['id'].'-')=== false && $parent!=0)
$hidden = true;
else
$hidden = false;
- echo ' <li id="li'.$row['id'].'" eid="'.$row['id'].'" class="folder" name="folder">';
+ echo ' <li id="li'.$row['id'].'" eid="'.$row['id'].'" class="folder '.($parent != 0 ? 'can_drag' : '').'" name="folder">';
- if ($parent != 0)
- echo ' <a href="/" onclick="javascript:library_folders_plusminus(\''.$row['id'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" id="f_pm_'.$row['id'].'"><span class="faicon icon-blue '.($hidden?'plus':'minus').'"></span></a>';
- else
- echo ' <span class="sprites spacer12"></span>';
- echo ' <span class="'.($parent!=0 || $uid>0 || $admin_type==0 ? ' folderdrop' : '').'" id="sp'.$row['id'].'" eid="'.$row['id'].'"><span class="faicon folder icon-blue'.($parent!=0?' movable':'').'"></span>'.
- ' <span title="'.$lang['srv_rename_profile'].'" '.($admin_type==0||$uid>0?' onclick="folder_rename(\''.$row['id'].'\'); return false;"':'').'>'.$row['naslov'].'</span>';
- if ($admin_type==0 || $uid>0)
- echo ' <a href="/" onclick="javascript:library_new_folder(\''.$row['id'].'\',\''.$uid.'\'); return false;"><span class="faicon add icon-blue-hover-orange small new_folder" id="new_folder_'.$row['id'].'" title="'.$lang['srv_newfolder'].'"></span></a>';
+ echo '<div class="folder_box_holder">';
+
+ // Drag handle
+ /*if($parent != 0)
+ echo '<span class="faicon move_updown folder_handle"></span>';*/
- if ($parent != 0 && ($admin_type==0||$uid>0) )
- echo ' <a href="/" onclick="javascript:library_delete_folder(\''.$row['id'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;"><span class="faicon remove icon-orange small delete_folder" id="delete_folder_'.$row['id'].'" title="'.$lang['srv_deletefolder'].'"></span></a>';
+ // Okvircek folderja
+ echo '<div eid="'.$row['id'].'" class="folder_box '.($hidden ? '' : 'open').' '.($parent!=0 || $uid>0 || $admin_type==0 ? ' folderdrop' : '').'">';
- echo ' </span>'."\n";
+ if ($parent != 0){
+ echo '<span onclick="library_folders_plusminus(\''.$row['id'].'\',\''.$this->tab.'\'); return false;" class="faicon folder_arrow_icon"></span>';
+ }
- echo '<ul id="folder_'.$row['id'].'"'.($hidden?' style="display:none"':'').'>'."\n";
+ echo '<div id="sp'.$row['id'].'" eid="'.$row['id'].'"><span class="faicon folder"></span>';
+ echo '<span '.($admin_type==0||$uid>0? 'title="'.$lang['srv_rename_profile'].'" onclick="folder_rename(\''.$row['id'].'\'); return false;"':'').'>'.$row['naslov'].'</span>';
+ if ($admin_type==0 || $uid>0)
+ echo '<span class="faicon add new_folder" id="new_folder_'.$row['id'].'" title="'.$lang['srv_newfolder'].'" onclick="javascript:library_new_folder(\''.$row['id'].'\',\''.$uid.'\'); return false;"></span>';
+ if ($parent != 0 && ($admin_type==0||$uid>0) )
+ echo '<span class="faicon remove delete_folder" id="delete_folder_'.$row['id'].'" title="'.$lang['srv_deletefolder'].'" onclick="javascript:library_delete_folder(\''.$row['id'].'\',\''.$this->tab.'\'); return false;"></span>';
+ echo '</div>';
- $this->display_contentfolders($row['id'], $uid);
+ echo '<div class="folder_clickable" onclick="library_folders_plusminus(\''.$row['id'].'\',\''.$this->tab.'\'); return false;"></div>';
- $this->display_ifs($row['id']);
+ echo '</div>';
- // Izpis spremenljivk v folderju - v root folderju ne izpisujemo vprasanj (ker jih itak ne sme bit)
- if(!($this->tip == 0 && $parent == 0 && $uid == 0)){
+ echo '</div>';
- if ($this->tip == 0)
- $sql1 = sisplet_query("SELECT * FROM srv_spremenljivka WHERE folder = '$row[id]' AND gru_id='-1' ORDER BY naslov ASC");
- else
- $sql1 = sisplet_query("SELECT * FROM srv_anketa a, srv_library_anketa l WHERE a.id=l.ank_id AND l.folder='$row[id]' AND l.uid='$uid' ORDER BY naslov ASC");
- if (!$sql1) echo mysqli_error($GLOBALS['connect_db']);
- if (mysqli_num_rows($sql1) > 0) {
+ // Vsebina folderja
+ echo ' <ul id="folder_'.$row['id'].'"'.($hidden?' style="display:none"':'').'>'."\n";
+ $this->display_contentfolders($row['id'], $uid);
- while ($row1 = mysqli_fetch_array($sql1)) {
+ // Izpis anket v folderju
+ $sql1 = sisplet_query("SELECT * FROM srv_anketa a, srv_library_anketa l WHERE a.id=l.ank_id AND l.folder='$row[id]' AND l.uid='$uid' ORDER BY naslov ASC");
+ if (!$sql1) echo mysqli_error($GLOBALS['connect_db']);
- echo '<li class="anketa tip'.$this->tip.'">';
- echo ' <div copy="'.$row1['id'].'" eid="'.$row1['id'].'" class="folder_container '.($this->tip==0?'new_spr':'').'" name="library">';
+ if (mysqli_num_rows($sql1) > 0) {
- echo ' <div class="folder_right">';
+ while ($row1 = mysqli_fetch_array($sql1)) {
- if ($this->tip == 0) {
- //echo '<a href="/" onclick="javascript:copy_spremenljivka(\''.$row1['id'].'\'); return false;"><img src="img_'.$this->skin.'/copy.png" title="'.$lang['srv_copy_spr'].'" /></a>';
- if ($admin_type==0 or $uid==$global_user_id)
- echo ' <a href="/" onclick="library_brisi_spremenljivko(\''.$row1['id'].'\', \''.$lang['srv_brisispremenljivkoconfirm'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;"><span class="faicon delete_circle icon-orange" title="'.$lang['srv_brisispremenljivko'].'"></span></a>';
- }
- else {
- SurveyInfo::getInstance()->SurveyInit($row1['id']);
-
- if ($this->prva == "1") {
-
- // Dodaj anketo v javno knjiznico
- if ($admin_type == 0 && $this->tab == 3) {
-
- $sqlPublic = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='".$row1['id']."' AND uid='0'");
- if (!$sqlPublic) echo mysqli_error($GLOBALS['connect_db']);
-
- // Anketa ze obstaja v javni knjiznici - jo pobrisemo
- if (mysqli_num_rows($sqlPublic) > 0) {
- echo ' <a href="/" onclick="surveyList_knjiznica_new(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_ank_lib_off'].'">';
- echo ' <span class="sprites faicon remove icon-orange small"></span> <span class="library_item_setting_text">'.$lang['srv_ank_lib_off'].'</span>';
- echo ' </a>';
- }
- // Anketo dodamo v javno knjiznico
- else{
- echo ' <a href="/" onclick="surveyList_knjiznica_new(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_ank_lib_on'].'">';
- echo ' <span class="sprites faicon library"></span> <span class="library_item_setting_text">'.$lang['srv_ank_lib_on'].'</span>';
- echo ' </a>';
- }
- }
-
- // nova anketa kot template iz knjiznice
- echo '<a href="/" onclick="anketa_copy(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_library_use_survey'].'"><span class="faicon copy"></span> <span class="library_item_setting_text">'.$lang['srv_anketacopy'].'</span></a> ';
- echo '<a href="'.$site_url.'main/survey/'.(!SurveyInfo::getInstance()->checkSurveyModule('uporabnost') ? 'index' : 'uporabnost').'.php?anketa='.$row1['id'].'&preview=on" target="_blank" title="'.$lang['srv_poglejanketo'].'"><span class="faicon preview"></span> <span class="library_item_setting_text">'.$lang['srv_poglejanketo2'].'</span></a> ';
-
- // brisi iz knjiznice
- if ($admin_type == 0) {
- echo ' <a href="index.php?anketa='.$row1['id'].'" title="'.$lang['srv_editirajanketo'].'"><span class="faicon edit"></span> <span class="library_item_setting_text">'.$lang['edit3'].'</span></a>';
- }
-
- if ($admin_type==0 && $this->tab==2) {// sistemska
- echo ' <a href="/" onclick="library_del_anketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_4'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" title="'.$lang['srv_ank_lib_off'].'"><span class="sprites faicon remove icon-orange small"></span> <span class="library_item_setting_text">'.$lang['hour_remove'].'</span></a>';
- }
-
- if($this->tab==3){// moja knjiznica
- echo ' <a href="/" onclick="library_del_myanketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_3'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" title="'.$lang['srv_ank_mylib_off'].'"><span class="faicon remove icon-orange small"></span> <span class="library_item_setting_text">'.$lang['hour_remove'].'</span></a>';
- }
- }
- else {
- echo '<a href="'.$site_url.'main/survey/'.(!SurveyInfo::getInstance()->checkSurveyModule('uporabnost') ? 'index' : 'uporabnost').'.php?anketa='.$row1['id'].'&preview=on" target="_blank" title="'.$lang['srv_poglejanketo'].'"><span class="faicon preview"></span></a>';
- // moznost da povozi anketo z anketo iz knjiznice
- //TEGA NE DOVOLIMO KER NI OK DA SE KAR PREPISE OBSTOJECO ANKETO - anketo iz knjiznice se lahko po novem dodaja samo iz mojih anket oz. pri ustvarjanju
- echo ' <a href="/" onclick="alert_copy_anketa(\''.$row1['id'].'\'); return false;"><span class="sprites copy_small" title="'.$lang['srv_copy_srv'].'"></span></a>';
- }
- }
- echo '</div>';
+ echo '<li eid="'.$row1['id'].'" class="anketa tip1 '.($admin_type==0 || $uid>0 ? 'can_drag' : '').'" name="library">';
- echo ' <div class="folder_left'.($this->tip==1?' indent"':'" onclick="library_spremenljivka_new(\''.$row1['id'].'\'); return false;"').'>';
- if ($this->tip == 1 && $this->prva == "0") {
- echo '<a href="/" onclick="javascript:library_anketa_plusminus(\''.$row1['id'].'\', this); return false;"><span class="faicon icon-blue plus" style="opacity: 0.3"></span></a> ';
- } else {
- if ($this->tip != 0)
- echo ' <span class="sprites spacer12"></span>';
- }
+ // Okvircek ankete
+ echo ' <div copy="'.$row1['id'].'" eid="'.$row1['id'].'" class="folder_container">';
- if ($this->tip == 0) {
- if ($row1['tip']==1 || $row1['tip']==2 || $row1['tip']==3 || $row1['tip']==21 || $row1['tip']==7)
- $ikonca = 'osnovna_vprasanja';
- elseif ($row1['tip']==6 || $row1['tip']==16 || $row1['tip']==19 || $row1['tip']==20)
- $ikonca = 'table';
- else
- $ikonca = 'other_vprasanja';
- } else {
- $ikonca = 'anketa';
- }
+ // Levo ime
+ echo '<div class="folder_left">';
- echo '<span class="faicon '.$ikonca.' mapca icon-blue" style="display:inline-block"></span> ';
- echo skrajsaj(strip_tags($row1['naslov']), 40).'</a>'."\n";
+ echo '<span class="faicon clipboard"></span> ';
+ echo skrajsaj(strip_tags($row1['naslov']), 40);
- echo ' </div>';
+ echo '</div>';
- if ($this->prva == "0") {
+ // Desne nastavitve
+ echo '<div class="folder_right">';
- echo '<div id="anketa_vprasanja_'.$row1['id'].'" class="anketa_vprasanja">';
- if ($this->tip == 1) {
- $sql2 = sisplet_query("SELECT s.id, s.naslov, s.tip FROM srv_spremenljivka s, srv_grupa g WHERE s.gru_id=g.id AND g.ank_id='$row1[id]'");
- while ($row2 = mysqli_fetch_array($sql2)) {
+ // Tri pikice
+ echo '<span class="faicon dots" onClick="library_show_more(\''.$row1['id'].'\');"></span>';
- if ($row2['tip']==1 || $row2['tip']==2 || $row2['tip']==3 || $row2['tip']==21 || $row2['tip']==7)
- $ikonca = 'osnovna_vprasanja';
- elseif ($row2['tip']==6 || $row2['tip']==16 || $row2['tip']==19 || $row2['tip']==20)
- $ikonca = 'table';
- else
- $ikonca = 'other_vprasanja';
+ // Div ki se prikaze po kliku na 3 pikice
+ echo '<div class="library_more_box_holder">';
+ echo '<div id="library_more_box_'.$row1['id'].'" class="library_more_box displayNone">';
- echo '<span class="new_spr" copy="'.$row2['id'].'" onclick="library_spremenljivka_new(\''.$row2['id'].'\'); return false;"><span class="faicon '.$ikonca.' icon-blue" title="'.$lang['srv_copy_spr'].'" style="display:inline-block"></span>';
- echo ' '.skrajsaj(strip_tags($row2['naslov']), 40).'</span>';
+ SurveyInfo::getInstance()->SurveyInit($row1['id']);
+
+ // Dodaj anketo v javno knjiznico
+ if ($admin_type == 0 && $this->tab == 3) {
- }
- }
+ $sqlPublic = sisplet_query("SELECT * FROM srv_library_anketa WHERE ank_id='".$row1['id']."' AND uid='0'");
+ if (!$sqlPublic) echo mysqli_error($GLOBALS['connect_db']);
+ // Anketa ze obstaja v javni knjiznici - jo pobrisemo
+ if (mysqli_num_rows($sqlPublic) > 0) {
+ echo '<div class="line" onclick="surveyList_knjiznica_new(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_ank_lib_off'].'">';
+ echo ' <span class="faicon anketa_delete"></span>'.$lang['srv_ank_lib_off'];
echo '</div>';
}
+ // Anketo dodamo v javno knjiznico
+ else{
+ echo '<div class="line" onclick="surveyList_knjiznica_new(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_ank_lib_on'].'">';
+ echo ' <span class="faicon library"></span>'.$lang['srv_ank_lib_on'];
+ echo '</div>';
+ }
+ }
+
+ // Predogled
+ if(SurveyInfo::getInstance()->checkSurveyModule('uporabnost')){
+ echo '<a href="'.$site_url.'main/survey/uporabnost.php?anketa='.SurveyInfo::getInstance()->getSurveyHash().'&preview=on" target="_blank" class="noline" title="'.$lang['srv_poglejanketo'].'">';
+ echo ' <div class="line">';
+ echo ' <span class="faicon monitor"></span>'.$lang['srv_poglejanketo2'];
+ echo ' </div>';
+ echo '</a>';
+ }
+ else{
+ echo '<a href="'.$site_url.'main/survey/index.php?anketa='.SurveyInfo::getInstance()->getSurveyHash().'&preview=on" target="_blank" class="noline" title="'.$lang['srv_poglejanketo'].'">';
+ echo ' <div class="line">';
+ echo ' <span class="faicon monitor"></span>'.$lang['srv_poglejanketo2'];
+ echo ' </div>';
+ echo '</a>';
+ }
+
+ // nova anketa kot template iz knjiznice
+ echo '<div class="line" onclick="anketa_copy(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_library_use_survey'].'">';
+ echo ' <span class="faicon copy"></span>'.$lang['srv_copy'];
+ echo '</div>';
+
+ // Uredi anketo
+ if ($admin_type == 0 || $this->tab==3) {
+ echo '<a href="index.php?anketa='.$row1['id'].'" class="noline" title="'.$lang['srv_editirajanketo'].'">';
+ echo ' <div class="line">';
+ echo ' <span class="faicon edit"></span>'.$lang['edit3'];
+ echo ' </div>';
+ echo '</a>';
+ }
+
+ // sistemska
+ if ($admin_type==0 && $this->tab==2) {
+ echo '<div class="line" onclick="library_del_anketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_4'].'\',\''.$this->tab.'\'); return false;" title="'.$lang['srv_ank_lib_off'].'">';
+ echo ' <span class="sprites faicon anketa_delete"></span>'.$lang['hour_remove'];
+ echo '</div>';
+ }
+
+ // moja knjiznica
+ if($this->tab==3){
+ echo '<div class="line" onclick="library_del_myanketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_3'].'\',\''.$this->tab.'\'); return false;" title="'.$lang['srv_ank_mylib_off'].'">';
+ echo ' <span class="faicon anketa_delete"></span>'.$lang['hour_remove'];
+ echo '</div>';
+ }
- echo '</div></li>';
- }
+ echo '</div>';
+ echo '</div>';
+
- }
- }
+ echo ' </div>';
- echo ' </ul>'."\n";
+ echo '</li>';
+ }
+ }
+
+ echo ' </ul>'."\n";
echo ' </li>'."\n";
}
@@ -399,36 +316,6 @@ class Library { <?php
}
}
-
- /**
- * @desc prikaze ife / bloke v knjiznici
- */
- function display_ifs ($folder) {
- global $lang, $admin_type;
-
- $sql = sisplet_query("SELECT * FROM srv_if WHERE folder = '$folder' ORDER BY label ASC, id ASC");
- while ($row = mysqli_fetch_array($sql)) {
-
- echo '<li class="anketa tip0">';
- echo ' <div eid="'.$row['id'].'" copy="'.$row['id'].'" class="folder_container new_if" name="library_if">';
-
- echo ' <div class="folder_right">';
- if ($admin_type==0 or $this->tab==1)
- echo ' <a href="/" onclick="library_if_remove(\''.$row['id'].'\', \''.$lang['srv_brisispremenljivkoconfirm'].'\'); return false;"><span class="faicon delete_circle icon-orange" title="'.($row['tip']==0?$lang['srv_if_rem']:$lang['srv_block_rem']).'"></span></a>';
- echo ' </div>';
-
- echo ' <div class="folder_left'.($this->tip==1?' indent':'').'" onclick="library_if_new(\''.$row['id'].'\'); return false;">';
-
- echo '<span class="faicon '.($row['tip']==0?'if':'b').' mapca icon-blue"></span> ';
-
- echo skrajsaj(strip_tags(($row['label']!=''?$row['label']:($row['tip']==0?$lang['srv_pogoj']:$lang['srv_blok']))), 40).'</a>'."\n";
-
- echo ' </div>';
-
- echo '</div></li>';
- }
-
- }
/**
@@ -450,12 +337,10 @@ class Library { if ($uid == 0)
$language = " AND lang='$lang[id]' ";
- // v skrite html elemente shranimo tab, in prva
+ // v skrite html elemente shranimo tab
echo '<input type="hidden" name="lib_tab" id="lib_tab" value="'.$this->tab.'">';
- echo '<input type="hidden" name="lib_tip" id="lib_tip" value="1">';
- echo '<input type="hidden" name="lib_prva" id="lib_prva" value="1">';
- echo '<ul title="'.($uid == 0 ? $lang['srv_library_left'] : $lang['srv_library_left_right']).'" style="padding-left:0; margin-left:-12px; margin-top:10px;" class="'.($admin_type == 0 || $uid == $global_user_id ? 'can_edit' : '').'">'."\n";
+ echo '<ul title="'.($uid == 0 ? $lang['srv_library_left'] : $lang['srv_library_left_right']).'" class="'.($admin_type == 0 || $uid == $global_user_id ? 'can_edit' : '').'">'."\n";
// Sestavimo query za search po knjiznici
@@ -474,39 +359,13 @@ class Library { while ($row1 = mysqli_fetch_array($sql1)) {
echo '<li class="anketa tip1">';
- echo ' <div copy="'.$row1['id'].'" eid="'.$row1['id'].'" class="folder_container" name="library">';
+ echo ' <div copy="'.$row1['id'].'" eid="'.$row1['id'].'" class="folder_container" name="library">';
- echo ' <div class="folder_right">';
-
- SurveyInfo::getInstance()->SurveyInit($row1['id']);
-
- // nova anketa kot template iz knjiznice
- echo '<a href="/" onclick="anketa_copy(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_library_use_survey'].'"><span class="faicon copy"></span> '.$lang['srv_anketacopy'].'</a> ';
-
- // Preview
- echo '<a href="'.$site_url.'main/survey/'.(!SurveyInfo::getInstance()->checkSurveyModule('uporabnost') ? 'index' : 'uporabnost').'.php?anketa='.$row1['id'].'&preview=on" target="_blank" title="'.$lang['srv_poglejanketo'].'"><span class="faicon preview"></span> '.$lang['srv_poglejanketo2'].'</a> ';
-
- // Urejanje - admin
- if ($admin_type == 0)
- echo ' <a href="index.php?anketa='.$row1['id'].'" title="'.$lang['srv_editirajanketo'].'"><span class="faicon edit"></span> '.$lang['edit3'].'</a>';
-
- // Brisanje - admin iz javne knjiznice
- if ($admin_type == 0 && $this->tab == 2)
- echo ' <a href="/" onclick="library_del_anketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_4'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" title="'.$lang['srv_ank_lib_off'].'"><span class="faicon remove icon-orange small"></span> '.$lang['hour_remove'].'</a>';
-
- // Brisanje - uporabnik iz moje knjiznice
- if($this->tab == 3)
- echo ' <a href="/" onclick="library_del_myanketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_3'].'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" title="'.$lang['srv_ank_mylib_off'].'"><span class="faicon remove icon-orange small"></span> '.$lang['hour_remove'].'</a>';
-
- echo '</div>';
-
-
- echo ' <div class="folder_left'.($this->tip==1?' indent"':'" onclick="library_spremenljivka_new(\''.$row1['id'].'\'); return false;"').'>';
- echo ' <span class="sprites spacer12"></span>';
- $ikonca = 'anketa';
+ // Leva stran - ime
+ echo '<div class="folder_left">';
- echo '<span class="faicon '.$ikonca.' mapca icon-blue" style="display:inline-block"></span> ';
+ echo '<span class="faicon clipboard"></span>';
// Ce gre za search moramo ustrezno pobarvati najden del besede
$text_searched = $row1['naslov'];
@@ -516,17 +375,83 @@ class Library { // Pobarvamo najden niz v naslovu ankete
preg_match_all("/$search_word+/i", $text_searched, $matches);
if (is_array($matches[0]) && count($matches[0]) >= 1) {
- foreach ($matches[0] as $match) {
- $text_searched = str_replace($match, '<span class="red">'.$match.'</span>', $text_searched);
- }
+
+ // 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);
}
}
}
- echo skrajsaj($text_searched, 40).'</a>'."\n";
+ echo skrajsaj($text_searched, 100);
+
+ echo '</div>';
- echo ' </div>';
- echo '</div></li>';
+
+ // Desne nastavitve
+ echo '<div class="folder_right">';
+
+ // Tri pikice
+ echo '<span class="faicon dots" onClick="library_show_more(\''.$row1['id'].'\');"></span>';
+
+ // Div ki se prikaze po kliku na 3 pikice
+ echo '<div class="library_more_box_holder">';
+ echo '<div id="library_more_box_'.$row1['id'].'" class="library_more_box displayNone">';
+
+ SurveyInfo::getInstance()->SurveyInit($row1['id']);
+
+ // Preview
+ if(SurveyInfo::getInstance()->checkSurveyModule('uporabnost')){
+ echo '<a href="'.$site_url.'main/survey/uporabnost.php?anketa='.SurveyInfo::getInstance()->getSurveyHash().'&preview=on" class="noline" target="_blank" title="'.$lang['srv_poglejanketo'].'">';
+ echo ' <div class="line">';
+ echo ' <span class="faicon monitor"></span>'.$lang['srv_poglejanketo2'];
+ echo ' </div>';
+ echo '</a>';
+ }
+ else{
+ echo '<a href="'.$site_url.'main/survey/index.php?anketa='.SurveyInfo::getInstance()->getSurveyHash().'&preview=on" class="noline" target="_blank" title="'.$lang['srv_poglejanketo'].'">';
+ echo ' <div class="line">';
+ echo ' <span class="faicon monitor"></span>'.$lang['srv_poglejanketo2'];
+ echo ' </div>';
+ echo '</a>';
+ }
+
+ // nova anketa kot template iz knjiznice
+ echo '<div class="line" onclick="anketa_copy(\''.$row1['id'].'\'); return false;" title="'.$lang['srv_library_use_survey'].'">';
+ echo ' <span class="faicon copy"></span>'.$lang['srv_copy'];
+ echo '</div>';
+
+ // Urejanje - v moji knjiznici vsi, v javni samo admin
+ if ($admin_type == 0 || $this->tab == 3){
+ echo ' <a href="index.php?anketa='.$row1['id'].'" class="noline" title="'.$lang['srv_editirajanketo'].'">';
+ echo ' <div class="line">';
+ echo ' <span class="faicon edit"></span>'.$lang['edit3'];
+ echo ' </div>';
+ echo '</a>';
+ }
+
+ // Brisanje - admin iz javne knjiznice
+ if ($admin_type == 0 && $this->tab == 2){
+ echo '<div class="line" onclick="library_del_anketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_4'].'\',\''.$this->tab.'\'); return false;" title="'.$lang['srv_ank_lib_off'].'">';
+ echo ' <span class="faicon anketa_delete"></span>'.$lang['hour_remove'];
+ echo '</div>';
+ }
+
+ // Brisanje - uporabnik iz moje knjiznice
+ if($this->tab == 3){
+ echo '<div class="line" onclick="library_del_myanketa(\''.$row1['id'].'\', \''.$lang['srv_anketadeletelibrary_3'].'\',\''.$this->tab.'\'); return false;" title="'.$lang['srv_ank_mylib_off'].'">';
+ echo ' <span class="faicon anketa_delete"></span>'.$lang['hour_remove'];
+ echo '</div>';
+ }
+
+ echo '</div>';
+ echo '</div>';
+
+ echo '</div>';
+
+ echo ' </div>';
+ echo '</li>';
}
}
@@ -554,68 +479,51 @@ class Library { global $lang;
global $site_url;
- echo '<span class="title">'.$lang['s_search_settings_lib'].'</span>';
-
echo '<form method="GET" id="1kasf2" action="'.$site_url.'admin/survey/index.php?a=knjiznica">';
- // Hidden polja za knjiznico
+ // Hidden polja za knjiznico
echo '<input type="hidden" name="a" value="knjiznica">';
if($this->tab == '3')
echo '<input type="hidden" name="t" value="moje_ankete">';
+ // Zgornja vrstica z geslom in gumbom za iskanje
+ echo '<div class="search_settings_top">';
+
// Iskano geslo
- echo '<p>';
- echo ' <span class="bold">'.$lang['s_search2'].':</span> <input type="text" name="search" id="searchMySurveyText" value="'.htmlentities($this->searchString).'" placeholder="' . $lang['s_search'] . '" />';
- echo '</p>';
+ echo '<div class="search_text">';
+ echo ' <input type="text" name="search" id="searchMySurveyText" value="'.htmlentities($this->searchString).'" placeholder="'.($this->tab == '3' ? $lang['s_search_Library_my'] : $lang['s_search_Library_public']).'" />';
+ echo '</div>';
// Iskanje po naslovu ali avtorju ali besedilu
- echo '<p>';
- echo ' <span>'.$lang['s_thru'].': </span>';
- echo ' <label for="stype_0"><input type="radio" name="stype" id="stype_0" value="0" '.($this->searchSettings['stype'] == '0' ? ' checked="checked"' : '').' />'.$lang['s_title'].'</label>';
- echo ' <label for="stype_1"><input type="radio" name="stype" id="stype_1" value="1" '.($this->searchSettings['stype'] == '1' ? ' checked="checked"' : '').' />'.$lang['s_text'].'</label>';
- echo '</p>';
-
- // Gumba isci in zapri
- echo '<span style="margin-top: 10px;" class="floatRight spaceRight">';
- echo ' <div class="buttonwrapper floatLeft spaceRight">';
- echo ' <a class="ovalbutton ovalbutton_gray" href="'.$site_url.'admin/survey/index.php?a=knjiznica'.($this->tab == '3' ? '&t=moje_ankete' : '').'"><span>'.$lang['srv_zapri'].'</span></a>';
- echo ' </div>';
- echo ' <div class="buttonwrapper floatRight">';
- echo ' <a class="ovalbutton ovalbutton_orange" href="#" onclick="$(\'#1kasf2\').submit(); return false;"><span>'.$lang['s_search'].'</span></a>';
- echo ' </div>';
- echo '</span>';
-
- // Link na isci po mojih anketah
- echo '<span class="link"><a href="'.$site_url.'admin/survey/index.php?search='.$this->searchString.'">'.$lang['s_search_mySurvey'].'</a></span>';
+ 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_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>';
- echo '<input style="display: none;" value="Išči" type="submit">';
+ // Gumba za napredne nastavitve
+ echo '<div class="search_settings_advanced_buttons">';
+
+ // Gumb nazaj na moje ankete
+ echo ' <a href="'.$site_url.'admin/survey/index.php?a=pregledovanje&search='.htmlentities($this->searchString).'"><button type="button" class="white-black small">';
+ echo ' <span class="faicon clipboard_notes"></span>'.$lang['s_search_mySurvey'];
+ echo ' </button></a>';
+
+ echo '</div>';
+
+ echo '<input style="display: none;" value="Išči" type="submit">';
echo '</form>';
}
-
- // Prikazemo search okno za iskanje po anketah znotraj knjiznice
- private function displaySearch(){
- global $lang;
- global $site_url;
- echo '<form method="GET" id="1kasmysurvey" action="'.$site_url.'admin/survey/index.php">';
-
- // Hidden polja za knjiznico
- echo '<input type="hidden" name="a" value="knjiznica">';
- if($this->tab == '3')
- echo '<input type="hidden" name="t" value="moje_ankete">';
-
- //echo '<span class="sprites search"></span> ';
- echo '<input id="searchMySurvey" class="floatLeft" type="text" value="" placeholder="' . $lang['s_search_Library'] . '" name="search" />';
-
- //echo '<input type="submit" value="' . $lang['s_search'] . '" />';
- echo ' <div class="buttonwrapper floatLeft">';
- echo ' <a class="ovalbutton ovalbutton_orange" href="#" onclick="$(\'#1kasmysurvey\').submit(); return false;"><span>'.$lang['s_search2'].'</span></a>';
- echo ' </div>';
-
- echo '</form>';
- }
-
// vrne sql string za search po anketah glede na nastavitve searcha
private function getSearchString(){
@@ -666,17 +574,6 @@ class Library { $this->tab = (int)$_GET['tab'];
if ($this->tab == 'undefined')
$this->tab = 0;
- if (isset($_POST['prva']))
- $this->prva = $_POST['prva'];
- else if (isset($_GET['prva']))
- $this->prva = $_GET['prva'];
- if ($this->prva == 'undefined')
- $this->prva = 0;
-
- if ($this->tab <= 1)
- $this->tip = 0;
- else
- $this->tip = 1;
if ($_GET['a'] == 'display_knjiznica') {
$this->ajax_display_knjiznica();
@@ -746,36 +643,11 @@ class Library { $data = array();
- if ($this->tip == 0) {
- $spremenljivka = substr($_POST['spremenljivka'], 10); // odrezemo branching_
- $folder = $_POST['folder'];
-
- // v knjiznico dodamo spremenljivko
- if ($spremenljivka > 0) {
- $id = $this->Branching->nova_spremenljivka(-1, 0, 0, $spremenljivka);
- sisplet_query("UPDATE srv_spremenljivka SET folder = '$folder' WHERE id = '$id'");
-
- $data['response'] = $lang['srv_library_q_added'];
-
- // v knjiznico dodamo if/blok
- } else {
- $if = substr($_POST['spremenljivka'], 12); // odrezemo branching_if
-
- if ($if > 0) {
- $id = $this->Branching->if_copy(0, $if, true);
- sisplet_query("UPDATE srv_if SET folder = '$folder' WHERE id = '$id'");
-
- $data['response'] = $lang['srv_library_b_added'];
- }
- }
- }
-
ob_start();
$this->display_folders();
$data['folders'] = ob_get_clean();
echo json_encode($data);
-
}
@@ -790,12 +662,8 @@ class Library { elseif ($this->tab == 1 or $this->tab == 3)
$uid = $global_user_id;
- if ($this->tip == 0) {
- sisplet_query("UPDATE srv_spremenljivka SET folder = '$folder' WHERE id = '$spremenljivka'");
- } else {
- sisplet_query("UPDATE srv_library_anketa SET folder = '$folder' WHERE ank_id = '$spremenljivka' AND uid='$uid'");
- }
- //$this->display();
+ sisplet_query("UPDATE srv_library_anketa SET folder='$folder' WHERE ank_id='$spremenljivka' AND uid='$uid'");
+
$this->display_folders();
}
@@ -817,9 +685,8 @@ class Library { $folder = $_POST['folder'];
if ($drop != $folder)
- sisplet_query("UPDATE srv_library_folder SET parent = '$folder' WHERE id = '$drop' AND tip='$this->tip'");
+ sisplet_query("UPDATE srv_library_folder SET parent = '$folder' WHERE id = '$drop' AND tip='1'");
- //$this->display();
$this->display_folders();
}
@@ -830,9 +697,9 @@ class Library { $sql = sisplet_query("SELECT naslov FROM srv_library_folder WHERE id = '$folder'");
$row = mysqli_fetch_array($sql);
- echo '<form method="post" onsubmit="javascript:library_folder_newname(\''.$folder.'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" style="display:inline">';
+ echo '<form method="post" onsubmit="javascript:library_folder_newname(\''.$folder.'\',\''.$this->tab.'\'); return false;" style="display:inline">';
echo '<span class="faicon folder icon-blue"></span> '.
- '<input type="text" name="naslov" id="naslov_'.$folder.'" value="'.$row['naslov'].'" onblur="javascript:library_folder_newname(\''.$folder.'\',\''.$this->tab.'\',\''.$this->prva.'\'); return false;" />';
+ '<input type="text" name="naslov" id="naslov_'.$folder.'" value="'.$row['naslov'].'" onblur="javascript:library_folder_newname(\''.$folder.'\',\''.$this->tab.'\'); return false;" />';
echo '</form>';
}
@@ -859,16 +726,19 @@ class Library { $uid = $_POST['uid'];
- $s = sisplet_query("INSERT INTO srv_library_folder (uid, tip, naslov, parent) VALUES ('$uid', '$this->tip', '$lang[srv_newfolder]', '$folder')");
+ $s = sisplet_query("INSERT INTO srv_library_folder (uid, tip, naslov, parent) VALUES ('$uid', '1', '$lang[srv_newfolder]', '$folder')");
if (!$s) echo mysqli_error($GLOBALS['connect_db']);
$insert_id = mysqli_insert_id($GLOBALS['connect_db']);
- $_COOKIE['library_folders'] .= '-'.$insert_id.'-'; // $_COOKIE popravimo, da bo sprememba vidna tudi v display_folders()
+ // $_COOKIE popravimo, da bo sprememba vidna tudi v display_folders()
+ if(isset($_COOKIE['library_folders']))
+ $_COOKIE['library_folders'] .= '-'.$insert_id.'-';
+ else
+ $_COOKIE['library_folders'] = '-'.$insert_id.'-';
+
setcookie('library_folders', $_COOKIE['library_folders'], time()+2500000);
- // $this->display();
$this->display_folders();
-
}
function ajax_delete_folder () {
@@ -879,12 +749,7 @@ class Library { $sql = sisplet_query("SELECT parent FROM srv_library_folder WHERE id = '$folder'");
$row = mysqli_fetch_array($sql);
- if ($this->tip == 0) {
- sisplet_query("UPDATE srv_spremenljivka SET folder = '$row[parent]' WHERE folder = '$folder'");
- sisplet_query("UPDATE srv_if SET folder = '$row[parent]' WHERE folder = '$folder'");
- } else {
- sisplet_query("UPDATE srv_library_anketa SET folder = '$row[parent]' WHERE folder = '$folder'");
- }
+ sisplet_query("UPDATE srv_library_anketa SET folder = '$row[parent]' WHERE folder = '$folder'");
sisplet_query("UPDATE srv_library_folder SET parent = '$row[parent]' WHERE parent = '$folder'");
@@ -902,13 +767,12 @@ class Library { if ($collapsed == 0) {
$cookie .= '-'.$folder.'-';
- } else {
+ }
+ else {
$cookie = str_replace('-'.$folder.'-', '', $cookie);
}
setcookie('library_folders', $cookie, time()+2500000);
-
- echo '<span class="faicon icon-blue '.($collapsed==1?'plus':'minus').'"></span>';
}
function ajax_library_del_anketa () {
@@ -948,17 +812,17 @@ class Library { global $global_user_id;
global $lang;
global $site_url;
+
$anketa = $_POST['anketa']; // nasa anketa (jo povozimo)
$ank_id = $_POST['ank_id']; // anketa, ki jo uporabimo za predlogo
$hierarhija = (empty($_POST['hierarhija']) ? false : true);
if($hierarhija && $ank_id == 'privzeta'){
- global $hierarhija_default_id;
-
- $ank_id = $hierarhija_default_id;
+ $ank_id = AppSettings::getInstance()->getSetting('hierarhija-default_id');
}
+
if ($anketa > 0) {
// preberemo osnovne podatke obstojece ankete (naslov.....)
@@ -968,11 +832,11 @@ class Library { $sql2 = sisplet_query("SELECT naslov FROM srv_anketa WHERE id = '$ank_id'");
$row2 = mysqli_fetch_array($sql2);
- $sqls = sisplet_query("SELECT ank_id, uid FROM srv_dostop WHERE ank_id='$anketa'");
+ $sqls = sisplet_query("SELECT ank_id, uid FROM srv_dostop WHERE ank_id='$anketa'");
$this->SurveyAdmin->anketa_delete($anketa);
-
- } else {
+ }
+ else {
$sql = sisplet_query("SELECT naslov, dostop FROM srv_anketa WHERE id = '$ank_id'");
$row = mysqli_fetch_array($sql);
@@ -983,14 +847,13 @@ class Library { $naslov = " naslov='".(isset($_POST['naslov']) ? $_POST['naslov'] : $row['naslov'])."',";
$intro_opomba = " intro_opomba='".(addslashes($lang['srv_library_copy_of_note'].'<a href="'.$site_url.'admin/survey/index.php?anketa='.$ank_id.'">'.$row2['naslov'].'</a>'))."',";
-
- //$new_id = $this->SurveyAdmin->anketa_copy($ank_id);
$sas = new SurveyAdminSettings();
$new_id = $sas->anketa_copy($ank_id);
// popravimo naslov, opombo, dostop, in novega avtorja
sisplet_query("UPDATE srv_anketa SET $naslov $intro_opomba dostop='$row[dostop]', insert_uid='$global_user_id', edit_uid='$global_user_id' WHERE id='$new_id'");
- // vsilimo refresh podatkov
+
+ // vsilimo refresh podatkov
SurveyInfo :: getInstance()->resetSurveyData();
// dostop uporabimo od stare ankete in ne od skopirane (trnutno ne kopira pravic od prej, če ustvarjamo novo anketo)
@@ -1011,7 +874,8 @@ class Library { (new \Hierarhija\Hierarhija($new_id))->izrisisSistemskoVprsanjeVloga();
echo $new_id;
- }else{
+ }
+ else{
echo 'index.php?anketa='.$new_id.'&a=branching';
}
}
@@ -1030,10 +894,10 @@ class Library { // Če imamo hierarhijo in je privzeta anketa potem preverimo v settings_optional.php
if(!empty($_POST['hierarhija']) && $ank_id == 'privzeta'){
- global $hierarhija_default_id;
- $ank_id=$hierarhija_default_id;
+ $ank_id = AppSettings::getInstance()->getSetting('hierarhija-default_id');
}
- }else {
+ }
+ else {
$API_call = true;
}
@@ -1213,16 +1077,12 @@ class Library { }
function repareTabs() {
- if ($this->tab >= 2)
- $this->tip = 1;
- else
- $this->tip = 0;
// popravimo tabe če smo v glasovanju ali formi
if ($this->mode < 2) {
- // uredimo tabe
+
+ // uredimo tabe
if ($this->tab==0 || $this->tab==1) {
- $this->tip = 1;
$this->tab=2;
}
}
|