Sort XML
Generates XML for sort

@param Array $sort array('<col>' => 'asc | desc')
@return XML DATA
979043
private function sortXML (array $sort) {
		// On no count, no need to sort
		if (count($sort) == 0) {
			return '';
		}

		$queryString = '';
		foreach ($sort as $col => $value) {
			$queryString .= '<FieldRef Name="' . $col . '" Ascending="' . $this->getSortFromValue($value) . '" />';
		}
		return '<OrderBy>' . $queryString . '</OrderBy>';
	}
905334
public function sort(array $sorting)
    {
        foreach ($sorting as $key => $value) {
            $column = isset($this->sortMapping[$key])
                ? $this->sortMapping[$key]
                : current($this->qb->getRootAliases()) . '.' . $key;

            $this->qb->addOrderBy($column, $value);
        }
    }
1110117
public function aSort($sort = null)
    {
        if ($sort !== null && ! is_int($sort)) {
            throw new \InvalidArgumentException(
                'Invalid sort type. Sort type must ne integer.',
                E_USER_ERROR
            );
        }

        return $sort === null
            ? asort($this->storedData)
            : asort($this->storedData, $sort);
    }
832411
public function sort(Sorting $sorting)
	{
		if (is_callable($sorting->getSortCallback())) {
			call_user_func(
				$sorting->getSortCallback(),
				$this->data_source,
				$sorting->getSort()
			);

			return $this;
		}

		$sort = $sorting->getSort();

		if (!empty($sort)) {
			$this->data_source->getSqlBuilder()->setOrder([], []);

			foreach ($sort as $column => $order) {
				$this->data_source->order("$column $order");
			}
		} else {
			/**
			 * Has the statement already a order by clause?
			 */
			if (!$this->data_source->getSqlBuilder()->getOrder()) {
				$this->data_source->order($this->primary_key);
			}
		}

		return $this;
	}
393699
public function generateFromArray(array $data)
    {
        $xml = $this->processGenerate($this->rootName, $data);
        $this->createPiNode();
        $this->getDomDocument()->appendChild($xml);
        $xml = $this->getDomDocument()->saveXML();

        $this->flush();

        return $xml;
    }
1120025
public static function actionMenu($sort = '')
    {
        $group_id = \Yii::$app->request->get('group_id');

        $order = ExtHelpers::getOrder($sort, [
            'menu_id',
            'parent_id',
            'text',
            'title',
            'url',
            'view_package',
            'expanded',
            'closable',
            'is_open_url',
            'is_open_target',
            'is_every_open',
            'is_hide',
            'display_order',
            'note',
            'status',
        ], [], 'menu_id DESC');
        $tree = DpAdminMenu::getGroupMenuTreeByParentId($group_id, null, $order);

        return [
            'children' => $tree,
        ];
    }
221582
public function sortRecords(array $sorting)
    {
        if (!$this->writeConnection) {
            throw new AnyContentClientException ('Current connection(s) doesn\'t support write operations.');
        }

        $records = $records = $this->getRecords();
        foreach ($records as $record) {
            $record->setPosition(null);
            $record->setParent(null);
        }

        $positions = [];
        foreach ($sorting as $recordId => $parentId) {
            if (!array_key_exists($parentId, $positions)) {
                $positions[$parentId] = 1;
            }

            $records[$recordId]->setPosition($positions[$parentId]++);
            $records[$recordId]->setParent($parentId);
        }

        return $this->saveRecords($records);
    }
27287
public function fetchAll($sort = null)
    {
        $select = $this->getSelect();
        $select = $this->setSortOrder($select, $sort);

        $resultSet = $this->fetchResult($select);

        return $resultSet;
    }
594879
public function setSort($sort = null)
    {
        $sort = $sort && is_array($sort) ? $sort : $this->config->getOption('sort');

        //set the sort values
        $this->sort = array(
            'field'     => isset($sort['field']) ? $sort['field'] : $this->config->getDataModel()->getKeyName(),
            'direction' => isset($sort['direction']) ? $sort['direction'] : 'desc',
        );

        //if the sort direction isn't valid, set it to 'desc'
        if (!in_array($this->sort['direction'], array('asc', 'desc'))) {
            $this->sort['direction'] = 'desc';
        }
    }
890660
protected function applySorting($sort)
    {
        if (is_array($sort)) {
            array_map([$this, 'applySorting'], $sort);
            return;
        }

        if (!strpos($sort, ':')) {
            $this->sort($sort, CanSort::ASC);
            return;
        }

        list($key, $direction) = explode(':', $sort, 2);

        $this->sort($key, $direction);

    }
1289453
public function setSorts(array $sorts)
    {
        $this->sorts = array();

        foreach ($sorts as $sort) {
            $this->addSort($sort);
        }
        
        return $this;
    }
404505
public function getList($sort = 'name')
    {
        $sites = $this->entityManager->getRepository('Concrete\Core\Entity\Site\Site')
            ->findAll();
        $list = [];
        $factory = new Factory($this->config);
        foreach ($sites as $site) {
            $list[] = $factory->createEntity($site);
        }

        switch ($sort) {
            case 'name':
                $comparer = new Comparer();
                usort($list, function ($siteA, $siteB) use ($comparer) {
                    return $comparer->compare($siteA->getSiteName(), $siteB->getSiteName());
                });
                break;
        }

        return $list;
    }
92952
protected function _load(array $filter, array $sort)
    {
        $result = array();
        foreach ($this->getItemsOrdered() as $item) {
            $result[0][$item] = $item;
        }
        return $result;
    }
1288945
public function sort(array $sorts = array())
    {
        if (func_num_args() === 0) {
            return $this->sorts;
        }

        $this->sorts = array();

        foreach ($sorts as $key => $value) {
            if ($key[0] === '$') {
                $key[0] = '_';
            }

            $this->sorts[$key] = $value;
        }

        return $this;
    }
64692
public function sort(string $sort): SectionTwigExtension
    {
        $this->options[ReadOptions::SORT] = $sort;

        return $this;
    }
282808
private function appendSort($sort)
    {
        $column = $sort;
        $direction = 'asc';

        if ($sort[0] == '-') {
            $column = substr($sort, 1);
            $direction = 'desc';
        }

        $this->sort[] = [
            'column'    => $column,
            'direction' => $direction,
        ];
    }
678558
public function sort(array $sort = null) {
        if ($sort === null) {
            return $this->sort;
        }

        $this->sort = $sort;

        return $this;
    }