File indexing completed on 2025-05-04 05:29:03

0001 <?php 
0002 /**
0003  *  ocs-webserver
0004  *
0005  *  Copyright 2016 by pling GmbH.
0006  *
0007  *    This file is part of ocs-webserver.
0008  *
0009  *    This program is free software: you can redistribute it and/or modify
0010  *    it under the terms of the GNU Affero General Public License as
0011  *    published by the Free Software Foundation, either version 3 of the
0012  *    License, or (at your option) any later version.
0013  *
0014  *    This program is distributed in the hope that it will be useful,
0015  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
0016  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0017  *    GNU Affero General Public License for more details.
0018  *
0019  *    You should have received a copy of the GNU Affero General Public License
0020  *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
0021  **/
0022 ?>
0023 <h3>"Was ist pling"-Slider Übersicht</h3>
0024 <?php if (count($this->sliderImages) == 0): ?>
0025     Keine Bilder für Slider vorhanden bisher.
0026 <?php else: $lfdNr = 0; ?>
0027     <div id="infomsg" style="" class="ui-state-highlight ui-corner-all"></div>
0028     <div id="dialog" style="display: none;"></div>
0029     <div class="row">
0030         <div id="title" class="title head">Bild</div>
0031         <div id="status" class="status head" style="width: 75px;">Aktiv</div>
0032         <br style="clear: both;"/>
0033     </div>
0034 
0035     <?php foreach ($this->sliderImages as $item):
0036         $lfdNr++;
0037         ?>
0038 
0039         <div id="row<?= $item->content_slider_id; ?>" class="row" style="height: auto;">
0040             <div id="title<?= $item->content_slider_id; ?>" class="title data <?= $this->evenOdd($lfdNr); ?>"
0041                  style="height: auto;"><img src="/images_fe/slider2/<?= $item->image; ?>" border="0" width="180px"/>
0042             </div>
0043             <div id="status<?= $item->content_slider_id; ?>" class="status data <?= $this->evenOdd($lfdNr); ?>"
0044                  style="width: 75px;"><?= ($item->is_active) ? "Ja" : ""; ?></div>
0045             <a href="/backend/slider/edit/id/<?= $item->content_slider_id; ?>"
0046                class="ui-state-default ui-corner-all button_normal showDetails">Bearbeiten</a>
0047             <?php if ($item->is_active): ?>
0048                 <a href="#" id="details_<?= $item->content_slider_id; ?>"
0049                    class="ui-state-default ui-corner-all button_normal deactivate">deaktivieren</a>
0050             <?php else: ?>
0051                 <a href="#" id="details_<?= $item->content_slider_id; ?>"
0052                    class="ui-state-default ui-corner-all button_normal activate">aktivieren</a>
0053             <?php endif; ?>
0054             <a href="#" id="details_<?= $item->content_slider_id; ?>"
0055                class="ui-state-default ui-corner-all button_normal delete">löschen</a>
0056             <br style="clear: both;"/>
0057         </div>
0058     <?php endforeach; ?>
0059     <br/>
0060 <?php endif; ?>
0061 <br/><br/>
0062 <a href="/backend/slider/add" class="ui-state-default ui-corner-all button_normal">Bild hinzufügen</a><br/><br/>
0063 
0064 <script type="text/javascript">
0065     $(document).ready(function () {
0066 
0067         $(".activate").click(function () {
0068             var itemId = $(this).attr("id");
0069             var tmp = itemId.split("_");
0070             itemId = tmp[1];
0071 
0072             var clickElement = $(this);
0073 
0074             $.post('/backend/slider/setstatus/', {id: itemId, status: 1}, function (response) {
0075                 if (response) {
0076                     $("#infomsg").html("Bild erfolgreich aktiviert");
0077                 } else {
0078                     $("#infomsg").html("Bild Kategorie nicht aktivieren");
0079                 }
0080 
0081                 $("#infomsg").fadeIn("normal");
0082                 $(clickElement).hide();
0083                 $("#deactivate_" + itemId).show();
0084 
0085                 $("#infomsg").fadeOut(4000);
0086                 $("#status" + itemId).html("Ja");
0087                 window.location.reload();
0088             });
0089         });
0090 
0091         $(".deactivate").click(function () {
0092             var itemId = $(this).attr("id");
0093             var tmp = itemId.split("_");
0094             itemId = tmp[1];
0095 
0096             var clickElement = $(this);
0097 
0098             $.post('/backend/slider/setstatus/', {id: itemId, status: 0}, function (response) {
0099                 if (response) {
0100                     $("#infomsg").html("Bild erfolgreich deaktiviert");
0101                 } else {
0102                     $("#infomsg").html("Konnte Bild nicht deaktivieren");
0103                 }
0104 
0105                 $("#infomsg").fadeIn("normal");
0106                 $(clickElement).hide();
0107 
0108                 $("#activate_" + itemId).show();
0109                 $("#infomsg").fadeOut(4000);
0110                 $("#status" + itemId).html("");
0111                 window.location.reload();
0112             });
0113         });
0114 
0115 
0116         $(".delete").click(function () {
0117             var clickelement = $(this);
0118             var itemId = $(this).attr("id");
0119             var tmp = itemId.split("_");
0120             itemId = tmp[1];
0121 
0122 
0123             $("#dialog").html("Möchten Sie diese Bild wirklich löschen?");
0124 
0125             $("#dialog").dialog(
0126                 {
0127                     title: "Bild löschen",
0128                     modal: true,
0129                     resizable: false,
0130                     buttons: {
0131                         "Nein": function () {
0132                             $("#dialog").dialog('close');
0133                         }, "Ja": function () {
0134                             $(this).dialog('close');
0135                             var url = "/backend/slider/delete/id/" + itemId;
0136 
0137                             $.post(url, function (data) {
0138                                 $('#infomsg').html("Bild gelöscht");
0139                                 $('#infomsg').show();
0140                                 $("#infomsg").fadeOut(4000);
0141                                 //$('.date #'+elementid).hide();
0142                                 $("#row" + itemId).remove();
0143                                 $(".details_" + itemId).remove();
0144                                 window.location.reload();
0145                             });
0146                         }
0147                     }
0148                 });
0149 
0150 
0151             $("#dialog").dialog('open');
0152 
0153         });
0154 
0155     });
0156 
0157 </script>