home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.ee.pdx.edu
/
2014.02.ftp.ee.pdx.edu.tar
/
ftp.ee.pdx.edu
/
oss
/
cvs-2004
/
bahasa
/
web
/
requests.php
< prev
next >
Wrap
PHP Script
|
2003-08-12
|
3KB
|
166 lines
<?
session_start();
require_once("../php/Indonesia.php");
require_once("../php/Web.php");
$web = new Web();
if (!session_is_registered("ADMIN")) {
$web->redirect("login.php");
exit;
}
if (session_is_registered("NODUP_DELETE_REQUEST")) {
session_unregister("NODUP_DELETE_REQUEST");
$web->redirect("admin.php");
exit;
}
$indonesia = new Indonesia();
$status = $indonesia->get_dictionary_status();
if ($status["status"] == 1 || $status["status"] == 2) {
$web->redirect("admin.php");
}
?>
<html>
<head>
<title>
Bahasa Indonesia Dictionary: Request Entries
</title>
</head>
<body>
<h2>Bahasa Indonesia Dictionary: Request Entries</h2>
<a href="admin.php">Administration</a>
<?
if (isset($_POST['delete_entry'])) {
$errstr =
$indonesia->delete_request($_POST['delete_entry']);
if ($errstr != "") {
print "<br><hr><b>${errstr}</b><hr><br>\n";
} else {
print "<br><hr><b>Successful deletion!</b><hr><br>\n";
$NODUP_DELETE_REQUEST = 1;
session_register("NODUP_DELETE_REQUEST");
}
} else {
show_requests($web, $indonesia);
}
?>
</body>
</html>
<?
//////////////////////////////////////////////////////////////////////////////
function show_requests($web, $indonesia) {
$requests = array();
$errstr = $indonesia->get_requests($requests);
if ($errstr != "") {
print "<hr><br><b>${errstr}</b><hr><br>\n";
} else {
$total_requests = count($requests);
print "<h3>Found ${total_requests} requests</h3>\n";
if ($total_requests == 0) {
return;
}
print
"<table cellpadding=\"3\" cellspacing=\"3\" " .
"border=\"1\" width=\"50%\">\n";
for($i = 0; $i < $total_requests; $i++) {
if ($i == 0) {
print
"<tr>\n" .
"<th>PKEY</th>\n" .
"<th>English</th>\n" .
"<th>Indonesian</th>\n" .
"<th>POS</th>\n" .
"<th>Spelling Flag</th>\n" .
"<th>Comments</th>\n" .
"<th>Created</th>\n" .
"<th>Insert</th>\n" .
"<th>Delete</th>\n" .
"</tr>\n";
}
$pkey =
$web->tohtml($requests[$i]->pkey);
$english =
$web->tohtml($requests[$i]->english);
$indonesian =
$web->tohtml($requests[$i]->indonesian);
$pos =
$web->tohtml($requests[$i]->part_of_speech);
$spl =
$web->tohtml($requests[$i]->spelling_flag);
$comments =
$web->tohtml($requests[$i]->comments);
$created =
$web->tohtml($requests[$i]->created);
print
"<tr>\n" .
"<td>${pkey} </td>\n" .
"<td>${english} </td>\n" .
"<td>${indonesian} </td>\n" .
"<td>${pos} </td>\n" .
"<td>${spl} </td>\n" .
"<td>${comments} </td>\n" .
"<td>${created} </td>\n" .
"<td>\n" .
"<form name=\"insert\" action=\"insert.php\" " .
"method=\"post\">\n" .
"<input type=\"submit\" value=\"Insert!\">\n" .
"<input type=\"hidden\" " .
"name=\"insert_request_entry\" " .
"value=\"${pkey}\"></form>\n" .
"</td>\n" .
"<td>\n" .
"<form name=\"delete\" method=\"post\">\n" .
"<input type=\"submit\" value=\"Delete!\">\n" .
"<input type=\"hidden\" name=\"delete_entry\" " .
"value=\"${pkey}\"></form>\n" .
"</tr>\n";
}
print "</table>\n";
}
return;
}
?>