';
// Loop cez vse ankete kjer je user avtor
$sql = sisplet_query("SELECT id, naslov, akronim FROM srv_anketa WHERE insert_uid='".$global_user_id."' AND active!='-1'");
while ($row = mysqli_fetch_array($sql)) {
echo '
';
echo ' ';
echo ' ';
echo '
';
}
echo '
';
echo '';
}
// Izvedemo izvoz anket v paket
private function createSurveysArchive($survey_list, $data=true){
global $connect_db;
global $global_user_id;
global $lang;
// Nastavimo nastavitve php-ja, da zmore sprocesirati
//set_time_limit(1800);
ini_set('memory_limit', '1024M');
ini_set('max_input_time', 600);
// Pobrisemo zip ce obstaja od prej
if (file_exists(ARCHIVE_FOLDER.'archive_surveys_'.$global_user_id.'.zip')) {
unlink(ARCHIVE_FOLDER.'archive_surveys_'.$global_user_id.'.zip');
}
// Gremo cez seznam anket in ustvarimo .1ka izvoz za vsako posebej in jo dodamo v zip
$surveys_for_deletion = array();
foreach($survey_list as $ank_id){
// Odpremo oz. ustvarimo zip
$zip = new ZipArchive();
$zip_file = ARCHIVE_FOLDER.'archive_surveys_'.$global_user_id.'.zip';
if ($zip->open($zip_file, ZipArchive::CREATE) !== true) {
exit('Napaka pri ustvarjanju zip arhiva anket.');
}
SurveyCopy::setSrcSurvey($ank_id);
SurveyCopy::setSrcConectDb($connect_db);
SurveyCopy::setDestSite(0);
//SurveyCopy::downloadArrayFile($data);
$export_survey_array = SurveyCopy::getArrayVar($data);
$export_survey_string = base64_encode(serialize($export_survey_array));
// Ustvarimo datoteko za anketo
$export_survey_file_name = $export_survey_array['srv_anketa'][0]['naslov'].' '.date("j.n.Y").'.1ka';
$export_survey_file_content = $export_survey_string;
// Dodamo vsebino kot datoteka v zip
$zip->addFromString($export_survey_file_name, $export_survey_file_content);
// Zapremo zip
$zip->close();
}
return $lang['srv_archive_surveys_export_created'];
}
// Izvedemo uvoz paketa anket
private function importSurveysArchive($zipFile){
global $lang;
global $connect_db;
global $admin_type;
// Nastavimo nastavitve php-ja, da zmore sprocesirati
//set_time_limit(1800);
ini_set('memory_limit', '1024M');
ini_set('max_input_time', 600);
$zip = new ZipArchive();
// Razpakiramo zip paket
if ($zip->open($zipFile) === true) {
$success_count = 0;
$error_surveys = array();
SurveyCopy::setSrcSurvey(-1);
SurveyCopy::setSrcConectDb($connect_db);
SurveyCopy::setDestSite(0);
// loop cez vse arhivske datoteke v zip paketu
for ($i = 0; $i < $zip->numFiles; $i++) {
try{
// Dobimo ime datoteke in vsebino
$fileName = $zip->getNameIndex($i);
$fileContent = $zip->getFromIndex($i);
$array = unserialize(base64_decode($fileContent));
if (is_array($array) ) {
SurveyCopy::setSourceArray($array);
// Ce je vse ok ustvarimo kopijo ankete
if(SurveyCopy::getErrors() == ''){
$new_survey_id = SurveyCopy::doCopy();
$success_count++;
}
else{
$error_surveys[] = array('name'=>$fileName, 'error'=>SurveyCopy::getErrors());
}
}
}
catch (Exception $e) {
$error_surveys[] = array('name'=>$fileName, 'error'=>$e->getMessage());
}
// Resetiramo parametre classa - errorje in source array
SurveyCopy::reset();
}
$zip->close();
// Uspesno uvozene ankete
echo '
';
}
}
public function ajax(){
global $lang;
global $global_user_id;
// Prikazemo popup s seznamom anket upporabnika za izvoz
if ($_GET['a'] == 'display_export') {
echo '