<?php /** * Script to manage widgets ****************************************/ /* verify that user is admin */ checkAdmin(); /* get all languages */ $widgets = getAllWidgets(true, true); ?> <h4><?php print _('Widgets'); ?> </h4> <hr> <?php print "<p class='muted'>"; print _('You can manage widgets here') . ".<br>"; print "</p>"; ?> <!-- Add new --> <button class="btn btn-sm btn-default wedit" data-action='add' style="margin-bottom:10px;"><i class="fa fa-plus"></i> <?php print _("Create new widget"); ?> </button> <table class="table table-striped table-auto table-top" style="min-width:400px;">
}); </script> <?php # show all widgets, sortable //user widgets form database $uwidgets = explode(";", $ipamusername['widgets']); //selected $uwidgets = array_filter($uwidgets); print "<ul id='sortable' class='sortable'>"; # get all widgets if ($ipamusername['role'] == "Administrator") { $widgets = getAllWidgets(true, false); } else { $widgets = getAllWidgets(false, false); } # first selected widgets already in user database if (sizeof($uwidgets) > 0) { foreach ($uwidgets as $k) { $wtmp = $widgets[$k]; print "<li id='{$k}'><i class='icon icon-move'></i><input type='checkbox' name='widget-{$wtmp['wfile']}' value='on' checked> {$wtmp['wtitle']}</li>"; } } # than others, based on admin or normal user foreach ($widgets as $k => $w) { if (!in_array($k, $uwidgets)) { $wtmp = $widgets[$k]; print "<li id='{$k}'><i class='icon icon-move'></i><input type='checkbox' name='widget-{$wtmp['wfile']}' value='on'> {$wtmp['wtitle']}</li>"; } }
if ($function == 'getPrinters') { logger("Getting Printers"); getAllPrinters(); sendResponse($finalResult['PrinterInfo'], 'printer'); } else { if ($function == 'getHome') { logger("Getting Home Widgets"); getHome($rptuser); sendResponse($finalResult['HomeInfo'], 'widget'); } else { if ($function == 'getWidgets') { logger("Getting Widgets"); if ($wID) { getAllWidgets($rptuser, $wID); } else { getAllWidgets($rptuser, 0); } sendResponse($finalResult['WidgetInfo'], 'widget'); } else { if ($function == 'saveSchedule') { logger("Saving Schedule"); saveSchedule($rptuser, $schedID, $schedReport, $schedName, $schedEmail, $schedTemplate, $schedFreq, $schedDay, $schedWeek, $schedWeekDay, $schedMonth, $schedMonthDay, $schedFormat, $_REQUEST['schedMessage']); sendResponse($finalResult['SchedulesInfo'], 'schedule'); } else { if ($function == 'remSchedule') { logger("Removing Schedule"); if (isset($schedule) && $schedule != '') { remSchedule($schedule); } else { if (isset($schedules) && $schedules != '') { remSchedule($schedules);