diff --git a/admin/exportclases/class.pdfIzvoz.php b/admin/exportclases/class.pdfIzvoz.php index 292a805ea..4d64fb9f9 100644 --- a/admin/exportclases/class.pdfIzvoz.php +++ b/admin/exportclases/class.pdfIzvoz.php @@ -120,8 +120,7 @@ class PdfIzvoz { $this->anketa['uid'] = $global_user_id; SurveyUserSetting::getInstance()->Init($this->anketa['id'], $this->anketa['uid']); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else return false; diff --git a/admin/exportclases/class.pdfIzvozResults.php b/admin/exportclases/class.pdfIzvozResults.php index 3eb21a125..0fc45c239 100644 --- a/admin/exportclases/class.pdfIzvozResults.php +++ b/admin/exportclases/class.pdfIzvozResults.php @@ -146,8 +146,7 @@ class PdfIzvozResults { { SurveyUserSetting::getInstance()->Init($this->anketa['id'], $global_user_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else return false; diff --git a/admin/exportclases/class.rtfIzvoz.php b/admin/exportclases/class.rtfIzvoz.php index c2c027064..71b1c896f 100644 --- a/admin/exportclases/class.rtfIzvoz.php +++ b/admin/exportclases/class.rtfIzvoz.php @@ -90,8 +90,7 @@ class RtfIzvoz { $this->anketa['uid'] = $global_user_id; SurveyUserSetting::getInstance()->Init($this->anketa['id'], $this->anketa['uid']); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else return false; diff --git a/admin/exportclases/class.rtfIzvozResults.php b/admin/exportclases/class.rtfIzvozResults.php index 512bbd123..e01e6400e 100644 --- a/admin/exportclases/class.rtfIzvozResults.php +++ b/admin/exportclases/class.rtfIzvozResults.php @@ -115,8 +115,7 @@ class RtfIzvozResults { { SurveyUserSetting::getInstance()->Init($this->anketa['id'], $global_user_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else return false; diff --git a/admin/survey/Branching.php b/admin/survey/Branching.php index 4182ac0d7..42ade09a4 100644 --- a/admin/survey/Branching.php +++ b/admin/survey/Branching.php @@ -84,8 +84,7 @@ class Branching { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); UserSetting :: getInstance()->Init($global_user_id); @@ -102,7 +101,7 @@ class Branching { } /** - * @desc inicializacija branchinga (samo prvi�, na za�etku), prepi�e vrstni red iz normalenga urejanja + * @desc inicializacija branchinga (samo prvic, na zacetku), prepise vrstni red iz normalenga urejanja */ function init_branching () { diff --git a/admin/survey/BranchingAjax.php b/admin/survey/BranchingAjax.php index 723f355c4..755fadb79 100644 --- a/admin/survey/BranchingAjax.php +++ b/admin/survey/BranchingAjax.php @@ -2172,7 +2172,7 @@ class BranchingAjax { // komentarji respondentov elseif ($type == 2) { - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $orderby = $sortpostorder == 1 ? 'DESC' : 'ASC' ; $sql = sisplet_query("SELECT d.*, u.time_edit FROM srv_data_text".$db_table." d, srv_user u WHERE d.spr_id='0' AND d.vre_id='$spremenljivka' AND u.id=d.usr_id ORDER BY d.id $orderby"); diff --git a/admin/survey/SurveyAdmin.php b/admin/survey/SurveyAdmin.php index 469b2a36e..3a8ccac7c 100644 --- a/admin/survey/SurveyAdmin.php +++ b/admin/survey/SurveyAdmin.php @@ -153,8 +153,7 @@ class SurveyAdmin SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $this->survey_type = $this->getSurvey_type($this->anketa); diff --git a/admin/survey/SurveyAdminAjax.php b/admin/survey/SurveyAdminAjax.php index f64948716..c0dc43d3d 100644 --- a/admin/survey/SurveyAdminAjax.php +++ b/admin/survey/SurveyAdminAjax.php @@ -68,8 +68,7 @@ class SurveyAdminAjax { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $this->survey_type = $this->SurveyAdmin->getSurvey_type($this->anketa); diff --git a/admin/survey/SurveyAdminSettings.php b/admin/survey/SurveyAdminSettings.php index f365d1a30..d9fb63022 100644 --- a/admin/survey/SurveyAdminSettings.php +++ b/admin/survey/SurveyAdminSettings.php @@ -58,8 +58,7 @@ class SurveyAdminSettings { SurveyInfo::getInstance()->SurveyInit($this->anketa); SurveyInfo::getInstance()->resetSurveyData(); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $this->survey_type = $this->getSurvey_type($this->anketa); diff --git a/admin/survey/api/class.ApiSurvey.php b/admin/survey/api/class.ApiSurvey.php index aa8a4813c..93eddc249 100644 --- a/admin/survey/api/class.ApiSurvey.php +++ b/admin/survey/api/class.ApiSurvey.php @@ -3377,7 +3377,7 @@ class ApiSurvey { // vstavimo v srv_data_text (email, ime, priimek) SurveyInfo::getInstance()->SurveyInit($ank_id); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); foreach ($sys_vars AS $sid => $spremenljivka) { if ($spremenljivka['variable'] == 'email') sisplet_query("INSERT INTO srv_data_text" . $db_table . " (spr_id, vre_id, text, usr_id) VALUES ('" . $sid . "', '" . $spremenljivka['vre_id'] . "', '" . $email . "', '" . $usr_id . "')"); @@ -3424,7 +3424,7 @@ class ApiSurvey { // vstavimo v srv_data_text (email, ime, priimek) SurveyInfo::getInstance()->SurveyInit($ank_id); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); foreach ($sys_vars AS $sid => $spremenljivka) { if ($spremenljivka['variable'] == 'email') { $data_insert = sisplet_query("INSERT INTO srv_data_text" . $db_table . " (spr_id, vre_id, text, usr_id) VALUES ('" . $sid . "', '" . $spremenljivka['vre_id'] . "', '" . $email . "', '" . $usr_id . "')"); @@ -3887,7 +3887,7 @@ class ApiSurvey { // vstavimo v srv_data_text (email, ime, priimek) SurveyInfo::getInstance()->SurveyInit($ank_id); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); foreach ($sys_vars AS $sid => $spremenljivka) { if ($spremenljivka['variable'] == 'email') sisplet_query("INSERT INTO srv_data_text" . $db_table . " (spr_id, vre_id, text, usr_id) VALUES ('" . $sid . "', '" . $spremenljivka['vre_id'] . "', '" . $email . "', '" . $usr_id . "')"); @@ -3934,7 +3934,7 @@ class ApiSurvey { // vstavimo v srv_data_text (email, ime, priimek) SurveyInfo::getInstance()->SurveyInit($ank_id); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); foreach ($sys_vars AS $sid => $spremenljivka) { if ($spremenljivka['variable'] == 'email') { $data_insert = sisplet_query("INSERT INTO srv_data_text" . $db_table . " (spr_id, vre_id, text, usr_id) VALUES ('" . $sid . "', '" . $spremenljivka['vre_id'] . "', '" . $email . "', '" . $usr_id . "')"); diff --git a/admin/survey/classes/class.Common.php b/admin/survey/classes/class.Common.php index f2cde6be2..93c7f2f2c 100644 --- a/admin/survey/classes/class.Common.php +++ b/admin/survey/classes/class.Common.php @@ -42,10 +42,9 @@ class Common { { if ($anketa) { self::$anketa = $anketa; - SurveyInfo::getInstance()->SurveyInit(self::$anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - self::$db_table = '_active'; + SurveyInfo::getInstance()->SurveyInit(self::$anketa); + self::$db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } @@ -240,9 +239,8 @@ class Common { $sql = sisplet_query("SELECT id FROM srv_user WHERE preview='1' AND time_edit < NOW() - INTERVAL 3 HOUR AND ank_id = '".$sid."'"); # polovimo vrsto tabel za to anketo - $strDbTable = "SELECT db_table FROM srv_anketa WHERE id = $sid"; - $qryDbTable = sisplet_query($strDbTable); - list($db_table) = mysqli_fetch_row($qryDbTable); + SurveyInfo::getInstance()->SurveyInit($sid); + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $list = ''; // se je dogajalo da je 0 ... pa se je pojavljal mysql_fetch error @@ -255,6 +253,7 @@ class Common { } if ($list != '') { sisplet_query("BEGIN"); + // tabela z respondenti $deleted = sisplet_query("DELETE FROM srv_user WHERE preview='1' AND id IN ($list) AND ank_id = '$sid'"); diff --git a/admin/survey/classes/class.Prevajanje.php b/admin/survey/classes/class.Prevajanje.php index 5a81263e5..14e504be4 100644 --- a/admin/survey/classes/class.Prevajanje.php +++ b/admin/survey/classes/class.Prevajanje.php @@ -47,8 +47,7 @@ class Prevajanje { SurveySetting::getInstance()->Init($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $row = SurveyInfo::getInstance()->getSurveyRow(); diff --git a/admin/survey/classes/class.RecodeValues.php b/admin/survey/classes/class.RecodeValues.php index 50276e2f3..d10b90caf 100644 --- a/admin/survey/classes/class.RecodeValues.php +++ b/admin/survey/classes/class.RecodeValues.php @@ -30,9 +30,8 @@ class RecodeValues { self::$anketa = $anketa; self::$spremenljivka = $spremenljivka; - SurveyInfo::getInstance()->SurveyInit($anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - self::$db_table = '_active'; + SurveyInfo::getInstance()->SurveyInit($anketa); + self::$db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # polovimo manjkajoče privzete vrednosti ankete self::$smv = new SurveyMissingValues(self::$anketa); diff --git a/admin/survey/classes/class.SurveyAktivnost.php b/admin/survey/classes/class.SurveyAktivnost.php index 63a4a496f..1928b39ec 100644 --- a/admin/survey/classes/class.SurveyAktivnost.php +++ b/admin/survey/classes/class.SurveyAktivnost.php @@ -137,8 +137,6 @@ class SurveyAktivnost{ if ($type == 'pages') $time_edit = 'srv_user_grupa_active.time_edit'; - // ker je time_edit vcasih 0000-00-00 bi mogli v teh primerih pobrat time_insert - // $time_edit = 'srv_user_grupa'.$this->db_table.'.time_insert'; elseif ($type == 'users') $time_edit = 'srv_user.time_edit'; elseif ($type=='analiza') diff --git a/admin/survey/classes/class.SurveyAppendMerge.php b/admin/survey/classes/class.SurveyAppendMerge.php index 955c841b4..1b10b05de 100644 --- a/admin/survey/classes/class.SurveyAppendMerge.php +++ b/admin/survey/classes/class.SurveyAppendMerge.php @@ -24,9 +24,7 @@ class SurveyAppendMerge { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; - + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } function display ($merge = false) { diff --git a/admin/survey/classes/class.SurveyConnect.php b/admin/survey/classes/class.SurveyConnect.php index 6f15ce455..e85d52fcf 100644 --- a/admin/survey/classes/class.SurveyConnect.php +++ b/admin/survey/classes/class.SurveyConnect.php @@ -24,8 +24,7 @@ class SurveyConnect { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } function ajax () { @@ -111,7 +110,24 @@ class SurveyConnect { if (!$subsql) echo mysqli_error($GLOBALS['connect_db']); while ($subrow = mysqli_fetch_assoc($subsql)) { - $db_table = ($subrow['db_table'] == 1) ? '_active' : ''; + switch($subrow['db_table']){ + + // Arhivska 1 + case '0': + $db_table = '_archive1'; + break; + + // Arhivska 2 + case '2': + $db_table = '_archive2'; + break; + + // Aktivna anketa + case '1': + default: + $db_table = '_active'; + break; + } $subsql1 = sisplet_query("SELECT d.* FROM srv_data_vrednost".$db_table." d, srv_vrednost v, srv_user u WHERE d.spr_id='$subrow[id]' AND d.vre_id=v.id AND v.variable='$unikat' AND u.id=d.usr_id AND u.deleted='0'"); if (!$subsql1) echo mysqli_error($GLOBALS['connect_db']); diff --git a/admin/survey/classes/class.SurveyCustomReport.php b/admin/survey/classes/class.SurveyCustomReport.php index fb9566f4b..8d0f6168b 100644 --- a/admin/survey/classes/class.SurveyCustomReport.php +++ b/admin/survey/classes/class.SurveyCustomReport.php @@ -29,9 +29,8 @@ class SurveyCustomReport { // polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->ank_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // Inicializiramo in polovimo nastavitve missing profila SurveyStatusProfiles::Init($this->ank_id); diff --git a/admin/survey/classes/class.SurveyDiagnostics.php b/admin/survey/classes/class.SurveyDiagnostics.php index 47329191d..073b9a4ea 100644 --- a/admin/survey/classes/class.SurveyDiagnostics.php +++ b/admin/survey/classes/class.SurveyDiagnostics.php @@ -794,7 +794,7 @@ class SurveyDiagnostics } if (count($spr_id) > 0) { - $db_table = ($this->surveyInfo['db_table'] == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); #preštejemo komentarje uporabnikov na vprašanja # srv_data_text where spr_id = 0 AND vre_id IN (id-ji spremenljivk) diff --git a/admin/survey/classes/class.SurveyExport.php b/admin/survey/classes/class.SurveyExport.php index 844ad0c59..b0166a610 100644 --- a/admin/survey/classes/class.SurveyExport.php +++ b/admin/survey/classes/class.SurveyExport.php @@ -87,8 +87,7 @@ class SurveyExport $this->survey = SurveyInfo::getInstance()->getSurveyRow(); # aktivne tabele - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // Preverimo ce ima user dostop $d = new Dostop(); @@ -820,7 +819,7 @@ class SurveyExport $_max_text_missing_chars = max($_max_text_missing_chars, strlen($mkey . ': '. $missing)); $_max_number_missing_chars = max($_max_number_missing_chars, strlen($mkey)); } - $maxLengthForSpr = self::create_array_SPSS(max($_max_text_missing_chars,$_max_number_missing_chars)); + $maxLengthForSpr = $this->create_array_SPSS(max($_max_text_missing_chars,$_max_number_missing_chars)); //$resultString .= .NEW_LINE; $resultString = $lang['srv_spss_export_base_instructions']; $resultString .= NEW_LINE.'.'.NEW_LINE.NEW_LINE; @@ -1361,18 +1360,15 @@ class SurveyExport private function create_array_SPSS($max_missing) { $array_SPSS = array(); - $db_table = ($this->survey['db_table'] == 1) ? '_active' : ''; - # poberemo max dolžine iz srv_data_text max(text1,text2) - $str_query = 'SELECT dt.spr_id, MAX(LENGTH(dt.text)) AS length, MAX(LENGTH(dt.text2)) AS length2 FROM srv_data_text'.$db_table.' dt, srv_grupa g, srv_spremenljivka s WHERE dt.spr_id = s.id AND s.gru_id=g.id AND g.ank_id='.$this->sid.' GROUP BY dt.spr_id'; + $str_query = 'SELECT dt.spr_id, MAX(LENGTH(dt.text)) AS length, MAX(LENGTH(dt.text2)) AS length2 FROM srv_data_text'.$this->db_table.' dt, srv_grupa g, srv_spremenljivka s WHERE dt.spr_id = s.id AND s.gru_id=g.id AND g.ank_id='.$this->sid.' GROUP BY dt.spr_id'; $_qry_SPSS = sisplet_query($str_query); while (list($spr_id,$text,$text2) = mysqli_fetch_row($_qry_SPSS)) { $array_SPSS[$spr_id] = max((int)$text,(int)$text2,$max_missing); } - $str_query = 'SELECT dt.spr_id, MAX(LENGTH(dt.text)) AS length FROM srv_data_textgrid'.$db_table.' AS dt, srv_grupa g, srv_spremenljivka s WHERE dt.spr_id = s.id AND s.gru_id=g.id AND g.ank_id='.$this->sid.' GROUP BY dt.spr_id'; + $str_query = 'SELECT dt.spr_id, MAX(LENGTH(dt.text)) AS length FROM srv_data_textgrid'.$this->db_table.' AS dt, srv_grupa g, srv_spremenljivka s WHERE dt.spr_id = s.id AND s.gru_id=g.id AND g.ank_id='.$this->sid.' GROUP BY dt.spr_id'; $_qry_SPSS = sisplet_query($str_query); while (list($spr_id,$text) = mysqli_fetch_row($_qry_SPSS)) { - #$this->_array_SPSS[$spr_id]['text2'] = ((int)$text < $this->MISSING_MAX_LENGTH ? $this->MISSING_MAX_LENGTH :$text); $array_SPSS[$spr_id] = max((int)$text,$array_SPSS[$spr_id],$max_missing); } return $array_SPSS; diff --git a/admin/survey/classes/class.SurveyInfo.php b/admin/survey/classes/class.SurveyInfo.php index 590a4c59a..436e8ff4c 100644 --- a/admin/survey/classes/class.SurveyInfo.php +++ b/admin/survey/classes/class.SurveyInfo.php @@ -847,5 +847,33 @@ class SurveyInfo else return false; } + + + // Vrnemo pripeto ime tabele s podatki ce gre za arhivsko ali aktivno anketo (_active, archive1, archive2...) + public static function getSurveyArchiveDBString() { + + $db_table = self::getSurveyColumn('db_table'); + + switch($db_table){ + + // Arhivska 1 + case '0': + $db_table_string = '_archive1'; + break; + + // Arhivska 2 + case '2': + $db_table_string = '_archive2'; + break; + + // Aktivna anketa + case '1': + default: + $db_table_string = '_active'; + break; + } + + return $db_table_string; + } } ?> \ No newline at end of file diff --git a/admin/survey/classes/class.SurveyParaAnalysis.php b/admin/survey/classes/class.SurveyParaAnalysis.php index 6c4ac097a..151fdb618 100644 --- a/admin/survey/classes/class.SurveyParaAnalysis.php +++ b/admin/survey/classes/class.SurveyParaAnalysis.php @@ -57,9 +57,8 @@ class SurveyParaAnalysis{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + $this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; Common::deletePreviewData($this->anketa); diff --git a/admin/survey/classes/class.SurveyPostProcess.php b/admin/survey/classes/class.SurveyPostProcess.php index bdbd5ec47..18aa4a37c 100644 --- a/admin/survey/classes/class.SurveyPostProcess.php +++ b/admin/survey/classes/class.SurveyPostProcess.php @@ -27,8 +27,7 @@ class SurveyPostProcess { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); #inicializiramo class za datoteke $this->SDF = SurveyDataFile::get_instance(); diff --git a/admin/survey/classes/class.SurveyRecoding.php b/admin/survey/classes/class.SurveyRecoding.php index ed65e1f0d..827eaa9d7 100644 --- a/admin/survey/classes/class.SurveyRecoding.php +++ b/admin/survey/classes/class.SurveyRecoding.php @@ -7,11 +7,10 @@ class SurveyRecoding function __construct($anketa) { $this->anketa = $anketa; + SurveyInfo::getInstance()->SurveyInit($anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - - $this->db_table = '_active'; - + + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } function Ajax() { diff --git a/admin/survey/classes/class.SurveyReminderTracking.php b/admin/survey/classes/class.SurveyReminderTracking.php index e76d45306..92151f7cb 100644 --- a/admin/survey/classes/class.SurveyReminderTracking.php +++ b/admin/survey/classes/class.SurveyReminderTracking.php @@ -51,9 +51,8 @@ class SurveyReminderTracking{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + $this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; Common::deletePreviewData($this->anketa); diff --git a/admin/survey/classes/class.SurveyRespondents.php b/admin/survey/classes/class.SurveyRespondents.php index 5108a6752..235edc61c 100644 --- a/admin/survey/classes/class.SurveyRespondents.php +++ b/admin/survey/classes/class.SurveyRespondents.php @@ -434,7 +434,7 @@ class SurveyRespondents { global $site_path, $site_url, $lang; SurveyInfo::getInstance()->SurveyInit(self::getSurveyId()); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); echo ''.$lang['srv_respondents_added_respondents'].':'; echo ''.$lang['forward'].''; @@ -669,7 +669,7 @@ class SurveyRespondents { global $admin_type; SurveyInfo::getInstance()->SurveyInit(self::getSurveyId()); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // preverimo potrebne sistemske variable // tu je lahko vejica diff --git a/admin/survey/classes/class.SurveyStatistic.php b/admin/survey/classes/class.SurveyStatistic.php index 092775db5..54f9ff7bb 100644 --- a/admin/survey/classes/class.SurveyStatistic.php +++ b/admin/survey/classes/class.SurveyStatistic.php @@ -140,8 +140,7 @@ class SurveyStatistic { # poiščemo aktivno anketo SurveyInfo :: getInstance()->SurveyInit($this->getSurveyId()); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # nastavimo spremenljivko ali imamo vse default vrednosti $this->isDefaultFilters = true; diff --git a/admin/survey/classes/class.SurveyTelephone.php b/admin/survey/classes/class.SurveyTelephone.php index e8fab94ba..675f1c191 100644 --- a/admin/survey/classes/class.SurveyTelephone.php +++ b/admin/survey/classes/class.SurveyTelephone.php @@ -3472,7 +3472,7 @@ class SurveyTelephone { sisplet_query($strInsert); # vstavimo v srv_data_text - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); if (count($strInsertDataText) > 0) { $strInsert = "INSERT INTO srv_data_text".$db_table." (spr_id, vre_id, text, usr_id) VALUES "; $strInsert .= implode(',',$strInsertDataText); diff --git a/admin/survey/classes/class.SurveyTextAnalysis.php b/admin/survey/classes/class.SurveyTextAnalysis.php index 6b96ac6c0..d7aa43918 100644 --- a/admin/survey/classes/class.SurveyTextAnalysis.php +++ b/admin/survey/classes/class.SurveyTextAnalysis.php @@ -15,9 +15,7 @@ class SurveyTextAnalysis{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else { echo 'Invalid Survey ID!'; diff --git a/admin/survey/classes/class.SurveyUsableResp.php b/admin/survey/classes/class.SurveyUsableResp.php index 980c76259..33817516a 100644 --- a/admin/survey/classes/class.SurveyUsableResp.php +++ b/admin/survey/classes/class.SurveyUsableResp.php @@ -51,9 +51,8 @@ class SurveyUsableResp{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + $this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; Common::deletePreviewData($this->anketa); diff --git a/admin/survey/classes/class.Vprasanje.php b/admin/survey/classes/class.Vprasanje.php index a12c80a62..5453b7946 100644 --- a/admin/survey/classes/class.Vprasanje.php +++ b/admin/survey/classes/class.Vprasanje.php @@ -31,8 +31,7 @@ class Vprasanje { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); if (SurveyInfo::getInstance()->getSurveyColumn('expanded') == 1) $this->expanded = 1; diff --git a/admin/survey/classes/class.VprasanjeInline.php b/admin/survey/classes/class.VprasanjeInline.php index 23c20cbfd..556eb1ead 100644 --- a/admin/survey/classes/class.VprasanjeInline.php +++ b/admin/survey/classes/class.VprasanjeInline.php @@ -31,8 +31,7 @@ class VprasanjeInline { SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); if (SurveyInfo::getInstance()->getSurveyColumn('expanded') == 1) $this->expanded = 1; diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyAnalysis.php b/admin/survey/classes/surveyAnalysis/class.SurveyAnalysis.php index c14cc02f0..fbf3a35b1 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyAnalysis.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyAnalysis.php @@ -196,9 +196,7 @@ class SurveyAnalysis { UserSetting :: getInstance()->Init($global_user_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - self::$db_table = '_active'; - } + self::$db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # nastavimo vse filtre self::setUpFilter(); diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyAnalysisHelper.php b/admin/survey/classes/surveyAnalysis/class.SurveyAnalysisHelper.php index 6678ebadc..fb9f3682f 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyAnalysisHelper.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyAnalysisHelper.php @@ -28,9 +28,8 @@ class SurveyAnalysisHelper { self::$anketa = $anketa; SurveyInfo::getInstance()->SurveyInit(self::$anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - self::$db_table = '_active'; - + + self::$db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php b/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php index d863c97cb..aea8c684d 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyBreak.php @@ -49,9 +49,8 @@ class SurveyBreak # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->sid); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + $this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; #inicializiramo class za datoteke diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php b/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php index b0ada1f68..44398adb4 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyCrosstabs.php @@ -104,9 +104,8 @@ class SurveyCrosstabs { # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->sid); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + $this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; # Inicializiramo in polovimo nastavitve missing profila diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyEditsAnalysis.php b/admin/survey/classes/surveyAnalysis/class.SurveyEditsAnalysis.php index ae07e781d..f7ba2f4a9 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyEditsAnalysis.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyEditsAnalysis.php @@ -15,20 +15,20 @@ class SurveyEditsAnalysis{ function __construct($anketa){ - if ((int)$anketa > 0){ - $this->anketa = $anketa; + if ((int)$anketa > 0){ - # polovimo vrsto tabel (aktivne / neaktivne) - SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } - } - else { - echo 'Invalid Survey ID!'; - exit(); - } + $this->anketa = $anketa; + + # polovimo vrsto tabel (aktivne / neaktivne) + SurveyInfo :: getInstance()->SurveyInit($this->anketa); + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + } + else { + + echo 'Invalid Survey ID!'; + exit(); + } } diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyMeans.php b/admin/survey/classes/surveyAnalysis/class.SurveyMeans.php index 0775dfdba..6b2602a68 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyMeans.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyMeans.php @@ -41,9 +41,7 @@ class SurveyMeans{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->sid); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # Inicializiramo in polovimo nastavitve missing profila SurveyStatusProfiles::Init($this->sid); diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyMultiCrosstabs.php b/admin/survey/classes/surveyAnalysis/class.SurveyMultiCrosstabs.php index 758c0f6f1..db9c9e448 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyMultiCrosstabs.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyMultiCrosstabs.php @@ -74,9 +74,7 @@ class SurveyMultiCrosstabs { # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->ank_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $this->_CURRENT_STATUS_FILTER = STATUS_FIELD.' ~ /6|5/'; diff --git a/admin/survey/classes/surveyAnalysis/class.SurveyTTest.php b/admin/survey/classes/surveyAnalysis/class.SurveyTTest.php index 9108c1046..035fe98c9 100644 --- a/admin/survey/classes/surveyAnalysis/class.SurveyTTest.php +++ b/admin/survey/classes/surveyAnalysis/class.SurveyTTest.php @@ -37,10 +37,7 @@ class SurveyTTest # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->sid); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } - + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # Inicializiramo in polovimo nastavitve missing profila SurveyStatusProfiles::Init($this->sid); diff --git a/admin/survey/classes/surveyData/class.SurveyDataCollect.php b/admin/survey/classes/surveyData/class.SurveyDataCollect.php index ec3a9a6bc..59975b4c3 100644 --- a/admin/survey/classes/surveyData/class.SurveyDataCollect.php +++ b/admin/survey/classes/surveyData/class.SurveyDataCollect.php @@ -189,11 +189,10 @@ class SurveyDataCollect{ $qry_survey = sisplet_query("SELECT *, UNIX_TIMESTAMP(edit_time) AS srv_edit_time FROM srv_anketa WHERE id='".$this->sid."'"); $this->survey = mysqli_fetch_assoc($qry_survey); + SurveyInfo::getInstance()->SurveyInit($this->sid); + // Aktivne tabele za podatke v bazi - if ((int)$this->survey['db_table'] == 1) - $this->db_table = '_active'; - else - $this->db_table = ''; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // Zadnji cas editiranja ankete $this->max_anketa_time = (int)$this->survey['srv_edit_time']; diff --git a/admin/survey/classes/surveyData/class.SurveyDataDisplay.php b/admin/survey/classes/surveyData/class.SurveyDataDisplay.php index f1b0641ea..1197feb25 100644 --- a/admin/survey/classes/surveyData/class.SurveyDataDisplay.php +++ b/admin/survey/classes/surveyData/class.SurveyDataDisplay.php @@ -165,8 +165,7 @@ class SurveyDataDisplay{ self::$survey = SurveyInfo::getInstance()->getSurveyRow(); # aktivne tabele - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - self::$db_table = '_active'; + self::$db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # ali je anketa tipa SN - social network self::$is_social_network = (SurveyInfo::getInstance()->checkSurveyModule('social_network')) ? true : false; @@ -3050,11 +3049,9 @@ class SurveyDataDisplay{ echo ''.$text.''; } - if ( $admin_type <= 1) { - + if ( $admin_type <= 1) { echo ''.$lang['srv_sc_txt1'].':'; - echo ''.$lang['srv_sc_txt2'].''; - + echo ''.$lang['srv_sc_txt2'].''; } } diff --git a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php index 92d83ab03..13962030d 100644 --- a/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php +++ b/admin/survey/classes/surveyEmails/class.SurveyInvitationsNew.php @@ -44,8 +44,7 @@ class SurveyInvitationsNew { SurveyInfo::SurveyInit($this->sid); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $this->surveySettings = SurveyInfo::getInstance()->getSurveyRow(); diff --git a/admin/survey/classes/surveyEmails/class.SurveyUnsubscribe.php b/admin/survey/classes/surveyEmails/class.SurveyUnsubscribe.php index 370c9eefa..a8a050522 100644 --- a/admin/survey/classes/surveyEmails/class.SurveyUnsubscribe.php +++ b/admin/survey/classes/surveyEmails/class.SurveyUnsubscribe.php @@ -122,7 +122,7 @@ class SurveyUnsubscribe { $anketa = self::$sid; - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $lang_id = (int)$_GET['language']; if ($lang_id != null) $_lang = '_'.$lang_id; else $_lang = ''; diff --git a/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php b/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php index 4dd983ae4..f37c0da24 100644 --- a/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php +++ b/admin/survey/classes/surveyEmails/squalo/class.SurveyInvitationsSqualo.php @@ -254,8 +254,7 @@ class SurveyInvitationsSqualo { // če mamo personalizirana email vabila, userje dodamo v bazo if ($individual == 1) { - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $db_table = '_active'; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $inv_variables_link = array('email'=>'email','geslo'=>'password','ime'=>'firstname','priimek'=>'lastname','naziv'=>'salutation','telefon'=>'phone','drugo'=>'custom','odnos'=>'relation','last_status'=>'last_status','sent'=>'sent','responded'=>'responded','unsubscribed'=>'unsubscribed'); diff --git a/admin/survey/classes/tracking/TrackingClass.php b/admin/survey/classes/tracking/TrackingClass.php index 3115d36a2..5d5bd8a9f 100644 --- a/admin/survey/classes/tracking/TrackingClass.php +++ b/admin/survey/classes/tracking/TrackingClass.php @@ -23,8 +23,7 @@ class TrackingClass # poiščemo aktivno anketo SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); if ($_GET['m'] == 'tracking_data') $this->sub = 'data'; @@ -322,7 +321,7 @@ class TrackingClass # poiščemo aktivno anketo SurveyInfo :: getInstance()->SurveyInit($anketa); - $db_table = (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); $get = ''; foreach ($_GET AS $key => $val) { diff --git a/admin/survey/export/latexclasses/class.LatexSurvey.php b/admin/survey/export/latexclasses/class.LatexSurvey.php index 2e1dce066..31672e9c1 100644 --- a/admin/survey/export/latexclasses/class.LatexSurvey.php +++ b/admin/survey/export/latexclasses/class.LatexSurvey.php @@ -95,9 +95,7 @@ class LatexSurvey{ //if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init()) if ( SurveyInfo::getInstance()->SurveyInit($this->anketa) ) { - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1){ - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else{ return false; diff --git a/admin/survey/export/latexclasses/class.LatexSurveyElement.php b/admin/survey/export/latexclasses/class.LatexSurveyElement.php index a9b00b475..2b2c0ee03 100644 --- a/admin/survey/export/latexclasses/class.LatexSurveyElement.php +++ b/admin/survey/export/latexclasses/class.LatexSurveyElement.php @@ -102,8 +102,7 @@ class LatexSurveyElement{ { SurveyUserSetting::getInstance()->Init($anketa, $global_user_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else{ return false; diff --git a/admin/survey/export/xmlClasses/class.XmlSurvey.php b/admin/survey/export/xmlClasses/class.XmlSurvey.php index db339af49..eede42ab3 100644 --- a/admin/survey/export/xmlClasses/class.XmlSurvey.php +++ b/admin/survey/export/xmlClasses/class.XmlSurvey.php @@ -63,9 +63,7 @@ class XmlSurvey{ //if ( SurveyInfo::getInstance()->SurveyInit($this->anketa['id']) && $this->init()) if ( SurveyInfo::getInstance()->SurveyInit($this->anketa) ) { - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1){ - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else{ return false; diff --git a/admin/survey/export/xmlClasses/class.XmlSurveyElement.php b/admin/survey/export/xmlClasses/class.XmlSurveyElement.php index 6b830becb..a04a38723 100644 --- a/admin/survey/export/xmlClasses/class.XmlSurveyElement.php +++ b/admin/survey/export/xmlClasses/class.XmlSurveyElement.php @@ -57,8 +57,7 @@ class XmlSurveyElement{ { SurveyUserSetting::getInstance()->Init($anketa, $global_user_id); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - $this->db_table = '_active'; + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else{ return false; diff --git a/admin/survey/modules/Evalvacija/class.Evalvacija.php b/admin/survey/modules/Evalvacija/class.Evalvacija.php index 2124e8a4f..978a893ae 100644 --- a/admin/survey/modules/Evalvacija/class.Evalvacija.php +++ b/admin/survey/modules/Evalvacija/class.Evalvacija.php @@ -69,9 +69,7 @@ class Evalvacija{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // Nastavimo clanico kateri pripada anketa $this->fakulteta = $this->getFakultetaId($anketa); diff --git a/admin/survey/modules/mod_360/class.Survey360.php b/admin/survey/modules/mod_360/class.Survey360.php index 6d8485606..76a81159e 100644 --- a/admin/survey/modules/mod_360/class.Survey360.php +++ b/admin/survey/modules/mod_360/class.Survey360.php @@ -19,9 +19,7 @@ class Survey360{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_360_1KA/class.Survey3601ka.php b/admin/survey/modules/mod_360_1KA/class.Survey3601ka.php index 37ba80a7d..0276a3f8c 100644 --- a/admin/survey/modules/mod_360_1KA/class.Survey3601ka.php +++ b/admin/survey/modules/mod_360_1KA/class.Survey3601ka.php @@ -19,9 +19,7 @@ class Survey3601ka{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_BORZA/class.SurveyBORZA.php b/admin/survey/modules/mod_BORZA/class.SurveyBORZA.php index ca4ca37aa..a1a0a1dbe 100644 --- a/admin/survey/modules/mod_BORZA/class.SurveyBORZA.php +++ b/admin/survey/modules/mod_BORZA/class.SurveyBORZA.php @@ -19,9 +19,7 @@ class SurveyBORZA{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_EVOLI/class.EvoliForm.php b/admin/survey/modules/mod_EVOLI/class.EvoliForm.php index 912595eee..dc652bdfe 100644 --- a/admin/survey/modules/mod_EVOLI/class.EvoliForm.php +++ b/admin/survey/modules/mod_EVOLI/class.EvoliForm.php @@ -39,9 +39,7 @@ class EvoliForm { # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_EVOLI/class.SurveyEmployMeter.php b/admin/survey/modules/mod_EVOLI/class.SurveyEmployMeter.php index 5b181885d..fcc6f19e9 100644 --- a/admin/survey/modules/mod_EVOLI/class.SurveyEmployMeter.php +++ b/admin/survey/modules/mod_EVOLI/class.SurveyEmployMeter.php @@ -21,9 +21,7 @@ class SurveyEmployMeter{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_EVOLI/class.SurveyEvoli.php b/admin/survey/modules/mod_EVOLI/class.SurveyEvoli.php index 49b8f3f0e..8bc517001 100644 --- a/admin/survey/modules/mod_EVOLI/class.SurveyEvoli.php +++ b/admin/survey/modules/mod_EVOLI/class.SurveyEvoli.php @@ -21,9 +21,7 @@ class SurveyEvoli{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_EVOLI/class.SurveyTeamMeter.php b/admin/survey/modules/mod_EVOLI/class.SurveyTeamMeter.php index 5d7a36795..046d44f75 100644 --- a/admin/survey/modules/mod_EVOLI/class.SurveyTeamMeter.php +++ b/admin/survey/modules/mod_EVOLI/class.SurveyTeamMeter.php @@ -30,9 +30,7 @@ class SurveyTeamMeter{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // Nastavimo se ustrezne parametre za skripto glede na tip izvoza (ime skripte, pdf-ja, csv-ja) $this->setExecuteParams(); diff --git a/admin/survey/modules/mod_MFDPS/class.SurveyMFDPS.php b/admin/survey/modules/mod_MFDPS/class.SurveyMFDPS.php index b3d320fb3..7b036e0cb 100644 --- a/admin/survey/modules/mod_MFDPS/class.SurveyMFDPS.php +++ b/admin/survey/modules/mod_MFDPS/class.SurveyMFDPS.php @@ -26,9 +26,7 @@ class SurveyMFDPS{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } $this->cacheData(); diff --git a/admin/survey/modules/mod_MJU/class.SurveyMJU.php b/admin/survey/modules/mod_MJU/class.SurveyMJU.php index 5c873b9a8..c7dba1f44 100644 --- a/admin/survey/modules/mod_MJU/class.SurveyMJU.php +++ b/admin/survey/modules/mod_MJU/class.SurveyMJU.php @@ -25,9 +25,7 @@ class SurveyMJU{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_MJU/class.SurveyMJUEnote.php b/admin/survey/modules/mod_MJU/class.SurveyMJUEnote.php index 1b23e948c..345aef189 100644 --- a/admin/survey/modules/mod_MJU/class.SurveyMJUEnote.php +++ b/admin/survey/modules/mod_MJU/class.SurveyMJUEnote.php @@ -20,9 +20,7 @@ class SurveyMJUEnote{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_NIJZ/class.SurveyNIJZ.php b/admin/survey/modules/mod_NIJZ/class.SurveyNIJZ.php index c98c1cbb1..ee3b9ecf2 100644 --- a/admin/survey/modules/mod_NIJZ/class.SurveyNIJZ.php +++ b/admin/survey/modules/mod_NIJZ/class.SurveyNIJZ.php @@ -45,9 +45,7 @@ class SurveyNIJZ{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } else{ die(); diff --git a/admin/survey/modules/mod_SPEEDINDEX/class.SurveySpeedIndex.php b/admin/survey/modules/mod_SPEEDINDEX/class.SurveySpeedIndex.php index 5fc234bc3..62d72b616 100644 --- a/admin/survey/modules/mod_SPEEDINDEX/class.SurveySpeedIndex.php +++ b/admin/survey/modules/mod_SPEEDINDEX/class.SurveySpeedIndex.php @@ -19,9 +19,7 @@ class SurveySpeedIndex{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_hierarhija/class/HierarhijaAnalysisClass.php b/admin/survey/modules/mod_hierarhija/class/HierarhijaAnalysisClass.php index 4b048092a..95a5992f7 100644 --- a/admin/survey/modules/mod_hierarhija/class/HierarhijaAnalysisClass.php +++ b/admin/survey/modules/mod_hierarhija/class/HierarhijaAnalysisClass.php @@ -54,9 +54,7 @@ class HierarhijaAnalysis # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo::getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); # Inicializiramo in polovimo nastavitve missing profila SurveyStatusProfiles::Init($this->anketa); diff --git a/admin/survey/modules/mod_hierarhija/class/HierarhijaClass.php b/admin/survey/modules/mod_hierarhija/class/HierarhijaClass.php index a004aaaa9..066944be2 100644 --- a/admin/survey/modules/mod_hierarhija/class/HierarhijaClass.php +++ b/admin/survey/modules/mod_hierarhija/class/HierarhijaClass.php @@ -2087,8 +2087,7 @@ class Hierarhija { } } - $db_table = (SurveyInfo::getInstance() - ->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // tukaj pridobimo podatke o anketi za določeno strukturo // preverimov prvi in zadnji nivo diff --git a/admin/survey/modules/mod_hierarhija/class/HierarhijaHelper.php b/admin/survey/modules/mod_hierarhija/class/HierarhijaHelper.php index 6c57ae424..43757f0ae 100644 --- a/admin/survey/modules/mod_hierarhija/class/HierarhijaHelper.php +++ b/admin/survey/modules/mod_hierarhija/class/HierarhijaHelper.php @@ -41,10 +41,7 @@ class HierarhijaHelper // V kolikor smo na katerikoli strani, potem gledamo po piškotkih if (isset($get->{'survey-'.$ank_id})) { - $active = ''; - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $active = '_active'; - } + $active = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // ID uporabnika, glede na njegov piškot $srv_user = sisplet_query("SELECT id FROM srv_user WHERE cookie='".$get->{'survey-'.$ank_id}."'", "obj")->id; diff --git a/admin/survey/modules/mod_hierarhija/class/HierarhijaIzvoz.php b/admin/survey/modules/mod_hierarhija/class/HierarhijaIzvoz.php index 6bf425076..d212e9f74 100644 --- a/admin/survey/modules/mod_hierarhija/class/HierarhijaIzvoz.php +++ b/admin/survey/modules/mod_hierarhija/class/HierarhijaIzvoz.php @@ -313,8 +313,7 @@ class HierarhijaIzvoz { } } - $db_table = (SurveyInfo::getInstance() - ->getSurveyColumn('db_table') == 1) ? '_active' : ''; + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); // tukaj pridobimo podatke o anketi za določeno strukturo // preverimov prvi in zadnji nivo diff --git a/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php b/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php index 979b0dde0..e21670646 100644 --- a/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php +++ b/admin/survey/modules/mod_kakovost/class.SurveyKakovost.php @@ -50,9 +50,7 @@ class SurveyKakovost{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); SurveyAnalysisHelper::getInstance()->Init($this->anketa); diff --git a/admin/survey/modules/mod_panel/class.SurveyPanel.php b/admin/survey/modules/mod_panel/class.SurveyPanel.php index 7d64cf1ac..5fc0cf12d 100644 --- a/admin/survey/modules/mod_panel/class.SurveyPanel.php +++ b/admin/survey/modules/mod_panel/class.SurveyPanel.php @@ -20,9 +20,7 @@ class SurveyPanel{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/modules/mod_uporabnost/class.SurveyUporabnost.php b/admin/survey/modules/mod_uporabnost/class.SurveyUporabnost.php index 16b3f1dfa..0a36243f9 100644 --- a/admin/survey/modules/mod_uporabnost/class.SurveyUporabnost.php +++ b/admin/survey/modules/mod_uporabnost/class.SurveyUporabnost.php @@ -50,9 +50,7 @@ class SurveyUporabnost{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); SurveyAnalysisHelper::getInstance()->Init($this->anketa); diff --git a/admin/survey/modules/mod_vizualizacija/class.SurveyVizualizacija.php b/admin/survey/modules/mod_vizualizacija/class.SurveyVizualizacija.php index 6a5bf5b7a..ae8700aaa 100644 --- a/admin/survey/modules/mod_vizualizacija/class.SurveyVizualizacija.php +++ b/admin/survey/modules/mod_vizualizacija/class.SurveyVizualizacija.php @@ -20,9 +20,7 @@ class SurveyVizualizacija{ # polovimo vrsto tabel (aktivne / neaktivne) SurveyInfo :: getInstance()->SurveyInit($this->anketa); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) { - $this->db_table = '_active'; - } + $this->db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); } } diff --git a/admin/survey/parapodatki.php b/admin/survey/parapodatki.php index 727150b3a..d30e1a887 100644 --- a/admin/survey/parapodatki.php +++ b/admin/survey/parapodatki.php @@ -106,9 +106,7 @@ if ($_GET['a'] == 'ankete') { if (mysqli_num_rows($sql) > 0) { $row = mysqli_fetch_array($sql); - - if ($row['db_table'] == 1) $db_table = '_active'; else $db_table = ''; - + echo $row['id'].delimiter; echo $row['insert_uid'].delimiter; echo $row['a_first'].delimiter; @@ -232,7 +230,24 @@ if ($_GET['a'] == 'ankete') { while ($row = mysqli_fetch_array($sql)) { - if ($row['db_table'] == 1) $db_table = '_active'; else $db_table = ''; + switch($row['db_table']){ + + // Arhivska 1 + case '0': + $db_table = '_archive1'; + break; + + // Arhivska 2 + case '2': + $db_table = '_archive2'; + break; + + // Aktivna anketa + case '1': + default: + $db_table = '_active'; + break; + } echo $row['id'].delimiter; echo $row['uid'].delimiter; diff --git a/main/survey/app/Controllers/InitClass.php b/main/survey/app/Controllers/InitClass.php index afed69e85..4439235d2 100644 --- a/main/survey/app/Controllers/InitClass.php +++ b/main/survey/app/Controllers/InitClass.php @@ -99,8 +99,8 @@ class InitClass extends Controller // polovimo podatke o anketi SurveyInfo::getInstance()->SurveyInit(get('anketa')); - if (SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - save('db_table', '_active'); + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + save('db_table', $db_table); $rowa = SurveyInfo::getInstance()->getSurveyRow(); @@ -453,8 +453,8 @@ class InitClass extends Controller // polovimo podatke o anketi \SurveyInfo::getInstance()->SurveyInit(get('anketa')); - if (\SurveyInfo::getInstance()->getSurveyColumn('db_table') == 1) - save('db_table', '_active'); + $db_table = \SurveyInfo::getInstance()->getSurveyArchiveDBString(); + save('db_table', $db_table); \SurveySetting::getInstance()->Init(get('anketa')); save('usr_id', $_REQUEST['usr_id']); diff --git a/main/survey/app/Controllers/StatisticController.php b/main/survey/app/Controllers/StatisticController.php index 59b7f44e0..7e1d4812c 100644 --- a/main/survey/app/Controllers/StatisticController.php +++ b/main/survey/app/Controllers/StatisticController.php @@ -138,8 +138,9 @@ class StatisticController extends Controller $sqla = sisplet_query("SELECT starts, expire, statistics, db_table FROM srv_anketa WHERE id ='$row2[ank_id]'"); $rowa = mysqli_fetch_array($sqla); - if ($rowa['db_table'] == 1) - save('db_table', '_active'); + SurveyInfo::getInstance()->SurveyInit($row2['ank_id']); + $db_table = SurveyInfo::getInstance()->getSurveyArchiveDBString(); + save('db_table', $db_table); $text = $rowa['statistics']; diff --git a/sql/update2.sql b/sql/update2.sql index 013778ffb..603da6ce9 100644 --- a/sql/update2.sql +++ b/sql/update2.sql @@ -9500,15 +9500,32 @@ INSERT INTO srv_help (help, what) VALUES ('Operatorji', 'srv_if_operator'); UPDATE misc SET value='21.05.25' WHERE what="version"; - # Drupal verzija je bila posodobljena in vpišemo na 1ka.si in te UPDATE misc SET value='7.81' WHERE what="drupal version"; UPDATE misc SET value='21.06.10' WHERE what="version"; - INSERT INTO srv_help (what, help) VALUES ('srv_export_full_meta', 'Export data and paradata'); -UPDATE misc SET value='21.07.19' WHERE what="version"; UPDATE srv_help SET help='Izvozi podatke in parapodatke' WHERE what='srv_export_full_meta' AND lang='1'; INSERT INTO srv_help (what, help, lang) VALUES ('srv_export_full_meta', 'Export data and paradata', '2'); -UPDATE misc SET value='21.07.19' WHERE what="version"; \ No newline at end of file + +UPDATE misc SET value='21.07.19' WHERE what="version"; + +# NOVE ARHIVSKE TABELE - STARE SO PREIMENOVANE IN DODANE DODATNE +RENAME TABLE srv_data_vrednost TO srv_data_vrednost_archive1; +RENAME TABLE srv_data_text TO srv_data_text_archive1; +RENAME TABLE srv_data_grid TO srv_data_grid_archive1; +RENAME TABLE srv_data_checkgrid TO srv_data_checkgrid_archive1; +RENAME TABLE srv_data_textgrid TO srv_data_textgrid_archive1; +RENAME TABLE srv_user_grupa TO srv_user_grupa_archive1; +RENAME TABLE srv_tracking TO srv_tracking_archive1; + +CREATE TABLE srv_data_vrednost_archive2 LIKE srv_data_vrednost_archive1; +CREATE TABLE srv_data_text_archive2 LIKE srv_data_text_archive1; +CREATE TABLE srv_data_grid_archive2 LIKE srv_data_grid_archive1; +CREATE TABLE srv_data_checkgrid_archive2 LIKE srv_data_checkgrid_archive1; +CREATE TABLE srv_data_textgrid_archive2 LIKE srv_data_textgrid_archive1; +CREATE TABLE srv_user_grupa_archive2 LIKE srv_user_grupa_archive1; +CREATE TABLE srv_tracking_archive2 LIKE srv_tracking_archive1; + +UPDATE misc SET value='23.07.19' WHERE what="version"; diff --git a/utils/1kaUtils/1ka_ankete_deactive_v3.php b/utils/1kaUtils/1ka_ankete_deactive_v3.php index 201583323..352381bac 100644 --- a/utils/1kaUtils/1ka_ankete_deactive_v3.php +++ b/utils/1kaUtils/1ka_ankete_deactive_v3.php @@ -1,7 +1,7 @@ '.$_GET['start'] : ''; // Limit stevila anket, ki jih naenkrat arhiviramo $limit = (isset($_GET['limit'])) ? $_GET['limit'] : 200; +$archive_table = '2'; +$archive_table_string = '_archive2'; + // Arhiviramo specificno anketo if($survey_id != ''){ @@ -50,8 +53,10 @@ else{ } if (!$sql) { echo mysqli_error($GLOBALS['connect_db']).' 50'; die(); } + echo 'Arhiviranje '.mysqli_num_rows($sql).' anket.
'; + // Loop po anketah while ($row = mysqli_fetch_array($sql)) { @@ -84,7 +89,7 @@ while ($row = mysqli_fetch_array($sql)) { // Popravimo anketo med arhivske (ni vec _active) - $s = sisplet_query("UPDATE srv_anketa SET db_table = '0' WHERE id = '$row[id]'"); + $s = sisplet_query("UPDATE srv_anketa SET db_table = '".$archive_table."' WHERE id = '$row[id]'"); if (!$s) { echo mysqli_error($GLOBALS['connect_db']).' 70'; die(); } @@ -101,8 +106,8 @@ while ($row = mysqli_fetch_array($sql)) { // ARHIVIRANJE srv_user_grupa function archive_srv_user_grupa($ank_id){ - // Vstavimo v arhivsko tabelo (srv_user_grupa) - $sql1 = sisplet_query("INSERT INTO srv_user_grupa (gru_id, usr_id, time_edit, preskocena) + // Vstavimo v arhivsko tabelo (srv_user_grupa_archive2) + $sql1 = sisplet_query("INSERT INTO srv_user_grupa".$archive_table_string." (gru_id, usr_id, time_edit, preskocena) SELECT d2.gru_id, d2.usr_id, d2.time_edit, d2.preskocena FROM srv_user_grupa_active d2, srv_grupa g WHERE d2.gru_id = g.id @@ -126,8 +131,8 @@ function archive_srv_data_vrednost($ank_id){ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja sisplet_query("SET FOREIGN_KEY_CHECKS=0"); - // Vstavimo v arhivsko tabelo (srv_data_vrednost) - $sql1 = sisplet_query("INSERT INTO srv_data_vrednost (spr_id, vre_id, usr_id, loop_id) + // Vstavimo v arhivsko tabelo (srv_data_vrednost_archive2) + $sql1 = sisplet_query("INSERT INTO srv_data_vrednost".$archive_table_string." (spr_id, vre_id, usr_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.loop_id FROM srv_data_vrednost_active d2, srv_spremenljivka s, srv_grupa g WHERE d2.spr_id = s.id @@ -156,7 +161,7 @@ function archive_srv_data_text($ank_id){ sisplet_query("SET FOREIGN_KEY_CHECKS=0"); // Vstavimo v arhivsko tabelo (srv_data_text) - $sql1 = sisplet_query("INSERT INTO srv_data_text (spr_id, vre_id, text, text2, usr_id, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_text".$archive_table_string." (spr_id, vre_id, text, text2, usr_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.text, d2.text2, d2.usr_id, d2.loop_id FROM srv_data_text_active d2, srv_spremenljivka s, srv_grupa g WHERE d2.spr_id = s.id @@ -181,7 +186,7 @@ function archive_srv_data_text($ank_id){ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja sisplet_query("SET FOREIGN_KEY_CHECKS=0"); - $sql1 = sisplet_query("INSERT INTO srv_data_text (spr_id, vre_id, text, text2, usr_id, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_text".$archive_table_string." (spr_id, vre_id, text, text2, usr_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.text, d2.text2, d2.usr_id, d2.loop_id FROM srv_data_text_active d2, srv_spremenljivka s, srv_grupa g WHERE d2.spr_id = '0' @@ -212,7 +217,7 @@ function archive_srv_data_grid($ank_id){ sisplet_query("SET FOREIGN_KEY_CHECKS=0"); // Vstavimo v arhivsko tabelo (srv_data_grid) - $sql1 = sisplet_query("INSERT INTO srv_data_grid (spr_id, vre_id, usr_id, grd_id, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_grid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id FROM srv_data_grid_active d2, srv_spremenljivka s, srv_grupa g WHERE d2.spr_id = s.id @@ -237,7 +242,7 @@ function archive_srv_data_grid($ank_id){ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja sisplet_query("SET FOREIGN_KEY_CHECKS=0"); - $sql1 = sisplet_query("INSERT INTO srv_data_grid (spr_id, vre_id, usr_id, grd_id, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_grid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id FROM srv_data_grid_active d2, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m WHERE d2.spr_id = m.spr_id AND m.parent=s.id @@ -266,7 +271,7 @@ function archive_srv_data_textgrid($ank_id){ sisplet_query("SET FOREIGN_KEY_CHECKS=0"); // Vstavimo v arhivsko tabelo (srv_data_textgrid) - $sql1 = sisplet_query("INSERT INTO srv_data_textgrid (spr_id, vre_id, usr_id, grd_id, text, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_textgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, text, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.text, d2.loop_id FROM srv_data_textgrid_active d2, srv_spremenljivka s, srv_grupa g WHERE d2.spr_id = s.id @@ -291,7 +296,7 @@ function archive_srv_data_textgrid($ank_id){ // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja sisplet_query("SET FOREIGN_KEY_CHECKS=0"); - $sql1 = sisplet_query("INSERT INTO srv_data_textgrid (spr_id, vre_id, usr_id, grd_id, text, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_textgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, text, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.text, d2.loop_id FROM srv_data_textgrid_active d2, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m WHERE d2.spr_id = m.spr_id AND m.parent=s.id @@ -320,7 +325,7 @@ function archive_srv_data_checkgrid($ank_id){ sisplet_query("SET FOREIGN_KEY_CHECKS=0"); // Vstavimo v arhivsko tabelo (srv_data_checkgrid) - $sql1 = sisplet_query("INSERT INTO srv_data_checkgrid (spr_id, vre_id, usr_id, grd_id, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_checkgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id FROM srv_data_checkgrid_active d2, srv_spremenljivka s, srv_grupa g WHERE d2.spr_id = s.id @@ -344,7 +349,7 @@ function archive_srv_data_checkgrid($ank_id){ // Se dodatno za kombinirane tabele // Samo za kopiranje ugasnemo foreign key check, ker obstajajo primeri, kjer usr_id ne obstaja sisplet_query("SET FOREIGN_KEY_CHECKS=0"); - $sql1 = sisplet_query("INSERT INTO srv_data_checkgrid (spr_id, vre_id, usr_id, grd_id, loop_id) + $sql1 = sisplet_query("INSERT INTO srv_data_checkgrid".$archive_table_string." (spr_id, vre_id, usr_id, grd_id, loop_id) SELECT d2.spr_id, d2.vre_id, d2.usr_id, d2.grd_id, d2.loop_id FROM srv_data_checkgrid_active d2, srv_spremenljivka s, srv_grupa g, srv_grid_multiple m WHERE d2.spr_id = m.spr_id AND m.parent=s.id @@ -370,7 +375,7 @@ function archive_srv_data_checkgrid($ank_id){ function archive_srv_tracking($ank_id){ // Vstavimo v arhivsko tabelo (srv_tracking) - $sql1 = sisplet_query("INSERT INTO srv_tracking (`ank_id`, `datetime`, `ip`, `user`, `get`, `post`, `status`, `time_seconds`) + $sql1 = sisplet_query("INSERT INTO srv_tracking".$archive_table_string." (`ank_id`, `datetime`, `ip`, `user`, `get`, `post`, `status`, `time_seconds`) SELECT d2.ank_id, d2.datetime, d2.ip, d2.user, d2.get, d2.post, d2.status, d2.time_seconds FROM srv_tracking_active d2 WHERE d2.ank_id = '$ank_id' diff --git a/utils/SurveySyncMergeImport.php b/utils/SurveySyncMergeImport.php index f4e33dc43..e5c727ed9 100644 --- a/utils/SurveySyncMergeImport.php +++ b/utils/SurveySyncMergeImport.php @@ -11,20 +11,26 @@ include_once ('../settings.php'); $struktura = array(); $podatki = array( 'srv_user' => array(), - 'srv_data_checkgrid' => array(), + 'srv_data_checkgrid_archive1' => array(), + 'srv_data_checkgrid_archive2' => array(), 'srv_data_checkgrid_active' => array(), 'srv_data_glasovanje' => array(), - 'srv_data_grid' => array(), + 'srv_data_grid_archive1' => array(), + 'srv_data_grid_archive2' => array(), 'srv_data_grid_active' => array(), 'srv_data_rating' => array(), - 'srv_data_text' => array(), + 'srv_data_text_archive1' => array(), + 'srv_data_text_archive2' => array(), 'srv_data_text_active' => array(), - 'srv_data_textgrid' => array(), + 'srv_data_textgrid_archive1' => array(), + 'srv_data_textgrid_archive2' => array(), 'srv_data_textgrid_active' => array(), 'srv_data_upload' => array(), - 'srv_data_vrednost' => array(), + 'srv_data_vrednost_archive1' => array(), + 'srv_data_vrednost_archive2' => array(), 'srv_data_vrednost_active' => array(), - 'srv_user_grupa' => array(), + 'srv_user_grupa_archive1' => array(), + 'srv_user_grupa_archive2' => array(), 'srv_user_grupa_active' => array()); @@ -102,20 +108,26 @@ if ($handle = opendir($sync_server_path)) { } $podatki['srv_user'] = array_merge($podatki['srv_user'], $kljuc['srv_user']); - $podatki['srv_data_checkgrid'] = array_merge($podatki['srv_data_checkgrid'], $kljuc['srv_data_checkgrid']); + $podatki['srv_data_checkgrid_archive1'] = array_merge($podatki['srv_data_checkgrid_archive1'], $kljuc['srv_data_checkgrid_archive1']); + $podatki['srv_data_checkgrid_archive2'] = array_merge($podatki['srv_data_checkgrid_archive2'], $kljuc['srv_data_checkgrid_archive2']); $podatki['srv_data_checkgrid_active'] = array_merge($podatki['srv_data_checkgrid_active'], $kljuc['srv_data_checkgrid_active']); $podatki['srv_data_glasovanje'] = array_merge($podatki['srv_data_glasovanje'], $kljuc['srv_data_glasovanje']); - $podatki['srv_data_grid'] = array_merge($podatki['srv_data_grid'], $kljuc['srv_data_grid']); + $podatki['srv_data_grid_archive1'] = array_merge($podatki['srv_data_grid_archive1'], $kljuc['srv_data_grid_archive1']); + $podatki['srv_data_grid_archive2'] = array_merge($podatki['srv_data_grid_archive2'], $kljuc['srv_data_grid_archive2']); $podatki['srv_data_grid_active'] = array_merge($podatki['srv_data_grid_active'], $kljuc['srv_data_grid_active']); $podatki['srv_data_rating'] = array_merge($podatki['srv_data_rating'], $kljuc['srv_data_rating']); - $podatki['srv_data_text'] = array_merge($podatki['srv_data_text'], $kljuc['srv_data_text']); + $podatki['srv_data_text_archive1'] = array_merge($podatki['srv_data_text_archive1'], $kljuc['srv_data_text_archive1']); + $podatki['srv_data_text_archive2'] = array_merge($podatki['srv_data_text_archive2'], $kljuc['srv_data_text_archive2']); $podatki['srv_data_text_active'] = array_merge($podatki['srv_data_text_active'], $kljuc['srv_data_text_active']); - $podatki['srv_data_textgrid'] = array_merge($podatki['srv_data_textgrid'], $kljuc['srv_data_textgrid']); + $podatki['srv_data_textgrid_archive1'] = array_merge($podatki['srv_data_textgrid_archive1'], $kljuc['srv_data_textgrid_archive1']); + $podatki['srv_data_textgrid_archive2'] = array_merge($podatki['srv_data_textgrid_archive2'], $kljuc['srv_data_textgrid_archive2']); $podatki['srv_data_textgrid_active'] = array_merge($podatki['srv_data_textgrid_active'], $kljuc['srv_data_textgrid_active']); $podatki['srv_data_upload'] = array_merge($podatki['srv_data_upload'], $kljuc['srv_data_upload']); - $podatki['srv_data_vrednost'] = array_merge($podatki['srv_data_vrednost'], $kljuc['srv_data_vrednost']); + $podatki['srv_data_vrednost_archive1'] = array_merge($podatki['srv_data_vrednost_archive1'], $kljuc['srv_data_vrednost_archive1']); + $podatki['srv_data_vrednost_archive2'] = array_merge($podatki['srv_data_vrednost_archive2'], $kljuc['srv_data_vrednost_archive2']); $podatki['srv_data_vrednost_active'] = array_merge($podatki['srv_data_vrednost_active'], $kljuc['srv_data_vrednost_active']); - $podatki['srv_user_grupa'] = array_merge($podatki['srv_user_grupa'], $kljuc['srv_user_grupa']); + $podatki['srv_user_grupa_archive1'] = array_merge($podatki['srv_user_grupa_archive1'], $kljuc['srv_user_grupa_archive1']); + $podatki['srv_user_grupa_archive2'] = array_merge($podatki['srv_user_grupa_archive2'], $kljuc['srv_user_grupa_archive2']); $podatki['srv_user_grupa_active'] = array_merge($podatki['srv_user_grupa_active'], $kljuc['srv_user_grupa_active']); $uvozeno = true;