|
|
@@ -37,6 +37,9 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
+ if(($aUnavailableTo = $oForm->getCleanValue('UnavailableTo')) && is_array($aUnavailableTo))
|
|
|
+ BxDolForm::setSubmittedValue('UnavailableTo', implode(',', $aUnavailableTo), $oForm->aFormAttrs['method']);
|
|
|
+
|
|
|
$mixedIcon = '';
|
|
|
if(!empty($_FILES['Icon_image']['tmp_name'])) {
|
|
|
$oStorage = BxDolStorage::getObjectInstance(BX_DOL_STORAGE_OBJ_IMAGES);
|
|
|
@@ -71,16 +74,16 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
|
|
|
$iActionsFrom = (int)$oForm->getCleanValue('Actions');
|
|
|
if($iActionsFrom > 0) {
|
|
|
- $aActions = array();
|
|
|
- $this->oDb->getActions(array('type' => 'by_level_id', 'value' => $iActionsFrom), $aActions, false);
|
|
|
- foreach($aActions as $aAction)
|
|
|
- $this->oDb->switchAction($iId, $aAction['id'], true, array(
|
|
|
- 'AllowedCount' => $aAction['allowed_count'],
|
|
|
- 'AllowedPeriodLen' => $aAction['allowed_period_len'],
|
|
|
- 'AllowedPeriodStart' => $aAction['allowed_period_start'],
|
|
|
- 'AllowedPeriodEnd' => $aAction['allowed_period_end'],
|
|
|
- 'AdditionalParamValue' => $aAction['additional_param_value']
|
|
|
- ));
|
|
|
+ $aActions = array();
|
|
|
+ $this->oDb->getActions(array('type' => 'by_level_id', 'value' => $iActionsFrom), $aActions, false);
|
|
|
+ foreach($aActions as $aAction)
|
|
|
+ $this->oDb->switchAction($iId, $aAction['id'], true, array(
|
|
|
+ 'AllowedCount' => $aAction['allowed_count'],
|
|
|
+ 'AllowedPeriodLen' => $aAction['allowed_period_len'],
|
|
|
+ 'AllowedPeriodStart' => $aAction['allowed_period_start'],
|
|
|
+ 'AllowedPeriodEnd' => $aAction['allowed_period_end'],
|
|
|
+ 'AdditionalParamValue' => $aAction['additional_param_value']
|
|
|
+ ));
|
|
|
}
|
|
|
|
|
|
// create system event
|
|
|
@@ -133,6 +136,9 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
$oForm->initChecker();
|
|
|
|
|
|
if($oForm->isSubmittedAndValid()) {
|
|
|
+ if(($aUnavailableTo = $oForm->getCleanValue('UnavailableTo')) && is_array($aUnavailableTo))
|
|
|
+ BxDolForm::setSubmittedValue('UnavailableTo', implode(',', $aUnavailableTo), $oForm->aFormAttrs['method']);
|
|
|
+
|
|
|
$bIconImageCur = is_numeric($aLevel['icon']) && (int)$aLevel['icon'] != 0;
|
|
|
$bIconImageNew = !empty($_FILES['Icon_image']['tmp_name']);
|
|
|
|
|
|
@@ -321,7 +327,7 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
|
|
|
protected function _getFormObject($sAction, $aLevel = array())
|
|
|
{
|
|
|
- bx_import('BxTemplStudioFormView');
|
|
|
+ bx_import('BxTemplStudioFormView');
|
|
|
|
|
|
$aForm = array(
|
|
|
'form_attrs' => array(
|
|
|
@@ -394,11 +400,21 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
'caption' => _t('_adm_prm_txt_level_description'),
|
|
|
'info' => _t('_adm_prm_dsc_level_description'),
|
|
|
'value' => isset($aLevel['description']) ? $aLevel['description'] : '_adm_prm_txt_level',
|
|
|
- 'code' => 1,
|
|
|
+ 'code' => 1,
|
|
|
'db' => array (
|
|
|
'pass' => 'XssHtml',
|
|
|
)
|
|
|
),
|
|
|
+ 'UnavailableTo' => array(
|
|
|
+ 'type' => 'checkbox_set',
|
|
|
+ 'name' => 'UnavailableTo',
|
|
|
+ 'caption' => _t('_adm_prm_txt_level_unavailable_to'),
|
|
|
+ 'info' => _t('_adm_prm_dsc_level_unavailable_to'),
|
|
|
+ 'value' => isset($aLevel['unavailable_to']) ? explode(',', $aLevel['unavailable_to']) : [],
|
|
|
+ 'db' => array (
|
|
|
+ 'pass' => 'Xss',
|
|
|
+ )
|
|
|
+ ),
|
|
|
'QuotaSize' => array(
|
|
|
'type' => 'text',
|
|
|
'name' => 'QuotaSize',
|
|
|
@@ -486,7 +502,7 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
'info' => _t('_adm_prm_dsc_level_icon'),
|
|
|
'value' => '',
|
|
|
'required' => '0',
|
|
|
- 'code' => 1,
|
|
|
+ 'code' => 1,
|
|
|
'db' => array (
|
|
|
'pass' => 'Xss',
|
|
|
),
|
|
|
@@ -495,7 +511,7 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
'params' => array(),
|
|
|
'error' => _t('_adm_prm_err_level_icon'),
|
|
|
),
|
|
|
- 'attrs' => array('class' => 'bx-form-input-textarea-small'),
|
|
|
+ 'attrs' => array('class' => 'bx-form-input-textarea-small'),
|
|
|
),
|
|
|
'Icon_image' => array(
|
|
|
'type' => 'file',
|
|
|
@@ -520,8 +536,8 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
'name' => 'Actions',
|
|
|
'caption' => _t('_adm_prm_txt_level_actions_copy'),
|
|
|
'values' => array(
|
|
|
- array('key' => 0, 'value' => _t('_sys_txt_empty'))
|
|
|
- ),
|
|
|
+ array('key' => 0, 'value' => _t('_sys_txt_empty'))
|
|
|
+ ),
|
|
|
),
|
|
|
'controls' => array(
|
|
|
'name' => 'controls',
|
|
|
@@ -547,7 +563,12 @@ class BxBaseStudioPermissionsLevels extends BxDolStudioPermissionsLevels
|
|
|
$aLevels = array();
|
|
|
$this->oDb->getLevels(array('type' => 'all_pair'), $aLevels, false);
|
|
|
foreach($aLevels as $iId => $sName)
|
|
|
- $aForm['inputs']['Actions']['values'][] = array('key' => $iId, 'value' => _t($sName));
|
|
|
+ $aForm['inputs']['Actions']['values'][] = array('key' => $iId, 'value' => _t($sName));
|
|
|
+
|
|
|
+ $aModules = bx_srv('system', 'GetModulesByType', ['profile']);
|
|
|
+ foreach($aModules as $aModule)
|
|
|
+ $aForm['inputs']['UnavailableTo']['values'][] = array('key' => '|' . $aModule['name'] . '|', 'value' => BxDolStudioUtils::getModuleTitle($aModule['name']));
|
|
|
+
|
|
|
|
|
|
switch($sAction) {
|
|
|
case 'add':
|