示例#1
0
文件: tf.php 项目: cjbayliss/alloc
    global $TPL;
    echo page::select_options(person::get_username_list($TPL["person_personID"]), $TPL["person_personID"]);
}
$db = new db_alloc();
$tf = new tf();
$tfID = $_GET["tfID"] or $tfID = $_POST["tfID"];
if ($tfID) {
    $tf->set_id($tfID);
    $tf->select();
} else {
    $tf_is_new = true;
}
if ($_POST["save"]) {
    $tf->read_globals();
    if ($_POST["isActive"]) {
        $tf->set_value("tfActive", 1);
    } else {
        $tf->set_value("tfActive", 0);
    }
    if ($tf->get_value("tfName") == "") {
        alloc_error("You must enter a name.");
    } else {
        if (!$tf->get_id()) {
            $db = new db_alloc();
            $q = prepare("SELECT count(*) AS tally FROM tf WHERE tfName = '%s'", $tf->get_value("tfName"));
            $db->query($q);
            $db->next_record();
            $tf_is_taken = $db->f("tally");
        }
        if ($tf_is_taken) {
            alloc_error("That TF name is taken, please choose another.");