Brisanje vprasanja - dokoncan cronjob (dokoncno brisanje starejsih od 3 mesecev), dodan predogled, popravek toolbox gumba na levi
This commit is contained in:
parent
ca17ee2935
commit
a27b23c6ab
@ -347,10 +347,8 @@ class Branching {
|
||||
// Pobrisana vprasanja
|
||||
$vd = new VprasanjeDeleted($this->anketa);
|
||||
$deleted_vrasanja_count = $vd->countDeletedVprasanja();
|
||||
if($deleted_vrasanja_count > 0){
|
||||
echo '<div class="toolbox_border"></div>';
|
||||
echo '<div class="toolbox_item open_deleted"><span class="item_icon faicon delete"></span><span class="item_text">'.$lang['srv_deleted_vprasanja'].' ('.$deleted_vrasanja_count.')</span></div>';
|
||||
}
|
||||
echo '<div id="vprasanje_deleted_border" class="toolbox_border '.($deleted_vrasanja_count == 0 ? 'displayNone' : '').'"></div>';
|
||||
echo '<div id="vprasanje_deleted_toolbox" class="toolbox_item open_deleted '.($deleted_vrasanja_count == 0 ? 'displayNone' : '').'"><span class="item_icon faicon delete"></span><span class="item_text">'.$lang['srv_deleted_vprasanja'].' (<span id="vprasanje_deleted_count">'.$deleted_vrasanja_count.'</span>)</span></div>';
|
||||
}
|
||||
else {
|
||||
|
||||
@ -403,10 +401,8 @@ class Branching {
|
||||
// Pobrisana vprasanja
|
||||
$vd = new VprasanjeDeleted($this->anketa);
|
||||
$deleted_vrasanja_count = $vd->countDeletedVprasanja();
|
||||
if($deleted_vrasanja_count > 0){
|
||||
echo '<div class="toolbox_border"></div>';
|
||||
echo '<div class="toolbox_item open_deleted" onClick="displayVprasanjeDeletedPopup();"><span class="item_icon faicon delete"></span><span class="item_text">'.$lang['srv_deleted_vprasanja'].' ('.$deleted_vrasanja_count.')</span></div>';
|
||||
}
|
||||
echo '<div id="vprasanje_deleted_border" class="toolbox_border '.($deleted_vrasanja_count == 0 ? 'displayNone' : '').'"></div>';
|
||||
echo '<div id="vprasanje_deleted_toolbox" class="toolbox_item open_deleted '.($deleted_vrasanja_count == 0 ? 'displayNone' : '').'" onClick="displayVprasanjeDeletedPopup();"><span class="item_icon faicon delete"></span><span class="item_text">'.$lang['srv_deleted_vprasanja'].' (<span id="vprasanje_deleted_count">'.$deleted_vrasanja_count.'</span>)</span></div>';
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
@ -56,9 +56,13 @@ class VprasanjeDeleted {
|
||||
|
||||
echo ' <div id="question_item_info_'.$row['spr_id'].'" item-id="'.$row['spr_id'].'" class="question_item_info">';
|
||||
|
||||
echo ' <span class="faicon list"></span>';
|
||||
echo ' <span class="title">'.substr(strip_tags($row['naslov']), 0, 40).'</span>';
|
||||
echo ' <span class="date">('.date("G:i d.m.Y", strtotime($row['delete_time'])).')</span>';
|
||||
echo ' <div>';
|
||||
echo ' <span class="faicon list"></span>';
|
||||
echo ' <span class="title">'.substr(strip_tags($row['naslov']), 0, 40).'</span>';
|
||||
echo ' <span class="date">('.date("G:i d.m.Y", strtotime($row['delete_time'])).')</span>';
|
||||
echo ' </div>';
|
||||
|
||||
echo ' <span class="faicon monitor" title="'.$lang['srv_predogled_spremenljivka'].'" onClick="previewVprasanjeDeleted(\''.$row['spr_id'].'\');"></span>';
|
||||
|
||||
echo ' </div>';
|
||||
|
||||
@ -105,6 +109,27 @@ class VprasanjeDeleted {
|
||||
}
|
||||
|
||||
|
||||
// Dokoncno brisanje vprasanja
|
||||
public static function permanentDeleteVprasanje($spremenljivka){
|
||||
|
||||
if ($spremenljivka > 0) {
|
||||
|
||||
$rowg = Cache::srv_spremenljivka($spremenljivka);
|
||||
|
||||
// pri brisanju multiple grid vprasanja, moramo pobrisate tudi vse child spremenljivke (ker kljuci niso nastavljeni)
|
||||
if ($rowg['tip'] == 24) {
|
||||
$sqld = sisplet_query("SELECT spr_id FROM srv_grid_multiple WHERE parent='$spremenljivka'");
|
||||
while ($rowd = mysqli_fetch_array($sqld)) {
|
||||
sisplet_query("DELETE FROM srv_spremenljivka WHERE id='$rowd[spr_id]'");
|
||||
}
|
||||
}
|
||||
|
||||
$sql = sisplet_query("DELETE FROM srv_vrednost WHERE spr_id='$spremenljivka'");
|
||||
$sql = sisplet_query("DELETE FROM srv_grid WHERE spr_id='$spremenljivka'");
|
||||
$sql = sisplet_query("DELETE FROM srv_spremenljivka WHERE id='$spremenljivka'");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @desc pohendla ajax klice
|
||||
|
@ -1014,6 +1014,11 @@ function brisi_spremenljivko (spremenljivka, text, confirmed) {
|
||||
//refreshLeft();
|
||||
$('#branching').html(data.output);
|
||||
refreshRight();
|
||||
|
||||
// Prikazemo gumb za pobrisana vprasanja (toolbox na levi) in povecamo counter
|
||||
$('#vprasanje_deleted_border, #vprasanje_deleted_toolbox').removeClass('displayNone');
|
||||
var vprasanje_deleted_count = parseInt($('#vprasanje_deleted_count').html()) + 1;
|
||||
$('#vprasanje_deleted_count').html(vprasanje_deleted_count);
|
||||
}
|
||||
else if (data.error == 1) {
|
||||
$('#fade').fadeIn('slow');
|
||||
@ -1026,7 +1031,6 @@ function brisi_spremenljivko (spremenljivka, text, confirmed) {
|
||||
$('#fade').fadeIn('slow');
|
||||
$('#dropped_alert').html(data.output).fadeIn('slow').css('width', '600px');
|
||||
}
|
||||
|
||||
}
|
||||
}, 'json'
|
||||
);
|
||||
|
@ -42,6 +42,7 @@ function deleteVprasanjeDeleted(item_id, item_type){
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
// Restavriramo pobrisano vprasanje nazaj v anketo na konec
|
||||
function insertVprasanjeDeletedItemsIntoSurvey(){
|
||||
|
||||
var items = [];
|
||||
@ -68,4 +69,13 @@ function insertVprasanjeDeletedItemsIntoSurvey(){
|
||||
popupClose();
|
||||
actionNotePopup('lib_add_to_survey_'+note, 'success');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Predogled pobrisanega vprasanja
|
||||
function previewVprasanjeDeleted(spr_id){
|
||||
|
||||
preview_spremenljivka(spr_id);
|
||||
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
@ -20659,6 +20659,7 @@ img.mapster_el {
|
||||
.vprasanje_deleted_popup .content .question_list .question_item_holder .question_item_info {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
height: 36px;
|
||||
@ -20732,6 +20733,9 @@ img.mapster_el {
|
||||
.vprasanje_deleted_popup .content .question_list .question_item_holder .question_item_info .item_settings ul li:hover {
|
||||
color: #0059ab;
|
||||
}
|
||||
.vprasanje_deleted_popup .content .question_list .question_item_holder .question_item_info .monitor {
|
||||
margin-right: 0;
|
||||
}
|
||||
.vprasanje_deleted_popup .content .selected_items {
|
||||
align-self: flex-end;
|
||||
margin: 16px 16px 8px 0;
|
||||
|
@ -63,6 +63,8 @@
|
||||
.question_item_info{
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
|
||||
position: relative;
|
||||
|
||||
box-sizing: border-box;
|
||||
@ -120,6 +122,10 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.monitor{
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -42,6 +42,20 @@ class CronJobs {
|
||||
$s->anketa_delete_from_db($row['id']);
|
||||
}
|
||||
}
|
||||
|
||||
// Brisanje pobrisanih vprasanj (vprasanja, ki so bila pobrisana vec kot 3 mesece nazaj)
|
||||
private function vprasanjeDeleteFromDB(){
|
||||
|
||||
// Loop po pobrisanih anketah, ki so bile nazadnje urejane vec kot 1 mesec nazaj
|
||||
$sql = sisplet_query("SELECT * FROM srv_spremenljivka_deleted WHERE delete_time < NOW() - INTERVAL 3 MONTH");
|
||||
if (!$sql) echo mysqli_error($GLOBALS['connect_db']);
|
||||
|
||||
$s = new SurveyAdmin();
|
||||
|
||||
while ($row = mysqli_fetch_array($sql)) {
|
||||
VprasanjeDeleted::permanentDeleteVprasanje($row['spr_id']);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Brisanje pobrisanih podatkov anket (podatki, ki so bili pobrisani pred vec kot 3 meseci)
|
||||
|
@ -24,6 +24,9 @@
|
||||
$SL->addMessage(SurveyLog::INFO, "CRONJOB 3am - brisanje pobrisanih anket (starejsih od 1 meseca)");
|
||||
$cj->executeAction('surveyDeleteFromDB');
|
||||
|
||||
$SL->addMessage(SurveyLog::INFO, "CRONJOB 3am - brisanje pobrisanih vprasanj (starejsih od 3 mesecev)");
|
||||
$cj->executeAction('vprasanjeDeleteFromDB');
|
||||
|
||||
// Brisanje pobrisanih podatkov anket (starejsi od 3 mesecev)
|
||||
$SL->addMessage(SurveyLog::INFO, "CRONJOB 3am - brisanje pobrisanih podatkov anket (starejsi od 3 mesecev)");
|
||||
$cj->executeAction('userDeleteFromDB');
|
||||
|
Loading…
x
Reference in New Issue
Block a user