mirror of
https://github.com/Combodo/iTop.git
synced 2026-02-13 07:24:13 +01:00
PHPDoc
SVN:trunk[5976]
This commit is contained in:
@@ -185,8 +185,16 @@ abstract class AttributeDefinition
|
||||
return $default;
|
||||
}
|
||||
}
|
||||
|
||||
public function __construct($sCode, $aParams)
|
||||
|
||||
/**
|
||||
* AttributeDefinition constructor.
|
||||
*
|
||||
* @param string $sCode
|
||||
* @param array $aParams
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function __construct($sCode, $aParams)
|
||||
{
|
||||
$this->m_sCode = $sCode;
|
||||
$this->m_aParams = $aParams;
|
||||
@@ -212,7 +220,12 @@ abstract class AttributeDefinition
|
||||
return $this->m_sHostClass;
|
||||
}
|
||||
|
||||
public function ListSubItems()
|
||||
/**
|
||||
* @return array
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function ListSubItems()
|
||||
{
|
||||
$aSubItems = array();
|
||||
foreach(MetaModel::ListAttributeDefs($this->m_sHostClass) as $sAttCode => $oAttDef)
|
||||
@@ -235,7 +248,10 @@ abstract class AttributeDefinition
|
||||
return array();
|
||||
}
|
||||
|
||||
private function ConsistencyCheck()
|
||||
/**
|
||||
* @throws \Exception
|
||||
*/
|
||||
private function ConsistencyCheck()
|
||||
{
|
||||
// Check that any mandatory param has been specified
|
||||
//
|
||||
@@ -255,7 +271,7 @@ abstract class AttributeDefinition
|
||||
/**
|
||||
* Check the validity of the given value
|
||||
*
|
||||
* @param DBObject $oHostObject
|
||||
* @param \DBObject $oHostObject
|
||||
* @param string An error if any, null otherwise
|
||||
*
|
||||
* @return bool
|
||||
@@ -368,9 +384,11 @@ abstract class AttributeDefinition
|
||||
*/
|
||||
public function GetMirrorLinkAttribute() {return null;}
|
||||
|
||||
/**
|
||||
* Helper to browse the hierarchy of classes, searching for a label
|
||||
*/
|
||||
/**
|
||||
* Helper to browse the hierarchy of classes, searching for a label
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function SearchLabel($sDictEntrySuffix, $sDefault, $bUserLanguageOnly)
|
||||
{
|
||||
$sLabel = Dict::S('Class:'.$this->m_sHostClass.$sDictEntrySuffix, '', $bUserLanguageOnly);
|
||||
@@ -392,7 +410,14 @@ abstract class AttributeDefinition
|
||||
return $sLabel;
|
||||
}
|
||||
|
||||
public function GetLabel($sDefault = null)
|
||||
/**
|
||||
* @param string|null $sDefault
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetLabel($sDefault = null)
|
||||
{
|
||||
$sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode, null, true /*user lang*/);
|
||||
if (is_null($sLabel))
|
||||
@@ -435,7 +460,13 @@ abstract class AttributeDefinition
|
||||
{
|
||||
return $sSearchString;
|
||||
}
|
||||
public function GetLabel_Obsolete()
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetLabel_Obsolete()
|
||||
{
|
||||
// Written for compatibility with a data model written prior to version 0.9.1
|
||||
if (array_key_exists('label', $this->m_aParams))
|
||||
@@ -448,7 +479,14 @@ abstract class AttributeDefinition
|
||||
}
|
||||
}
|
||||
|
||||
public function GetDescription($sDefault = null)
|
||||
/**
|
||||
* @param string|null $sDefault
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetDescription($sDefault = null)
|
||||
{
|
||||
$sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'+', null, true /*user lang*/);
|
||||
if (is_null($sLabel))
|
||||
@@ -464,7 +502,14 @@ abstract class AttributeDefinition
|
||||
return $sLabel;
|
||||
}
|
||||
|
||||
public function GetHelpOnEdition($sDefault = null)
|
||||
/**
|
||||
* @param string|null $sDefault
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetHelpOnEdition($sDefault = null)
|
||||
{
|
||||
$sLabel = $this->SearchLabel('/Attribute:'.$this->m_sCode.'?', null, true /*user lang*/);
|
||||
if (is_null($sLabel))
|
||||
@@ -492,9 +537,14 @@ abstract class AttributeDefinition
|
||||
}
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
public function GetDescription_Obsolete()
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetDescription_Obsolete()
|
||||
{
|
||||
// Written for compatibility with a data model written prior to version 0.9.1
|
||||
if (array_key_exists('description', $this->m_aParams))
|
||||
@@ -675,11 +725,13 @@ abstract class AttributeDefinition
|
||||
return '\\Combodo\\iTop\\Form\\Field\\StringField';
|
||||
}
|
||||
|
||||
/**
|
||||
* Override to specify Field class
|
||||
*
|
||||
* When called first, $oFormField is null and will be created (eg. Make). Then when the ::parent is called and the $oFormField is passed, MakeFormField behave more like a Prepare.
|
||||
*/
|
||||
/**
|
||||
* Override to specify Field class
|
||||
*
|
||||
* When called first, $oFormField is null and will be created (eg. Make). Then when the ::parent is called and the $oFormField is passed, MakeFormField behave more like a Prepare.
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function MakeFormField(DBObject $oObject, $oFormField = null)
|
||||
{
|
||||
// This is a fallback in case the AttributeDefinition subclass has no overloading of this function.
|
||||
@@ -741,12 +793,13 @@ abstract class AttributeDefinition
|
||||
/**
|
||||
* Get various representations of the value, for insertion into a template (e.g. in Notifications)
|
||||
*
|
||||
* @param $value mixed The current value of the field
|
||||
* @param $sVerb string The verb specifying the representation of the value
|
||||
* @param $oHostObject DBObject The object
|
||||
* @param $bLocalize bool Whether or not to localize the value
|
||||
* @param mixed $value mixed The current value of the field
|
||||
* @param string $sVerb string The verb specifying the representation of the value
|
||||
* @param \DBObject $oHostObject DBObject The object
|
||||
* @param bool $bLocalize bool Whether or not to localize the value
|
||||
*
|
||||
* @return mixed|null|string
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function GetForTemplate($value, $sVerb, $oHostObject = null, $bLocalize = true)
|
||||
@@ -782,9 +835,11 @@ abstract class AttributeDefinition
|
||||
return $oValSetDef->GetValues($aArgs, $sContains);
|
||||
}
|
||||
|
||||
/**
|
||||
* Explain the change of the attribute (history)
|
||||
*/
|
||||
/**
|
||||
* Explain the change of the attribute (history)
|
||||
*
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function DescribeChangeAsHTML($sOldValue, $sNewValue, $sLabel = null)
|
||||
{
|
||||
if (is_null($sLabel))
|
||||
@@ -850,15 +905,19 @@ abstract class AttributeDefinition
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Parses a string to find some smart search patterns and build the corresponding search/OQL condition
|
||||
* Each derived class is reponsible for defining and processing their own smart patterns, the base class
|
||||
* does nothing special, and just calls the default (loose) operator
|
||||
* @param string $sSearchText The search string to analyze for smart patterns
|
||||
* @param FieldExpression The FieldExpression representing the atttribute code in this OQL query
|
||||
* @param array $aParams Values of the query parameters
|
||||
* @return Expression The search condition to be added (AND) to the current search
|
||||
*/
|
||||
/**
|
||||
* Parses a string to find some smart search patterns and build the corresponding search/OQL condition
|
||||
* Each derived class is reponsible for defining and processing their own smart patterns, the base class
|
||||
* does nothing special, and just calls the default (loose) operator
|
||||
*
|
||||
* @param string $sSearchText The search string to analyze for smart patterns
|
||||
* @param \FieldExpression $oField
|
||||
* @param array $aParams Values of the query parameters
|
||||
*
|
||||
* @return \Expression The search condition to be added (AND) to the current search
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetSmartConditionExpression($sSearchText, FieldExpression $oField, &$aParams)
|
||||
{
|
||||
$sParamName = $oField->GetParent().'_'.$oField->GetName();
|
||||
@@ -921,7 +980,17 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
|
||||
public function GetValuesDef() {return $this->Get("allowed_values");}
|
||||
public function GetPrerequisiteAttributes($sClass = null) {return $this->Get("depends_on");}
|
||||
public function GetDefaultValue(DBObject $oHostObject = null)
|
||||
|
||||
/**
|
||||
* @param \DBObject|null $oHostObject
|
||||
*
|
||||
* @return \ormLinkSet
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
* @throws \CoreWarning
|
||||
*/
|
||||
public function GetDefaultValue(DBObject $oHostObject = null)
|
||||
{
|
||||
$sLinkClass = $this->GetLinkedClass();
|
||||
$sExtKeyToMe = $this->GetExtKeyToMe();
|
||||
@@ -973,7 +1042,16 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
public function GetBasicFilterLooseOperator() {return '';}
|
||||
public function GetBasicFilterSQLExpr($sOpCode, $value) {return '';}
|
||||
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
/**
|
||||
* @param string $sValue
|
||||
* @param \DBObject $oHostObject
|
||||
* @param bool $bLocalize
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetAsHTML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
{
|
||||
if (is_object($sValue) && ($sValue instanceof ormLinkSet))
|
||||
{
|
||||
@@ -1001,7 +1079,16 @@ class AttributeLinkedSet extends AttributeDefinition
|
||||
return null;
|
||||
}
|
||||
|
||||
public function GetAsXML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
/**
|
||||
* @param string $sValue
|
||||
* @param \DBObject $oHostObject
|
||||
* @param bool $bLocalize
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function GetAsXML($sValue, $oHostObject = null, $bLocalize = true)
|
||||
{
|
||||
if (is_object($sValue) && ($sValue instanceof ormLinkSet))
|
||||
{
|
||||
|
||||
@@ -1184,6 +1184,11 @@ class Config
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPropCode
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function Get($sPropCode)
|
||||
{
|
||||
return $this->m_aSettings[$sPropCode]['value'];
|
||||
@@ -1252,7 +1257,16 @@ class Config
|
||||
*/
|
||||
protected $m_aCharsets;
|
||||
|
||||
public function __construct($sConfigFile = null, $bLoadConfig = true)
|
||||
/**
|
||||
* Config constructor.
|
||||
*
|
||||
* @param string|null $sConfigFile
|
||||
* @param bool $bLoadConfig
|
||||
*
|
||||
* @throws \ConfigException
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function __construct($sConfigFile = null, $bLoadConfig = true)
|
||||
{
|
||||
$this->m_sFile = $sConfigFile;
|
||||
if (is_null($sConfigFile))
|
||||
@@ -1310,7 +1324,13 @@ class Config
|
||||
*/
|
||||
}
|
||||
|
||||
protected function CheckFile($sPurpose, $sFileName)
|
||||
/**
|
||||
* @param string $sPurpose
|
||||
* @param string $sFileName
|
||||
*
|
||||
* @throws \ConfigException
|
||||
*/
|
||||
protected function CheckFile($sPurpose, $sFileName)
|
||||
{
|
||||
if (!file_exists($sFileName))
|
||||
{
|
||||
@@ -1446,7 +1466,14 @@ class Config
|
||||
return $this->GetModuleParameter($sModule, $sProperty, $defaultvalue);
|
||||
}
|
||||
|
||||
public function GetModuleParameter($sModule, $sProperty, $defaultvalue = null)
|
||||
/**
|
||||
* @param string $sModule
|
||||
* @param string $sProperty
|
||||
* @param mixed|null $defaultvalue
|
||||
*
|
||||
* @return mixed|null
|
||||
*/
|
||||
public function GetModuleParameter($sModule, $sProperty, $defaultvalue = null)
|
||||
{
|
||||
$ret = $defaultvalue;
|
||||
if (class_exists('ModulesXMLParameters'))
|
||||
@@ -1478,6 +1505,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6
|
||||
* @see Config::Get() as a replacement
|
||||
*/
|
||||
@@ -1488,6 +1516,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6
|
||||
* @see Config::Get() as a replacement
|
||||
*/
|
||||
@@ -1498,6 +1527,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6
|
||||
* @see Config::Get() as a replacement
|
||||
*/
|
||||
@@ -1508,6 +1538,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6 #1001 utf8mb4 switch
|
||||
* @see Config::DEFAULT_CHARACTER_SET
|
||||
*/
|
||||
@@ -1518,6 +1549,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6 #1001 utf8mb4 switch
|
||||
* @see Config::DEFAULT_COLLATION
|
||||
*/
|
||||
@@ -1528,6 +1560,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6
|
||||
* @see Config::Get() as a replacement
|
||||
*/
|
||||
@@ -1538,6 +1571,7 @@ class Config
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*
|
||||
* @deprecated 2.5 will be removed in 2.6
|
||||
* @see Config::Get() as a replacement
|
||||
*/
|
||||
@@ -1756,14 +1790,16 @@ class Config
|
||||
return $aSettings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the configuration to a file (php format) that can be reloaded later
|
||||
* By default write to the same file that was specified when constructing the object
|
||||
/**
|
||||
* Write the configuration to a file (php format) that can be reloaded later
|
||||
* By default write to the same file that was specified when constructing the object
|
||||
*
|
||||
* @param string $sFileName string Name of the file to write to (emtpy to write to the same file)
|
||||
*
|
||||
* @return boolean True otherwise throws an Exception
|
||||
*
|
||||
* @param $sFileName string Name of the file to write to (emtpy to write to the same file)
|
||||
*
|
||||
* @return boolean True otherwise throws an Exception
|
||||
*/
|
||||
* @throws \ConfigException
|
||||
*/
|
||||
public function WriteToFile($sFileName = '')
|
||||
{
|
||||
if (empty($sFileName))
|
||||
@@ -1910,9 +1946,16 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to initialize a configuration from the page arguments
|
||||
*/
|
||||
/**
|
||||
* Helper function to initialize a configuration from the page arguments
|
||||
*
|
||||
* @param array $aParamValues
|
||||
* @param string|null $sModulesDir
|
||||
* @param bool $bPreserveModuleSettings
|
||||
*
|
||||
* @throws \Exception
|
||||
* @throws \CoreException
|
||||
*/
|
||||
public function UpdateFromParams($aParamValues, $sModulesDir = null, $bPreserveModuleSettings = false)
|
||||
{
|
||||
if (isset($aParamValues['application_path']))
|
||||
@@ -2042,9 +2085,13 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper: for an array of string, change the prefix when found
|
||||
*/
|
||||
/**
|
||||
* Helper: for an array of string, change the prefix when found
|
||||
*
|
||||
* @param array $aStrings
|
||||
* @param string $sSearchPrefix
|
||||
* @param string $sNewPrefix
|
||||
*/
|
||||
protected static function ChangePrefix(&$aStrings, $sSearchPrefix, $sNewPrefix)
|
||||
{
|
||||
foreach ($aStrings as &$sFile)
|
||||
@@ -2056,10 +2103,13 @@ class Config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Obsolete: kept only for backward compatibility of the Toolkit
|
||||
* Quick and dirty way to clone a config file into another environment
|
||||
*/
|
||||
/**
|
||||
* Obsolete: kept only for backward compatibility of the Toolkit
|
||||
* Quick and dirty way to clone a config file into another environment
|
||||
*
|
||||
* @param string $sSourceEnv
|
||||
* @param string $sTargetEnv
|
||||
*/
|
||||
public function ChangeModulesPath($sSourceEnv, $sTargetEnv)
|
||||
{
|
||||
// Now does nothing since the includes are built into the environment itself
|
||||
@@ -2096,5 +2146,3 @@ class Config
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user