00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00040 class DerivedExplicitReadWritePermissionsUserConfigElement extends ExplicitReadWriteModelPermissionsElement
00041 {
00042 protected function assertModelIsValid()
00043 {
00044 assert('$this->model instanceof UserConfigurationForm');
00045 assert('$this->model->user instanceof User');
00046 }
00047
00048 protected static function getPermissionTypes()
00049 {
00050 return array(
00051 UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER =>
00052 Zurmo::t('ZurmoModule', 'Owner'),
00053 UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_OWNER_AND_USERS_IN_GROUP =>
00054 Zurmo::t('ZurmoModule', 'Owner and users in'),
00055 UserConfigurationForm::DEFAULT_PERMISSIONS_SETTING_EVERYONE =>
00056 GroupsModule::resolveEveryoneDisplayLabel());
00057 }
00058
00059 protected function renderControlNonEditable()
00060 {
00061 throw new NotSupportedException();
00062 }
00063
00069 protected function resolveSelectedGroup()
00070 {
00071 return UserConfigurationFormAdapter::resolveAndGetValue($this->model->user, 'defaultPermissionGroupSetting', false);
00072 }
00073
00079 protected function resolveSelectedType()
00080 {
00081 return UserConfigurationFormAdapter::resolveAndGetDefaultPermissionSetting($this->model->user);
00082 }
00083
00084 protected function getAttributeName()
00085 {
00086 return 'defaultPermissionSetting';
00087 }
00088
00089 protected function getSelectableAttributeName()
00090 {
00091 return 'defaultPermissionGroupSetting';
00092 }
00093
00094 protected function resolveAttributeNameAndRelatedAttributes()
00095 {
00096 return array($this->getAttributeName(), null);
00097 }
00098
00099 protected function resolveSelectableAttributeNameAndRelatedAttributes()
00100 {
00101 return array($this->getSelectableAttributeName(), null);
00102 }
00103
00104 protected function renderLabel()
00105 {
00106 if ($this->model === null)
00107 {
00108 throw new NotImplementedException();
00109 }
00110 return ZurmoHtml::label(Zurmo::t('ZurmoModule', 'Who can read and write - Default'), false);
00111 }
00112 }
00113 ?>