87 lines
2.5 KiB
PHP
87 lines
2.5 KiB
PHP
<?php
|
|
require_once("include/globals.php");
|
|
|
|
if (SessionActive() != 1 || ! UserLoggedIn()) {
|
|
header("Location: /");
|
|
exit();
|
|
}
|
|
|
|
|
|
//
|
|
// Process all actions to list and edit records
|
|
//
|
|
$action = "poll-admin";
|
|
$CurrentTable = "polls";
|
|
$FormFile = "";
|
|
$TitleText = getLanguageText('TEXT-ONLINE-POLL');
|
|
$OrderBy = "poll_title";
|
|
|
|
// Start the template and output buffering
|
|
startTemplate();
|
|
$templatePageTitle = "$TitleText";
|
|
|
|
|
|
// Ensure that only valid user types have access to this module
|
|
$AllowedUserTypes = array('SuperUser','System Administrator','Application Administrator','Communications Administrator','Administration Team','Schedule Team');
|
|
if (checkPermission($AllowedUserTypes) != 1) {
|
|
$error_message = getLanguageText('ERRORMSG-ACCESS-DENIED');
|
|
include "form.messages.php";
|
|
endTemplate();
|
|
exit();
|
|
}
|
|
|
|
$school_num = $school_record['record_num'];
|
|
|
|
?>
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
<?php include "include/ajax.Setup.php" ?>
|
|
|
|
loadPolls();
|
|
|
|
function loadPolls() {
|
|
$("#poll-list").html("<p><b>Loading...</b></p>");
|
|
|
|
var data = "table_name=polls"+
|
|
"&sequence_flag=Y"+
|
|
"&action=polls"+
|
|
"&table_id=poll-list-table";
|
|
|
|
// Get data table
|
|
$.getJSON( "ajax.DataTable.Fetch.php",data,
|
|
function(results) {
|
|
$("#poll-list").html(results.content);
|
|
$("#poll-list-table").tableDnD({
|
|
onDrop: function(table, row) {
|
|
var rows = table.tBodies[0].rows;
|
|
var data = "&table="+table_name+"&school_num=<?php echo($school_num) ?>";
|
|
for (var i=0; i<rows.length; i++) {
|
|
var rowid = rows[i].id;
|
|
data += "&row_ids[]="+rowid;
|
|
|
|
// Update row classes
|
|
$("#"+rowid).removeClass("data-even");
|
|
$("#"+rowid).removeClass("data-odd");
|
|
if (i % 2) $("#"+rowid).addClass("data-even");
|
|
else $("#"+rowid).addClass("data-odd");
|
|
}
|
|
$.ajax({
|
|
url: "ajax.SequenceRecords.php",
|
|
data: data
|
|
});
|
|
}
|
|
});
|
|
}
|
|
);
|
|
}
|
|
});
|
|
</script>
|
|
<div id='poll-list'></div>
|
|
|
|
<p><a href='#' id='add-poll' class='btn btn--primary>'><?php displayLanguageText('TEXT-INSERT-NEW'); ?></a></p>
|
|
|
|
<?php
|
|
endTemplate();
|
|
?>
|