<?php Output::set_title("Group Administration"); MainTemplate::set_subtitle("View and edit groups"); Output::require_group("Group Admin"); function print_groups($group) { $groups = Groups::get_by_parent($group); if ($groups) { echo "<ul>"; foreach ($groups as $group) { echo "<li data-group-id=\"" . $group->get_id() . "\" data-description=\"" . $group->get_description() . "\">" . $group->get_name() . "</li>"; print_groups($group); } echo "</ul>"; } } echo "\r\n\t<script>\r\n\t\$(document).ready(function() {\r\n\t\t\$(document).on('click', '#groups li', function() {\r\n\t\t\t\$('#group-info h3').html(\$(this).html());\r\n\t\t\t\$('#group-description').html(\$(this).attr('data-description'));\r\n\t\t\t\$('#group-info').attr('data-group-id',\$(this).attr('data-group-id'));\r\n\t\t\t\$('#group-members ul').html('');\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/group-admin.php?action=members&group='+\$(this).attr('data-group-id'),\r\n\t\t\t\tdataType: 'json'\r\n\t\t\t}).done(function(data) {\r\n\t\t\t\t\$.each(data, function(id,user) {\r\n\t\t\t\t\t\$('#group-members ul').append('<li class=\"list-group-item\" data-user-id=\"'+id+'\">'+user+'" . Bootstrap::glyphicon("remove pull-right") . "</li>');\r\n\t\t\t\t})\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\t\$(document).on('click', '.glyphicon-remove', function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/group-admin.php?action=del-user&user='******'data-user-id')+'&group='+\$(this).parents('#group-info').attr('data-group-id'),\r\n\t\t\t\tdataType: 'json'\r\n\t\t\t}).done(function(data) {\r\n\t\t\t\t\$.each(data, function(id,user) {\r\n\t\t\t\t\t\$('[data-user-id='+id+']').remove();\r\n\t\t\t\t})\r\n\t\t\t})\r\n\t\t});\r\n\r\n\t\t\$(document).on('submit', '.form-horizontal', function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/group-admin.php?action=add-user&user='******'input').val()+'&group='+\$(this).parents('#group-info').attr('data-group-id'),\r\n\t\t\t\tdataType: 'json'\r\n\t\t\t}).done(function(data) {\r\n\t\t\t\t\$('input').val('');\r\n\t\t\t\t\$.each(data, function(id,user) {\r\n\t\t\t\t\t\$('#group-members ul').append('<li class=\"list-group-item\" data-user-id=\"'+id+'\">'+user+'" . Bootstrap::glyphicon("remove pull-right") . "</li>');\r\n\t\t\t\t})\r\n\t\t\t});\r\n\t\t\treturn false;\r\n\t\t});\r\n\r\n\t\t\$('#groups').find('li:first').click();\r\n\t});\r\n\t</script>\r\n\r\n\t<div class=\"row\">\r\n\t\t<div class=\"col-md-6\">\r\n\t\t\t<h3>Group tree</h3>\r\n\t\t\t<div id=\"groups\">\r\n"; print_groups(NULL); echo "\r\n\t\t</div>\r\n\t</div>\r\n\t<div class=\"col-md-6\">\r\n\t\t<div id=\"group-info\">\r\n\t\t\t<h3></h3>\r\n\t\t\t<div id=\"group-description\"></div>\r\n\t\t\t<h4>Members:</h4>\r\n\t\t\t<div id=\"group-members\">\r\n\t\t\t\t<ul class=\"list-group\">\r\n\r\n\t\t\t\t</ul>\r\n\t\t\t</div>\r\n\t\t\t<form class=\"form-horizontal\">\r\n\t\t\t\t<div class=\"form-group\">\r\n\t\t\t\t\t<div class=\"col-xs-9\">\r\n\t\t\t\t\t\t<input type=\"text\" id=\"add-user\" class=\"form-control\" placeholder=\"Add user...\" />\r\n\t\t\t\t\t</div>\r\n\t\t\t\t\t<button type=\"submit\" class=\"btn btn-primary col-xs-3\" id=\"add-user-submit\">Add</button>\r\n\t\t\t\t</div>\r\n\t\t\t</div>\r\n\t\t</div>\r\n\t</div>\r\n</div>\r\n";
<?php Output::set_title("Sustainer Schedule"); Output::add_script(LINK_ABS . "js/jquery-ui-1.10.3.custom.min.js"); Output::add_stylesheet(LINK_ABS . "css/select2.min.css"); Output::add_script(LINK_ABS . "js/select2.min.js"); Output::require_group("Sustainer Admin"); MainTemplate::set_subtitle("Change the schedule of the sustainer service"); echo "<style type=\"text/css\">\r\n\ttd.timeslot { text-align: center; }\r\n </style>\r\n\r\n\r\n\t<script type=\"text/javascript\">\r\n\$(function() {\r\n\r\n\t\t\$('#update-playlist').click(function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/update-sustainer-slots.php',\r\n\t\t\t\tdata: { updateid: \$('.update-id').val(), playlistid: \$('#playlist-id').val() },\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\talert(value.error);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t\$('#save-prerecord').click(function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/add-update-prerecord.php',\r\n\t\t\t\tdata: { updateid: \$('.update-id').val(), prerecordid: \$('#prerecord-id').val() },\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\talert(value.error);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t\$('#delete-prerecord').click(function() {\r\n\t\t\t\$.ajax({\r\n\t\t\t\turl: '" . LINK_ABS . "ajax/add-update-prerecord.php',\r\n\t\t\t\tdata: { updateid: \$('.update-id').val(), prerecordid: 0 },\r\n\t\t\t\ttype: 'POST',\r\n\t\t\t\terror: function(xhr,text,error) {\r\n\t\t\t\t\tvalue = \$.parseJSON(xhr.responseText);\r\n\t\t\t\t\talert(value.error);\r\n\t\t\t\t},\r\n\t\t\t\tsuccess: function(data,text,xhr) {\r\n\t\t\t\t\twindow.location.reload(true); \r\n\t\t\t\t}\r\n\t\t\t});\r\n\t\t});\r\n\r\n\t\t\$('#prerecord-id').select2({\r\n\t\t ajax: {\r\n\t\t url: '" . LINK_ABS . "ajax/prerecord-search.php',\r\n\t\t dataType: 'json',\r\n\t\t delay: 250,\r\n\t\t data: function (params) {\r\n\t\t return {\r\n\t\t q: params.term\r\n\t\t };\r\n\t\t },\r\n\t\t processResults: function (data, page) {\r\n\t\t // parse the results into the format expected by Select2.\r\n\t\t // since we are using custom formatting functions we do not need to\r\n\t\t // alter the remote JSON data\r\n\t\t return {\r\n\t\t results: data.data\r\n\t\t };\r\n\t\t },\r\n\t\t cache: true\r\n\t\t },\r\n\t\t escapeMarkup: function (markup) { return markup; }, // let our custom formatter work\r\n\t\t minimumInputLength: 1,\r\n\t\t templateResult: formatRepo, // omitted for brevity, see the source of this page\r\n\t\t templateSelection: formatRepoSelection\r\n\t\t});\r\n\r\n\t\tfunction formatRepo (repo) {\r\n\t\t\tif (repo.loading) return repo.title;\r\n\t\t return repo.title + ' by <i>' + repo.by + '</i>';\r\n\t\t }\r\n\r\n\t function formatRepoSelection (repo) {\r\n\t \treturn repo.title;\r\n\t }\r\n\r\n\t \$('#playlist-id').select2()\r\n\r\n});\r\n</script>"; $colours = array('2ecc71', 'e67e22', '3498db', 'e74c3c', '9b59b6', '34495e', '1abc9c', 'f1c40f'); $timeslots = array('00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'); $slots = SustainerSlots::get_all(); $i = 0; echo "<table class=\"table table-striped table-bordered\">\r\n\t<thead>\r\n\t<tr>\r\n\t<th></th>\r\n\t<th>Monday</th>\r\n\t<th>Tuesday</th>\r\n\t<th>Wednesday</th>\r\n\t<th>Thursday</th>\r\n\t<th>Friday</th>\r\n\t<th>Saturday</th>\r\n\t<th>Sunday</th>\r\n\t</tr>\r\n\t</thead>\r\n\t<tbody>"; $i = 0; foreach ($slots as $slot) { if ($i < 1) { echo "<tr>\r\n\t\t\t<td>" . $slot->get_time() . ":00</td>"; } $thisPlaylist = Playlists::get_by_id($slot->get_playlist_id()); $thisPlaylistColour = $thisPlaylist->get_colour() == "" ? 'FFFFFF' : $thisPlaylist->get_colour(); echo "<td class='timeslot' id='slot-" . $slot->get_day() . "-" . $slot->get_time() . "' style='background-color: #" . $thisPlaylistColour . ";'>"; echo $slot->get_audio_id() == NULL ? '' : "<span class=\"glyphicon glyphicon-time\" aria-hidden=\"true\"></span>"; echo "</td>"; $i++; if ($i > 6) { echo "</tr>"; $i = 0; } } echo "</tbody>\r\n\t</table>";
<?php Output::set_title("Jingle Packages"); MainTemplate::set_subtitle("Create and manage groups of jingles"); Output::add_script(LINK_ABS . 'js/bootbox.min.js'); Output::add_script(LINK_ABS . 'js/bootstrap.typeahead.min.js'); Output::require_group("Files Admin"); if (isset($_GET['archive']) && ($package = JinglePackages::get_by_id($_GET['archive']))) { if ($package->get_archived() == false) { $package->set_archived(true); } else { $package->set_archived(false); } $package->save(); } else { if (isset($_GET['delete']) && ($package = JinglePackages::get_by_id($_GET['delete']))) { $package->delete(); } } if (isset($_GET['show_archived']) && $_GET['show_archived'] == 'true') { $show_archived = true; } else { $show_archived = false; } ?> <script> $().ready(function() { <?php echo $show_archived ? 'var archive_str = \'&show_archived=true\';' : 'var archive_str = \'\';'; ?>