From 00d0d383f850905f59ea43f1eb37d7d9acaaebcd Mon Sep 17 00:00:00 2001 From: Guillaume Lajarige Date: Fri, 29 Jun 2018 16:05:11 +0000 Subject: [PATCH] Code cleanup: Warning suppression & PHPDoc. SVN:trunk[5927] --- .../nl.dict.itop-portal-base.php | 1 - ...aggregatepagebrickcontroller.class.inc.php | 3 +- .../browsebrickcontroller.class.inc.php | 154 +++--- .../createbrickcontroller.class.inc.php | 16 +- .../defaultcontroller.class.inc.php | 10 +- .../managebrickcontroller.class.inc.php | 138 ++--- .../objectcontroller.class.inc.php | 491 +++++++----------- .../userprofilebrickcontroller.class.inc.php | 42 +- .../src/entities/abstractbrick.class.inc.php | 47 +- .../entities/aggregatepagebrick.class.inc.php | 5 +- .../src/entities/browsebrick.class.inc.php | 51 +- .../src/entities/createbrick.class.inc.php | 34 +- .../src/entities/filterbrick.class.inc.php | 27 +- .../src/entities/managebrick.class.inc.php | 62 ++- .../src/entities/portalbrick.class.inc.php | 71 ++- .../entities/userprofilebrick.class.inc.php | 2 +- .../src/forms/objectformmanager.class.inc.php | 142 +++-- .../forms/passwordformmanager.class.inc.php | 47 +- .../preferencesformmanager.class.inc.php | 48 +- .../helpers/applicationhelper.class.inc.php | 62 +-- .../contextmanipulatorhelper.class.inc.php | 108 ++-- .../lifecyclevalidatorhelper.class.inc.php | 50 +- .../scopevalidatorhelper.class.inc.php | 177 ++----- .../src/helpers/securityhelper.class.inc.php | 28 +- .../helpers/urlgeneratorhelper.class.inc.php | 22 +- .../src/routers/abstractrouter.class.inc.php | 4 +- .../object/mode_search_regular.html.twig | 2 +- sources/form/field/field.class.inc.php | 2 +- sources/form/field/selectfield.class.inc.php | 5 + sources/form/form.class.inc.php | 37 +- sources/form/formmanager.class.inc.php | 6 +- .../validator/integervalidator.class.inc.php | 4 +- .../mandatoryvalidator.class.inc.php | 4 +- .../notemptyextkeyvalidator.class.inc.php | 4 +- .../form/validator/validator.class.inc.php | 11 +- 35 files changed, 987 insertions(+), 930 deletions(-) diff --git a/datamodels/2.x/itop-portal-base/nl.dict.itop-portal-base.php b/datamodels/2.x/itop-portal-base/nl.dict.itop-portal-base.php index 6ca89a6ec..8c7bf512b 100644 --- a/datamodels/2.x/itop-portal-base/nl.dict.itop-portal-base.php +++ b/datamodels/2.x/itop-portal-base/nl.dict.itop-portal-base.php @@ -126,4 +126,3 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array( Dict::Add('NL NL', 'Dutch', 'Nederlands', array( 'Brick:Portal:Create:Name' => 'Snel aanmaken', )); -?> diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/aggregatepagebrickcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/aggregatepagebrickcontroller.class.inc.php index 128d3d536..7a5b691be 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/aggregatepagebrickcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/aggregatepagebrickcontroller.class.inc.php @@ -31,7 +31,8 @@ class AggregatePageBrickController * @param \Silex\Application $oApp * @param string $sBrickId * - * @return response + * @return \Symfony\Component\HttpFoundation\Response + * * @throws \Exception */ public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId) diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/browsebrickcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/browsebrickcontroller.class.inc.php index 37a8cb920..5d1b54585 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/browsebrickcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/browsebrickcontroller.class.inc.php @@ -40,7 +40,19 @@ class BrowseBrickController extends BrickController const LEVEL_SEPARATOR = '-'; public static $aOptionalAttributes = array('tooltip_att', 'description_att', 'image_att'); - public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId, $sBrowseMode = null, $sDataLoading = null) + /** + * @param \Symfony\Component\HttpFoundation\Request $oRequest + * @param \Silex\Application $oApp + * @param string $sBrickId + * @param string $sBrowseMode + * @param string $sDataLoading + * + * @return \Symfony\Component\HttpFoundation\Response + * + * @throws \Exception + * @throws \CoreException + */ + public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId, $sBrowseMode = null, $sDataLoading = null) { /** @var \Combodo\iTop\Portal\Brick\BrowseBrick $oBrick */ $oBrick = ApplicationHelper::GetLoadedBrickFromId($oApp, $sBrickId); @@ -113,7 +125,7 @@ class BrowseBrickController extends BrickController { // - Cleaning the search value by exploding and trimming spaces $aSearchValues = explode(' ', $sSearchValue); - array_walk($aSearchValues, function(&$sSearchValue, $sKey) + array_walk($aSearchValues, function(&$sSearchValue /*, $sKey*/) { trim($sSearchValue); }); @@ -385,17 +397,21 @@ class BrowseBrickController extends BrickController return $oResponse; } - /** - * Flattens the $aLevels into $aLevelsProperties in order to be able to build an OQL query from multiple single queries related to each others. - * As of now it only keeps search / parent_att / name_att properties. - * - * Note : This is not in the BrowseBrick class because the classes should not rely on DBObjectSearch. - * - * @param \Silex\Application $oApp - * @param array $aLevels Levels from a BrowseBrick class - * @param array $aLevelsProperties Reference to an array that will contain the flattened levels - * @param string $sLevelAliasPrefix String that will be prefixed to the level ID as an unique path identifier - */ + /** + * Flattens the $aLevels into $aLevelsProperties in order to be able to build an OQL query from multiple single queries related to each others. + * As of now it only keeps search / parent_att / name_att properties. + * + * Note : This is not in the BrowseBrick class because the classes should not rely on DBObjectSearch. + * + * @param \Silex\Application $oApp + * @param array $aLevels Levels from a BrowseBrick class + * @param array $aLevelsProperties Reference to an array that will contain the flattened levels + * @param string $sLevelAliasPrefix String that will be prefixed to the level ID as an unique path identifier + * + * @throws \Exception + * @throws \OQLException + * @throws \CoreException + */ public static function TreeToFlatLevelsProperties(Application $oApp, array $aLevels, array &$aLevelsProperties, $sLevelAliasPrefix = 'L') { foreach ($aLevels as $aLevel) @@ -586,28 +602,32 @@ class BrowseBrickController extends BrickController return $aActionRules; } - /** - * Takes $aCurrentRow as a flat array and transform it in another flat array (not objects) with only the necessary informations - * - * eg: - * - $aCurrentRow : array('L-1' => ObjectClass1, 'L-1-1' => ObjectClass2, 'L-1-1-1' => ObjectClass3) - * - $aRow will be : array( - * 'L1' => array( - * 'name' => 'Object class 1 name' - * ), - * 'L1-1' => array( - * 'name' => 'Object class 2 name', - * ), - * 'L1-1-1' => array( - * 'name' => 'Object class 3 name', - * ), - * ... - * ) - * - * @param array $aCurrentRow - * @param array $aLevelsProperties - * @return array - */ + /** + * Takes $aCurrentRow as a flat array and transform it in another flat array (not objects) with only the necessary informations + * + * eg: + * - $aCurrentRow : array('L-1' => ObjectClass1, 'L-1-1' => ObjectClass2, 'L-1-1-1' => ObjectClass3) + * - $aRow will be : array( + * 'L1' => array( + * 'name' => 'Object class 1 name' + * ), + * 'L1-1' => array( + * 'name' => 'Object class 2 name', + * ), + * 'L1-1-1' => array( + * 'name' => 'Object class 3 name', + * ), + * ... + * ) + * + * @param array $aCurrentRow + * @param array $aLevelsProperties + * @param \Silex\Application $oApp + * + * @return array + * + * @throws \Exception + */ public static function AddToFlatItems(array $aCurrentRow, array &$aLevelsProperties, Application $oApp) { $aRow = array(); @@ -663,36 +683,40 @@ class BrowseBrickController extends BrickController return $aRow; } - /** - * Takes $aCurrentRow as a flat array to recursvily convert and insert it into a tree array $aItems. - * This is used to build a tree array from a DBObjectSet retrieved with FetchAssoc(). - * - * eg: - * - $aCurrentRow : array('L-1' => ObjectClass1, 'L-1-1' => ObjectClass2, 'L-1-1-1' => ObjectClass3) - * - $aItems will be : array( - * 'L1' => - * 'name' => 'Object class 1 name', - * 'subitems' => array( - * 'L1-1' => array( - * 'name' => 'Object class 2 name', - * 'subitems' => array( - * 'L1-1-1' => array( - * 'name' => 'Object class 3 name', - * 'subitems' => array() - * ), - * ... - * ) - * ), - * ... - * ) - * ), - * ... - * ) - * - * @param array &$aItems Reference to the array to be built - * @param array $aCurrentRow - * @param array $aLevelsProperties - */ + /** + * Takes $aCurrentRow as a flat array to recursvily convert and insert it into a tree array $aItems. + * This is used to build a tree array from a DBObjectSet retrieved with FetchAssoc(). + * + * eg: + * - $aCurrentRow : array('L-1' => ObjectClass1, 'L-1-1' => ObjectClass2, 'L-1-1-1' => ObjectClass3) + * - $aItems will be : array( + * 'L1' => + * 'name' => 'Object class 1 name', + * 'subitems' => array( + * 'L1-1' => array( + * 'name' => 'Object class 2 name', + * 'subitems' => array( + * 'L1-1-1' => array( + * 'name' => 'Object class 3 name', + * 'subitems' => array() + * ), + * ... + * ) + * ), + * ... + * ) + * ), + * ... + * ) + * + * @param array &$aItems Reference to the array to be built + * @param array $aCurrentRow + * @param array $aLevelsProperties + * @param array|null $aCurrentRowObjects + * @param \Silex\Application|null $oApp + * + * @throws \Exception + */ public static function AddToTreeItems(array &$aItems, array $aCurrentRow, array &$aLevelsProperties, $aCurrentRowObjects = null, Application $oApp = null) { $aCurrentRowKeys = array_keys($aCurrentRow); diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/createbrickcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/createbrickcontroller.class.inc.php index 8425a3738..19f732daf 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/createbrickcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/createbrickcontroller.class.inc.php @@ -1,6 +1,6 @@ GetClass(); diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/defaultcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/defaultcontroller.class.inc.php index 70477005e..c805424cb 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/defaultcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/defaultcontroller.class.inc.php @@ -21,18 +21,22 @@ namespace Combodo\iTop\Portal\Controller; use Silex\Application; use Symfony\Component\HttpFoundation\Request; -use Combodo\iTop\Portal\Brick\PortalBrick; class DefaultController { - + /** + * @param \Symfony\Component\HttpFoundation\Request $oRequest + * @param \Silex\Application $oApp + * + * @return \Symfony\Component\HttpFoundation\Response + */ public function homeAction(Request $oRequest, Application $oApp) { $aData = array(); // Rendering tiles $aData['aTilesRendering'] = array(); - /** @var PortalBrick $oBrick */ + /** @var \Combodo\iTop\Portal\Brick\PortalBrick $oBrick */ foreach($oApp['combodo.portal.instance.conf']['bricks'] as $oBrick) { // Doing it only for tile visible on home page to avoid unnecessary rendering diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/managebrickcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/managebrickcontroller.class.inc.php index ba8437cf0..7d6de768f 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/managebrickcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/managebrickcontroller.class.inc.php @@ -42,6 +42,7 @@ use JSButtonItem; use MetaModel; use Silex\Application; use Symfony\Component\HttpFoundation\Request; +use Symfony\Component\HttpFoundation\Response; use UnaryExpression; use URLButtonItem; use VariableExpression; @@ -50,21 +51,22 @@ class ManageBrickController extends BrickController { const EXCEL_EXPORT_TEMPLATE_PATH = 'itop-portal-base/portal/src/views/bricks/manage/popup-export-excel.html.twig'; - /** - * @param \Symfony\Component\HttpFoundation\Request $oRequest - * @param \Silex\Application $oApp - * @param string $sBrickId - * @param string $sDisplayMode - * @param string $sGroupingTab - * @param string $sDataLoading - * - * @return \Symfony\Component\HttpFoundation\Response - * @throws \CoreException - * @throws \DictExceptionMissingString - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \OQLException - */ + /** + * @param Request $oRequest + * @param Application $oApp + * @param string $sBrickId + * @param string $sGroupingTab + * @param string $sDisplayMode + * @param string $sDataLoading + * + * @return Response + * + * @throws \Exception + * @throws \CoreException + * @throws \DictExceptionMissingString + * @throws \MySQLException + * @throws \OQLException + */ public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId, $sGroupingTab, $sDisplayMode = null, $sDataLoading = null) { /** @var ManageBrick $oBrick */ @@ -96,15 +98,17 @@ class ManageBrickController extends BrickController return $oResponse; } - /** - * Method for the brick's tile on home page - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sBrickId - * - * @return Response - */ + /** + * Method for the brick's tile on home page + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sBrickId + * + * @return Response + * + * @throws Exception + */ public function TileAction(Request $oRequest, Application $oApp, $sBrickId) { /** @var ManageBrick $oBrick */ @@ -123,19 +127,20 @@ class ManageBrickController extends BrickController return $oApp['twig']->render($oBrick->GetTileTemplatePath(), $aData); } - /** - * @param Request $oRequest - * @param Application $oApp - * @param string $sBrickId - * @param string $sGroupingTab - * @param string $sGroupingArea - * - * @throws \DictExceptionMissingString - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \OQLException - * @throws \Exception - */ + /** + * @param Request $oRequest + * @param Application $oApp + * @param string $sBrickId + * @param string $sGroupingTab + * @param string $sGroupingArea + * + * @return Response + * + * @throws Exception + * @throws \DictExceptionMissingString + * @throws \MySQLException + * @throws \OQLException + */ public function ExcelExportStartAction( Request $oRequest, Application $oApp, $sBrickId, $sGroupingTab, $sGroupingArea ) { @@ -156,7 +161,7 @@ class ManageBrickController extends BrickController { $oQuery = DBSearch::FromOQL($oBrick->GetOql()); $sClass = $oQuery->GetClass(); - /** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeHelper */ + /** @var ScopeValidatorHelper $oScopeHelper */ $oScopeHelper = $oApp['scope_validator']; $oScopeHelper->AddScopeToQuery($oQuery, $sClass); $aData = array(); @@ -229,21 +234,21 @@ class ManageBrickController extends BrickController } - /** - * @param Request $oRequest - * @param Application $oApp - * @param string $sBrickId - * @param string $sGroupingTab - * @param bool $bNeedDetails - * - * @return array - * @throws \CoreException - * @throws \DictExceptionMissingString - * @throws \Exception - * @throws \MissingQueryArgument - * @throws \MySQLException - * @throws \OQLException - */ + /** + * @param Request $oRequest + * @param Application $oApp + * @param string $sBrickId + * @param string $sGroupingTab + * @param bool $bNeedDetails + * + * @return array + * + * @throws \Exception + * @throws \CoreException + * @throws \DictExceptionMissingString + * @throws \MySQLException + * @throws \OQLException + */ public function GetData(Request $oRequest, Application $oApp, $sBrickId, $sGroupingTab, $bNeedDetails = false) { /** @var ManageBrick $oBrick */ @@ -614,7 +619,8 @@ class ManageBrickController extends BrickController // ... Checking menu extensions $aItemButtons = array(); - foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) + /** @var iPopupMenuExtension $oExtensionInstance */ + foreach (MetaModel::EnumPlugins('iPopupMenuExtension') as $oExtensionInstance) { foreach ($oExtensionInstance->EnumItems(iPopupMenuExtension::PORTAL_OBJLISTITEM_ACTIONS, array( 'portal_id' => $oApp['combodo.portal.instance.id'], @@ -741,8 +747,10 @@ class ManageBrickController extends BrickController * @param array $aData * @param DBSearch $oQuery * @param string $sClass + * @param array $aColumnsAttrs * - * @throws Exception + * @throws \Exception + * @throws \CoreException */ protected function ManageSearchValue(Request $oRequest, &$aData, DBSearch &$oQuery, $sClass, $aColumnsAttrs) { @@ -915,18 +923,20 @@ class ManageBrickController extends BrickController return $aGroupingTabsValues; } - /** - * @param Application $oApp - * @param ManageBrick $oBrick - * @param string $sClass - * - * @return DBSearch - * @throws \OQLException - */ + /** + * @param Application $oApp + * @param ManageBrick $oBrick + * @param string $sClass + * + * @return DBSearch + * + * @throws \CoreException + * @throws \OQLException + */ protected function GetScopedQuery(Application $oApp, ManageBrick $oBrick, $sClass) { $oQuery = DBSearch::FromOQL($oBrick->GetOql()); - /** @var \Combodo\iTop\Portal\Helper\ScopeValidatorHelper $oScopeHelper */ + /** @var ScopeValidatorHelper $oScopeHelper */ $oScopeHelper = $oApp['scope_validator']; $oScopeHelper->AddScopeToQuery($oQuery, $sClass); diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php index 51064b543..e80891d5f 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/objectcontroller.class.inc.php @@ -63,15 +63,21 @@ class ObjectController extends AbstractController const ENUM_MODE_CREATE = 'create'; const DEFAULT_LIST_LENGTH = 10; - /** - * Displays an cmdbAbstractObject if the connected user is allowed to. - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sObjectClass (Class must be instance of cmdbAbstractObject) - * @param string $sObjectId - * @return Response - */ + /** + * Displays an cmdbAbstractObject if the connected user is allowed to. + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sObjectClass (Class must be instance of cmdbAbstractObject) + * @param string $sObjectId + * + * @return Response + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \DictExceptionMissingString + */ public function ViewAction(Request $oRequest, Application $oApp, $sObjectClass, $sObjectId) { // Checking parameters @@ -145,6 +151,19 @@ class ObjectController extends AbstractController return $oResponse; } + /** + * @param Request $oRequest + * @param Application $oApp + * @param $sObjectClass + * @param $sObjectId + * + * @return Response + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \DictExceptionMissingString + */ public function EditAction(Request $oRequest, Application $oApp, $sObjectClass, $sObjectId) { // Checking parameters @@ -208,14 +227,19 @@ class ObjectController extends AbstractController return $oResponse; } - /** - * Creates an cmdbAbstractObject of the $sObjectClass - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sObjectClass - * @return Response - */ + /** + * Creates an cmdbAbstractObject of the $sObjectClass + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sObjectClass + * + * @return Response + * + * @throws \Exception + * @throws \CoreException + * @throws \DictExceptionMissingString + */ public function CreateAction(Request $oRequest, Application $oApp, $sObjectClass) { // Checking security layers @@ -261,17 +285,22 @@ class ObjectController extends AbstractController return $oResponse; } - /** - * Creates an cmdbAbstractObject of a class determined by the method encoded in $sEncodedMethodName. - * This method use an origin DBObject in order to determine the created cmdbAbstractObject. - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sObjectClass Class of the origin object - * @param string $sObjectId ID of the origin object - * @param string $sEncodedMethodName Base64 encoded factory method name - * @return Response - */ + /** + * Creates an cmdbAbstractObject of a class determined by the method encoded in $sEncodedMethodName. + * This method use an origin DBObject in order to determine the created cmdbAbstractObject. + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sObjectClass Class of the origin object + * @param string $sObjectId ID of the origin object + * @param string $sEncodedMethodName Base64 encoded factory method name + * + * @return Response + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + */ public function CreateFromFactoryAction(Request $oRequest, Application $oApp, $sObjectClass, $sObjectId, $sEncodedMethodName) { $sMethodName = base64_decode($sEncodedMethodName); @@ -312,16 +341,21 @@ class ObjectController extends AbstractController return $oApp->handle($oSubRequest, HttpKernelInterface::SUB_REQUEST, true); } - /** - * Applies a stimulus $sStimulus on an cmdbAbstractObject - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sObjectClass - * @param string $sObjectId - * @param string $sStimulusCode - * @return Response - */ + /** + * Applies a stimulus $sStimulus on an cmdbAbstractObject + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sObjectClass + * @param string $sObjectId + * @param string $sStimulusCode + * + * @return Response + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + */ public function ApplyStimulusAction(Request $oRequest, Application $oApp, $sObjectClass, $sObjectId, $sStimulusCode) { // Checking parameters @@ -426,6 +460,24 @@ class ObjectController extends AbstractController return $oResponse; } + /** + * @param Request $oRequest + * @param Application $oApp + * @param $sMode + * @param $sObjectClass + * @param null $sObjectId + * @param null $aFormProperties + * + * @return array + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \OQLException + * @throws \Twig_Error_Loader + * @throws \Twig_Error_Runtime + * @throws \Twig_Error_Syntax + */ public static function HandleForm(Request $oRequest, Application $oApp, $sMode, $sObjectClass, $sObjectId = null, $aFormProperties = null) { $aFormData = array(); @@ -662,16 +714,22 @@ class ObjectController extends AbstractController return $aFormData; } - /** - * Handles the autocomplete search - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sTargetAttCode Attribute code of the host object pointing to the Object class to search - * @param string $sHostObjectClass Class name of the host object - * @param string $sHostObjectId Id of the host object - * @return Response - */ + /** + * Handles the autocomplete search + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sTargetAttCode Attribute code of the host object pointing to the Object class to search + * @param string $sHostObjectClass Class name of the host object + * @param string $sHostObjectId Id of the host object + * + * @return Response + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \OQLException + */ public function SearchAutocompleteAction(Request $oRequest, Application $oApp, $sTargetAttCode, $sHostObjectClass, $sHostObjectId = null) { $aData = array( @@ -820,16 +878,23 @@ class ObjectController extends AbstractController return $oResponse; } - /** - * Handles the regular (table) search from an attribute - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sTargetAttCode Attribute code of the host object pointing to the Object class to search - * @param string $sHostObjectClass Class name of the host object - * @param string $sHostObjectId Id of the host object - * @return Response - */ + /** + * Handles the regular (table) search from an attribute + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sTargetAttCode Attribute code of the host object pointing to the Object class to search + * @param string $sHostObjectClass Class name of the host object + * @param string $sHostObjectId Id of the host object + * + * @return Response + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \DictExceptionMissingString + * @throws \OQLException + */ public function SearchFromAttributeAction(Request $oRequest, Application $oApp, $sTargetAttCode, $sHostObjectClass, $sHostObjectId = null) { $aData = array( @@ -1112,226 +1177,21 @@ class ObjectController extends AbstractController return $oResponse; } - /** - * Handles the hierarchical search from an attribute - * - * @param Request $oRequest - * @param Application $oApp - * @param string $sTargetAttCode Attribute code of the host object pointing to the Object class to search - * @param string $sHostObjectClass Class name of the host object - * @param string $sHostObjectId Id of the host object - * @return Response - */ + /** + * Handles the hierarchical search from an attribute + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sTargetAttCode Attribute code of the host object pointing to the Object class to search + * @param string $sHostObjectClass Class name of the host object + * @param string $sHostObjectId Id of the host object + * + * @return void + * + */ public function SearchHierarchyAction(Request $oRequest, Application $oApp, $sTargetAttCode, $sHostObjectClass, $sHostObjectId = null) { - $aData = array( - 'sMode' => 'search_hierarchy', - 'sTargetAttCode' => $sTargetAttCode, - 'sHostObjectClass' => $sHostObjectClass, - 'sHostObjectId' => $sHostObjectId - ); - - // Checking security layers - if (!SecurityHelper::IsActionAllowed($oApp, UR_ACTION_READ, $sHostObjectClass, $sHostObjectId)) - { - IssueLog::Warning(__METHOD__ . ' at line ' . __LINE__ . ' : User #' . UserRights::GetUserId() . ' not allowed to read ' . $sHostObjectClass . '::' . $sHostObjectId . ' object.'); - $oApp->abort(404, Dict::S('UI:ObjectDoesNotExist')); - } - - // Retrieving host object for future DBSearch parameters - if ($sHostObjectId !== null) - { - // Note : AllowAllData set to true here instead of checking scope's flag because we are displaying a value that has been set and validated - $oHostObject = MetaModel::GetObject($sHostObjectClass, $sHostObjectId, true, true); - } - else - { - $oHostObject = MetaModel::NewObject($sHostObjectClass); - } - - // Retrieving request parameters - $bInitalPass = ($oRequest->get('draw') === null) ? true : false; - $sQuery = $oRequest->get('sSearchValue'); // Note : Not used yet - $sFormPath = $oRequest->get('sFormPath'); - $sFieldId = $oRequest->get('sFieldId'); - - // Building search query - // - Retrieving target object class from attcode - $oTargetAttDef = MetaModel::GetAttributeDef($sHostObjectClass, $sTargetAttCode); - if ($oTargetAttDef->IsExternalKey()) - { - $sTargetObjectClass = $oTargetAttDef->GetTargetClass(); - } - elseif ($oTargetAttDef->IsLinkSet()) - { - if (!$oTargetAttDef->IsIndirect()) - { - $sTargetObjectClass = $oTargetAttDef->GetLinkedClass(); - } - else - { - $oRemoteAttDef = MetaModel::GetAttributeDef($oTargetAttDef->GetLinkedClass(), $oTargetAttDef->GetExtKeyToRemote()); - $sTargetObjectClass = $oRemoteAttDef->GetTargetClass(); - } - } - else - { - throw new Exception('Search by hierarchy can only apply on AttributeExternalKey or AttributeLinkedSet objects, ' . get_class($oTargetAttDef) . ' given.'); - } - -// // - Retrieving class attribute list -// $aAttCodes = MetaModel::FlattenZList(MetaModel::GetZListItems($sTargetObjectClass, 'list')); -// // - Adding friendlyname attribute to the list is not already in it -// $sTitleAttrCode = 'friendlyname'; -// if (($sTitleAttrCode !== null) && !in_array($sTitleAttrCode, $aAttCodes)) -// { -// $aAttCodes = array_merge(array($sTitleAttrCode), $aAttCodes); -// } - // - Retrieving scope search - $oScopeSearch = $oApp['scope_validator']->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sTargetObjectClass, UR_ACTION_READ); - if ($oScopeSearch === null) - { - IssueLog::Info(__METHOD__ . ' at line ' . __LINE__ . ' : User #' . UserRights::GetUserId() . ' has no scope query for ' . $sTargetObjectClass . ' class.'); - $oApp->abort(404, Dict::S('UI:ObjectDoesNotExist')); - } - - // - Base query from meta model - if ($oTargetAttDef->IsExternalKey()) - { - $oSearch = DBSearch::FromOQL($oTargetAttDef->GetValuesDef()->GetFilterExpression()); - } -// elseif ($oTargetAttDef->IsLinkSet()) - else - { - $oSearch = $oScopeSearch; - } - -// // - Adding query condition - $aInternalParams = array('this' => $oHostObject); -// if ($sQuery !== null) -// { -// for ($i = 0; $i < count($aAttCodes); $i++) -// { -// // Checking if the current attcode is an external key in order to search on the friendlyname -// $oAttDef = MetaModel::GetAttributeDef($sTargetObjectClass, $aAttCodes[$i]); -// $sAttCode = (!$oAttDef->IsExternalKey()) ? $aAttCodes[$i] : $aAttCodes[$i] . '_friendlyname'; -// // Building expression for the current attcode -// $oBinExpr = new BinaryExpression(new FieldExpression($sAttCode, $oSearch->GetClassAlias()), 'LIKE', new VariableExpression('re_query')); -// // Adding expression to the full expression (all attcodes) -// if ($i === 0) -// { -// $oFullExpr = $oBinExpr; -// } -// else -// { -// $oFullExpr = new BinaryExpression($oFullExpr, 'OR', $oBinExpr); -// } -// } -// // Adding full expression to the search object -// $oSearch->AddConditionExpression($oFullExpr); -// $aInternalParams['re_query'] = '%' . $sQuery . '%'; -// } - // - Intersecting with scope constraints - $oSearch = $oSearch->Intersect($oScopeSearch); - // - Allowing all data if necessary - if ($oScopeSearch->IsAllDataAllowed()) - { - $oSearch->AllowAllData(); - } - - // Retrieving results - // - Preparing object set - $oSet = new DBObjectSet($oSearch, array(), $aInternalParams); - $oSet->OptimizeColumnLoad(array($oSearch->GetClassAlias() => array('friendlyname'))); -// $oSet->SetLimit($iListLength, $iListLength * ($iPageNumber - 1)); -// // - Retrieving columns properties -// $aColumnProperties = array(); -// foreach ($aAttCodes as $sAttCode) -// { -// $oAttDef = MetaModel::GetAttributeDef($sTargetObjectClass, $sAttCode); -// $aColumnProperties[$sAttCode] = array( -// 'title' => $oAttDef->GetLabel() -// ); -// } - // - Retrieving objects - $aItems = array(); - while ($oItem = $oSet->Fetch()) - { - $aItemProperties = array( - 'id' => $oItem->GetKey(), - 'name' => $oItem->GetName(), - 'attributes' => array() - ); - -// foreach ($aAttCodes as $sAttCode) -// { -// if ($sAttCode !== 'id') -// { -// $aAttProperties = array( -// 'att_code' => $sAttCode -// ); -// -// $oAttDef = MetaModel::GetAttributeDef($sTargetObjectClass, $sAttCode); -// if ($oAttDef->IsExternalKey()) -// { -// $aAttProperties['value'] = $oItem->Get($sAttCode . '_friendlyname'); -// // Checking if we can view the object -// if ((SecurityHelper::IsActionAllowed($oApp, UR_ACTION_READ, $oAttDef->GetTargetClass(), $oItem->Get($sAttCode)))) -// { -// $aAttProperties['url'] = $oApp['url_generator']->generate('p_object_view', array('sObjectClass' => $oAttDef->GetTargetClass(), 'sObjectId' => $oItem->GetKey())); -// } -// } -// else -// { -// $aAttProperties['value'] = $oAttDef->GetValueLabel($oItem->Get($sAttCode)); -// } -// -// $aItemProperties['attributes'][$sAttCode] = $aAttProperties; -// } -// } - - $aItems[] = $aItemProperties; - } - - // Preparing response - if ($bInitalPass) - { - $aData = $aData + array( - 'form' => array( - 'id' => 'object_search_form_' . time(), - 'title' => Dict::Format('Brick:Portal:Object:Search:Hierarchy:Title', $oTargetAttDef->GetLabel(), MetaModel::GetName($sTargetObjectClass)) - ), - 'aResults' => array( - 'aItems' => json_encode($aItems), - 'iCount' => count($aItems) - ), - 'aSource' => array( - 'sFormPath' => $sFormPath, - 'sFieldId' => $sFieldId - ) - ); - - if ($oRequest->isXmlHttpRequest()) - { - $oResponse = $oApp['twig']->render('itop-portal-base/portal/src/views/bricks/object/modal.html.twig', $aData); - } - else - { - //$oResponse = $oApp->abort(404, Dict::S('UI:ObjectDoesNotExist')); - $oResponse = $oApp['twig']->render('itop-portal-base/portal/src/views/bricks/object/layout.html.twig', $aData); - } - } - else - { - $aData = $aData + array( - 'levelsProperties' => $aColumnProperties, - 'data' => $aItems - ); - - $oResponse = $oApp->json($aData); - } - - return $oResponse; + // TODO } /** @@ -1342,6 +1202,11 @@ class ObjectController extends AbstractController * @param Request $oRequest * @param Application $oApp * @param string $sOperation + * + * @return Response + * + * @throws \ArchivedObjectException + * @throws \CoreException */ public function DocumentAction(Request $oRequest, Application $oApp, $sOperation = null) { @@ -1417,14 +1282,21 @@ class ObjectController extends AbstractController return new Response($oDocument->GetData(), Response::HTTP_OK, $aHeaders); } - /** - * Handles attachment add/remove on an object - * - * Note: This is inspired from itop-attachment/ajax.attachment.php - * - * @param Request $oRequest - * @param Application $oApp - */ + /** + * Handles attachment add/remove on an object + * + * Note: This is inspired from itop-attachment/ajax.attachment.php + * + * @param Request $oRequest + * @param Application $oApp + * @param string $sOperation + * + * @return Response + * + * @throws \Exception + * @throws \CoreException + * @throws \CoreUnexpectedValue + */ public function AttachmentAction(Request $oRequest, Application $oApp, $sOperation = null) { $aData = array( @@ -1502,18 +1374,22 @@ class ObjectController extends AbstractController return $oResponse; } - /** - * Returns a json response containing an array of objects informations. - * - * The service must be given 3 parameters : - * - sObjectClass : The class of objects to retrieve information from - * - aObjectIds : An array of object ids - * - aObjectAttCodes : An array of attribute codes to retrieve - * - * @param Request $oRequest - * @param Application $oApp - * @return Response - */ + /** + * Returns a json response containing an array of objects informations. + * + * The service must be given 3 parameters : + * - sObjectClass : The class of objects to retrieve information from + * - aObjectIds : An array of object ids + * - aObjectAttCodes : An array of attribute codes to retrieve + * + * @param Request $oRequest + * @param Application $oApp + * + * @return Response + * + * @throws \OQLException + * @throws \CoreException + */ public function GetInformationsAsJsonAction(Request $oRequest, Application $oApp) { $aData = array(); @@ -1524,7 +1400,7 @@ class ObjectController extends AbstractController $aObjectAttCodes = $oRequest->Get('aObjectAttCodes'); if ($sObjectClass === null || $aObjectIds === null || $aObjectAttCodes === null) { - IssueLog::Info(__METHOD__ . ' at line ' . __LINE__ . ' : sObjectClass, sObjectId and aObjectAttCodes expected, "' . $sObjectClass . '", "' . $sObjectId . '" given.'); + IssueLog::Info(__METHOD__ . ' at line ' . __LINE__ . ' : sObjectClass, aObjectIds and aObjectAttCodes expected, "' . $sObjectClass . '", "' . implode('/', $aObjectIds) . '" given.'); $oApp->abort(500, 'Invalid request data, some informations are missing'); } @@ -1553,15 +1429,18 @@ class ObjectController extends AbstractController return $oApp->json($aData); } - /** - * Prepare a DBObject informations as an array for a client side usage (typically, add a row in a table) - * - * @param \Silex\Application $oApp - * @param \Combodo\iTop\Portal\Controller\DBObject $oObject - * @param array $aAttCodes - * - * @return array - */ + /** + * Prepare a DBObject informations as an array for a client side usage (typically, add a row in a table) + * + * @param Application $oApp + * @param DBObject $oObject + * @param array $aAttCodes + * + * @return array + * + * @throws \Exception + * @throws \CoreException + */ protected function PrepareObjectInformations(Application $oApp, DBObject $oObject, $aAttCodes = array()) { $sObjectClass = get_class($oObject); diff --git a/datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php index cda957650..fb2048136 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/controllers/userprofilebrickcontroller.class.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/abstractbrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/abstractbrick.class.inc.php index 754c77d0a..f583c7855 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/abstractbrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/abstractbrick.class.inc.php @@ -1,6 +1,6 @@ */ abstract class AbstractBrick { @@ -227,7 +226,9 @@ abstract class AbstractBrick /** * Sets the brick id * - * @param string $sid + * @param string $sId + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetId($sId) { @@ -239,6 +240,8 @@ abstract class AbstractBrick * Sets if the brick is mandatory * * @param boolean $bMandatory + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetMandatory($bMandatory) { @@ -250,6 +253,8 @@ abstract class AbstractBrick * Sets if the brick is visible * * @param boolean $bVisible + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetVisible($bVisible) { @@ -261,6 +266,8 @@ abstract class AbstractBrick * Sets if the brick is active * * @param boolean $bActive + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetActive($bActive) { @@ -272,6 +279,8 @@ abstract class AbstractBrick * Sets the rank of the brick * * @param float $fRank + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetRank($fRank) { @@ -283,6 +292,8 @@ abstract class AbstractBrick * Sets the page template path of the brick * * @param string $sPageTemplatePath + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetPageTemplatePath($sPageTemplatePath) { @@ -294,6 +305,8 @@ abstract class AbstractBrick * Sets the title of the brick * * @param string $sTitle + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetTitle($sTitle) { @@ -305,6 +318,8 @@ abstract class AbstractBrick * Sets the description of the brick * * @param string $sDescription + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDescription($sDescription) { @@ -316,6 +331,8 @@ abstract class AbstractBrick * Sets the data loading mode of the brick * * @param string $sDataLoading + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDataLoading($sDataLoading) { @@ -327,6 +344,8 @@ abstract class AbstractBrick * Sets the allowed profiles for the brick * * @param array $aAllowedProfiles + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetAllowedProfiles($aAllowedProfiles) { @@ -338,6 +357,8 @@ abstract class AbstractBrick * Sets the denied profiles for the brick * * @param array $aDeniedProfiles + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDeniedProfiles($aDeniedProfiles) { @@ -349,6 +370,8 @@ abstract class AbstractBrick * Sets the allowed profiles oql query for the brick * * @param string $sAllowedProfilesOql + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetAllowedProfilesOql($sAllowedProfilesOql) { @@ -360,6 +383,8 @@ abstract class AbstractBrick * Sets the denied profiles oql query for the brick * * @param array $sDeniedProfilesOql + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function SetDeniedProfilesOql($sDeniedProfilesOql) { @@ -371,6 +396,7 @@ abstract class AbstractBrick * Adds $sProfile to the list of allowed profiles for that brick * * @param string $sProfile + * * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function AddAllowedProfile($sProfile) @@ -383,6 +409,7 @@ abstract class AbstractBrick * Removes $sProfile from the list of allowed profiles * * @param string $sProfile + * * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function RemoveAllowedProfile($sProfile) @@ -408,6 +435,7 @@ abstract class AbstractBrick * Adds $sProfile to the list of denied profiles for that brick * * @param string $sProfile + * * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function AddDeniedProfile($sProfile) @@ -420,6 +448,7 @@ abstract class AbstractBrick * Removes $sProfile from the list of denied profiles * * @param string $sProfile + * * @return \Combodo\iTop\Portal\Brick\AbstractBrick */ public function RemoveDeniedProfile($sProfile) @@ -448,6 +477,7 @@ abstract class AbstractBrick * Priority is deny/allow * * @param string $sProfile + * * @return boolean */ public function IsGrantedForProfile($sProfile) @@ -462,6 +492,7 @@ abstract class AbstractBrick * Priority is deny/allow * * @param array $aProfiles + * * @return boolean */ public function IsGrantedForProfiles($aProfiles) @@ -512,8 +543,10 @@ abstract class AbstractBrick * This is used to set all the brick attributes at once. * * @param \Combodo\iTop\DesignElement $oMDElement - * @return AbstractBrick - * @throws DOMFormatException + * + * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @throws \DOMFormatException */ public function LoadFromXml(DesignElement $oMDElement) { @@ -588,5 +621,3 @@ abstract class AbstractBrick } } - -?> \ No newline at end of file diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/aggregatepagebrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/aggregatepagebrick.class.inc.php index c3824a529..4191a3e92 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/aggregatepagebrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/aggregatepagebrick.class.inc.php @@ -49,7 +49,8 @@ class AggregatePageBrick extends PortalBrick /** * @param \Combodo\iTop\DesignElement $oMDElement * - * @return \Combodo\iTop\Portal\Brick\PortalBrick|void + * @return \Combodo\iTop\Portal\Brick\AggregatePageBrick + * * @throws \DOMFormatException */ public function LoadFromXml(DesignElement $oMDElement) @@ -83,6 +84,8 @@ class AggregatePageBrick extends PortalBrick } asort($this->aAggregatePageBricks); + + return $this; } /** diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/browsebrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/browsebrick.class.inc.php index 3ff6ba2b4..4c94ba38a 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/browsebrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/browsebrick.class.inc.php @@ -1,6 +1,6 @@ */ class BrowseBrick extends PortalBrick { @@ -107,11 +106,13 @@ class BrowseBrick extends PortalBrick return $this->sDefaultBrowseMode; } - /** - * Sets the levels of the brick - * - * @param array $aLevels - */ + /** + * Sets the levels of the brick + * + * @param array $aLevels + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick + */ public function SetLevels($aLevels) { $this->aLevels = $aLevels; @@ -122,6 +123,8 @@ class BrowseBrick extends PortalBrick * Sets the availables browse modes of the brick * * @param array $aAvailablesBrowseModes + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ public function SetAvailablesBrowseModes($aAvailablesBrowseModes) { @@ -133,6 +136,8 @@ class BrowseBrick extends PortalBrick * Sets the adefault browse mode of the brick * * @param string $sDefaultBrowseMode + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ public function SetDefaultBrowseMode($sDefaultBrowseMode) { @@ -154,7 +159,8 @@ class BrowseBrick extends PortalBrick * Adds $aLevel to the list of levels for that brick * * @param array $aLevel - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ public function AddLevel($aLevel) { @@ -165,14 +171,15 @@ class BrowseBrick extends PortalBrick /** * Removes $aLevel from the list of levels browse modes * - * @param array $aLevel - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * @param string $sLevel + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ - public function RemoveLevels($aLevel) + public function RemoveLevels($sLevel) { - if (isset($this->aLevels[$aLevel])) + if (isset($this->aLevels[$sLevel])) { - unset($this->aLevels[$aLevel]); + unset($this->aLevels[$sLevel]); } return $this; } @@ -182,7 +189,8 @@ class BrowseBrick extends PortalBrick * * @param string $sModeId * @param array $aData Hash array containing 'template' => TEMPLATE_PATH - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ public function AddAvailableBrowseMode($sModeId, $aData = array()) { @@ -194,7 +202,8 @@ class BrowseBrick extends PortalBrick * Removes $sModeId from the list of availables browse modes * * @param string $sModeId - * @return \Combodo\iTop\Portal\Brick\AbstractBrick + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick */ public function RemoveAvailableBrowseMode($sModeId) { @@ -210,8 +219,10 @@ class BrowseBrick extends PortalBrick * This is used to set all the brick attributes at once. * * @param \Combodo\iTop\DesignElement $oMDElement - * @return BrowseBrick - * @throws DOMFormatException + * + * @return \Combodo\iTop\Portal\Brick\BrowseBrick + * + * @throws \DOMFormatException */ public function LoadFromXml(DesignElement $oMDElement) { @@ -294,8 +305,10 @@ class BrowseBrick extends PortalBrick * Parses the ModuleDesignElement to recursivly load levels * * @param \Combodo\iTop\DesignElement $oMDElement + * * @return array - * @throws DOMFormatException + * + * @throws \DOMFormatException */ protected function LoadLevelFromXml(DesignElement $oMDElement) { diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/createbrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/createbrick.class.inc.php index c1a36f1b2..dcc21a83c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/createbrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/createbrick.class.inc.php @@ -21,12 +21,11 @@ namespace Combodo\iTop\Portal\Brick; use DOMFormatException; use Combodo\iTop\DesignElement; -use Combodo\iTop\Portal\Brick\PortalBrick; /** * Description of CreateBrick * - * @author Guillaume Lajarige + * @author Guillaume Lajarige */ class CreateBrick extends PortalBrick { @@ -60,11 +59,13 @@ class CreateBrick extends PortalBrick return $this->sClass; } - /** - * Sets the class of the brick - * - * @param string $sClass - */ + /** + * Sets the class of the brick + * + * @param string $sClass + * + * @return \Combodo\iTop\Portal\Brick\CreateBrick + */ public function SetClass($sClass) { $this->sClass = $sClass; @@ -85,6 +86,8 @@ class CreateBrick extends PortalBrick * Sets the rules of the brick * * @param array $aRules + * + * @return \Combodo\iTop\Portal\Brick\CreateBrick */ public function SetRules($aRules) { @@ -92,13 +95,16 @@ class CreateBrick extends PortalBrick 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. - * - * @param \Combodo\iTop\DesignElement $oMDElement - * @return CreateBrick - */ + /** + * Load the brick's data from the xml passed as a ModuleDesignElement. + * This is used to set all the brick attributes at once. + * + * @param \Combodo\iTop\DesignElement $oMDElement + * + * @return \Combodo\iTop\Portal\Brick\CreateBrick + * + * @throws \DOMFormatException + */ public function LoadFromXml(DesignElement $oMDElement) { parent::LoadFromXml($oMDElement); diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/filterbrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/filterbrick.class.inc.php index 2a47b0106..849d89754 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/filterbrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/filterbrick.class.inc.php @@ -1,6 +1,6 @@ */ class FilterBrick extends PortalBrick { @@ -122,14 +121,16 @@ class FilterBrick extends PortalBrick 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. - * - * @param \Combodo\iTop\DesignElement $oMDElement - * @return BrowseBrick - * @throws DOMFormatException - */ + /** + * Load the brick's data from the xml passed as a ModuleDesignElement. + * This is used to set all the brick attributes at once. + * + * @param \Combodo\iTop\DesignElement $oMDElement + * + * @return \Combodo\iTop\Portal\Brick\FilterBrick + * + * @throws \DOMFormatException + */ public function LoadFromXml(DesignElement $oMDElement) { parent::LoadFromXml($oMDElement); @@ -180,5 +181,3 @@ class FilterBrick extends PortalBrick } } - -?> \ No newline at end of file diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/managebrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/managebrick.class.inc.php index 8d3ff337b..4b19438c5 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/managebrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/managebrick.class.inc.php @@ -20,10 +20,11 @@ namespace Combodo\iTop\Portal\Brick; -use Combodo\iTop\DesignElement; -use DBSearch; +use Exception; use DOMFormatException; +use DBSearch; use MetaModel; +use Combodo\iTop\DesignElement; class ManageBrick extends PortalBrick { @@ -287,6 +288,7 @@ class ManageBrick extends PortalBrick * Sets the tile mode (display) * * @param string $sTileMode + * * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function SetTileMode($sTileMode) @@ -332,7 +334,7 @@ class ManageBrick extends PortalBrick * * @param string $sOql * - * @return ManageBrick + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function SetOql($sOql) { @@ -345,8 +347,8 @@ class ManageBrick extends PortalBrick * Sets the brick's objects opening mode * * @param string $sOpeningMode - * - * @return ManageBrick + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function SetOpeningMode($sOpeningMode) { @@ -359,6 +361,8 @@ class ManageBrick extends PortalBrick * Sets the grouping of the brick * * @param array $aGrouping + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function SetGrouping($aGrouping) { @@ -371,6 +375,8 @@ class ManageBrick extends PortalBrick * Sets the fields of the brick * * @param array $aFields + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function SetFields($aFields) { @@ -383,8 +389,8 @@ class ManageBrick extends PortalBrick * Sets if the brick should display objects count on tab * * @param bool $bShowTabCounts - * - * @return ManageBrick + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function SetShowTabCounts($bShowTabCounts) { @@ -400,8 +406,8 @@ class ManageBrick extends PortalBrick * * @param string $sName (Must be "tabs" or -Not implemented yet, implicit grouping on y axis-) * @param array $aGrouping - * - * @return ManageBrick + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function AddGrouping($sName, $aGrouping) { @@ -422,8 +428,8 @@ class ManageBrick extends PortalBrick * Removes a grouping by its name * * @param string $sName - * - * @return ManageBrick + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function RemoveGrouping($sName) { @@ -439,8 +445,8 @@ class ManageBrick extends PortalBrick * Adds a field to display from its attribute_code. * * @param string $sAttCode - * - * @return ManageBrick + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function AddField($sAttCode) { @@ -456,8 +462,8 @@ class ManageBrick extends PortalBrick * Removes a field * * @param string $sAttCode - * - * @return ManageBrick + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function RemoveField($sAttCode) { @@ -533,6 +539,8 @@ class ManageBrick extends PortalBrick * @param string $sModeId * * @return \Combodo\iTop\Portal\Brick\ManageBrick + * + * @throws \Exception */ public function AddAvailableDisplayMode($sModeId) { @@ -550,6 +558,7 @@ class ManageBrick extends PortalBrick * Removes $sModeId from the list of availables display modes * * @param string $sModeId + * * @return \Combodo\iTop\Portal\Brick\ManageBrick */ public function RemoveAvailableDisplayMode($sModeId) @@ -608,16 +617,18 @@ class ManageBrick extends PortalBrick return $this->IsGroupingByDistinctValues('areas'); } - /** - * Load the brick's data from the xml passed as a ModuleDesignElement. - * This is used to set all the brick attributes at once. - * - * @param \Combodo\iTop\DesignElement $oMDElement - * - * @return ManageBrick - * @throws DOMFormatException - * @throws \OQLException - */ + /** + * Load the brick's data from the xml passed as a ModuleDesignElement. + * This is used to set all the brick attributes at once. + * + * @param \Combodo\iTop\DesignElement $oMDElement + * + * @return \Combodo\iTop\Portal\Brick\ManageBrick + * + * @throws \Exception + * @throws \DOMFormatException + * @throws \OQLException + */ public function LoadFromXml(DesignElement $oMDElement) { parent::LoadFromXml($oMDElement); @@ -858,6 +869,7 @@ class ManageBrick extends PortalBrick $sDecorationClassNavigationMenu = $this->GetDecorationClassNavigationMenu(); if (empty($sDecorationClassNavigationMenu) && isset(static::$aPresentationData[$this->sTileMode])) { + /** @var string $sDecorationClassNavigationMenu */ $sDecorationClassNavigationMenu = static::$aPresentationData[$this->sTileMode]['decorationCssClass']; if (!empty($sDecorationClassNavigationMenu)) { diff --git a/datamodels/2.x/itop-portal-base/portal/src/entities/portalbrick.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/entities/portalbrick.class.inc.php index 645809841..f88c01aef 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/entities/portalbrick.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/entities/portalbrick.class.inc.php @@ -19,6 +19,7 @@ namespace Combodo\iTop\Portal\Brick; +use DOMFormatException; use ModuleDesign; use Combodo\iTop\DesignElement; @@ -27,7 +28,7 @@ use Combodo\iTop\DesignElement; * * Classes that will be used only in the portal, not the console. * - * @author Guillaume Lajarige + * @author Guillaume Lajarige */ abstract class PortalBrick extends AbstractBrick { @@ -233,6 +234,8 @@ abstract class PortalBrick extends AbstractBrick * Sets the width of the brick * * @param boolean $iWidth + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetWidth($iWidth) { @@ -243,7 +246,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets the width of the brick * - * @param boolean $iWidth + * @param integer $iHeight + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetHeight($iHeight) { @@ -255,6 +260,8 @@ abstract class PortalBrick extends AbstractBrick * Sets if the brick will show in a modal dialog or not * * @param boolean $bModal + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetModal($bModal) { @@ -265,7 +272,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick is visible on the portal's home * - * @param boolean $iWidth + * @param boolean $bVisibleHome + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetVisibleHome($bVisibleHome) { @@ -276,7 +285,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick is visible on the portal's navigation menu * - * @param boolean $iWidth + * @param boolean $bVisibleNavigationMenu + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetVisibleNavigationMenu($bVisibleNavigationMenu) { @@ -287,7 +298,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick's rank on the portal's home * - * @param boolean $fRank + * @param float $fRankHome + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetRankHome($fRankHome) { @@ -298,7 +311,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick's rank on the portal's navigation menu * - * @param boolean $fRank + * @param float $fRankNavigationMenu + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetRankNavigationMenu($fRankNavigationMenu) { @@ -309,7 +324,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick's decoration class on the portal's home * - * @param boolean $sDecorationClassHome + * @param string $sDecorationClassHome + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetDecorationClassHome($sDecorationClassHome) { @@ -320,7 +337,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick's decoration class on the portal's navigation menu * - * @param boolean $sDecorationClassNavigationMenu + * @param string $sDecorationClassNavigationMenu + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetDecorationClassNavigationMenu($sDecorationClassNavigationMenu) { @@ -331,7 +350,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick's title on the portal's home * - * @param boolean $sTitleHome + * @param string $sTitleHome + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetTitleHome($sTitleHome) { @@ -342,7 +363,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets if the brick's title on the portal's navigation menu * - * @param boolean $sTitleNavigationMenu + * @param string $sTitleNavigationMenu + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetTitleNavigationMenu($sTitleNavigationMenu) { @@ -353,7 +376,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets the brick tile template path * - * @param boolean $sTileTemplatePath + * @param string $sTileTemplatePath + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetTileTemplatePath($sTileTemplatePath) { @@ -364,7 +389,9 @@ abstract class PortalBrick extends AbstractBrick /** * Sets the brick tile controller action * - * @param boolean $sTileControllerAction + * @param string $sTileControllerAction + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetTileControllerAction($sTileControllerAction) { @@ -376,6 +403,7 @@ abstract class PortalBrick extends AbstractBrick * Sets the brick's objects opening target * * @param string $sOpeningTarget + * * @return \Combodo\iTop\Portal\Brick\PortalBrick */ public function SetOpeningTarget($sOpeningTarget) @@ -384,13 +412,16 @@ abstract class PortalBrick extends AbstractBrick 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. - * - * @param \Combodo\iTop\DesignElement $oMDElement - * @return PortalBrick - */ + /** + * Load the brick's data from the xml passed as a ModuleDesignElement. + * This is used to set all the brick attributes at once. + * + * @param \Combodo\iTop\DesignElement $oMDElement + * + * @return \Combodo\iTop\Portal\Brick\PortalBrick + * + * @throws \DOMFormatException + */ public function LoadFromXml(DesignElement $oMDElement) { parent::LoadFromXml($oMDElement); @@ -551,5 +582,3 @@ abstract class PortalBrick extends AbstractBrick } } - -?> \ No newline at end of file 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 38b186b8f..f71d249eb 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 @@ -24,7 +24,7 @@ use Combodo\iTop\DesignElement; /** * Description of UserProfileBrick * - * @author Guillaume Lajarige + * @author Guillaume Lajarige */ class UserProfileBrick extends PortalBrick { diff --git a/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php index 20114f57b..26440b74c 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/forms/objectformmanager.class.inc.php @@ -63,15 +63,20 @@ class ObjectFormManager extends FormManager protected $aFormProperties; protected $aCallbackUrls = array(); - /** - * Creates an instance of \Combodo\iTop\Portal\Form\ObjectFormManager from JSON data that must contain at least : - * - formobject_class : The class of the object that is being edited/viewed - * - formmode : view|edit|create - * - values for parent - * - * @param string $sJson - * @return \Combodo\iTop\Portal\Form\ObjectFormManager - */ + /** + * Creates an instance of \Combodo\iTop\Portal\Form\ObjectFormManager from JSON data that must contain at least : + * - formobject_class : The class of the object that is being edited/viewed + * - formmode : view|edit|create + * - values for parent + * + * @param string $sJson + * + * @return \Combodo\iTop\Portal\Form\ObjectFormManager + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + */ static function FromJSON($sJson) { if (is_array($sJson)) @@ -83,6 +88,7 @@ class ObjectFormManager extends FormManager $aJson = json_decode($sJson, true); } + /** @var \Combodo\iTop\Portal\Form\ObjectFormManager $oFormManager */ $oFormManager = parent::FromJSON($sJson); // Retrieving object to edit @@ -277,7 +283,7 @@ class ObjectFormManager extends FormManager * - formmode * - values for parent * - * @return string + * @return array */ public function ToJSON() { @@ -292,7 +298,15 @@ class ObjectFormManager extends FormManager return $aJson; } - public function Build() + /** + * @throws \Exception + * @throws \CoreException + * @throws \OQLException + * @throws \Twig_Error_Loader + * @throws \Twig_Error_Runtime + * @throws \Twig_Error_Syntax + */ + public function Build() { $sObjectClass = get_class($this->oObject); @@ -876,15 +890,19 @@ class ObjectFormManager extends FormManager $this->oRenderer->SetForm($this->oForm); } - /** - * Calls all form fields OnCancel method in order to delegate them the cleanup; - * - * @param array $aArgs - */ + /** + * Calls all form fields OnCancel method in order to delegate them the cleanup; + * + * @param array $aArgs + * + * @throws \DeleteException + * @throws \OQLException + */ public function OnCancel($aArgs = null) { // Ask to each field to clean itself - foreach ($this->oForm->GetFields() as $oField) + /** @var \Combodo\iTop\Form\Field\Field $oField */ + foreach ($this->oForm->GetFields() as $oField) { $oField->OnCancel(); } @@ -897,20 +915,31 @@ class ObjectFormManager extends FormManager $this->CancelAttachments(); } - /** - * Validates the form and returns an array with the validation status and the messages. - * If the form is valid, creates/updates the object. - * - * eg : - * array( - * 'status' => true|false - * 'messages' => array( - * 'errors' => array() - * ) - * - * @param array $aArgs - * @return array - */ + /** + * Validates the form and returns an array with the validation status and the messages. + * If the form is valid, creates/updates the object. + * + * eg : + * array( + * 'status' => true|false + * 'messages' => array( + * 'errors' => array() + * ) + * + * @param array $aArgs + * + * @return array + * + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + * @throws \OQLException + * @throws \Twig_Error_Loader + * @throws \Twig_Error_Runtime + * @throws \Twig_Error_Syntax + */ public function OnSubmit($aArgs = null) { $aData = array( @@ -1005,13 +1034,22 @@ class ObjectFormManager extends FormManager return $aData; } - /** - * Updates the form and its fields with the current values - * - * Note : Doesn't update the object, see ObjectFormManager::OnSubmit() for that; - * - * @param array $aArgs - */ + /** + * Updates the form and its fields with the current values + * + * Note : Doesn't update the object, see ObjectFormManager::OnSubmit() for that; + * + * @param array $aArgs + * + * @throws \Exception + * @throws \ArchivedObjectException + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \OQLException + * @throws \Twig_Error_Loader + * @throws \Twig_Error_Runtime + * @throws \Twig_Error_Syntax + */ public function OnUpdate($aArgs = null) { $aFormProperties = array(); @@ -1129,12 +1167,17 @@ class ObjectFormManager extends FormManager $this->Build(); } - /** - * This is a temporary function until the Attachment refactoring is done. It should be remove once it's done. - * It is inspired from itop-attachments/main.attachments.php / UpdateAttachments() - * - * @param array $aAttachmentIds - */ + /** + * This is a temporary function until the Attachment refactoring is done. It should be remove once it's done. + * It is inspired from itop-attachments/main.attachments.php / UpdateAttachments() + * + * @param array $aAttachmentIds + * + * @throws \CoreException + * @throws \CoreUnexpectedValue + * @throws \DeleteException + * @throws \OQLException + */ protected function FinalizeAttachments($aAttachmentIds) { $aRemovedAttachmentsIds = (isset($aAttachmentIds['removed_attachments_ids'])) ? $aAttachmentIds['removed_attachments_ids'] : array(); @@ -1176,10 +1219,13 @@ class ObjectFormManager extends FormManager } } - /** - * This is a temporary function until the Attachment refactoring is done. It should be remove once it's done. - * It is inspired from itop-attachments/main.attachments.php / UpdateAttachments() - */ + /** + * This is a temporary function until the Attachment refactoring is done. It should be remove once it's done. + * It is inspired from itop-attachments/main.attachments.php / UpdateAttachments() + * + * @throws \OQLException + * @throws \DeleteException + */ protected function CancelAttachments() { // Processing temporary attachments diff --git a/datamodels/2.x/itop-portal-base/portal/src/forms/passwordformmanager.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/forms/passwordformmanager.class.inc.php index c7f650c63..7ef34c4f3 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/forms/passwordformmanager.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/forms/passwordformmanager.class.inc.php @@ -22,6 +22,7 @@ namespace Combodo\iTop\Portal\Form; use Exception; use Dict; use UserRights; +use IssueLog; use Combodo\iTop\Form\FormManager; use Combodo\iTop\Form\Form; use Combodo\iTop\Form\Field\HiddenField; @@ -36,7 +37,10 @@ class PasswordFormManager extends FormManager { const FORM_TYPE = 'change_password'; - public function Build() + /** + * @throws \Exception + */ + public function Build() { // Building the form $oForm = new Form('change_password'); @@ -67,20 +71,23 @@ class PasswordFormManager extends FormManager $this->oRenderer->SetForm($this->oForm); } - /** - * Validates the form and returns an array with the validation status and the messages. - * If the form is valid, creates/updates the object. - * - * eg : - * array( - * 'status' => true|false - * 'messages' => array( - * 'errors' => array() - * ) - * - * @param array $aArgs - * @return array - */ + /** + * Validates the form and returns an array with the validation status and the messages. + * If the form is valid, creates/updates the object. + * + * eg : + * array( + * 'status' => true|false + * 'messages' => array( + * 'errors' => array() + * ) + * + * @param array $aArgs + * + * @return array + * + * @throws \Exception + */ public function OnSubmit($aArgs = null) { $aData = array( @@ -152,7 +159,12 @@ class PasswordFormManager extends FormManager return $aData; } - public function OnUpdate($aArgs = null) + /** + * @param array $aArgs + * + * @throws \Exception + */ + public function OnUpdate($aArgs = null) { // We build the form @@ -171,6 +183,9 @@ class PasswordFormManager extends FormManager } } + /** + * @param array $aArgs + */ public function OnCancel($aArgs = null) { diff --git a/datamodels/2.x/itop-portal-base/portal/src/forms/preferencesformmanager.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/forms/preferencesformmanager.class.inc.php index d2e01fa47..9919e8ab6 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/forms/preferencesformmanager.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/forms/preferencesformmanager.class.inc.php @@ -38,7 +38,10 @@ class PreferencesFormManager extends FormManager { const FORM_TYPE = 'preferences'; - public function Build() + /** + * @throws \Exception + */ + public function Build() { // Building the form $oForm = new Form('preferences'); @@ -70,20 +73,25 @@ class PreferencesFormManager extends FormManager $this->oRenderer->SetForm($this->oForm); } - /** - * Validates the form and returns an array with the validation status and the messages. - * If the form is valid, creates/updates the object. - * - * eg : - * array( - * 'status' => true|false - * 'messages' => array( - * 'errors' => array() - * ) - * - * @param array $aArgs - * @return array - */ + /** + * Validates the form and returns an array with the validation status and the messages. + * If the form is valid, creates/updates the object. + * + * eg : + * array( + * 'status' => true|false + * 'messages' => array( + * 'errors' => array() + * ) + * + * @param array $aArgs + * + * @return array + * + * @throws \Exception + * @throws \MySQLException + * @throws \MySQLHasGoneAwayException + */ public function OnSubmit($aArgs = null) { $aData = array( @@ -148,7 +156,12 @@ class PreferencesFormManager extends FormManager return $aData; } - public function OnUpdate($aArgs = null) + /** + * @param array $aArgs + * + * @throws \Exception + */ + public function OnUpdate($aArgs = null) { // We build the form @@ -167,6 +180,9 @@ class PreferencesFormManager extends FormManager } } + /** + * @param array $aArgs + */ public function OnCancel($aArgs = null) { diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php index 19410a1f2..2c3934726 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/applicationhelper.class.inc.php @@ -21,6 +21,7 @@ namespace Combodo\iTop\Portal\Helper; use ApplicationContext; use Combodo\iTop\Portal\Brick\AbstractBrick; +use Combodo\iTop\Portal\Brick\PortalBrick; use DBObjectSearch; use DBObjectSet; use Dict; @@ -45,7 +46,7 @@ use utils; * Contains static methods to help loading / registering classes of the application. * Mostly used for Controllers / Routers / Entities initialization. * - * @author Guillaume Lajarige + * @author Guillaume Lajarige */ class ApplicationHelper { @@ -592,7 +593,7 @@ class ApplicationHelper * * @param \Silex\Application $oApp * - * @throws Exception + * @throws \Exception */ public static function LoadCurrentUser(Application $oApp) { @@ -689,28 +690,21 @@ class ApplicationHelper * @param \Silex\Application $oApp * @param string $sBrickId * - * @return \Combodo\iTop\Portal\Brick\AbstractBrick - * @throws Exception + * @return \Combodo\iTop\Portal\Brick\PortalBrick + * + * @throws \Exception */ public static function GetLoadedBrickFromId(Application $oApp, $sBrickId) { - $bFound = false; - foreach ($oApp['combodo.portal.instance.conf']['bricks'] as $oBrick) { if ($oBrick->GetId() === $sBrickId) { - $bFound = true; - break; + return $oBrick; } } - if (!$bFound) - { - throw new Exception('Brick with id = "'.$sBrickId.'" was not found among loaded bricks.'); - } - - return $oBrick; + throw new Exception('Brick with id = "'.$sBrickId.'" was not found among loaded bricks.'); } /** @@ -724,6 +718,7 @@ class ApplicationHelper * @param string $sMode Form mode to find (view|edit|create) * * @return array + * * @throws \CoreException */ public static function GetLoadedFormFromClass(Application $oApp, $sClass, $sMode) @@ -770,6 +765,7 @@ class ApplicationHelper * @param string $sList List name to find * * @return array Array of attribute codes + * * @throws \CoreException */ public static function GetLoadedListFromClass(Application $oApp, $sClass, $sList = 'default') @@ -830,10 +826,11 @@ class ApplicationHelper * - 'bricks_total_width' => an integer used to create the home page grid * * @param \Silex\Application $oApp - * @param ModuleDesign $oDesign + * @param \ModuleDesign $oDesign * * @return array - * @throws Exception + * + * @throws \Exception */ protected static function LoadBricksConfiguration(Application $oApp, ModuleDesign $oDesign) { @@ -846,32 +843,16 @@ class ApplicationHelper foreach ($oDesign->GetNodes('/module_design/bricks/brick') as $oBrickNode) { + $sBrickClass = $oBrickNode->getAttribute('xsi:type'); try { - $sBrickClass = $oBrickNode->getAttribute('xsi:type'); if (class_exists($sBrickClass)) { + /** @var \Combodo\iTop\Portal\Brick\PortalBrick $oBrick */ $oBrick = new $sBrickClass(); $oBrick->LoadFromXml($oBrickNode); static::LoadBrickSecurity($oBrick); - // GLA : This didn't work has the modal flag was set for all instances of that brick -// // Checking brick modal flag -// if ($oBrick->GetModal()) -// { -// // We have to extract / replace the array as we can modify $oApp values directly -// $aRoutes = $oApp['combodo.portal.instance.routes']; -// // Init brick's array if necessary -// if (!isset($aRoutes[$oBrick->GetRouteName()]['navigation_menu_attr'])) -// { -// $aRoutes[$oBrick->GetRouteName()]['navigation_menu_attr'] = array(); -// } -// // Add modal datas for the brick -// $aRoutes[$oBrick->GetRouteName()]['navigation_menu_attr']['data-toggle'] = 'modal'; -// $aRoutes[$oBrick->GetRouteName()]['navigation_menu_attr']['data-target'] = '#modal-for-all'; -// // Finally, replace array in $oApp -// $oApp['combodo.portal.instance.routes'] = $aRoutes; -// } // Checking brick security if ($oBrick->GetActive() && $oBrick->IsGrantedForProfiles(UserRights::ListProfiles())) { @@ -906,12 +887,12 @@ class ApplicationHelper $aPortalConf['bricks_ordering'] = array(); // - Home $aPortalConf['bricks_ordering']['home'] = $aPortalConf['bricks']; - usort($aPortalConf['bricks_ordering']['home'], function ($a, $b) { + usort($aPortalConf['bricks_ordering']['home'], function (PortalBrick $a, PortalBrick $b) { return $a->GetRankHome() > $b->GetRankHome(); }); // - Navigation menu $aPortalConf['bricks_ordering']['navigation_menu'] = $aPortalConf['bricks']; - usort($aPortalConf['bricks_ordering']['navigation_menu'], function ($a, $b) { + usort($aPortalConf['bricks_ordering']['navigation_menu'], function (PortalBrick $a, PortalBrick $b) { return $a->GetRankNavigationMenu() > $b->GetRankNavigationMenu(); }); @@ -930,12 +911,12 @@ class ApplicationHelper * ... * * @param \Silex\Application $oApp - * @param ModuleDesign $oDesign + * @param \ModuleDesign $oDesign * * @return array - * @throws Exception - * @throws DOMFormatException - */ + * + * @throws \Exception + */ protected static function LoadFormsConfiguration(Application $oApp, ModuleDesign $oDesign) { $aForms = array(); @@ -1359,6 +1340,7 @@ class ApplicationHelper * Form will look like the "Properties" tab of a $sClass object in the console. * * @param string $sClass + * @param bool $bAddLinksets * * @return array */ diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/contextmanipulatorhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/contextmanipulatorhelper.class.inc.php index 1d5b15f0d..4b1b41d7f 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/contextmanipulatorhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/contextmanipulatorhelper.class.inc.php @@ -51,16 +51,17 @@ class ContextManipulatorHelper /** * Initializes the ScopeValidator by generating and caching the scopes compilation in the $this->sCachePath.$this->sFilename file. * - * @param DOMNodeList $oNodes - * @throws DOMFormatException - * @throws Exception + * @param \DOMNodeList $oNodes + * + * @throws \Exception + * @throws \DOMFormatException */ public function Init(DOMNodeList $oNodes) { $this->aRules = array(); // Iterating over the scope nodes - foreach ($oNodes as $oRuleNode) + foreach ($oNodes as $oRuleNode) { // Retrieving mandatory id attribute $sRuleId = $oRuleNode->getAttribute('id'); @@ -195,12 +196,14 @@ class ContextManipulatorHelper return $this->aRules; } - /** - * Return the rule identified by its ID, as a hash array - * - * @param string $sId - * @return array - */ + /** + * Return the rule identified by its ID, as a hash array + * + * @param string $sId + * + * @return array + * @throws \Exception + */ public function GetRule($sId) { if (!array_key_exists($sId, $this->aRules)) @@ -210,26 +213,30 @@ class ContextManipulatorHelper return $this->aRules[$sId]; } - /** - * Prepare the $oObject passed as a reference with the $aData - * - * $aData must be of the form : - * array( - * 'rules' => array( - * 'rule-id-1', - * 'rule-id-2', - * ... - * ), - * 'sources' => array( - * => , - * => , - * ... - * ) - * ) - * - * @param array $aData - * @param DBObject $oObject - */ + /** + * Prepare the $oObject passed as a reference with the $aData + * + * $aData must be of the form : + * array( + * 'rules' => array( + * 'rule-id-1', + * 'rule-id-2', + * ... + * ), + * 'sources' => array( + * => , + * => , + * ... + * ) + * ) + * + * @param array $aData + * @param \DBObject $oObject + * + * @throws \Exception + * @throws \CoreException + * @throws \OQLException + */ public function PrepareObject(array $aData, DBObject &$oObject) { if (isset($aData['rules']) && isset($aData['sources'])) @@ -237,7 +244,7 @@ class ContextManipulatorHelper $aRules = $aData['rules']; $aSources = $aData['sources']; - foreach ($aData['rules'] as $sId) + foreach ($aRules as $sId) { // Retrieveing current rule $aRule = $this->GetRule($sId); @@ -333,21 +340,24 @@ class ContextManipulatorHelper } } - /** - * Returns a hash array of urls for each type of callback - * - * eg : - * array( - * 'submit' => 'http://localhost/', - * 'cancel' => null - * ); - * - * @param \Silex\Application $oApp - * @param array $aData - * @param \DBObject $oObject - * @param boolean $bModal - * @return array - */ + /** + * Returns a hash array of urls for each type of callback + * + * eg : + * array( + * 'submit' => 'http://localhost/', + * 'cancel' => null + * ); + * + * @param \Silex\Application $oApp + * @param array $aData + * @param \DBObject $oObject + * @param boolean $bModal + * + * @return array + * + * @throws \Exception + */ public function GetCallbackUrls(Application $oApp, array $aData, DBObject $oObject, $bModal = false) { $aResults = array( @@ -429,8 +439,8 @@ class ContextManipulatorHelper * * To retrieve it has * - * @param array $aRules - * @param array $aObjects + * @param array $aTokenRules + * * @return string */ public static function EncodeRulesToken($aTokenRules) @@ -465,5 +475,3 @@ class ContextManipulatorHelper } } - -?> \ No newline at end of file diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php index a06db9a25..4f00efbff 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/lifecyclevalidatorhelper.class.inc.php @@ -25,7 +25,6 @@ use DOMFormatException; use utils; use ProfilesConfig; use MetaModel; -use DBSearch; class LifecycleValidatorHelper { @@ -92,6 +91,7 @@ class LifecycleValidatorHelper * This is used to create a unique lifecycle values class in the cache directory (/data/cache-) as there can be several instance of the portal. * * @param string $sInstancePrefix + * * @return \Combodo\iTop\Portal\Helper\LifecycleValidatorHelper */ public function SetInstancePrefix($sInstancePrefix) @@ -108,9 +108,10 @@ class LifecycleValidatorHelper /** * Initializes the LifecycleValidator by generating and caching the lifecycles compilation in the $this->sCachePath.$this->sFilename file. * - * @param DOMNodeList $oNodes - * @throws DOMFormatException - * @throws Exception + * @param \DOMNodeList $oNodes + * + * @throws \DOMFormatException + * @throws \Exception */ public function Init(DOMNodeList $oNodes) { @@ -260,26 +261,32 @@ class LifecycleValidatorHelper } } - /** - * Returns an array of available stimuli for the $sProfile for the class $sClass - * - * @param string $sProfile - * @param string $sClass - * @return DBSearch - */ + /** + * Returns an array of available stimuli for the $sProfile for the class $sClass + * + * @param string $sProfile + * @param string $sClass + * + * @return \DBSearch + * + * @throws \Exception + */ public function GetStimuliForProfile($sProfile, $sClass) { return $this->GetStimuliForProfiles(array($sProfile), $sClass); } - /** - * Returns an array of available stimuli for the $aProfiles for the class $sClass. - * Profiles are a OR condition. - * - * @param array $aProfiles - * @param string $sClass - * @return DBSearch - */ + /** + * Returns an array of available stimuli for the $aProfiles for the class $sClass. + * Profiles are a OR condition. + * + * @param array $aProfiles + * @param string $sClass + * + * @return \DBSearch + * + * @throws \Exception + */ public function GetStimuliForProfiles($aProfiles, $sClass) { $aStimuli = array(); @@ -316,8 +323,10 @@ class LifecycleValidatorHelper * Returns the profile id from a string being either a constant or its name. * * @param string $sProfile + * * @return integer - * @throws Exception + * + * @throws \Exception */ protected function GetProfileIdFromProfileName($sProfile) { @@ -362,6 +371,7 @@ class LifecycleValidatorHelper * Returns a string containing the generated PHP class for the compiled scopes * * @param array $aProfiles + * * @return string */ protected function BuildPHPClass($aProfiles = array()) diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/scopevalidatorhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/scopevalidatorhelper.class.inc.php index 5d8ad1675..b0cdf9827 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/scopevalidatorhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/scopevalidatorhelper.class.inc.php @@ -333,115 +333,6 @@ class ScopeValidatorHelper } } - // Iterating over the scope nodes - /* foreach ($oNodes as $oScopeNode) - { - // Retrieving mandatory id attribute - $sProfile = $oScopeNode->getAttribute('id'); - if ($sProfile === '') - { - throw new DOMFormatException('Scope tag must have an id attribute.', null, null, $oScopeNode); - } - - // Scope profile id - $iProfileId = $this->GetProfileIdFromProfileName($sProfile); - // This will be used to know which classes have been set, so we can set the missing ones. - $aProfileClasses = array(); - - // Iterating over the class nodes of the scope - foreach ($oScopeNode->GetUniqueElement('classes')->GetNodes('./class') as $oClassNode) - { - // Retrieving mandatory id attribute - $sClass = $oClassNode->getAttribute('id'); - if ($sClass === '') - { - throw new DOMFormatException('Class tag must have an id attribute.', null, null, $oClassNode); - } - - // Retrieving the type of query - $oOqlViewTypeNode = $oClassNode->GetOptionalElement('oql_view_type'); - $sOqlViewType = ($oOqlViewTypeNode !== null && ($oOqlViewTypeNode->GetText() === static::ENUM_TYPE_RESTRICT)) ? static::ENUM_TYPE_RESTRICT : static::ENUM_TYPE_ALLOW; - // Retrieving the view query - $oOqlViewNode = $oClassNode->GetUniqueElement('oql_view'); - $sOqlView = $oOqlViewNode->GetText(); - if ($sOqlView === null) - { - throw new DOMFormatException('Class tag in scope must have a not empty oql_view tag', null, null, $oClassNode); - } - // Retrieving the edit query - $oOqlEditNode = $oClassNode->GetOptionalElement('oql_edit'); - $sOqlEdit = ( ($oOqlEditNode !== null) && ($oOqlEditNode->GetText() !== null) ) ? $oOqlEditNode->GetText() : null; - - // Now that we have the queries infos, we are going to build the queries for that profile / class - $sMatrixPrefix = $iProfileId . '_' . $sClass . '_'; - // - View query - $oViewFilter = DBSearch::FromOQL($sOqlView); - $aProfiles[$sMatrixPrefix . 'r'] = array( - $sOqlViewType => $oViewFilter->ToOQL() - ); - // - Edit query - if ($sOqlEdit !== null) - { - $oEditFilter = DBSearch::FromOQL($sOqlEdit); - // - If the queries are the same, we don't make an intersect, we just reuse the view query - if ($sOqlEdit === $sOqlView) - { - // Do not intersect, edit query is identical to view query - } - else - { - if (($oEditFilter->GetClass() === $oViewFilter->GetClass()) && $oEditFilter->IsAny()) - { - $oEditFilter = $oViewFilter; - // Do not intersect, edit query is identical to view query - } - else - { - // Intersect - $oEditFilter = $oViewFilter->Intersect($oEditFilter); - } - } - - $aProfiles[$sMatrixPrefix . 'w'] = array( - $sOqlViewType => $oEditFilter->ToOQL() - ); - } - - $aProfileClasses[] = $sClass; - } - - // Filling the array with missing classes from MetaModel, so we can have an inheritance principle on the scope - // For each class explicitly given in the scopes, we check if its child classes were also in the scope : - // If not, we add them with the same OQL - foreach ($aProfileClasses as $sProfileClass) - { - foreach (MetaModel::EnumChildClasses($sProfileClass) as $sChildClass) - { - // If the child class is not in the scope, we are going to try to add it - if (!in_array($sChildClass, $aProfileClasses)) - { - foreach (array('r', 'w') as $sAction) - { - // If the current profile has scope for that class in that mode, we duplicate it - if (isset($aProfiles[$iProfileId . '_' . $sProfileClass . '_' . $sAction])) - { - $aTmpProfile = $aProfiles[$iProfileId . '_' . $sProfileClass . '_' . $sAction]; - foreach ($aTmpProfile as $sType => $sOql) - { - $oTmpFilter = DBSearch::FromOQL($sOql); - $oTmpFilter->ChangeClass($sChildClass); - - $aTmpProfile[$sType] = $oTmpFilter->ToOQL(); - } - - $aProfiles[$iProfileId . '_' . $sChildClass . '_' . $sAction] = $aTmpProfile; - } - } - } - } - } - } */ - // - Build php class $sPHP = $this->BuildPHPClass($aProfiles); @@ -474,22 +365,32 @@ class ScopeValidatorHelper * @param string $sProfile * @param string $sClass * @param integer $iAction - * @return DBSearch + * + * @return \DBSearch + * + * @throws \Exception + * @throws \CoreException + * @throws \OQLException */ public function GetScopeFilterForProfile($sProfile, $sClass, $iAction = null) { return $this->GetScopeFilterForProfiles(array($sProfile), $sClass, $iAction); } - /** - * Returns the DBSearch for the $aProfiles in $iAction for the class $sClass. - * Profiles are a OR condition. - * - * @param array $aProfiles - * @param string $sClass - * @param integer $iAction - * @return DBSearch - */ + /** + * Returns the DBSearch for the $aProfiles in $iAction for the class $sClass. + * Profiles are a OR condition. + * + * @param array $aProfiles + * @param string $sClass + * @param integer $iAction + * + * @return \DBSearch + * + * @throws \Exception + * @throws \CoreException + * @throws \OQLException + */ public function GetScopeFilterForProfiles($aProfiles, $sClass, $iAction = null) { $oSearch = null; @@ -552,15 +453,18 @@ class ScopeValidatorHelper return $oSearch; } - /** + /** * Add the scope query (view or edit depending on $sAction) for $sClass to the $oQuery. * - * @param DBSearch $oQuery - * @param string $sClass - * @param string $sAction - * - * @return bool true if scope exists, false if scope is null - */ + * @param \DBSearch $oQuery + * @param string $sClass + * @param int $sAction + * + * @return bool true if scope exists, false if scope is null + * + * @throws \CoreException + * @throws \OQLException + */ public function AddScopeToQuery(DBSearch &$oQuery, $sClass, $sAction = UR_ACTION_READ) { $oScopeQuery = $this->GetScopeFilterForProfiles(UserRights::ListProfiles(), $sClass, $sAction); @@ -579,13 +483,16 @@ class ScopeValidatorHelper return false; } - /** - * Returns true if at least one of the $aProfiles has the ignore_silos flag set to true for the $sClass. - * - * @param array $aProfiles - * @param string $sClass - * @return boolean - */ + /** + * Returns true if at least one of the $aProfiles has the ignore_silos flag set to true for the $sClass. + * + * @param array $aProfiles + * @param string $sClass + * + * @return boolean + * + * @throws \Exception + */ public function IsAllDataAllowedForScope($aProfiles, $sClass) { $bIgnoreSilos = false; @@ -616,8 +523,10 @@ class ScopeValidatorHelper * Returns the profile id from a string being either a constant or its name. * * @param string $sProfile + * * @return integer - * @throws Exception + * + * @throws \Exception */ protected function GetProfileIdFromProfileName($sProfile) { diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/securityhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/securityhelper.class.inc.php index 479fdd5f7..a185924bf 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/securityhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/securityhelper.class.inc.php @@ -44,19 +44,22 @@ class SecurityHelper UR_ACTION_MODIFY => array(), ); - /** - * Returns true if the current user is allowed to do the $sAction on an $sObjectClass object (with optionnal $sObjectId id) + /** + * Returns true if the current user is allowed to do the $sAction on an $sObjectClass object (with optionnal $sObjectId id) * Checks are: * - Has a scope query for the $sObjectClass / $sAction * - Optionally, if $sObjectId provided: Is object within scope for $sObjectClass / $sObjectId / $sAction * - Is allowed by datamodel for $sObjectClass / $sAction - * - * @param Silex\Application $oApp - * @param string $sAction Must be in UR_ACTION_READ|UR_ACTION_MODIFY|UR_ACTION_CREATE - * @param string $sObjectClass - * @param string $sObjectId - * @return boolean - */ + * + * @param \Silex\Application $oApp + * @param string $sAction Must be in UR_ACTION_READ|UR_ACTION_MODIFY|UR_ACTION_CREATE + * @param string $sObjectClass + * @param string $sObjectId + * + * @return boolean + * + * @throws \CoreException + */ public static function IsActionAllowed(Application $oApp, $sAction, $sObjectClass, $sObjectId = null) { $sDebugTracePrefix = __CLASS__ . ' / ' . __METHOD__ . ' : Returned false for action ' . $sAction . ' on ' . $sObjectClass . '::' . $sObjectId; @@ -174,9 +177,12 @@ class SecurityHelper /** * Preloads scope objects cache with objects from $oQuery * - * @param Application $oApp - * @param DBSearch $oSet + * @param \Silex\Application $oApp + * @param \DBSearch $oSearch * @param array $aExtKeysToPreload + * + * @throws \Exception + * @throws \CoreException */ public static function PreloadForCache(Application $oApp, DBSearch $oSearch, $aExtKeysToPreload = null) { diff --git a/datamodels/2.x/itop-portal-base/portal/src/helpers/urlgeneratorhelper.class.inc.php b/datamodels/2.x/itop-portal-base/portal/src/helpers/urlgeneratorhelper.class.inc.php index 183f20c5c..c7f378558 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/helpers/urlgeneratorhelper.class.inc.php +++ b/datamodels/2.x/itop-portal-base/portal/src/helpers/urlgeneratorhelper.class.inc.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/datamodels/2.x/itop-portal-base/portal/src/views/bricks/object/mode_search_regular.html.twig b/datamodels/2.x/itop-portal-base/portal/src/views/bricks/object/mode_search_regular.html.twig index bde847b52..58d1005a3 100644 --- a/datamodels/2.x/itop-portal-base/portal/src/views/bricks/object/mode_search_regular.html.twig +++ b/datamodels/2.x/itop-portal-base/portal/src/views/bricks/object/mode_search_regular.html.twig @@ -235,7 +235,7 @@ var iItemId = aData[i].id; if(!(iItemId in oSelectedItems)) { - oSelectedItems[iItemId] = $('').html(aData[i].name).text(); } } }); diff --git a/sources/form/field/field.class.inc.php b/sources/form/field/field.class.inc.php index 7d2a62ca3..6cf6646f1 100644 --- a/sources/form/field/field.class.inc.php +++ b/sources/form/field/field.class.inc.php @@ -196,7 +196,7 @@ abstract class Field /** * - * @return array + * @return mixed */ public function GetCurrentValue() { diff --git a/sources/form/field/selectfield.class.inc.php b/sources/form/field/selectfield.class.inc.php index 7ae45f210..b47c03f60 100644 --- a/sources/form/field/selectfield.class.inc.php +++ b/sources/form/field/selectfield.class.inc.php @@ -53,6 +53,11 @@ class SelectField extends MultipleChoicesField return $this->bStartsWithNullChoice; } + /** + * @param $bStartsWithNullChoice + * + * @return \Combodo\iTop\Form\Field\SelectField + */ public function SetStartsWithNullChoice($bStartsWithNullChoice) { $this->bStartsWithNullChoice = $bStartsWithNullChoice; diff --git a/sources/form/form.class.inc.php b/sources/form/form.class.inc.php index 1e48a5902..3bb0a097b 100644 --- a/sources/form/form.class.inc.php +++ b/sources/form/form.class.inc.php @@ -1,6 +1,6 @@ "Field value" - * @return \Combodo\iTop\Form\Form - */ + /** + * + * @param array $aValues Must be a hash array of "Field id" => "Field value" + * + * @return \Combodo\iTop\Form\Form + * + * @throws \Exception + */ public function SetCurrentValues($aValues) { foreach ($aValues as $sId => $value) @@ -374,11 +377,13 @@ class Form return $aRes; } - /** - * Returns the number of editable fields in this form. - * - * @return integer - */ + /** + * Returns the number of editable fields in this form. + * + * @param bool $bForce + * + * @return integer + */ public function GetEditableFieldCount($bForce = false) { // Count is usally done by the Finalize function but it can be done there if Finalize hasn't been called yet or if we choose to force it. @@ -488,10 +493,12 @@ class Form return $this; } - /** - * Finalizes each field, following the dependencies so that a field can compute its value or other properties, - * depending on other fields - */ + /** + * Finalizes each field, following the dependencies so that a field can compute its value or other properties, + * depending on other fields + * + * @throws \Exception + */ public function Finalize() { $aFieldList = array(); // Fields ordered by dependence diff --git a/sources/form/formmanager.class.inc.php b/sources/form/formmanager.class.inc.php index 8a375c14d..6e88a0fcf 100644 --- a/sources/form/formmanager.class.inc.php +++ b/sources/form/formmanager.class.inc.php @@ -1,6 +1,6 @@ SetEndpoint($aJson['formrenderer_endpoint']); $oFormManager->SetRenderer($oFormRenderer); @@ -129,7 +129,7 @@ abstract class FormManager * - formrenderer_class * - formrenderer_endpoint * - * @return string + * @return array */ public function ToJSON() { diff --git a/sources/form/validator/integervalidator.class.inc.php b/sources/form/validator/integervalidator.class.inc.php index 279217d4a..9501b96b3 100644 --- a/sources/form/validator/integervalidator.class.inc.php +++ b/sources/form/validator/integervalidator.class.inc.php @@ -1,6 +1,6 @@ AddField($sId, ..., function() use ($oManager, $oForm, '...') { ... } ); ) - */ + /** + * + * @param string $sRegExp + * @param string $sErrorMessage + */ public function __construct($sRegExp = null, $sErrorMessage = null) { $this->sRegExp = ($sRegExp === null) ? static::DEFAULT_REGEXP : $sRegExp;