Example #1
0
<?php

// Called when TypeAhead autocomplete are updated
$data = array();
if (isset($_GET["un"])) {
    $un = CleanString($_GET["un"]);
    $client = Client::GetByUsername($un);
    if ($client->IsValid() && $client->IsActive()) {
        $data["name"] = $client->GetName();
        $data["building"] = $client->GetBuilding();
        $data["location"] = $client->GetLocation();
        $data["phone_number"] = $client->GetPhoneNumber();
        $data["community"] = Building::GetCommunity($client->GetBuilding());
    }
} else {
    if (isset($_GET["sq"])) {
        $query = CleanString($_GET["sq"]);
        $staffs = Staff::GetAll();
        foreach ($staffs as $staff) {
            if ($staff->IsActive() && strpos($staff->GetUsername(), $query) === 0) {
                array_push($data, $staff->GetUsername());
            }
        }
    } else {
        $query = CleanString($_GET["q"]);
        $data = Client::GetUsernameBeginsWith($query);
    }
}
echo json_encode($data);
Example #2
0
		<?php 
    }
} elseif (isset($_GET["clients"])) {
    if (isset($_POST["add"])) {
        $name = $_POST["name"];
        $username = CleanString($_POST["username"]);
        $building = $_POST["building"];
        $location = $_POST["location"];
        $phone_number = CleanString($_POST["phone_number"]);
        if (empty($name) || empty($username) || empty($building) || empty($location) || empty($phone_number)) {
            ShowError("One or more fields were empty!");
        } elseif (!Building::Exists($building) && $building !== "N/A") {
            ShowError("Invalid building.");
        } else {
            $client = Client::GetByUsername($username);
            if ($client->IsValid()) {
                if ($client->IsActive()) {
                    ShowError("A client with that username already exists");
                } else {
                    Client::EditByUsername($username, $name, $building, $location, $phone_number);
                    ShowInfo("Successfully Added Client");
                    RedirectTimer("admin&amp;clients", 3);
                }
            } else {
                Client::Add($name, $username, $building, $location, $phone_number);
                ShowInfo("Successfully Added Client");
                RedirectTimer("admin&amp;clients", 3);
            }
        }
    } elseif (isset($_POST["upload"])) {
Example #3
0
<?php

if (isset($_POST["ticket"])) {
    $clientid = CleanString($_POST["clientid"]);
    $description = $_POST["description"];
    if (!isset($_POST["tags"])) {
        ShowError("You must specify at least one tag!");
    } else {
        $tags = $_POST["tags"];
        $client = Client::GetByUsername($clientid);
        if (empty($clientid) || empty($description) || empty($tags)) {
            ShowError("One or more fields were empty!");
        } elseif (!$client->IsValid()) {
            ShowError("Invalid Client ID.");
        } else {
            $ticket = Ticket::Add($client->GetID(), $me->GetID(), $description, STATUS_OPENED, $tags, $client->GetBuilding(), Building::GetCommunity($client->GetBuilding()));
            $me->IncrementPoints(5);
            ShowInfo("Created Ticket Successfully");
            RedirectTimer("ticket&amp;id=" . $ticket->GetID(), 0);
        }
    }
} else {
    ?>

<form class="form-horizontal" role="form" method="post">
	<div class="row">
		<div class="col-lg-12">
			<div class="panel panel-default">
				<div class="panel-heading">
					Client Information
				</div>