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

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>Content</h3>
0024 <?php if (!count($this->paginator)): ?>
0025     Keine Content-Einträge vorhanden.
0026     <?php
0027 else:
0028     $lfdNr = 0;
0029     ?>
0030     <div id="infomsg" style="" class="ui-state-highlight ui-corner-all"></div>
0031     <div id="dialog" style="display: none;"></div>
0032     <div class="row">
0033         <div id="title" class="title head">Interner Titel</div>
0034         <div id="status" class="status head">Aktiv</div>
0035         <br style="clear: both;"/>
0036     </div>
0037 
0038     <?php foreach ($this->paginator as $item):
0039     $lfdNr++;
0040     ?>
0041     <div id="row<?= $item->content_id; ?>" class="row">
0042         <div id="title<?= $item->content_id; ?>"
0043              class="title data <?= $this->evenOdd($lfdNr); ?>"><?= $item->title; ?></div>
0044         <div id="status<?= $item->content_id; ?>"
0045              class="status data <?= $this->evenOdd($lfdNr); ?>"><?= ($item->is_active) ? "Ja" : ""; ?></div>
0046         <a href="#" id="details_<?= $item->content_id; ?>"
0047            class="ui-state-default ui-corner-all button_normal showDetails">Details anschauen</a>
0048         <br style="clear: both;"/>
0049     </div>
0050     <div class="datatable_detailsarea details_<?= $item->content_id; ?>" style="width:580px;">
0051         <div class="dataDetailsContent fleft" style="width:440px;">
0052             <strong>Interner Titel:</strong><br/><?= $item->title; ?><br/>
0053             <strong>Inhalt:</strong><br/>
0054             <?= substr(strip_tags(stripslashes($item->content)), 0, 50) . " ..."; ?>
0055             <br/><br/>
0056             Erstellt am: <?= $item->created_at; ?><br/>
0057             Zuletzt geändert: <?= $item->changed_at; ?><br/>
0058         </div>
0059         <div class="dataDetailsButtons fleft">
0060             <a href="/backend/content/edit/id/<?= $item->content_id; ?>"
0061                class="ui-state-default ui-corner-all button_normal">Bearbeiten</a><br/><br/>
0062             <?php if ($item->is_active): ?>
0063                 <a href="#" id="deactivate_<?= $item->content_id; ?>"
0064                    class="ui-state-default ui-corner-all button_normal deactivate">Deaktivieren</a><br/><br/>
0065                 <a href="#" id="activate_<?= $item->content_id; ?>"
0066                    class="ui-state-default ui-corner-all button_normal activate noshow">Aktivieren</a><br/><br/>
0067             <?php else: ?>
0068                 <a href="#" id="deactivate_<?= $item->content_id; ?>"
0069                    class="ui-state-default ui-corner-all button_normal deactivate noshow">Deaktivieren</a><br/><br/>
0070                 <a href="#" id="activate_<?= $item->content_id; ?>"
0071                    class="ui-state-default ui-corner-all button_normal activate">Aktivieren</a><br/><br/>
0072             <?php endif; ?>
0073             <a href="#" id="delete_<?= $item->content_id; ?>"
0074                class="ui-state-default ui-corner-all button_normal delete">Löschen</a>
0075         </div>
0076         <div class="clear"></div>
0077     </div>
0078 <?php endforeach; ?>
0079 
0080     <br/><?php echo $this->paginator; ?><br/>
0081 <?php endif; ?>
0082 <br/><br/>
0083 <a href='/backend/content/add' class="ui-state-default ui-corner-all button_normal" id="4">Content hinzufügen</a>
0084 <div class="legendArea">
0085 
0086 </div>
0087 
0088 <script type="text/javascript">
0089     $(document).ready(function () {
0090         $(".showDetails").click(function () {
0091             var elementId = $(this).attr("id");
0092 
0093             $(".datatable_detailsarea." + elementId).slideToggle();
0094 
0095             if ($(this).parent().hasClass("open")) {
0096                 $(this).parent().removeClass("open");
0097             } else {
0098                 $(this).parent().addClass("open");
0099             }
0100         });
0101 
0102         $(".activate").click(function () {
0103             var itemId = $(this).attr("id");
0104             var tmp = itemId.split("_");
0105             itemId = tmp[1];
0106 
0107             var clickElement = $(this);
0108 
0109             $.post('/backend/content/setstatus/', {id: itemId, status: 1}, function (response) {
0110                 if (response) {
0111                     $("#infomsg").html("Content erfolgreich aktiviert");
0112                 } else {
0113                     $("#infomsg").html("Konnte Content nicht aktivieren");
0114                 }
0115 
0116                 $("#infomsg").fadeIn("normal");
0117                 $(clickElement).hide();
0118                 $("#deactivate_" + itemId).show();
0119 
0120                 $("#infomsg").fadeOut(4000);
0121                 $("#status" + itemId).html("Ja");
0122             });
0123         });
0124 
0125         $(".deactivate").click(function () {
0126             var itemId = $(this).attr("id");
0127             var tmp = itemId.split("_");
0128             itemId = tmp[1];
0129 
0130             var clickElement = $(this);
0131 
0132             $.post('/backend/content/setstatus/', {id: itemId, status: 0}, function (response) {
0133                 if (response) {
0134                     $("#infomsg").html("Content erfolgreich deaktiviert");
0135                 } else {
0136                     $("#infomsg").html("Konnte Content nicht deaktivieren");
0137                 }
0138 
0139                 $("#infomsg").fadeIn("normal");
0140                 $(clickElement).hide();
0141                 $("#activate_" + itemId).show();
0142                 $("#infomsg").fadeOut(4000);
0143                 $("#status" + itemId).html("");
0144             });
0145         });
0146 
0147         $(".delete").click(function () {
0148             var clickelement = $(this);
0149             var itemId = $(this).attr("id");
0150             var tmp = itemId.split("_");
0151             itemId = tmp[1];
0152 
0153 
0154             $("#dialog").html("Möchten Sie diesen Content wirklich löschen?");
0155 
0156             $("#dialog").dialog(
0157                 {
0158                     title: "Content löschen",
0159                     modal: true,
0160                     resizable: false,
0161                     buttons: {
0162                         "Nein": function () {
0163                             $("#dialog").dialog('close');
0164                         }, "Ja": function () {
0165                             $(this).dialog('close');
0166                             var url = "/backend/content/delete/id/" + itemId;
0167 
0168                             $.post(url, function (data) {
0169                                 $('#infomsg').html("Content gelöscht");
0170                                 $('#infomsg').show();
0171                                 $("#infomsg").fadeOut(4000);
0172                                 //$('.date #'+elementid).hide();
0173                                 $("#row" + itemId).remove();
0174                                 $(".details_" + itemId).remove();
0175                             });
0176                         }
0177                     }
0178                 });
0179 
0180 
0181             $("#dialog").dialog('open');
0182 
0183         });
0184     });
0185 </script>