Check node for child.
@param array $rows
@param int $id parent id
@return bool
329769
private function hasChild($rows, $id)
    {
        foreach ($rows as $row) {
            if ($row['parent_id'] == $id) {
                return true;
            }
        }

        return false;
    }
1068491
public function hasChildNodes($dsId = null)
    {
        if (!$dsId) {
            // use root as default
            $dsId = $this->rootDsId;
        }

        $childrenDsIds = $this->getChildrenDsIds($dsId);
        $hasChildren = count($childrenDsIds) > 0;

        return $hasChildren;
    }
78804
public function findOrFail($id, $columns = ['*'])
    {
        if (Uuid::validate($id)) {
            return $this->findOrFailByUuid($id, $columns);
        } else {
            return parent::findOrFail($id, $columns);
        }
    }
1364071
function (e, id) {
	if (!e) {
		return false;
	}
	else {
		var el = e.target || e.srcElement || e || false;
		while (el && el.id !== id) {
			el = el.parentNode || false;
		}
		return (el !== false);
	}
}
1307491
public function hasParent($id, $direct = true)
    {
        if ($numOfParents = $this->getNumOfParent($idParent, $direct)) {
            return (bool)($numOfParents == 0 ? false : true);
        }

        return false;
    }
459459
public function addRow($id, $cells = array(), $replace = false)
    {
        $returnValue = (bool) false;

        
		if(!$replace && isset($this->rows[$id])){
			throw new common_Exception('the row with the id '.$id.' already exists');
		}else{
			$this->rows[$id] = $cells;
			//@TODO: implement a sort funciton?

			$returnValue = true;
		}
        

        return (bool) $returnValue;
    }
316202
public function hasChilds($idParent)
    {
        if ($numOfChilds = $this->getNumOfChilds($idParent)) {
            return (bool)($numOfChilds == 0 ? false : true);
        }

        return false;
    }
1217678
private function nestedNodeExists(&$array, $parent_id, $child) {
		foreach ($array as &$a) {
			if ($a->id == $parent_id) {
				$a->children[] = $child;
				return true;
			} elseif (count($a->children) && self::nestedNodeExists($a->children, $parent_id, $child)) {
				return true;
			}
		}
		return false;
	}
191223
public function isBlockedBy($id): bool
    {
        if (is_array($id)) {
            return count($id) === $this->blockerUsers()->whereIn('blocker_id', $id)->count();
        }

        return $this->blockerUsers()->where('blocker_id', $id)->exists();
    }
318068
protected function getCheckedState($row, $data)
	{
		return ($this->value === null)
			? CHtml::value($data, $this->name)
			: $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row));
	}
1362630
private function _getAncectors($id)
    {
        $nodes = [];
        foreach ($this->_tree as $key => $value) {
            if ($value['id'] == $id) {
                $nodes[] = $value;
                if ($value[$this->_parentSign] != 0) {
                    $nodes = array_merge($nodes, $this->_getAncectors($value[$this->_parentSign]));
                }
            }
        }
        return $nodes;
    }
23307
public function removeChildById($id)
	{
		if(isset($this->id2index[$id]))
		{
			$tmp = $this->children[$this->id2index[$id]];
			if(isset($tmp->name))
				unset($this->name2index[$tmp->name]);
			unset($this->children[$this->id2index[$id]], $this->id2index[$id]);
			return $tmp;
		}
		return null;
	}
740380
public function getParents($id)
    {
        $nodes = [];
        $tree = array_column($this->_tree, null, 'id');//var_dump($tree);exit;
        foreach ($tree as $key => $value) {
            if ($tree[$id][$this->_parentSign] == $value['id']) {
                $nodes[] = $value;
            }
        }
        return $nodes;
    }
941432
public function checkChildren($table, array $row, $level, array &$theData, DatabaseRecordListXclass $parentObj)
    {
        if ($table === 'tt_content' && $row['CType'] === 'gridelements_pi1') {
            $elementChildren = Helper::getInstance()->getChildren(
                $table,
                $row['uid'],
                $row['pid'],
                '',
                0,
                $parentObj->selFieldList
            );
            if (!empty($elementChildren)) {
                $theData['_EXPANDABLE_'] = true;
                $theData['_EXPAND_ID_'] = $table . ':' . $row['uid'];
                $theData['_EXPAND_TABLE_'] = $table;
                $theData['_LEVEL_'] = $level;
                $theData['_CHILDREN_'] = $elementChildren;
            }
        }
    }
1263988
public function getChilds($idParent, $ordering = 'ASC')
    {
        if ($childs = $this->qb
            ->select($this->table . '.*')
            ->from($this->table)
            ->from($this->table . ' AS node')
            ->whereBetween('node.record_left', [$this->table . '.record_left', $this->table . '.record_right'])
            ->where([
                $this->table . '.id' => $id,
            ])
            ->get()) {
            if ($childs->count()) {
                return $childs;
            }
        }

        return false;
    }
1121723
private boolean containsElmentWithId(Node node, String id) {
        String nodeName = node.getNodeName();
        if ("channel".equals(nodeName) || "folder".equals(nodeName)) {
            Element e = (Element) node;
            if (id.equals(e.getAttribute("ID"))) {
                return true;
            }
            if ("folder".equals(nodeName)) {
                for (Node child = e.getFirstChild();
                        child != null;
                        child = child.getNextSibling()) {
                    if (containsElmentWithId(child, id)) {
                        return true;
                    }
                }
            }
        }
        return false;
    }
1325944
def check_node_parent(
        self, resource_id, new_parent_id, db_session=None, *args, **kwargs
    ):
        
        return self.service.check_node_parent(
            resource_id=resource_id,
            new_parent_id=new_parent_id,
            db_session=db_session,
            *args,
            **kwargs
        )