14 if (isset(
$_GET[
'add']) && (
$_GET[
'add'] ===
"1"))
16 $pageID =
$db->quote($_POST[
'pageID']);
17 $widgetType =
$db->quote($_POST[
'widgetType']);
19 $date_publish = sys::now();
21 $newWidgetID = widget::create(
$db, $widgetType, $pageID,
$positions);
22 if (is_int($newWidgetID) || (is_numeric($newWidgetID)))
24 print alert::draw(
"success",
"$lang[SUCCESS]",
"$lang[WIDGET_CREATE_OK]",
"page=widget-edit&widget=$newWidgetID", 800);
28 print alert::draw(
"danger",
"$lang[ERROR]",
"$lang[WIDGET_CREATE_FAILED]",
"", 5800);
39 if (isset(
$_GET[
'widget']) && (isset(
$_GET[
'delete']) && (
$_GET[
'delete'] ==
"true")))
41 if($widget->delete(
$db,
$_GET[
'widget']))
43 alert::draw(
"success",
"$lang[SUCCESS]",
"$lang[WIDGET] $lang[ID]: ".
$_GET[
'widget'].
" $lang[DELETED]",
"",
"800");
47 alert::draw(
"danger",
"$lang[ERROR]",
"$lang[WIDGET_DEL_FAILED] $lang[WIDGET] $lang[ID]: ".
$_GET[
'widget'].
"",
"",
"5800");
52 <script
type=
"text/javascript">
53 $(document).
ready(
function() {
54 $(
'#table-sort').dataTable( {
56 "bLengthChange":
false,
67 <!-- Content Wrapper. Contains page content -->
68 <div class=\"content-wrapper\" id=\"content-FX\">
69 <!-- Content Header (Page header) -->
70 <section class=\"content-header\">";
72 echo backend::getTitle(
$lang[
'WIDGET_MANAGER'],
$lang[
'WIDGET_MANAGER_SUBTEXT']);
73 echo
"<ol class=\"breadcrumb\">
74 <li><a href=\"index.php\" title=\"$lang[DASHBOARD]\"><i class=\"fa fa-dashboard\"></i> $lang[DASHBOARD]</a></li>
75 <li><a href=\"index.php?page=widgets\" title=\"$lang[WIDGETS]\"> $lang[WIDGETS]</a></li>
76 <li class=\"active\"><a href=\"index.php?page=widget-manager\" title=\"$lang[WIDGET_MANAGER]\"> $lang[WIDGET_MANAGER]</a></li>
80 <section class=\"content\">";
84 <div
class=
"box box-default">
85 <div
class=
"box-body">
86 <
a class=
"btn btn-success pull-right" title=
"<?php echo $lang['WIDGET+']; ?>" href=
"index.php?page=widget-new">
87 <
i class=
"glyphicon glyphicon-download-alt"></
i> &
nbsp;&
nbsp;<?php echo
$lang[
'WIDGET_INSTALL']; ?></
a>
89 <table style=
"width: 100%" class=
"table table-striped table-hover table-responsive" id=
"table-sort">
92 <td style=
"width: 5%;" class=
"text-center"><strong><?php echo
"$lang[STATUS]"; ?></strong></td>
93 <td style=
"width: 5%;" class=
"text-center"><strong><?php echo
"$lang[ID]"; ?></strong></td>
94 <td style=
"width: 20%;"><strong><?php echo
"$lang[WIDGET]"; ?></strong></td>
95 <td style=
"width: 60%;"><strong><?php echo
"$lang[DESCRIPTION]"; ?></strong></td>
96 <td style=
"width: 10%;" class=
"text-center"><strong><?php echo
"$lang[ACTIONS]"; ?></strong></td>
101 if (
$res =
$db->query(
"SELECT * FROM {widget_types} ORDER BY name"))
103 while($row = mysqli_fetch_assoc(
$res))
105 if ($row[
'status']==1)
107 $pub =
"success"; $pubtext=
"$lang[ACTIVE]";
111 $pub =
"danger"; $pubtext=
"$lang[INACTIVE]";
115 <td class=\"text-center\"><i class=\"label label-$pub\">$pubtext</i></td>
116 <td class=\"text-center\">".$row[
'id'].
"</td>
117 <td><a href=\"index.php?page=widget-edit&widget=".$row[
'id'].
"\"><div style=\"width:100%;\">".$row[
'name'].
"<br></div></a>
118 <small>system/widgets/<b>".$row[
'folder'].
"</b></small>
121 <td>".$row[
'description'].
"</td>
122 <td class=\"text-center\">
124 <a class=\"fa fa-trash-o\" role=\"dialog\" data-confirm=\"".
$lang[
'WIDGET'].
" « $row[name] » ".
$lang[
'DELETE'].
"?\"
125 title=\"$lang[DELETE]\" href=\"index.php?page=widgets&del=1&widget=$row[id]&delete=true\">
print $lang['FILEMAN_UPLOAD']
Throws a fancy Bootstrap Alert (success, info, warning or danger)
Backend class serves a few useful functions for the admin backend.
Mysqli database class; returns db connection object.
The language class - support multilingual backend.
The sys class - handles yawk's system core functions.
<!-- backend language -->< h3 >< i class="fa fa-language"></i > & nbsp
document ready(function() { $('a[data-confirm]').click(function(ev) { modal='#dataConfirmModal';var href=$(this).attr('href');var title=$(this).attr('title');var icon=$(this).attr('data-icon');if(!icon) { icon='fa fa-trash-o';} if(!$(modal).length) { $('body').append('< div id="dataConfirmModal" class="modal fade" role="dialog" aria-labelledby="dataConfirmLabel" aria-hidden="true">< div class="modal-dialog">< div class="modal-content">< div class="modal-header">< button type="button" class="close" data-dismiss="modal" aria-hidden="true">< i class="fa fa-times"></i ></button >< br >< div class="col-md-1">< h3 class="modal-title">< i class="'+icon+'"></i ></h3 ></div >< div class="col-md-11">< h3 class="modal-title" id="dataConfirmLabel">'+title+'</h3 ></div ></h3 ></div >< div class="modal-body"></div >< div class="modal-footer">< button type="button" class="btn btn-default" data-dismiss="modal" aria-hidden="true">Abbrechen</button >< a type="button" class="btn btn-danger" id="dataConfirmOK">< i class="'+icon+'"></i > L öschen</a ></div ></div ></div ></div >');} $(modal).find('.modal-body').text($(this).attr('data-confirm'));$('#dataConfirmOK').attr('href', href);$(modal).modal({show:true});return false;});$('#terminateUser').click(function() { var terminate=window.confirm("ACHTUNG!\nDas wird Deinen Account permanent deaktivieren.\n"+"Bist Du Dir sicher, dass Du das tun willst?");if(terminate===true) { var terminateUser=window.confirm("Bist Du Dir wirklich ganz sicher?\n"+"Diese Aktion kann nicht rueckgaengig gemacht werden.");if(terminateUser===true) { $.get('system/templates/YaWK-bootstrap3/js/terminate-user.php', function(data) { if(data==="true") { setTimeout("window.location='logout.html'", 0);} else { alert("Fehler: "+data);} });} } });function dismissNotifications() { $.ajax({ url:'js/dismiss-notifications.php', type:'POST', success:function(data) { if(!data) { alert('Something went wrong!');return false;} } });$("#bell-label").fadeOut();$('#notification-header').html('You have 0 notifications');$('#notification-menu').fadeOut();} $("#dismiss").click(function() { dismissNotifications();});function disableButtons(delay) { $('#loginButton').removeClass().addClass('btn btn-success disabled').attr('id', 'LOGIN_FORBIDDEN');$('#resetPasswordButton').removeClass().addClass('btn btn-danger disabled');setTimeout(function() { $('#LOGIN_FORBIDDEN').attr('id', 'loginButton').removeClass().addClass('btn btn-success');$('#resetPasswordButton').removeClass().addClass('btn btn-danger');}, delay);} $("#loginButton").click(function(){ if($('#loginButton').length > 0) { if($('#loginButton').hasClass('btn') &&$('#loginButton').hasClass('btn-success') &&$('#loginButton').hasClass('disabled')) { } else { $("#loginForm").submit();disableButtons(10000);} } else if($('#LOGIN_FORBIDDEN').length > 0) { if($('#LOGIN_FORBIDDEN').hasClass('btn') &&$('#LOGIN_FORBIDDEN').hasClass('btn-success') &&$('#LOGIN_FORBIDDEN').hasClass('disabled')) { } else { } } });$("#blockedBtn").hover(function() { $("#blockedBtn").hide();$("#askBtn").fadeIn(820);});})