Code cleanup: Warning suppression & PHPDoc.

SVN:trunk[5927]
This commit is contained in:
Guillaume Lajarige
2018-06-29 16:05:11 +00:00
parent 401a8cdd77
commit 00d0d383f8
35 changed files with 987 additions and 930 deletions

View File

@@ -126,4 +126,3 @@ Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
Dict::Add('NL NL', 'Dutch', 'Nederlands', array(
'Brick:Portal:Create:Name' => 'Snel aanmaken',
));
?>

View File

@@ -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)

View File

@@ -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);

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2015 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -30,8 +30,20 @@ use Combodo\iTop\Portal\Helper\SecurityHelper;
class CreateBrickController extends BrickController
{
public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId)
/**
* @param \Symfony\Component\HttpFoundation\Request $oRequest
* @param \Silex\Application $oApp
* @param string $sBrickId
*
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Exception
* @throws \CoreException
* @throws \DictExceptionMissingString
*/
public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId)
{
/** @var \Combodo\iTop\Portal\Brick\CreateBrick $oBrick */
$oBrick = ApplicationHelper::GetLoadedBrickFromId($oApp, $sBrickId);
$sObjectClass = $oBrick->GetClass();

View File

@@ -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

View File

@@ -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);

View File

@@ -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);

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2015 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -26,9 +26,9 @@ use MetaModel;
use UserRights;
use Silex\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Combodo\iTop\Portal\Helper\ApplicationHelper;
use Combodo\iTop\Portal\Brick\UserProfileBrick;
use Combodo\iTop\Portal\Controller\ObjectController;
use Combodo\iTop\Portal\Form\PreferencesFormManager;
use Combodo\iTop\Portal\Form\PasswordFormManager;
use Combodo\iTop\Renderer\Bootstrap\BsFormRenderer;
@@ -37,6 +37,21 @@ class UserProfileBrickController extends BrickController
{
const ENUM_FORM_TYPE_PICTURE = 'picture';
/**
* @param Request $oRequest
* @param Application $oApp
* @param $sBrickId
*
* @return Response
*
* @throws \Exception
* @throws \ArchivedObjectException
* @throws \CoreException
* @throws \OQLException
* @throws \Twig_Error_Loader
* @throws \Twig_Error_Runtime
* @throws \Twig_Error_Syntax
*/
public function DisplayAction(Request $oRequest, Application $oApp, $sBrickId)
{
// If the brick id was not specified, we get the first one registered that is an instance of UserProfileBrick as default
@@ -117,6 +132,13 @@ class UserProfileBrickController extends BrickController
return $oResponse;
}
/**
* @param Request $oRequest
* @param Application $oApp
* @param $sFormMode
*
* @return array
*/
public function HandlePreferencesForm(Request $oRequest, Application $oApp, $sFormMode)
{
$aFormData = array();
@@ -185,6 +207,12 @@ class UserProfileBrickController extends BrickController
return $aFormData;
}
/**
* @param Request $oRequest
* @param Application $oApp
*
* @return array
*/
public function HandlePasswordForm(Request $oRequest, Application $oApp)
{
$aFormData = array();
@@ -241,6 +269,14 @@ class UserProfileBrickController extends BrickController
return $aFormData;
}
/**
* @param Request $oRequest
* @param Application $oApp
* @param $sFormMode
*
* @return array
* @throws \FileUploadException
*/
public function HandlePictureForm(Request $oRequest, Application $oApp, $sFormMode)
{
$aFormData = array();
@@ -302,5 +338,3 @@ class UserProfileBrickController extends BrickController
}
}
?>

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2015 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -22,7 +22,6 @@ namespace Combodo\iTop\Portal\Brick;
require_once APPROOT . '/core/moduledesign.class.inc.php';
require_once APPROOT . '/setup/compiler.class.inc.php';
use DOMXPath;
use DOMFormatException;
use ModuleDesign;
use Combodo\iTop\DesignElement;
@@ -33,7 +32,7 @@ use Combodo\iTop\DesignElement;
* Bricks are used mostly in the portal for now, not the console.
* This class defines common functionnalities for the extended classes.
*
* @author Guillaume Lajarige
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
*/
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
}
}
?>

View File

@@ -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;
}
/**

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -21,12 +21,11 @@ namespace Combodo\iTop\Portal\Brick;
use DOMFormatException;
use Combodo\iTop\DesignElement;
use Combodo\iTop\Portal\Brick\PortalBrick;
/**
* Description of BrowseBrick
*
* @author Guillaume Lajarige
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
*/
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)
{

View File

@@ -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 <guillaume.lajarige@combodo.com>
*/
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);

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2015 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -19,14 +19,13 @@
namespace Combodo\iTop\Portal\Brick;
use DOMFormatException;
use Combodo\iTop\DesignElement;
use Combodo\iTop\Portal\Brick\PortalBrick;
use Combodo\iTop\Portal\Brick\BrowseBrick;
/**
* Description of FilterBrick
*
* @author Guillaume Lajarige
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
*/
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
}
}
?>

View File

@@ -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))
{

View File

@@ -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 <guillaume.lajarige@combodo.com>
*/
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
}
}
?>

View File

@@ -24,7 +24,7 @@ use Combodo\iTop\DesignElement;
/**
* Description of UserProfileBrick
*
* @author Guillaume Lajarige
* @author Guillaume Lajarige <guillaume.lajarige@combodo.com>
*/
class UserProfileBrick extends PortalBrick
{

View File

@@ -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

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -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 <guillaume.lajarige@combodo.com>
*/
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
*/

View File

@@ -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(
* <DBObject1 class> => <DBObject1 id>,
* <DBObject2 class> => <DBObject2 id>,
* ...
* )
* )
*
* @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(
* <DBObject1 class> => <DBObject1 id>,
* <DBObject2 class> => <DBObject2 id>,
* ...
* )
* )
*
* @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
}
}
?>

View File

@@ -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-<ENV>) 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())

View File

@@ -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)
{

View File

@@ -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)
{

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2017 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -34,14 +34,18 @@ use utils;
*/
class UrlGenerator extends SymfonyUrlGenerator
{
/**
* Overloading of the parent function to add the $_REQUEST parameters to the url parameters.
* This is used to keep additionnal parameters in the url, especially when portal is accessed from the /pages/exec.php
*
* Note : As of now, it only adds the exec_module and exec_page parameters. Any other parameter will be ignored.
*
* @return string
*/
/**
* Overloading of the parent function to add the $_REQUEST parameters to the url parameters.
* This is used to keep additionnal parameters in the url, especially when portal is accessed from the /pages/exec.php
*
* Note : As of now, it only adds the exec_module and exec_page parameters. Any other parameter will be ignored.
*
* @param string $name
* @param array $parameters
* @param boolean $referenceType
*
* @return string
*/
public function generate($name, $parameters = array(), $referenceType = SymfonyUrlGenerator::ABSOLUTE_PATH)
{
// Mandatory parameters

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2015 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -134,5 +134,3 @@ abstract class AbstractRouter
}
}
?>

View File

@@ -235,7 +235,7 @@
var iItemId = aData[i].id;
if(!(iItemId in oSelectedItems))
{
oSelectedItems[iItemId] = $('<textarea />').html(aData[i].name).text();
oSelectedItems[iItemId] = $('<textarea></textarea>').html(aData[i].name).text();
}
}
});

View File

@@ -196,7 +196,7 @@ abstract class Field
/**
*
* @return array
* @return mixed
*/
public function GetCurrentValue()
{

View File

@@ -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;

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -136,11 +136,14 @@ class Form
return $aValues;
}
/**
*
* @param array $aValues Must be a hash array of "Field id" => "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

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -19,7 +19,6 @@
namespace Combodo\iTop\Form;
use \Combodo\iTop\Form\Form;
use \Combodo\iTop\Renderer\FormRenderer;
/**
@@ -57,6 +56,7 @@ abstract class FormManager
$oFormManager = new static();
$sFormRendererClass = $aJson['formrenderer_class'];
/** @var \Combodo\iTop\Renderer\FormRenderer $oFormRenderer */
$oFormRenderer = new $sFormRendererClass();
$oFormRenderer->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()
{

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -19,8 +19,6 @@
namespace Combodo\iTop\Form\Validator;
use \Combodo\iTop\Form\Validator\Validator;
/**
* Description of IntegerValidator
*

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -19,8 +19,6 @@
namespace Combodo\iTop\Form\Validator;
use \Combodo\iTop\Form\Validator\Validator;
/**
* Description of MandatoryValidator
*

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -19,8 +19,6 @@
namespace Combodo\iTop\Form\Validator;
use \Combodo\iTop\Form\Validator\Validator;
/**
* Description of NotEmptyExtKeyValidator
*

View File

@@ -1,6 +1,6 @@
<?php
// Copyright (C) 2010-2016 Combodo SARL
// Copyright (C) 2010-2018 Combodo SARL
//
// This file is part of iTop.
//
@@ -38,10 +38,11 @@ class Validator
return static::VALIDATOR_NAME;
}
/**
*
* @param Closure $callback (Used in the $oForm->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;