forked from pouetnet/pouet2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_group_edit.php
87 lines (66 loc) · 1.91 KB
/
admin_group_edit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?
require_once("bootstrap.inc.php");
require_once("include_pouet/box-modalmessage.php");
require_once("include_pouet/box-group-submit.php");
if ($currentUser && !$currentUser->CanEditItems())
{
redirect("groups.php?which=".(int)$_GET["which"]);
exit();
}
class PouetBoxAdminEditGroup extends PouetBoxSubmitGroup
{
function PouetBoxAdminEditGroup( $id )
{
parent::__construct();
$this->id = (int)$id;
$this->group = PouetGroup::Spawn( $this->id );
$this->title = "edit this group: "._html($this->group->name);
}
function Commit($data)
{
global $groupID;
$a = array();
$a["name"] = trim($data["name"]);
$a["acronym"] = $data["acronym"];
$a["web"] = $data["website"];
$a["csdb"] = $data["csdbID"];
$a["zxdemo"] = $data["zxdemoID"];
SQLLib::UpdateRow("groups",$a,"id=".$this->id);
gloperator_log( "group", $this->id, "group_edit" );
return array();
}
function LoadFromDB()
{
parent::LoadFromDB();
$group = $this->group;
$this->fields["name"]["value"] = $group->name;
$this->fields["acronym"]["value"] = $group->acronym;
$this->fields["website"]["value"] = $group->web;
$this->fields["csdbID"]["value"] = $group->csdb;
$this->fields["zxdemoID"]["value"] = $group->zxdemo;
}
}
$form = new PouetFormProcessor();
$form->SetSuccessURL( "groups.php?which=".(int)$_GET["which"], true );
$box = new PouetBoxAdminEditGroup( $_GET["which"] );
$form->Add( "group", $box );
if ($currentUser && $currentUser->CanEditItems())
$form->Process();
$TITLE = "edit a group: ".$box->group->name;
require_once("include_pouet/header.php");
require("include_pouet/menu.inc.php");
echo "<div id='content'>\n";
if (get_login_id())
{
$form->Display();
}
else
{
require_once("include_pouet/box-login.php");
$box = new PouetBoxLogin();
$box->Render();
}
echo "</div>\n";
require("include_pouet/menu.inc.php");
require_once("include_pouet/footer.php");
?>