<?php
if(isset($_GET["opt"]) && $_GET["opt"]=="add"){
$grade = new UnitData();
$grade->name = $_POST["name"];
$grade->add();
Core::redir("./?view=units&opt=all");
}
else if(isset($_GET["opt"]) && $_GET["opt"]=="update"){
if(count($_POST)>0){
	$user = UnitData::getById($_POST["user_id"]);
	$user->name = $_POST["name"];
	$user->update();
Core::redir("./?view=units&opt=all");
}
}
else if(isset($_GET["opt"]) && $_GET["opt"]=="del"){
$category = UnitData::getById($_GET["id"]);
$category->del();
Core::redir("./?view=units&opt=all");

}






?>