*/
class admin_plugin_judge extends DokuWiki_Admin_Plugin
{
/**
* handle user request
*/
function handle()
{
if (!isset($_REQUEST['cmd'])) {
return; // first time - nothing to do
}
if (!checkSecurityToken()) {
return;
}
if (!is_array($_REQUEST['cmd'])) {
return;
}
$crud = plugin_load('helper', 'judge_crud', true);
// verify valid values
switch (key($_REQUEST['cmd'])) {
case 'get' :
$this->output = '
';
$table = $crud->tableRender(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']), "html", 1, "timestamp");
if ($table["count"] == 0) {
$this->output .= '' . $this->getLang("empty_result") . '
';
break;
} else {
$this->output .= $table["submissions_table"];
}
$this->output .= "
";
break;
case 'delete' :
$this->output = $crud->delSubmissions(array('problem_name' => $_REQUEST['problem_name'], 'type' => $_REQUEST['type'], 'user' => $_REQUEST['user']));
break;
}
}
/**
* output appropriate html
*/
function html()
{
global $ID, $auth;
$filter['grps'] = "user";
if ($auth->canDo('getUsers')) { // is this feature available?
$users = $auth->retrieveUsers(0, 0);
}
$html = '' . $this->getLang("intro_message") . '
';
$html .= $this->output;
ptln($html);
}
}