Example #1
0
}
if (isset($_POST['submit'])) {
    // form was submitted
    $id = $_POST['id'];
    $newid = $_POST['newLabId'];
    $newdesc = $_POST['newLabDesc'];
    modifyLab($id, $newid, $newdesc);
    redirectTo("labs_manage.php");
} else {
    if (!isset($_GET['id'])) {
        // must pass lab id to modify
        redirectTo('index.php');
    }
}
$id = $_GET['id'];
$currentLab = getLabById($id);
ob_flush();
include_once "templates/page_head.php";
?>

<div class="container">
    <?php 
include_once "templates/navigation.php";
?>

    <content>
        <!-- edit lab form -->
        <form class="account-form form-signin" action="lab_edit.php" method="post">
            <h2 class="form-signin-heading"> Edit Lab <?php 
echo $currentLab['id'];
?>
Example #2
0
    redirectTo("index.php");
}
// must pass lab id
if (!isset($_GET['id'])) {
    redirectTo('index.php');
}
$lab_id = $_GET['id'];
// was submitted for file upload
if (isset($_POST['submit']) && $_POST['command'] == 'upload') {
    require_once "file_upload.php";
    $uploadStatus = uploadFile(basename($_FILES["fileToUpload"]["name"]), $lab_id, $_SESSION['loggedInUser']);
    $uploadWasSuccessful = $uploadStatus['success'];
    $uploadMessage = $uploadStatus['message'];
    $scriptResult = $uploadStatus['scriptResult'];
}
$currentLab = getLabById($lab_id);
ob_flush();
include_once "templates/page_head.php";
?>

<div class="container" xmlns="http://www.w3.org/1999/html">
    <?php 
include_once "templates/navigation.php";
?>

    <content>


	    <h1><?php 
echo "Lab " . $currentLab['id'];
?>
Example #3
0
<?php

ob_start();
require_once "model.php";
//only accessible if logged in as instructor
session_start();
if (!isset($_SESSION['loggedInUser']) || $_SESSION['isInstructor'] != '1') {
    redirectTo("index.php");
}
if (isset($_POST['submit'])) {
    // form was submitted
    $id = $_POST['inputLabId'];
    $description = $_POST['inputLabDesc'];
    // check for duplicate lab
    // lab with that name exists
    if (getLabById($id) != null) {
        $msg = "Can't add Lab {$id}, already exists.";
    } else {
        // add lab
        $testCases = array();
        for ($i = 1; $i <= $_POST['numTestCases']; $i++) {
            array_push($testCases, array($i . 'name' => $_POST['testCase' . $i . 'Name'], $i . 'description' => $_POST['testCase' . $i . 'Description']));
        }
        addLab($id, $description);
        addTestCasesForLab($id, $testCases);
        $msg = "Lab {$id} added.";
    }
} else {
    // form was not submitted (GET request)
    $msg = "Add Lab";
}