diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/userprofilebrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/userprofilebrick.class.inc.php index bb8bf02064..b988aa7ee5 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/userprofilebrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/userprofilebrick.class.inc.php @@ -1,5 +1,5 @@ 'details', 'layout' => null ); + $this->bShowPictureForm = static::DEFAULT_SHOW_PICTURE_FORM; + $this->bShowPreferencesForm = static::DEFAULT_SHOW_PREFERENCES_FORM; + $this->bShowPasswordForm = static::DEFAULT_SHOW_PASSWORD_FORM; } /** @@ -72,6 +81,60 @@ class UserProfileBrick extends PortalBrick return $this; } + /** + * @return bool + */ + public function GetShowPictureForm() + { + return $this->bShowPictureForm; + } + + /** + * @param $bShowPictureForm + * @return \Combodo\iTop\Portal\Brick\UserProfileBrick + */ + public function SetShowPictureForm($bShowPictureForm) + { + $this->bShowPictureForm = $bShowPictureForm; + return $this; + } + + /** + * @return bool + */ + public function GetShowPreferencesForm() + { + return $this->bShowPreferencesForm; + } + + /** + * @param $bShowPreferencesForm + * @return \Combodo\iTop\Portal\Brick\UserProfileBrick + */ + public function SetShowPreferencesForm($bShowPreferencesForm) + { + $this->bShowPreferencesForm = $bShowPreferencesForm; + return $this; + } + + /** + * @return bool + */ + public function GetShowPasswordForm() + { + return $this->bShowPasswordForm; + } + + /** + * @param $bShowPasswordForm + * @return \Combodo\iTop\Portal\Brick\UserProfileBrick + */ + public function SetShowPasswordForm($bShowPasswordForm) + { + $this->bShowPasswordForm = $bShowPasswordForm; + return $this; + } + /** * Load the brick's data from the xml passed as a ModuleDesignElement. * This is used to set all the brick attributes at once. @@ -121,7 +184,7 @@ class UserProfileBrick extends PortalBrick } else { - throw new DOMFormatException('Field tag must have an id attribute', null, null, $oFormNode); + throw new DOMFormatException('Field tag must have an id attribute', null, null, $oFieldNode); } } } @@ -140,6 +203,16 @@ class UserProfileBrick extends PortalBrick ); } break; + + case 'show_picture_form': + case 'show_preferences_form': + case 'show_password_form': + $sConstName = 'DEFAULT_'.strtoupper($oBrickSubNode->nodeName); + $sSetterName = 'Set'.str_replace('_', '', ucwords($oBrickSubNode->nodeName, '_')); + + $bNodeValue = ($oBrickSubNode->GetText(constant('static::'.$sConstName)) === 'true') ? true : false; + $this->$sSetterName($bNodeValue); + break; } } @@ -147,5 +220,3 @@ class UserProfileBrick extends PortalBrick } } - -?> \ No newline at end of file diff --git a/datamodels/2.x/itop-portal-base/portal/src/views/bricks/user-profile/layout.html.twig b/datamodels/2.x/itop-portal-base/portal/src/views/bricks/user-profile/layout.html.twig index a456b82089..7d844c7d8c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/views/bricks/user-profile/layout.html.twig +++ b/datamodels/2.x/itop-portal-base/portal/src/views/bricks/user-profile/layout.html.twig @@ -44,85 +44,91 @@
- {% block pUserProfilePictureFormContainer %} -
-
-

{{ 'Brick:Portal:UserProfile:Photo:Title'|dict_s }}

-
-
-
- - - + {% if oBrick.GetShowPictureForm() %} + {% block pUserProfilePictureFormContainer %} + -
- {% endblock %} - - {% block pUserProfilePreferencesFormContainer %} -
-
-

{{ 'Class:appUserPreferences/Attribute:preferences'|dict_s }}

-
-
-
+
-
- {{ oPreferencesForm.renderer.GetBaseLayout()|raw }} -
- +
+ + +
+ + + + + + + + + {# + #} + +
+
+
-
- {% endblock %} + {% endblock %} + {% endif %} - {% block pUserProfilePasswordFormContainer %} -
-
-

{{ 'Brick:Portal:UserProfile:Password:Title'|dict_s }}

-
-
- {% if oPasswordForm is not null %} -
+ {% if oBrick.GetShowPreferencesForm() %} + {% block pUserProfilePreferencesFormContainer %} +
+
+

{{ 'Class:appUserPreferences/Attribute:preferences'|dict_s }}

+
+
+
- {{ oPasswordForm.renderer.GetBaseLayout()|raw }} + {{ oPreferencesForm.renderer.GetBaseLayout()|raw }}
- {% else %} - {{ 'Brick:Portal:UserProfile:Password:CantChangeContactAdministrator'|dict_s }} - {% endif %} +
-
- {% endblock %} + {% endblock %} + {% endif %} + + {% if oBrick.GetShowPasswordForm() %} + {% block pUserProfilePasswordFormContainer %} +
+
+

{{ 'Brick:Portal:UserProfile:Password:Title'|dict_s }}

+
+
+ {% if oPasswordForm is not null %} +
+
+ + + +
+
+ {{ oPasswordForm.renderer.GetBaseLayout()|raw }} +
+
+ {% else %} + {{ 'Brick:Portal:UserProfile:Password:CantChangeContactAdministrator'|dict_s }} + {% endif %} +
+
+ {% endblock %} + {% endif %}
diff --git a/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml b/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml index 46f9daf6e3..39fda9e03a 100755 --- a/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml +++ b/datamodels/2.x/itop-tickets/datamodel.itop-tickets.xml @@ -1013,6 +1013,10 @@ fa fa-user fa-2x + + + +