aboutsummaryrefslogtreecommitdiffstats
path: root/admin/group_list.php
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2006-10-30 23:34:31 +0000
committerrub <rub@piwigo.org>2006-10-30 23:34:31 +0000
commit9c3e182268ed2bc5df5f31cf4045b217f7ad8791 (patch)
treec09a2b977ba3bfde8f32d2e38c07ad237ac29013 /admin/group_list.php
parenta0e981198d4602c7634407780379c19d58b92e15 (diff)
Resolved Issue ID 0000526:
o Add default group to new user Allow to have n default groups. Property are save on table #_group and can be modified on administration group screen. git-svn-id: http://piwigo.org/svn/trunk@1583 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/group_list.php34
1 files changed, 32 insertions, 2 deletions
diff --git a/admin/group_list.php b/admin/group_list.php
index 0386757dd..69edcb02a 100644
--- a/admin/group_list.php
+++ b/admin/group_list.php
@@ -123,6 +123,33 @@ INSERT INTO '.GROUPS_TABLE.'
}
// +-----------------------------------------------------------------------+
+// | toggle is default group property |
+// +-----------------------------------------------------------------------+
+
+if (isset($_GET['toggle_is_default']) and is_numeric($_GET['toggle_is_default']))
+{
+ $query = '
+SELECT name, is_default
+ FROM '.GROUPS_TABLE.'
+ WHERE id = '.$_GET['toggle_is_default'].'
+;';
+ list($groupname, $is_default) = mysql_fetch_row(pwg_query($query));
+
+ // update of the group
+ $query = '
+UPDATE '.GROUPS_TABLE.'
+ SET is_default = \''.boolean_to_string(!get_boolean($is_default)).'\'
+ WHERE id = '.$_GET['toggle_is_default'].'
+;';
+ pwg_query($query);
+
+ array_push(
+ $page['infos'],
+ sprintf(l10n('group "%s" updated'), $groupname)
+ );
+}
+
+// +-----------------------------------------------------------------------+
// | template init |
// +-----------------------------------------------------------------------+
@@ -139,7 +166,7 @@ $template->assign_vars(
// +-----------------------------------------------------------------------+
$query = '
-SELECT id, name
+SELECT id, name, is_default
FROM '.GROUPS_TABLE.'
ORDER BY id ASC
;';
@@ -149,6 +176,7 @@ $admin_url = PHPWG_ROOT_PATH.'admin.php?page=';
$perm_url = $admin_url.'group_perm&amp;group_id=';
$del_url = $admin_url.'group_list&amp;delete=';
$members_url = $admin_url.'user_list&amp;group=';
+$toggle_is_default_url = $admin_url.'group_list&amp;toggle_is_default=';
$num = 0;
while ($row = mysql_fetch_array($result))
@@ -165,10 +193,12 @@ SELECT COUNT(*)
array(
'CLASS' => ($num++ % 2 == 1) ? 'row2' : 'row1',
'NAME' => $row['name'],
+ 'IS_DEFAULT' => (get_boolean($row['is_default']) ? ' ['.l10n('is_default_group').']' : ''),
'MEMBERS' => sprintf(l10n('%d members'), $counter),
'U_MEMBERS' => $members_url.$row['id'],
'U_DELETE' => $del_url.$row['id'],
- 'U_PERM' => $perm_url.$row['id']
+ 'U_PERM' => $perm_url.$row['id'],
+ 'U_ISDEFAULT' => $toggle_is_default_url.$row['id']
)
);
}