diff --git a/admin/survey/classes/class.SurveyPostProcess.php b/admin/survey/classes/class.SurveyPostProcess.php index b1f858090..bdbd5ec47 100644 --- a/admin/survey/classes/class.SurveyPostProcess.php +++ b/admin/survey/classes/class.SurveyPostProcess.php @@ -227,6 +227,9 @@ class SurveyPostProcess { } elseif ($_GET['a'] == 'edit_data_question_save') { $this->ajax_edit_data_question_save(0); + } elseif ($_GET['a'] == 'edit_data_question_upload_delete') { + $this->ajax_edit_data_question_upload_delete(); + } elseif ($_GET['a'] == 'get_inline_edit') { $this->ajax_get_inline_edit(); @@ -255,11 +258,8 @@ class SurveyPostProcess { $this->ajax_coding_merge(); } elseif ($_GET['a'] == 'coding_filter') { - $this->ajax_coding_filter(); - - } - - + $this->ajax_coding_filter(); + } } /** @@ -547,6 +547,25 @@ class SurveyPostProcess { /*if ($refresh == 1) header("Location: index.php?anketa=".$this->anketa."&a=data&m=edit");*/ } + + // Pobrisemo upload datoteke v urejanju podatkov + function ajax_edit_data_question_upload_delete () { + Common::updateEditStamp(); + + $spr_id = $_POST['spr_id']; + $usr_id = $_POST['usr_id']; + $code = $_POST['code']; + + $s = sisplet_query("DELETE FROM srv_data_upload WHERE ank_id='".$this->anketa."' AND usr_id='".$usr_id."' AND code='".$code."'"); + if (!$s) echo mysqli_error($GLOBALS['connect_db']); + + $s2 = sisplet_query("DELETE FROM srv_data_text".$this->db_table." WHERE spr_id='".$spr_id."' AND usr_id='".$usr_id."'"); + if (!$s2) echo mysqli_error($GLOBALS['connect_db']); + + $this->ajax_edit_data_question(); + + self::forceRefreshData($this->anketa); + } function ajax_get_inline_edit () { diff --git a/admin/survey/script/script.js b/admin/survey/script/script.js index 1aea2fd86..a97393e80 100644 --- a/admin/survey/script/script.js +++ b/admin/survey/script/script.js @@ -5468,3 +5468,10 @@ function consultingPopupClose(){ $('#popup_note').fadeOut('slow').html(''); $('#fade').fadeOut('slow'); } + + +// Brisanje datoteke iz podatkov +function removeUploadFromData(usr_id, spr_id, code){ + + $("#fullscreen").load('ajax.php?t=postprocess&a=edit_data_question_upload_delete', {anketa: srv_meta_anketa_id, usr_id: usr_id, spr_id: spr_id, code: code}); +} diff --git a/main/survey/app/Controllers/Vprasanja/TextController.php b/main/survey/app/Controllers/Vprasanja/TextController.php index 46bae6283..2e70a1858 100644 --- a/main/survey/app/Controllers/Vprasanja/TextController.php +++ b/main/survey/app/Controllers/Vprasanja/TextController.php @@ -774,15 +774,55 @@ class TextController extends Controller '; } + // Smo v admin podatkih in uplodamo datoteko ali fotografijo + elseif( ($row['upload'] == 1 || $row['upload'] == 2) && ($_GET['t'] == 'postprocess' || $_GET['m'] == 'quick_edit') ){ + + $sqlUpload = sisplet_query("SELECT filename FROM srv_data_upload WHERE usr_id='".get('usr_id')."' AND code='".$row2['text']."'"); + + // Ze imamo datoteko - moznost brisanja v adminu + if(mysqli_num_rows($sqlUpload) > 0){ + + $rowUpload = mysqli_fetch_array($sqlUpload); + $file = $rowUpload[0]; + + global $site_url; + echo '
'.$file.'
'; + + // Remove file button + if($_GET['quick_view'] != '1'){ + echo '
+ '; + echo self::$lang['srv_alert_upload_remove']; + echo '
'; + } + } + // Uploadamo datoteko preko admina - TODO + else{ + + echo ''; + } + } + // Upload elseif ($row['upload'] == 1) { + echo ''; + type="file" + id="spremenljivka_' . $spremenljivka . '_vrednost_' . $i . '" + ' . (!$missing ? '' : ' disabled') . ' + class="pointer" + onChange="checkUpload(this, \''.$spremenljivka.'_vrednost_'.$i.'\');" + >'; // Remove file button echo '
'; } - //Fotografiranje + // Fotografiranje elseif ($row['upload'] == 2) { + $inpname = 'vrednost_' . $spremenljivka . '_kos_' . $row1['id']; $inpid = 'spremenljivka_' . $spremenljivka . '_vrednost_' . $i;