-
Notifications
You must be signed in to change notification settings - Fork 25
/
RCCWP_CustomGroupPage.php
83 lines (66 loc) · 3.07 KB
/
RCCWP_CustomGroupPage.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
<?php
include_once('RCCWP_CustomGroup.php');
class RCCWP_CustomGroupPage
{
public static function Content($customGroup = null)
{
// add the new expanded column, if it's not there already (Traversal)
RCCWP_Application::AddColumnIfNotExist(MF_TABLE_PANEL_GROUPS, "expanded", $column_attr = "tinyint after duplicate" );
global $mf_domain;
$customGroupName = $customGroupDuplicate = $customGroupExpanded = "";
if (isset($_GET['custom-write-panel-id']) )
$customWritePanelId = filter_var($_GET['custom-write-panel-id'], FILTER_VALIDATE_INT);
if (isset($_POST['custom-write-panel-id']) )
$customWritePanelId = filter_var($_POST['custom-write-panel-id'], FILTER_VALIDATE_INT);
if ($customGroup != null)
{
$customGroupName = $customGroup->name;
$customGroupDuplicate = $customGroup->duplicate;
$customGroupExpanded = $customGroup->expanded;
}
?>
<?php if($customWritePanelId) { ?>
<input type="hidden" name="custom-write-panel-id" value="<?php echo $customWritePanelId?>">
<?php } ?>
<table class="form-table" width="100%" border="0" cellspacing="0" cellpadding="6">
<tbody>
<tr valign="top">
<th scope="row" align="right"><?php _e('Name', $mf_domain); ?>:</th>
<td><input name="custom-group-name" id="custom-group-name" size="40" type="text" value="<?php echo $customGroupName?>" /></td>
</tr>
<tr>
<th scope="row" align="right"><?php _e('Duplication', $mf_domain); ?>:</th>
<td><input name="custom-group-duplicate" id="custom-group-duplicate" type="checkbox" value="1" <?php echo $customGroupDuplicate == 0 ? "":"checked" ?> /> <?php _e('The group can be duplicated', $mf_domain); ?></td>
</tr>
<tr>
<th scope="row" align="right"><?php _e('Show as Expanded', $mf_domain); ?>:</th>
<td><input name="custom-group-expanded" id="custom-group-expanded" type="checkbox" value="1" <?php echo $customGroupExpanded == 0 ? '': ' checked="checked" ' ?> /> <?php _e('Display the full expanded group editing interface instead of the group summary', $mf_domain); ?>
<br /><small><?php _e('Note: the group can still be collapsed by the user, this just determines the default state on load')?></td>
</tr>
</tbody>
</table>
<br />
<?php
}
public static function Edit()
{
global $mf_domain;
$customGroup = RCCWP_CustomGroup::Get((int)$_REQUEST['custom-group-id']);
?>
<div class="wrap">
<h2><?php _e('Edit Group', $mf_domain); ?> - <?php echo $customGroup->name?></h2>
<form action="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('submit-edit-custom-group')."&custom-group-id={$customGroup->id}"?>" method="post" id="edit-custom-group-form">
<?php wp_nonce_field('submit-edit-custom-group'); ?>
<?php
RCCWP_CustomGroupPage::Content($customGroup);
?>
<p class="submit" >
<a style="color:black" href="<?php echo RCCWP_ManagementPage::GetCustomWritePanelGenericUrl('cancel-edit-custom-group')?>" class="button"><?php _e('Cancel', $mf_domain); ?></a>
<input type="submit" id="submit-edit-custom-group" value="<?php _e('Update', $mf_domain); ?>" />
</p>
</form>
</div>
<br />
<?php
}
}