function ShowForm() { global $db; $sql = "INSERT INTO groups (name) VALUES ()"; $elemsedit = array("name" => new FInput("name", "Название:")); $formedit = new FormInsertSQL($db, $sql, $elemsedit); $formedit->SetUserFunc("CheckGroupForm"); $list_sql = "SELECT id, login FROM users"; $join_sql = "SELECT user_id FROM groups_users WHERE group_id="; $formcheckboxs = new FormCheckList($db, $list_sql, $join_sql, true); $formcheckboxs->SetWidth("100%"); $elemsform = array("editform" => new FBlock($formedit->AsString()), "checkboxs" => new FBlock($formcheckboxs->AsString())); $fr = new Form($elemsform, "Добавить"); $fr->SetGoBack(false); $fr->Show(); }
function ShowForm() { global $db; $sql = "INSERT INTO users (login, password, name, family, daddy, mobile_telephone) " . "VALUES ()"; $elemsedit = array("login" => new FInput("login", "Логин:"), "password" => new FPassword("password", "Пароль:"), "password2" => new FPassword("password2", "Пароль ещё раз:"), "name" => new FInput("name", "Имя:"), "family" => new FInput("family", "Фамилия:"), "daddy" => new FInput("daddy", "Отчество:"), "mobile_telephone" => new FInput("mobile_telephone", "Мобильный:")); $formedit = new FormInsertSQL($db, $sql, $elemsedit); $formedit->SetUserFunc("CheckUserForm"); $list_sql = "SELECT id, name FROM groups"; $join_sql = "SELECT group_id FROM groups_users WHERE user_id="; $formcheckboxs = new FormCheckList($db, $list_sql, $join_sql, true); $formcheckboxs->SetWidth("100%"); $elemsform = array("editform" => new FBlock($formedit->AsString()), "checkboxs" => new FBlock($formcheckboxs->AsString())); $fr = new Form($elemsform, "Добавить"); $fr->SetGoBack(false); $fr->Show(); }
function ShowForm() { global $db, $group_edit_id; if (!CheckAction() || $group_edit_id == 0) { return; } $sql = "SELECT name, is_deleted " . "FROM groups " . "WHERE id='" . $group_edit_id . "' LIMIT 0,1"; $elemsedit = array("is_deleted" => new FCheckbox("is_deleted", "Удалён"), "name" => new FInput("name", "Название:")); $formedit = new FormUpdateSQL($db, $sql, $elemsedit); $formedit->SetUserFunc("CheckGroupForm"); $list_sql = "SELECT id, login FROM users"; $join_sql = "SELECT user_id FROM groups_users WHERE group_id=" . $group_edit_id; $formcheckboxs = new FormCheckList($db, $list_sql, $join_sql); $formcheckboxs->SetWidth("100%"); $elemsform = array("id" => new FHidden("id", $group_edit_id), "editform" => new FBlock($formedit->AsString()), "checkboxs" => new FBlock($formcheckboxs->AsString())); $fr = new Form($elemsform, "Изменить"); $fr->AddButton("<input type=\"button\" value=\"Уничтожить\" " . "onClick=\"if(window.confirm('Уверены, что хотите безвозвратно уничтожить группу?')) GoURL('?action=full_delete&id=" . $group_edit_id . "')\">"); $fr->Show(); }
function ShowForm() { global $db, $user_edit_id; if (!CheckAction() || $user_edit_id == 0) { return; } $sql = "SELECT login, password, name, family, daddy, mobile_telephone, " . "is_deleted " . "FROM users " . "WHERE id='" . $user_edit_id . "' LIMIT 0,1"; $elemsedit = array("is_deleted" => new FCheckbox("is_deleted", "Удалён"), "login" => new FInput("login", "Логин:"), "password" => new FPassword("password", "Пароль:"), "password2" => new FPassword("password2", "Пароль ещё раз:"), "name" => new FInput("name", "Имя:"), "family" => new FInput("family", "Фамилия:"), "daddy" => new FInput("daddy", "Отчество:"), "mobile_telephone" => new FInput("mobile_telephone", "Мобильный:")); $formedit = new FormUpdateSQL($db, $sql, $elemsedit); $formedit->SetUserFunc("CheckUserForm"); $list_sql = "SELECT id, name FROM groups"; $join_sql = "SELECT group_id FROM groups_users WHERE user_id=" . $user_edit_id; $formcheckboxs = new FormCheckList($db, $list_sql, $join_sql); $formcheckboxs->SetWidth("100%"); $elemsform = array("id" => new FHidden("id", $user_edit_id), "editform" => new FBlock($formedit->AsString()), "checkboxs" => new FBlock($formcheckboxs->AsString())); $fr = new Form($elemsform, "Изменить"); $fr->AddButton("<input type=\"button\" value=\"Уничтожить\" " . "onClick=\"if(window.confirm('Уверены, что хотите безвозвратно уничтожить пользователя?')) GoURL('?action=full_delete&id=" . $user_edit_id . "')\">"); $fr->Show(); }