mirror of
https://github.com/Combodo/iTop.git
synced 2026-04-22 10:08:45 +02:00
Add some PHPDoc, fix some syntax (thanks to SonarLint !)
SVN:trunk[5188]
This commit is contained in:
@@ -43,6 +43,7 @@ require_once(APPROOT.'/application/utils.inc.php');
|
||||
class DisplayBlock
|
||||
{
|
||||
const TAG_BLOCK = 'itopblock';
|
||||
/** @var \DBSearch */
|
||||
protected $m_oFilter;
|
||||
protected $m_aConditions; // Conditions added to the filter -> avoid duplicate conditions
|
||||
protected $m_sStyle;
|
||||
@@ -74,10 +75,17 @@ class DisplayBlock
|
||||
{
|
||||
return $this->m_oFilter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a DisplayBlock object from a DBObjectSet already in memory
|
||||
* @param $oSet DBObjectSet
|
||||
*
|
||||
* @param DBObjectSet $oSet
|
||||
* @param string $sStyle
|
||||
* @param array $aParams
|
||||
*
|
||||
* @return DisplayBlock The DisplayBlock object, or null if the creation failed
|
||||
* @throws \CoreException
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function FromObjectSet(DBObjectSet $oSet, $sStyle, $aParams = array())
|
||||
{
|
||||
@@ -1104,10 +1112,19 @@ EOF
|
||||
}
|
||||
return $sHtml;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a condition (restriction) to the current DBSearch on which the display block is based
|
||||
* taking into account the hierarchical keys for which the condition is based on the 'below' operator
|
||||
*
|
||||
* @param string $sFilterCode
|
||||
* @param array $condition
|
||||
* @param string $sOpCode
|
||||
* @param bool $bParseSearchString
|
||||
*
|
||||
* @throws \CoreException
|
||||
* @throws \CoreWarning
|
||||
* @throws \Exception
|
||||
*/
|
||||
protected function AddCondition($sFilterCode, $condition, $sOpCode = null, $bParseSearchString = false)
|
||||
{
|
||||
@@ -1336,15 +1353,25 @@ EOF
|
||||
* For backward compatibility 'popup' is equivalent to 'list'...
|
||||
*/
|
||||
class MenuBlock extends DisplayBlock
|
||||
{
|
||||
{
|
||||
/**
|
||||
* Renders the "Actions" popup menu for the given set of objects
|
||||
*
|
||||
*
|
||||
* Note that the menu links containing (or ending) with a hash (#) will have their fragment
|
||||
* part (whatever is after the hash) dynamically replaced (by javascript) when the menu is
|
||||
* displayed, to correspond to the current hash/fragment in the page. This allows modifying
|
||||
* an object in with the same tab active by default as the tab that was active when selecting
|
||||
* the "Modify..." action.
|
||||
*
|
||||
* @param \WebPage $oPage
|
||||
* @param array $aExtraParams
|
||||
* @param string $sId
|
||||
*
|
||||
* @return string
|
||||
* @throws \DictExceptionMissingString
|
||||
* @throws \Exception
|
||||
* @throws \MissingQueryArgument
|
||||
* @throws \MySQLException
|
||||
*/
|
||||
public function GetRenderContent(WebPage $oPage, $aExtraParams = array(), $sId)
|
||||
{
|
||||
|
||||
@@ -294,7 +294,10 @@ abstract class DBSearch
|
||||
*/
|
||||
static public function FromOQL($sQuery, $aParams = null)
|
||||
{
|
||||
if (empty($sQuery)) return null;
|
||||
if (empty($sQuery))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Query caching
|
||||
$sQueryId = md5($sQuery);
|
||||
@@ -366,7 +369,10 @@ abstract class DBSearch
|
||||
{
|
||||
$sSQL = $this->MakeSelectQuery($aOrderBy, $aArgs);
|
||||
$resQuery = CMDBSource::Query($sSQL);
|
||||
if (!$resQuery) return;
|
||||
if (!$resQuery)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (count($aColumns) == 0)
|
||||
{
|
||||
@@ -682,7 +688,10 @@ abstract class DBSearch
|
||||
|
||||
public static function RecordQueryTrace()
|
||||
{
|
||||
if (!self::$m_bTraceQueries) return;
|
||||
if (!self::$m_bTraceQueries)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
$iOqlCount = count(self::$m_aQueriesLog);
|
||||
$iSqlCount = 0;
|
||||
@@ -720,6 +729,7 @@ abstract class DBSearch
|
||||
{
|
||||
// Merge the new queries into the existing log
|
||||
include($sAllQueries);
|
||||
$aQueriesLog = array();
|
||||
foreach (self::$m_aQueriesLog as $sQueryId => $aOqlData)
|
||||
{
|
||||
if (!array_key_exists($sQueryId, $aQueriesLog))
|
||||
@@ -738,7 +748,10 @@ abstract class DBSearch
|
||||
|
||||
protected static function DbgTrace($value)
|
||||
{
|
||||
if (!self::$m_bDebugQuery) return;
|
||||
if (!self::$m_bDebugQuery)
|
||||
{
|
||||
return;
|
||||
}
|
||||
$aBacktrace = debug_backtrace();
|
||||
$iCallStackPos = count($aBacktrace) - self::$m_bDebugQuery;
|
||||
$sIndent = "";
|
||||
@@ -754,11 +767,7 @@ abstract class DBSearch
|
||||
$sCallers = "Callstack: ".implode(', ', $aCallers);
|
||||
$sFunction = "<b title=\"$sCallers\">".$aBacktrace[1]["function"]."</b>";
|
||||
|
||||
if (is_string($value))
|
||||
{
|
||||
echo "$sIndent$sFunction: $value<br/>\n";
|
||||
}
|
||||
else if (is_object($value))
|
||||
if (is_object($value))
|
||||
{
|
||||
echo "$sIndent$sFunction:\n<pre>\n";
|
||||
print_r($value);
|
||||
@@ -814,7 +823,10 @@ abstract class DBSearch
|
||||
$aUpdates = array();
|
||||
foreach (MetaModel::EnumParentClasses($sFinalClass, ENUM_PARENT_CLASSES_ALL) as $sParentClass)
|
||||
{
|
||||
if (!MetaModel::IsValidAttCode($sParentClass, 'archive_flag')) continue;
|
||||
if (!MetaModel::IsValidAttCode($sParentClass, 'archive_flag'))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
$sTable = MetaModel::DBGetTable($sParentClass);
|
||||
$aUpdates[] = "`$sTable`.`archive_flag` = $iFlag";
|
||||
|
||||
@@ -85,6 +85,7 @@ class OqlInterpreter
|
||||
|
||||
/**
|
||||
* @return OqlQuery
|
||||
* @throws \OQLException
|
||||
*/
|
||||
public function ParseQuery()
|
||||
{
|
||||
|
||||
@@ -283,10 +283,10 @@ abstract class OqlQuery
|
||||
/**
|
||||
* Check the validity of the expression with regard to the data model
|
||||
* and the query in which it is used
|
||||
*
|
||||
* @param ModelReflection $oModelReflection MetaModel to consider
|
||||
* @throws OqlNormalizeException
|
||||
*/
|
||||
*
|
||||
* @param ModelReflection $oModelReflection MetaModel to consider
|
||||
* @param string $sSourceQuery
|
||||
*/
|
||||
abstract public function Check(ModelReflection $oModelReflection, $sSourceQuery);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user