Skip to content

Commit

Permalink
allotment procedures call added
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishabh04-02 committed Jan 10, 2018
1 parent 8f83c97 commit da87577
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 41 deletions.
1 change: 0 additions & 1 deletion api-dbconnect.php
Original file line number Diff line number Diff line change
Expand Up @@ -2024,7 +2024,6 @@ public static function reCAPTCHAvalidate($captcha) {
* select_priority - Selects the subject code with minimum priority from priorities
*
* total_seats_subject - Selects the no. of seats in a subject, subject code is taken as input
*
*/

?>
72 changes: 33 additions & 39 deletions views/admin/admin_profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
<div class="page-content">
<!-- Your content goes here -->

<?php
//catching the allotment form result
$allot = 0;
if (isset($_POST['allot']) && $_POST['allot'] == true) {
$allot = 1;
}
?>

<!-- Wide card with share menu button -->

<div class="mdl-grid">
Expand Down Expand Up @@ -45,47 +39,47 @@
Start Allotment
</h4>
</div>
<?php
if ($allot == 0) {
?>

<div class="table-responsive">
<button class="mdl-button mdl-js-button mdl-button--green mdl-button--raised mdl-js-ripple-effect">Ready for Allotment?</button>
<?php
//create backup
if (isset($_POST['backup']) && $_POST['backup'] == true) {
$backup = Database::createbackup();

if ($backup == 1) {
echo "<b>Backup created successfully.</b>";
} else {
echo "<b>Backup creation failed. Check if the backup table already exist.</b>";
}
}

//catching the allotment form result
// $allot = 0;
if (isset($_POST['allot']) && $_POST['allot'] == true) {
$allot = Database::startallotment();

if ($allot == 1) {
echo "<b>Allotment successful.</b>";
} else {
echo "<b>Allotment failed.</b>";
}
}
?>
<br><br>
<button class="mdl-button mdl-js-button mdl-button--green mdl-button--raised mdl-js-ripple-effect">Ready for Allotment?</button>
<!-- The hidden div -->
<div id="Hideit" style="display: none;">
<br><p>Once you are ready for allotment (All departments have registered and all students have filled their priorities), just start the allotment by clicking on the button below.</p>
<br><p><b>Note - Allotment once started can't be undone.</b></p><br>
<br><p><b>Note - Allotment once started can't be undone.</b><br>But you can create a backup of the priorities filled by students.</p><br>
<form class="update" action="" method="post">
<button name="backup" type="submit" value="true" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--colored">Create priorities backup</button>
</form>

<form class="update" action="" method="post">
<button name="allot" type="submit" value="true" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent">Start Allotment</button>
</form>
</div>
<?php
} else {
?>
<div class="table-responsive">
<p><b>Allotting electives......</b></p>

<!-- Snackbar starts -->
<div id="snackbar" class="mdl-js-snackbar mdl-snackbar">
<div class="mdl-snackbar__text"></div>
<button class="mdl-snackbar__action" type="button"></button>
</div>

<script>
r(function(){
var snackbarContainer = document.querySelector('#snackbar');
var data = { message: 'Elective Allotment Complete.',timeout: 4000};
snackbarContainer.MaterialSnackbar.showSnackbar(data);
});
function r(f){ /in/.test(document.readyState)?setTimeout('r('+f+')',9):f()}
</script>
<!-- Snackbar ends -->



<?php
}
?>

</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion views/includes/includes_header.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
<meta name="description" content="Elective Manager">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
<link rel="icon" href="../images/book.png">
<title>Elective Manager</title>
Expand Down

0 comments on commit da87577

Please sign in to comment.