Lists immediate neighbours.
<?php $arNeighbours = ThisClass::ListImmediateNeighbours (1); var_dump ($arNeighbours); ?>
<?php
{
public static function Unlink ($parentNodeId, $childNodeId);
public static function SetProperty ($parentNodeId, $childNodeId, $propertyName, $value);
public static function GetProperty ($parentNodeId, $childNodeId, $propertyName);
}
{
private static $arNodesCache =
array();
private static $nodesCached = 0;
{
return (self::_ListImmediateNeighbours ($nodeId, self::NBRS_IMDT_PARENTS));
}
{
return (self::_ListImmediateNeighbours ($nodeId, self::NBRS_IMDT_CHILDS));
}
{
return (self::_ListImmediateNeighbours ($nodeId, self::NBRS_IMDT_PARENTS | self::NBRS_IMDT_CHILDS));
}
{
if ($bitmaskSearchMode & self::NBRS_IMDT_PARENTS)
$arWhere[] = "TARGET_NODE='" . (int) ($nodeId + 0) . "'";
if ($bitmaskSearchMode & self::NBRS_IMDT_CHILDS)
$arWhere[] = "SOURCE_NODE='" . (int) ($nodeId + 0) . "'";
$sqlWhere = implode (' OR ', $arWhere);
if ($sqlWhere == '')
{
throw new LearnException ('EA_PARAMS: nothing to search (check search mode bitmask);',
}
if ( ! array_key_exists($sqlWhere, self::$arNodesCache) )
{
"SELECT SOURCE_NODE, TARGET_NODE, SORT
FROM b_learn_lesson_edges
WHERE " . $sqlWhere,
$ignore_errors = true);
if ($rc === false)
while ($arData = $rc->Fetch())
{
'SOURCE_NODE' => $arData['SOURCE_NODE'],
'TARGET_NODE' => $arData['TARGET_NODE'],
'PARENT_LESSON' => $arData['SOURCE_NODE'],
'CHILD_LESSON' => $arData['TARGET_NODE'],
'SORT' => (int) $arData['SORT']
);
}
if (self::$nodesCached < 1024)
{
++self::$nodesCached;
self::$arNodesCache[$sqlWhere] =
$result;
}
}
else
$result = self::$arNodesCache[$sqlWhere];
}
{
self::$arNodesCache =
array();
self::$nodesCached = 0;
&& ($parentNodeId > 0)
&& ($childNodeId > 0);
else
$args_check = false;
if ( ! $args_check )
{
throw new LearnException (
'EA_PARAMS: ' . $parentNodeId .
' / ' . $childNodeId .
' / ' . var_export(
$arProperties,
true),
}
{
$parentNodeId += 0;
$childNodeId += 0;
}
"INSERT INTO b_learn_lesson_edges (SOURCE_NODE, TARGET_NODE, SORT)
VALUES ('" . $parentNodeId . "', '" . $childNodeId . "', '" . $sort . "')",
$ignore_errors = true);
if ($rc === false)
}
public static function Unlink ($parentNodeId, $childNodeId)
{
self::$arNodesCache =
array();
self::$nodesCached = 0;
$args_check = ($parentNodeId > 0) && ($childNodeId > 0);
if ( ! $args_check )
$parentNodeId += 0;
$childNodeId += 0;
"DELETE FROM b_learn_lesson_edges
WHERE SOURCE_NODE = '" . $parentNodeId . "'
AND TARGET_NODE = '" . $childNodeId . "'",
$ignore_errors = true);
if ($rc === false)
if ($rc->AffectedRowsCount() == 0)
}
public static function SetProperty ($parentNodeId, $childNodeId, $propertyName, $value)
{
self::$arNodesCache =
array();
self::$nodesCached = 0;
$args_check = ($parentNodeId > 0) && ($childNodeId > 0)
&& ( in_array ($propertyName,
array(
'SORT'),
true) );
if ($propertyName === 'SORT')
{
$args_check = $args_check && is_numeric ($value) && is_int ($value + 0);
}
if ( ! $args_check )
$parentNodeId += 0;
$childNodeId += 0;
switch ($propertyName)
{
case 'SORT':
break;
default:
throw new LearnException ('EA_PARAMS: unknown property name: '
break;
}
"WHERE SOURCE_NODE='" . $parentNodeId . "'
AND TARGET_NODE='" . $childNodeId . "'", __LINE__, false,
false);
if ($rc === false)
}
public static function GetProperty ($parentNodeId, $childNodeId, $propertyName)
{
$args_check = ($parentNodeId > 0) && ($childNodeId > 0)
&& ( in_array ($propertyName,
array(
'SORT'),
true) );
if ( ! $args_check )
$parentNodeId += 0;
$childNodeId += 0;
switch ($propertyName)
{
case 'SORT':
$field = 'SORT';
break;
default:
throw new LearnException ('EA_PARAMS: unknown property name: '
break;
}
"SELECT " . $field . "
FROM b_learn_lesson_edges
WHERE SOURCE_NODE='" . $parentNodeId . "'
AND TARGET_NODE='" . $childNodeId . "'",
$ignore_errors = true);
if ($rc === false)
if ( ! (($arData = $rc->Fetch()) && isset($arData[$field])) )
switch ($propertyName)
{
case 'SORT':
$rc = (int) $arData[$field];
break;
default:
throw new LearnException ('EA_PARAMS: unknown property name: '
break;
}
return ($rc);
}
}
static GetProperty($parentNodeId, $childNodeId, $propertyName)
static SetProperty($parentNodeId, $childNodeId, $propertyName, $value)
static Link($parentNodeId, $childNodeId, $arProperties)
static ListImmediateNeighbours($nodeId)
static Unlink($parentNodeId, $childNodeId)
static ListImmediateChilds($nodeId)
static ListImmediateParents($nodeId)
static _ListImmediateNeighbours($nodeId, $bitmaskSearchMode)
const EXC_ERR_GR_SET_PROPERTY
const EXC_ERR_GR_GET_NEIGHBOURS
const EXC_ERR_GR_GET_PROPERTY
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
static GetProperty($parentNodeId, $childNodeId, $propertyName)
static SetProperty($parentNodeId, $childNodeId, $propertyName, $value)
static Link($parentNodeId, $childNodeId, $arProperties)
static ListImmediateNeighbours($nodeId)
static Unlink($parentNodeId, $childNodeId)
static ListImmediateChilds($nodeId)
static ListImmediateParents($nodeId)
</p ></td >< td valign=top style='border-top:none;border-left:none;border-bottom:solid windowtext 1.0pt;border-right:solid windowtext 1.0pt;padding:0cm 2.0pt 0cm 2.0pt;height:9.0pt'>< p class=Normal align=center style='margin:0cm;margin-bottom:.0001pt;text-align:center;line-height:normal'>< a name=ТекстовоеПоле54 ></a ><?=($taxRate > count( $arTaxList) > 0) ? $taxRate."%"
if( $site[ 'SERVER_NAME']==='') if($site['SERVER_NAME']==='') $arProperties