moving logic from template to the 'controller'
THX @VicDeo
This commit is contained in:
parent
24e0a2a358
commit
7e78f8e15a
|
@ -50,7 +50,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
|
|||
</option>
|
||||
<?php endif;?>
|
||||
<?php endforeach;?>
|
||||
<?php if(array_search($_['default_quota'], $_['quota_preset'])===false && array_search($_['default_quota'], array('none', 'default'))===false):?>
|
||||
<?php if($_['defaultQuotaIsUserDefined']):?>
|
||||
<option selected="selected"
|
||||
value='<?php echo $_['default_quota'];?>'>
|
||||
<?php echo $_['default_quota'];?>
|
||||
|
@ -144,7 +144,7 @@ var isadmin = <?php echo $_['isadmin']?'true':'false'; ?>;
|
|||
<?php echo $preset;?>
|
||||
</option>
|
||||
<?php endforeach;?>
|
||||
<?php if(array_search($user['quota'], $_['quota_preset'])===false && array_search($user['quota'], array('none', 'default'))===false):?>
|
||||
<?php if($user['isQuotaUserDefined']):?>
|
||||
<option selected="selected" value='<?php echo $user['quota'];?>'>
|
||||
<?php echo $user['quota'];?>
|
||||
</option>
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue