Populate the childrenCIDArray property (called by the getCollectionChildrenArray() method).

@param int $cID
@param bool $oneLevelOnly
@param string $sortColumn
178564
protected function _getNumChildren($cID, $oneLevelOnly = 0, $sortColumn = 'cDisplayOrder asc')
    {
        $db = Database::connection();
        $q = "select cID from Pages where cParentID = {$cID} and cIsTemplate = 0 order by {$sortColumn}";
        $r = $db->query($q);
        if ($r) {
            while ($row = $r->fetchRow()) {
                if ($row['cID'] > 0) {
                    $this->childrenCIDArray[] = $row['cID'];
                    if (!$oneLevelOnly) {
                        $this->_getNumChildren($row['cID']);
                    }
                }
            }
        }
    }
672988
public function addGroupBy($column, $sort = null)
        {
            if (is_array($column)) {
                foreach ($column as $single_column) {
                    $this->addGroupBy($single_column[0], $single_column[1]);
                }
            } else {
                $this->sort_groups[] = new QueryColumnSort($column, $sort);
            }

            return $this;
        }
202822
public static function keyedAssocToHierarchical($data, $sortKeys = self::DO_NOT_SORT_KEYS)
    {
        if(self::SORT_KEYS == $sortKeys){
            ksort($data);
        }
        $result = array();
        foreach($data as $key=>$value){
            if($value!==null){
                $keys = explode('.',$key);
                $node = $value;
                for($i = count($keys); $i>0; $i--){
                    $k = $keys[$i-1];
                    $node = array($k => $node);
                }
                $result = array_merge_recursive($result, $node);
            }
        }

        return $result;
    }
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;
            }
        }
    }
86863
public function getFirstChild($sortColumn = 'cDisplayOrder asc')
    {
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $now = $app->make('date')->getOverridableNow();
        $cID = $db->fetchColumn(
            <<<EOT
select
    Pages.cID
from
    Pages
    inner join CollectionVersions
        on Pages.cID = CollectionVersions.cID
where
    cParentID = ?
    and cvIsApproved = 1 and (cvPublishDate is null or cvPublishDate <= ?) and (cvPublishEndDate is null or cvPublishEndDate >= ?)
order by
    {$sortColumn}
EOT
            ,
            [$this->cID, $now, $now]
        );
        if ($cID && $cID != $this->getSiteHomePageID()) {
            return self::getByID($cID, 'ACTIVE');
        }

        return false;
    }
1101500
public function assignFilteredChildNodes(NodeInterface $node, array $matchedNodes, $outputStyle = self::STYLE_LIST)
    {
        $this->outputStyle = $outputStyle;
        $nodes = $this->collectParentNodeData($node, $matchedNodes);
        $this->setConfiguration(['value' => ['data' => ['_descendAll' => []]]]);

        $this->assign('value', ['data' => $nodes, 'success' => true]);
    }
1302227
public function clientMove($clid, $cid, $cpw = null)
  {
    $this->clientListReset();

    $this->execute("clientmove", array("clid" => $clid, "cid" => $cid, "cpw" => $cpw));

    if($clid instanceof Node)
    {
      $clid = $clid->getId();
    }

    if($cid instanceof Node)
    {
      $cid = $cid->getId();
    }

    if(!is_array($clid) && $clid == $this->whoamiGet("client_id"))
    {
      $this->getParent()->whoamiSet("client_channel_id", $cid);
    }
  }
929350
public static function applySorting($pagelist, $sortOrder = null, $sortBy = null)
    {
        // sort order
        if (isset($sortOrder)) {
            switch ($sortOrder) {
                case 'asc':
                    $sortOrder = 1;
                    break;

                case 'desc':
                    $sortOrder = -1;
                    break;

                default:
                    $sortOrder = 1;
                    break;
            }
        }

        if (!isset($sortBy)) {
            $sortBy = 'name';
        }

        // sort key
        usort(
            $pagelist,
            function ($a, $b) use ($sortBy, $sortOrder) {
                if (isset($sortBy)) {
                    if (is_array($sortBy)) {
                        $key = key($sortBy);
                        $value = reset($sortBy);
                        if (isset($a->$key)) {
                            $temp = $a->$key;
                            if (isset($temp[$value])) {
                                $a = $temp[$value];
                            }
                        } else {
                            $a = 0;
                        }
                        if (isset($b->$key)) {
                            $temp = $b->$key;
                            if (isset($temp[$value])) {
                                $b = $temp[$value];
                            }
                        } else {
                            $b = 0;
                        }
                    } else {
                        $a = $a->{$sortBy};
                        $b = $b->{$sortBy};
                    }
                }

                if ($a == $b) {
                    return 0;
                }
                $compareResult = ($a < $b) ? 1 : -1;

                return $sortOrder * $compareResult;
            }
        );

        return $pagelist;
    }
545303
public function sort(Sorting $sorting)
	{
		if (is_callable($sorting->getSortCallback())) {
			$data = call_user_func(
				$sorting->getSortCallback(),
				$this->data,
				$sorting->getSort()
			);

			if (!is_array($data)) {
				throw new DataGridArrayDataSourceException('Sorting callback has to return array');
			}

			$this->setData($data);

			return $this;
		}

		$sort = $sorting->getSort();

		foreach ($sort as $column => $order) {
			$data = [];

			foreach ($this->data as $item) {
				if (is_object($item[$column]) && $item[$column] instanceof \DateTimeInterface) {
					$sort_by = $item[$column]->format('Y-m-d H:i:s');
				} else {
					$sort_by = (string) $item[$column];
				}
				$data[$sort_by][] = $item;
			}

			if ($order === 'ASC') {
				ksort($data);
			} else {
				krsort($data);
			}

			$data_source = [];

			foreach ($data as $i) {
				foreach ($i as $item) {
					$data_source[] = $item;
				}
			}

			$this->setData($data_source);
		}

		return $this;
	}
1236045
private static function getAnchorClass($sortColumn, &$anchorAttributes = [])
    {
        $class = [];

        $anchorClass = config('columnsortable.anchor_class', null);
        if ($anchorClass !== null) {
            $class[] = $anchorClass;
        }

        $activeClass = config('columnsortable.active_anchor_class', null);
        if ($activeClass !== null && self::shouldShowActive($sortColumn)) {
            $class[] = $activeClass;
        }

        $directionClassPrefix = config('columnsortable.direction_anchor_class_prefix', null);
        if ($directionClassPrefix !== null && self::shouldShowActive($sortColumn)) {
            $class[] = $directionClassPrefix.(request()->get('direction') === 'asc' ? config('columnsortable.asc_suffix', '-asc') :
                    config('columnsortable.desc_suffix', '-desc'));
        }

        if (isset($anchorAttributes['class'])) {
            $class = array_merge($class, explode(' ', $anchorAttributes['class']));
            unset($anchorAttributes['class']);
        }

        return (empty($class)) ? '' : ' class="'.implode(' ', $class).'"';
    }
70358
public function addOrderBy($column, $sort = null)
        {
            if (is_array($column)) {
                foreach ($column as $single_column) {
                    $this->addOrderBy($single_column[0], $single_column[1]);
                }
            } else {
                $this->sort_orders[] = new QueryColumnSort($column, $sort);
            }

            return $this;
        }
560640
private function applyMultiSort(array $data, array $sortArguments)
    {
        $args = [];
        foreach ($sortArguments as $values) {
            $remain = count($values) % 3;
            if ($remain != 0) {
                throw new \InvalidArgumentException(
                    'The parameter count for each sortArgument has to be three. Given count of: ' . count($values)
                );
            }
            $args[] = $values[0]; // column value
            $args[] = $values[1]; // sort direction
            $args[] = $values[2]; // sort type
        }

        $args[] = $data;

        //possible 5.3.3 fix?
        $sortArgs = [];
        foreach ($args as $key => &$value) {
            $sortArgs[$key] = &$value;
        }

        call_user_func_array('array_multisort', $sortArgs);

        return end($args);
    }
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;
    }
1093536
public function setItemSorting($sortIdent, $sortBy, $sortDir = null)
    {
        $sorting = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('aSorting');
        $sorting[$sortIdent]['sortby'] = $sortBy;
        $sorting[$sortIdent]['sortdir'] = $sortDir ? $sortDir : null;

        \OxidEsales\Eshop\Core\Registry::getSession()->setVariable('aSorting', $sorting);
    }
578999
public function findAllForDataTables($search, $sortColumn, $sortDirection, $roles)
    {
        // select
        $qb = $this->getQueryBuilder()
            ->select('u.id, u.email, u.name, u.lastname, i.path actorImage');

        // join
        $qb->leftJoin('u.roles', 'r');
        $qb->leftJoin('u.image', 'i');
                
        $x=0;
        if(count($roles)>0){
            foreach ($roles as $role) {
                $x++;
                if($x == 1){
                    $qb->where('r.role = :role'.$x)
                        ->setParameter('role'.$x, $role);
                }else{
                    $qb->orWhere('r.role = :role'.$x)
                        ->setParameter('role'.$x, $role);
                }
                
            }
        }
                
        // search
        if (!empty($search)) {
            // where('u.email LIKE :search')
            $qb->where('u.email LIKE :search')
                ->orWhere('u.name LIKE :search')
                ->orWhere('u.lastname LIKE :search')
                
                ->setParameter('search', '%'.$search.'%');
        }

        // sort by column
        switch($sortColumn) {
            case 0:
                $qb->orderBy('u.id', $sortDirection);
                break;
            case 2:
                $qb->orderBy('u.email', $sortDirection);
                break;
            case 3:
                $qb->orderBy('u.name', $sortDirection);
                break;
            case 4:
                $qb->orderBy('u.lastname', $sortDirection);
                break;
        }

        return $qb->getQuery();
    }
503944
public function getChildrenByStatus(
        $node = null,
        $direct = false,
        $sortByField = null,
        $direction = 'ASC',
        $includeNode = false,
        $viewStatus = Page::STATUS_PUBLISHED
    ) {
        $qb = $this->childrenQueryBuilder($node, $direct, $sortByField, $direction, $includeNode);
        $aliases = $qb->getRootAliases();
        if ($viewStatus == Page::STATUS_PUBLISHED) {
            $orx = $qb->expr()->orX();
            $conditionA = $qb->expr()->in('ps.id', $this->getLatestSnapshotIds());
            $conditionB = $qb->expr()->isNull('ps.id');
            $orx->addMultiple([$conditionA, $conditionB]);
            $qb->addSelect('ps.id AS ps_id')
                ->addSelect('ps.versionedData AS ps_versionedData')
                ->leftJoin(PageSnapshot::class,
                    'ps',
                    Expr\Join::WITH,
                    sprintf('%s.page = ps.page ', $aliases[0])
                )
                ->andWhere($orx)
                ->leftJoin('ps.contentRoute', 'cr');
        } else {
            $qb->leftJoin(sprintf('%s.page', $aliases[0]), 'p')
                ->leftJoin('p.contentRoute', 'cr')
                ->addSelect('p');
        }
        $qb->addSelect('cr.path AS path');
        $results = $qb->getQuery()->getResult();

        $menuItems = [];
        foreach ($results as $item) {
            $menuItem = $item[0];
            if ($menuItem->getPage()) {
                if ($viewStatus == Page::STATUS_PUBLISHED) {
                    if (!$item['path'] || !$item['ps_id']) {
                        continue;
                    } else {
                        if (!$this->pageHelper->jsonPageIsActive($item['ps_versionedData'])) {
                            continue;
                        }
                        $menuItem->setPath($item['path']);
                    }
                } else {
                    if (!$item['path']) {
                        continue;
                    } else {
                        $menuItem->setPath($item['path']);
                    }
                }
            }
            $menuItems[] = $menuItem;
        }

        return $menuItems;
    }
947044
protected function getCollection(Select $sql, $cid)
    {
        $this->triggerBeforeSelect(
            $sql,
            $this->getRepository()->getEntityDescriptor()
        );
        $data = $this->adapter->query($sql, $sql->getParameters());
        $collection = $this->repository->getEntityMapper()
            ->createFrom($data);
        $this->triggerAfterSelect(
            $data,
            $collection
        );
        $this->registerEventsTo($collection, $cid);
        $this->getCollectionsMap()->set($cid, $collection);
        $this->updateIdentityMap($collection);
        
        return $collection;
    }