refreshData(); } // osvežimo podatke nastavitev static function refreshData() { // nastavitve sistema self::getSystemSetting(); // nastavitve ankete // nastavitve uporabika } static function getSystemSetting() { //$stringSystemSetting = "SELECT * FROM srv_settng " } /** @desc: polovi sistemske filtre */ private static $_systemFilters = array(); private static $_systemFiltersArray; static function GetSystemFilters($filter=null) { if (!$filter) { if (isset(self::$_systemFiltersArray)) { return self::$_systemFiltersArray; } else { $result = array(); $stringSystemSetting_filters = "SELECT * FROM srv_sys_filters ORDER BY type, filter ASC"; $sqlSystemSetting_filters = sisplet_query($stringSystemSetting_filters ); while ( $rowSystemSetting_filters = mysqli_fetch_assoc($sqlSystemSetting_filters) ) { $result[] = $rowSystemSetting_filters; } self::$_systemFiltersArray = $result; return self::$_systemFiltersArray; } } else { if (isset(self::$_systemFilters[$filter])) return self::$_systemFilters[$filter]; else { $stringSystemSetting_filters = "SELECT * FROM srv_sys_filters where filter = '".$filter."'"; $sqlSystemSetting_filters = sisplet_query($stringSystemSetting_filters ); $result = mysqli_fetch_assoc($sqlSystemSetting_filters); self::$_systemFilters[$filter] = $result; return $result; } } } // vrne array z sistemskimi filtri private static $_systemFiltersValues; static function GetSystemFiltersValues() { if (isset(self::$_systemFiltersValues)) { return self::$_systemFiltersValues; } else { $result = array(); $stringSystemSetting_filters = "SELECT filter FROM srv_sys_filters ORDER BY type, filter ASC"; $sqlSystemSetting_filters = sisplet_query($stringSystemSetting_filters ); while ( $rowSystemSetting_filters = mysqli_fetch_assoc($sqlSystemSetting_filters) ) { $result[$rowSystemSetting_filters['filter']] = $rowSystemSetting_filters['filter']; } self::$_systemFiltersValues = $result; return self::$_systemFiltersValues; } } private static $_systemFiltersByType = array(); static function GetSystemFlterByType($type) { if (isset(self::$_systemFiltersByType[$type])) return self::$_systemFiltersByType[$type]; else { $result = array(); $stringSystemSetting_filters = "SELECT * FROM srv_sys_filters WHERE type = '".$type."' ORDER BY filter ASC"; $sqlSystemSetting_filters = sisplet_query($stringSystemSetting_filters ); while ( $rowSystemSetting_filters = mysqli_fetch_assoc($sqlSystemSetting_filters) ) { $result[] = $rowSystemSetting_filters; } self::$_systemFiltersByType[$type] = $result; return self::$_systemFiltersByType[$type]; } } /** desc: vrnemo sistemsko privzete nastavtive filtrov * (v opisnih statistikah so vsi filtri vključeni, v frekvencah pa izključeni) */ private static $_systemFiltersDefaultValues = array(); static function GetSystemFlterDefaultValues($fid) { if (isset(self::$_systemFiltersDefaultValues[$fid])) return self::$_systemFiltersDefaultValues[$fid]; else { $result = array('means'=>false, 'crosstab'=>false, 'frequencies'=>false, 'descriptives'=>true); self::$_systemFiltersByType[$fid] = $result; return self::$_systemFiltersByType[$fid]; } } // vrne true če je $key v tabeli z filtri private static $_systemFiltersValue; static function isSystemFiltersValue($key) { $stringSystemSetting_filters = "SELECT count(id) as cnt FROM srv_sys_filters where filter = '".$key."'"; $sqlSystemSetting_filters = sisplet_query($stringSystemSetting_filters ); $row = mysqli_fetch_assoc($sqlSystemSetting_filters); return $row['cnt']; } static function AddSystemFilters( $filter, $text, $fid) { $insertString = "INSERT INTO srv_sys_filters (fid,filter,text,uid,type) ". "VALUES ('".$fid."', '".$filter."', '".$text."', '".self::$uid."', '3');"; self::$mySqlResult = sisplet_query($insertString); self::$mySqlErrNo = mysqli_errno($GLOBALS['connect_db']); } static function DeleteSystemFilters( $id) { $deleteString = "DELETE FROM srv_sys_filters WHERE id = '".$id."'"; self::$mySqlResult = sisplet_query($deleteString); self::$mySqlErrNo = mysqli_errno($GLOBALS['connect_db']); } static function SaveSystemFilters($id,$filter,$text) { $updateString = "UPDATE srv_sys_filters " . "SET filter = '".$filter."', text = '".$text."' ". "WHERE id = '".$id."'"; self::$mySqlResult = sisplet_query($updateString); self::$mySqlErrNo = mysqli_errno($GLOBALS['connect_db']); } private static $_systemSysVarFlterData = array(); static function GetSystemSysVarFlterData($id) { if (isset(self::$_systemSysVarFlterData[$id])) { return self::$_systemSysVarFlterData[$id]; } else { $stringSystemSetting_filters = "SELECT * FROM srv_sys_filters WHERE id = '".$id."'"; $sqlSystemSetting_filters = sisplet_query($stringSystemSetting_filters ); $result = mysqli_fetch_assoc($sqlSystemSetting_filters); self::$_systemSysVarFlterData[$id] = $result; return self::$_systemSysVarFlterData[$id]; } } /** Hendla prikaz filtrov v nastavitvah * */ static function DisplaySystemFilters($mode='normal') { global $lang; global $s; $filtri = self::GetSystemFilters(); if ( $mode=='normal' ) { echo ''; echo '' .$lang['srv_settings_filter_edit_mode']. ''; echo '
'; echo '
'; echo '
'; echo ''.$lang['srv_filter_id'].''; echo '
'; echo '
'; echo ''.$lang['srv_filter_vrednost'].''; echo '
'; echo '
'; echo ''.$lang['srv_filter_variabla'].''; echo '
'; echo '
'; foreach ( $filtri as $key => $filter) { echo '
'; echo '
'.$filter['fid'].'
'; echo '
'.$filter['filter'].'
'; echo '
'.$filter['text'].'
'; echo '
'; } } else if ( $mode=='edit' || $mode=='new') { echo ''; echo '' .$lang['srv_settings_filter_view_mode']. ''; echo '
'; echo '
'; echo ''.$lang['srv_filter_id'].''; echo '
'; echo '
'; echo ''.$lang['srv_filter_vrednost'].''; echo '
'; echo '
'; echo ''.$lang['srv_filter_variabla'].''; echo '
'; echo '
'; foreach ( $filtri as $key => $filter) { echo '
'; echo '
'.$filter['fid'].'
'; echo '
'; echo ''; echo '
'; echo '
'; echo ''; echo '
'; if ( $filter['type'] == 3) { echo '
'; echo ''; echo ''.$lang['srv_filtri_izbrisi_filter'].''; echo ''; echo '
'; } echo '
'; echo ''; } echo '
'; // pohendlamo error: duplicate if (self::$mySqlErrNo == 1062) { echo '
'; echo $lang['srv_duplicateEntry']; echo '
'; } echo '
'; if ($mode == 'new') { echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo ''; echo '
'; echo '
'; echo ''.$lang['srv_novfilter'].''; echo '
'; } else echo ''.$lang['srv_novfilter'].''.$lang['srv_novfilter']; echo '
'; echo ''; } } /** * @desc polovimo nastavitev survey sistema */ private static $_sysMiscSetting = array(); function getSysMiscSetting($what=null) { if (isset(self::$_sysMiscSetting[$what])) { return self::$_sysMiscSetting[$what]; } else { $result = null; if (is_string($what)) { $stringSelect = "SELECT value FROM srv_misc WHERE what = '".$what."'"; $sqlSelect = sisplet_query($stringSelect); $rowSelect = mysqli_fetch_array($sqlSelect); if (mysqli_num_rows($sqlSelect) > 0) $result = $rowSelect['value']; else $result = ''; } if($result == ''&&$what == 'export_data_type'){ $result = 2; } self::$_sysMiscSetting[$what] = $result; return self::$_sysMiscSetting[$what]; } } /** * @desc shranimo nastavitev survey sistema */ function setSysMiscSetting($what=null, $value=null) { if ( $what && $value ) { if ( is_string($what) && is_string($value) ) { $stringInsert = "INSERT INTO srv_misc (what, value) VALUES ('".$what."', '".$value."') ON DUPLICATE KEY UPDATE value = '".$value."'"; $sqlInsert = sisplet_query($stringInsert); return mysqli_affected_rows($GLOBALS['connect_db']); } else return false; } else return false; } } /* function getTableNextAutoIncrement($tableName) { $next_increment = 0; $qShowStatus = "SHOW TABLE STATUS LIKE '$tableName'"; $qShowStatusResult = sisplet_query($qShowStatus) or die ( "Query failed: " . mysqli_error($GLOBALS['connect_db']) . "
" . qShowStatus ); while ($row = mysqli_fetch_assoc($qShowStatusResult)) { $next_increment = $row['Auto_increment']; } mysqli_free_result($qShowStatusResult); return $next_increment; } */ ?>