';
$this->display_contentfolders();
}
// Klik izven "Vec" - zapremo okno
echo '';
}
/**
* @desc prikaze folderje v knjiznici
*/
function display_contentfolders ($parent = 0, $uid = -1) {
global $lang;
global $admin_type;
global $global_user_id;
global $site_url;
$language = "";
if ($uid == -1) {
if ($this->tab == 0 || $this->tab == 2) {
$uid = 0;
} else {
$uid = $global_user_id;
}
}
if ($parent == 0 && $uid == 0) {
$language = " AND lang='$lang[id]' ";
}
$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
echo 'tab").'">';
echo '
'."\n";
}
$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
$naslov = $lang['srv_moje_ankete'];
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='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 '
'."\n";
$this->display_contentfolders($row['id'], $uid);
// 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']);
if (mysqli_num_rows($sql1) > 0) {
while ($row1 = mysqli_fetch_array($sql1)) {
echo '
';
// Tri pikice
echo '';
// Div ki se prikaze po kliku na 3 pikice
echo '
';
echo '
';
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 '
';
echo ' '.$lang['srv_ank_lib_off'];
echo '
';
}
// Anketo dodamo v javno knjiznico
else{
echo '
';
echo '';
}
}
echo ' '."\n";
echo ' '."\n";
}
if ($parent == 0) {
echo ''."\n";
}
if ( $parent == 0 ) {
?>
tab == 2)
$uid = 0;
else
$uid = $global_user_id;
if ($uid == 0)
$language = " AND lang='$lang[id]' ";
// v skrite html elemente shranimo tab
echo '';
echo '
'."\n";
// Sestavimo query za search po knjiznici
$search_query = $this->getSearchString();
$sql1 = sisplet_query("SELECT sa.*
FROM srv_anketa sa, srv_library_anketa l, srv_grupa sg, srv_spremenljivka ss, srv_vrednost sv
WHERE sa.id=l.ank_id AND sg.ank_id=sa.id AND ss.gru_id=sg.id AND sv.spr_id=ss.id
AND l.uid='$uid' ".$search_query."
GROUP BY sa.id
ORDER BY sa.naslov ASC");
if (!$sql1) echo mysqli_error($GLOBALS['connect_db']);
// Loop po najdenih anketah
if (mysqli_num_rows($sql1) > 0) {
while ($row1 = mysqli_fetch_array($sql1)) {
echo '
';
echo '
';
// Leva stran - ime
echo '
';
echo '';
// Ce gre za search moramo ustrezno pobarvati najden del besede
$text_searched = $row1['naslov'];
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], ''.$matches[0][0].'', $text_searched);
}
}
}
echo skrajsaj($text_searched, 100);
echo '
';
// Desne nastavitve
echo '
';
// Tri pikice
echo '';
// Div ki se prikaze po kliku na 3 pikice
echo '
SurveyAdmin->anketa_copy($ank_id);
$sas = new SurveyAdminSettings();
$new_id = $sas->anketa_copy($ank_id);
$intro_opomba = addslashes( $lang['srv_library_copy_of_note'].''.$row2['naslov'].'' );
// popravimo polja
sisplet_query("UPDATE srv_anketa SET naslov='$row[naslov]', intro_opomba='$intro_opomba', dostop='$row[dostop]', insert_uid='$global_user_id', insert_time=NOW(), edit_uid='$global_user_id', edit_time=NOW() WHERE id='$new_id'");
// dostop uporabimo od stare ankete in ne od skopirane
sisplet_query("DELETE FROM srv_dostop WHERE ank_id = '$new_id'");
while ($rows = mysqli_fetch_array($sqls)) {
sisplet_query("INSERT INTO srv_dostop (ank_id, uid) VALUES ('$new_id', '$rows[uid]')");
}
// staro anketo razglasimo kot backup(arhiv) nove
sisplet_query("UPDATE srv_anketa SET backup='$new_id', active=0, edit_uid='$global_user_id', edit_time=NOW(), naslov = CONCAT( naslov, ' ', DAY(NOW()), '.', MONTH(NOW()), '.', YEAR(NOW()) ) WHERE id='$anketa'");
// vsilimo refresh podatkov
SurveyInfo :: getInstance()->resetSurveyData();
// redirektamo na novo anketo
echo 'index.php?anketa='.$new_id;
}
function repareTabs() {
// popravimo tabe če smo v glasovanju ali formi
if ($this->mode < 2) {
// uredimo tabe
if ($this->tab==0 || $this->tab==1) {
$this->tab=2;
}
}
}
}
?>