Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2012-12-21 03:48:12 +0400
committerThomas Müller <thomas.mueller@tmit.eu>2012-12-21 03:48:12 +0400
commit7e78f8e15a536dc57b6fad959fce286b8fc5345c (patch)
treeeb73158aefef36c66cf5289787663f39b1600905 /settings/users.php
parent24e0a2a358c1febfe7b6fc46cb6e9f65df66fcdf (diff)
moving logic from template to the 'controller'
THX @VicDeo
Diffstat (limited to 'settings/users.php')
-rw-r--r--settings/users.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/settings/users.php b/settings/users.php
index ea740bfafc0..26d1026e8c8 100644
--- a/settings/users.php
+++ b/settings/users.php
@@ -29,11 +29,27 @@ if($isadmin) {
$subadmins = false;
}
+// load preset quotas
+$quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
+$quotaPreset=explode(',', $quotaPreset);
+foreach($quotaPreset as &$preset) {
+ $preset=trim($preset);
+}
+$quotaPreset=array_diff($quotaPreset, array('default', 'none'));
+
+$defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'none');
+$defaultQuotaIsUserDefined=array_search($default_quota, $quotaPreset)===false && array_search($default_quota, array('none', 'default'))===false;
+
+// load users and quota
foreach($accessibleusers as $i) {
+ $quota=OC_Preferences::getValue($i, 'files', 'quota', 'default');
+ $isQuotaUserDefined=array_search($quota, $quotaPreset)===false && array_search($quota, array('none', 'default'))===false;
+
$users[] = array(
"name" => $i,
"groups" => join( ", ", /*array_intersect(*/OC_Group::getUserGroups($i)/*, OC_SubAdmin::getSubAdminsGroups(OC_User::getUser()))*/),
- 'quota'=>OC_Preferences::getValue($i, 'files', 'quota', 'default'),
+ 'quota'=>$quota,
+ 'isQuotaUserDefined'=>$isQuotaUserDefined,
'subadmin'=>implode(', ', OC_SubAdmin::getSubAdminsGroups($i)));
}
@@ -41,21 +57,14 @@ foreach( $accessiblegroups as $i ) {
// Do some more work here soon
$groups[] = array( "name" => $i );
}
-$quotaPreset=OC_Appconfig::getValue('files', 'quota_preset', '1 GB, 5 GB, 10 GB');
-$quotaPreset=explode(',', $quotaPreset);
-foreach($quotaPreset as &$preset) {
- $preset=trim($preset);
-}
-$quotaPreset=array_diff($quotaPreset, array('default', 'none'));
-
-$defaultQuota=OC_Appconfig::getValue('files', 'default_quota', 'none');
$tmpl = new OC_Template( "settings", "users", "user" );
-$tmpl->assign( "users", $users );
-$tmpl->assign( "groups", $groups );
+$tmpl->assign( 'users', $users );
+$tmpl->assign( 'groups', $groups );
$tmpl->assign( 'isadmin', (int) $isadmin);
$tmpl->assign( 'subadmins', $subadmins);
$tmpl->assign( 'numofgroups', count($accessiblegroups));
$tmpl->assign( 'quota_preset', $quotaPreset);
$tmpl->assign( 'default_quota', $defaultQuota);
+$tmpl->assign( 'defaultQuotaIsUserDefined', $defaultQuotaIsUserDefined);
$tmpl->printPage();