From 602be73d0b4472580ce3c4de337945569e0f0005 Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Mon, 29 May 2017 16:14:21 +0000 Subject: [PATCH] =?UTF-8?q?N=C2=B0873=20Portal:=20Picture/Preferences/Pass?= =?UTF-8?q?word=20forms=20can=20now=20be=20disabled=20in=20the=20user=20pr?= =?UTF-8?q?ofile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit SVN:trunk[4752] --- .../entities/userprofilebrick.class.inc.php | 79 ++++++++++- .../bricks/user-profile/layout.html.twig | 130 +++++++++--------- .../itop-tickets/datamodel.itop-tickets.xml | 4 + 3 files changed, 147 insertions(+), 66 deletions(-) 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 %} -