$defaults = array("return" => "html", "showHeader" => true, "showName" => true, "showActive" => true, "showNos" => true, "showLinks" => true, "form_name" => "personList_filter"); function show_filter() { global $TPL; global $defaults; $_FORM = person::load_form_data($defaults); $arr = person::load_person_filter($_FORM); is_array($arr) and $TPL = array_merge($TPL, $arr); include_template("templates/personListFilterS.tpl"); } function show_people() { global $defaults; $_FORM = person::load_form_data($defaults); #echo "<pre>".print_r($_FORM,1)."</pre>"; echo person::get_list($_FORM); } $TPL["main_alloc_title"] = "People - " . APPLICATION_NAME; $max_alloc_users = get_max_alloc_users(); $num_alloc_users = get_num_alloc_users(); if ($max_alloc_users && $num_alloc_users > $max_alloc_users) { alloc_error("Maximum number of active user accounts: " . $max_alloc_users); alloc_error("Current number of active user accounts: " . $num_alloc_users . "<br>"); alloc_error(get_max_alloc_users_message()); } else { if ($max_alloc_users) { $TPL["message_help"][] = "Maximum number of active user accounts: " . $max_alloc_users; $TPL["message_help"][] = "Current number of active user accounts: " . $num_alloc_users; } } include_template("templates/personListM.tpl");
} if ($_POST["username"]) { $q = prepare("SELECT personID FROM person WHERE username = '******'", $_POST["username"]); $db = new db_alloc(); $db->query($q); $num_rows = $db->num_rows(); $row = $db->row(); if ($num_rows > 0 && !$person->get_id() || $num_rows > 0 && $person->get_id() != $row["personID"]) { alloc_error("That username is already taken. Please select another."); } } else { alloc_error("Please enter a username."); } $person->set_value("personActive", $_POST["personActive"] ? 1 : "0"); $max_alloc_users = get_max_alloc_users(); if (!$person->get_id() && $max_alloc_users && get_num_alloc_users() >= $max_alloc_users && $_POST["personActive"]) { alloc_error(get_max_alloc_users_message()); } if (!$TPL["message"]) { $person->set_value("availability", rtrim($person->get_value("availability"))); $person->set_value("areasOfInterest", rtrim($person->get_value("areasOfInterest"))); $person->set_value("comments", rtrim($person->get_value("comments"))); $person->set_value("emergencyContact", rtrim($person->get_value("emergencyContact"))); $person->set_value("managementComments", rtrim($person->get_value("managementComments"))); $person->currency = config::get_config_item('currency'); $person->save(); alloc_redirect($TPL["url_alloc_personList"]); } } else { if ($_POST["delete"]) { $person->delete();