Returns object with ordering information (order articles list).

@param int $iLimit how many entries to load
@param int $iPage  which page to start

@return oxList
323107
public function getOrders($iLimit = false, $iPage = 0)
    {
        $oOrders = oxNew(\OxidEsales\Eshop\Core\Model\ListModel::class);
        $oOrders->init('oxorder');

        if ($iLimit !== false) {
            $oOrders->setSqlLimit($iLimit * $iPage, $iLimit);
        }

        //P
        // Lists does not support loading from two tables, so orders
        // articles now are loaded in account_order.php view and no need to use blLoadProdInfo
        // forcing to load product info which is used in templates
        // $oOrders->aSetBeforeAssign['blLoadProdInfo'] = true;

        //loading order for registered user
        if ($this->oxuser__oxregister->value > 1) {
            $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            $sQ = 'select * from oxorder where oxuserid = ' . $oDb->quote($this->getId()) . ' and oxorderdate >= ' . $oDb->quote($this->oxuser__oxregister->value) . ' ';
            $sQ = $this->updateGetOrdersQuery($sQ);

            $sQ .= ' order by oxorderdate desc ';
            $oOrders->selectString($sQ);
        }

        return $oOrders;
    }
254473
public function getFirstImageFromEvenement($idEvenement = 0)
    {
        $fetch=array();

        $reqVerifTri = "
                    SELECT ei.idImage
                    FROM _evenementImage ei
                    WHERE ei.idEvenement = '".$idEvenement."'
                    AND position<>0
        ";

        $resVerifTri = $this->connexionBdd->requete($reqVerifTri);

        if (mysql_num_rows($resVerifTri)>0) {
        // les images ont deja ete triés , on prend celle qui a la plus petite position <>0
            $req = "
                SELECT hi1.idHistoriqueImage as idHistoriqueImage, hi1.dateUpload as dateUpload , hi1.idImage as idImage
                FROM historiqueImage hi2,historiqueImage hi1
                RIGHT JOIN _evenementImage ei1 ON ei1.idEvenement ='".$idEvenement."'
                RIGHT JOIN _evenementImage ei2 ON ei2.idEvenement = ei1.idEvenement
                WHERE hi1.idImage = ei1.idImage
                AND hi2.idImage = hi1.idImage
                AND ei1.position<>'0'
                AND ei2.position<>'0'
                GROUP BY hi1.idImage,ei1.position,hi1.idHistoriqueImage
                HAVING hi1.idHistoriqueImage = max(hi2.idHistoriqueImage) AND ei1.position = min(ei2.position)
                ORDER BY ei1.position ASC
            ";

            $res = $this->connexionBdd->requete($req);

            $fetch = mysql_fetch_assoc($res);
        } else {
            // pas d'image de position differente de zero , on selectionne la derniere ajoutée de l'evenement
            $req = "
                SELECT hi1.idHistoriqueImage as idHistoriqueImage, hi1.dateUpload as dateUpload, hi1.idImage as idImage
                FROM historiqueImage hi2,historiqueImage hi1
                RIGHT JOIN _evenementImage ei1 ON ei1.idEvenement ='".$idEvenement."'
                WHERE hi1.idImage = ei1.idImage
                AND hi2.idImage = hi1.idImage
                GROUP BY hi1.idImage,hi1.idHistoriqueImage
                HAVING hi1.idHistoriqueImage = max(hi2.idHistoriqueImage)
                ORDER BY hi1.idHistoriqueImage
            ";

            $res = $this->connexionBdd->requete($req);

            if (mysql_num_rows($res)==0) {
            // pas d'image pour l'evenement courant, on va en chercher une pour l'adresse courante de l'evenement ( donc dans un evenement de la meme adresse)
                $req = "
                    SELECT hi1.idHistoriqueImage as idHistoriqueImage, hi1.dateUpload as dateUpload,ei1.position as position  , hi1.idImage as idImage
                    FROM historiqueImage hi2,historiqueImage hi1

                    RIGHT JOIN _evenementEvenement ee ON ee.idEvenementAssocie = '".$idEvenement."'
                    LEFT JOIN _evenementEvenement ee2 ON ee2.idEvenement = ee.idEvenement
                    RIGHT JOIN _evenementEvenement ee3 ON ee3.idEvenement = ee2.idEvenementAssocie
                    RIGHT JOIN _evenementImage ei1 ON ei1.idEvenement = ee3.idEvenementAssocie

                    WHERE hi1.idImage = ei1.idImage
                    AND hi2.idImage = hi1.idImage
                    GROUP BY hi1.idImage,hi1.idHistoriqueImage
                    HAVING hi1.idHistoriqueImage = max(hi2.idHistoriqueImage)
                    ORDER BY position, hi1.idHistoriqueImage
                ";

                $res = $this->connexionBdd->requete($req);
                while ($fetchImagesAdresses = mysql_fetch_assoc($res)) {
                    if ($fetchImagesAdresses['position']=='1') {
                        $fetch = $fetchImagesAdresses;
                        break;
                    } else {
                        $fetch = $fetchImagesAdresses;
                    }
                }
            } else {
                $fetch = mysql_fetch_assoc($res);
            }
        }

        return $fetch;
    }
1182128
public static function sortOrder($aItem, $bItem)
    {
        $a = $aItem->get('order');
        $b = $bItem->get('order');

        if ($a == $b) {
            return 0;
        }

        return $a > $b ? 1 : -1;
    }
675249
public function list_participants($currentgroup, $idsonly, $tablesort = false) {
        global $DB, $USER;

        // Get the last known sort order for the grading table.

        if (empty($currentgroup)) {
            $currentgroup = 0;
        }

        $key = $this->context->id . '-' . $currentgroup . '-' . $this->show_only_active_users();
        if (!isset($this->participants[$key])) {
            list($esql, $params) = get_enrolled_sql($this->context, 'mod/assign:submit', $currentgroup,
                    $this->show_only_active_users());

            $fields = 'u.*';
            $orderby = 'u.lastname, u.firstname, u.id';

            $additionaljoins = '';
            $additionalfilters = '';
            $instance = $this->get_instance();
            if (!empty($instance->blindmarking)) {
                $additionaljoins .= " LEFT JOIN {assign_user_mapping} um
                                  ON u.id = um.userid
                                 AND um.assignment = :assignmentid1
                           LEFT JOIN {assign_submission} s
                                  ON u.id = s.userid
                                 AND s.assignment = :assignmentid2
                                 AND s.latest = 1
                        ";
                $params['assignmentid1'] = (int) $instance->id;
                $params['assignmentid2'] = (int) $instance->id;
                $fields .= ', um.id as recordid ';

                // Sort by submission time first, then by um.id to sort reliably by the blind marking id.
                // Note, different DBs have different ordering of NULL values.
                // Therefore we coalesce the current time into the timecreated field, and the max possible integer into
                // the ID field.
                if (empty($tablesort)) {
                    $orderby = "COALESCE(s.timecreated, " . time() . ") ASC, COALESCE(s.id, " . PHP_INT_MAX . ") ASC, um.id ASC";
                }
            }

            if ($instance->markingworkflow &&
                    $instance->markingallocation &&
                    !has_capability('mod/assign:manageallocations', $this->get_context()) &&
                    has_capability('mod/assign:grade', $this->get_context())) {

                $additionaljoins .= ' LEFT JOIN {assign_user_flags} uf
                                     ON u.id = uf.userid
                                     AND uf.assignment = :assignmentid3';

                $params['assignmentid3'] = (int) $instance->id;

                $additionalfilters .= ' AND uf.allocatedmarker = :markerid';
                $params['markerid'] = $USER->id;
            }

            $sql = "SELECT $fields
                      FROM {user} u
                      JOIN ($esql) je ON je.id = u.id
                           $additionaljoins
                     WHERE u.deleted = 0
                           $additionalfilters
                  ORDER BY $orderby";

            $users = $DB->get_records_sql($sql, $params);

            $cm = $this->get_course_module();
            $info = new \core_availability\info_module($cm);
            $users = $info->filter_user_list($users);

            $this->participants[$key] = $users;
        }

        if ($tablesort) {
            // Resort the user list according to the grading table sort and filter settings.
            $sortedfiltereduserids = $this->get_grading_userid_list(true, '');
            $sortedfilteredusers = [];
            foreach ($sortedfiltereduserids as $nextid) {
                $nextid = intval($nextid);
                if (isset($this->participants[$key][$nextid])) {
                    $sortedfilteredusers[$nextid] = $this->participants[$key][$nextid];
                }
            }
            $this->participants[$key] = $sortedfilteredusers;
        }

        if ($idsonly) {
            $idslist = array();
            foreach ($this->participants[$key] as $id => $user) {
                $idslist[$id] = new stdClass();
                $idslist[$id]->id = $id;
            }
            return $idslist;
        }
        return $this->participants[$key];
    }
1052206
public function loadTop5Articles($iLimit = null)
    {
        //has module?
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();

        if (!$myConfig->getConfigParam('bl_perfLoadPriceForAddList')) {
            $this->getBaseObject()->disablePriceLoad();
        }

        switch ($myConfig->getConfigParam('iTop5Mode')) {
            case 0:
                // switched off, do nothing
                break;
            case 1:
                // manually entered
                $this->loadActionArticles('oxtop5', $iLimit);
                break;
            case 2:
                $sArticleTable = getViewName('oxarticles');

                //by default limit 5
                $sLimit = ($iLimit > 0) ? "limit " . $iLimit : 'limit 5';

                $sSelect = "select * from $sArticleTable ";
                $sSelect .= "where " . $this->getBaseObject()->getSqlActiveSnippet() . " and $sArticleTable.oxissearch = 1 ";
                $sSelect .= "and $sArticleTable.oxparentid = '' and $sArticleTable.oxsoldamount>0 ";
                $sSelect .= "order by $sArticleTable.oxsoldamount desc $sLimit";

                $this->selectString($sSelect);
                break;
        }
    }
1200209
public function getIn(
        $whereInKey,
        array $whereIn = [],
        array $with = [],
        string $orderBy = null,
        string $order = 'desc',
        int $limit = 0
    ) {
        $query = $this->make($with);

        $query = $query->whereIn($whereInKey, $whereIn);

        if ($orderBy) {
            $query = $query->orderBy($orderBy, $order);
        }

        if ($limit) {
            $query = $query->take($limit);
        }

        return $query->get();
    }
21624
public function index(ListRequest $request)
    {
        return $this->paginate(
            $this->service->index(
                $request->all(),
                $request->getParams()['limit'],
                [$request->getParams()['order'] => $request->getParams()['sort']],
                ['*'],
                $request->getParams()['page']
            )
        );
    }
1120266
public static function getPersonsFromSource($idSource)
    {
        global $config;
        $req="SELECT idEvenement
            FROM `historiqueEvenement`
            WHERE `idSource` =".$idSource;
        $res = $config->connexionBdd->requete($req);
        $e = new archiEvenement();
        while ($event=mysql_fetch_object($res)) {
            $idEvenementGroupeAdresse = $e->getIdEvenementGroupeAdresseFromIdEvenement($event->idEvenement);
            if ($idPerson=archiPersonne::isPerson($idEvenementGroupeAdresse)) {
                $person= new archiPersonne($idPerson);
                $people[]=$person->getInfosPersonne($idPerson);
            }
        }

        if (isset($people)) {
            $already=array();
            print "<b>Voici la liste des personnes auxquelles cette source est attachée</b>";
            print('<table class="results">');
            foreach ($people as $person) {
                if (!in_array($person['idPersonne'], $already)) {
                    $already[]=$person['idPersonne'];
                    print('<tr class="listAddressItem">
                    <td><a href="'.
                    $config->creerUrl(
                        "",
                        "evenementListe",
                        array("selection"=>"personne", "id"=>$person['idPersonne'])
                    ).'"><img src="'.archiPersonne::getImage($person['idPersonne'], "mini", false).'" border=0 alt=""></a> <span><br/><a href="'.$config->creerUrl(
                        "",
                        "evenementListe",
                        array("selection"=>"personne", "id"=>$person['idPersonne'])
                    ).'" >'.stripslashes($person['prenom']." ".$person['nom']).'</a></span><br/><span style="font-size:11px;">'.$person['nomMetier'].'</span></td>
                    </tr>');
                }
            }
            print('</table>');
        }
    }
982236
public function getBaseSeoLink($iLang, $iPage = 0)
    {
        $oEncoder = \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderRecomm::class);
        if (!$iPage) {
            return $oEncoder->getRecommUrl($this, $iLang);
        }

        return $oEncoder->getRecommPageUrl($this, $iPage, $iLang);
    }
1220506
def ordered(self, ord='desc'):
        """"""
        if ord not in ('asc', 'desc', ):
            raise
        ord_f = getattr(PIDRelation.index, ord)()
        return self.order_by(ord_f)
783634
protected function lastLink(string $ifIssetGet)
    {
        $html = '';

        if ($this->pagination->getCurrentPage() != $this->pagination->getPageEnd()) {
            $points = ($this->pagination->getCurrentPage() < $this->pagination->getNbPages()-($this->pagination->getNumberLinks() + 1))
                    ? '<li class="points"><span>...</span></li>' : '';

            if ($this->pagination->getCssClassP() !== self::CSS_CLASS_BOOTSRPAP) {
                $title = ' title="'.$this->langPagination['last'].'"';
            } else {
                $title = '';
            }

            $href = 'href="?'.self::PAGE_NAME.'='.$this->pagination->getNbPages().''.$ifIssetGet.'"';

            $html .= $points.'<li><a'.$title.' '.$href.'>';
            $html .= $this->pagination->getNbPages();
            $html .= '</a></li>';
        }

        return $html;
    }
1052731
private function getOrderShipment(OrderInterface $order)
    {
        if ($order->getShipment()) {
            return $order->getShipment();
        }

        /** @var ShipmentInterface $shipment */
        $shipment = $this->shipmentFactory->createNew();
        $order->setShipment($shipment);
        $shipment->setMethod($this->defaultShippingMethodResolver->getDefaultShippingMethod($shipment));

        return $shipment;
    }
597509
protected function _getArticleById($sArticleId)
    {
        /** @var \OxidEsales\Eshop\Application\Model\Article $oArticle */
        $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $oArticle->load($sArticleId);
        $iLinkType = $this->getViewParameter('iLinkType');

        if ($this->getViewParameter('inlist')) {
            $oArticle->setInList();
        }
        if ($iLinkType) {
            $oArticle->setLinkType($iLinkType);
        }
        // @deprecated since v5.3 (2016-06-17); Listmania will be moved to an own module.
        if ($oRecommList = $this->getActiveRecommList()) {
            $oArticle->text = $oRecommList->getArtDescription($oArticle->getId());
        }
        // END deprecated

        return $oArticle;
    }
654293
def get_ordering(self, *args, **kwargs):
        """"""
        result = super(SequenceCursorPagination, self).get_ordering(*args, **kwargs)

        # Because paginate_queryset sets self.ordering after reading it...we
        # need to only modify it sometimes. (This allows re-use of the
        # paginator, which probably only happens in tests.)
        if result[0] != '#':
            result = ('#', ) + result

        return result
340585
protected function buildContext(IPaginator $paginator)
    {
        $firstItemNumber = ($paginator->getCurrentPage() - 1) * $paginator->getItemsPerPage();
        $currentItemsCount = $paginator->getCurrentPage() < $paginator->getPagesCount() ? $paginator->getItemsPerPage(
        ) : $paginator->getItemsCount() - $firstItemNumber;

        return [
            'firstPage'         => 1,
            'lastPage'          => $paginator->getPagesCount(),
            'currentPage'       => $paginator->getCurrentPage(),
            'pagesCount'        => $paginator->getPagesCount(),
            'itemsPerPage'      => $paginator->getItemsPerPage(),
            'previousPage'      => ($paginator->getCurrentPage() > 1) ? $paginator->getCurrentPage() - 1 : null,
            'nextPage'          => ($paginator->getCurrentPage() < $paginator->getPagesCount(
                    )) ? $paginator->getCurrentPage() + 1 : null,
            'currentItemsCount' => $currentItemsCount,
            'itemsCount'        => $paginator->getItemsCount(),
            'firstItemNumber'   => $firstItemNumber + 1,
            'lastItemNumber'    => $firstItemNumber + $currentItemsCount
        ];
    }
684652
public static function GetPublishedReviewsForUser($iUserId, $iLanguage = null)
    {
        $sFilter = "`shop_article_review`.`data_extranet_user_id`='".MySqlLegacySupport::getInstance()->real_escape_string($iUserId)."' ";
        $sFilter .= "AND `shop_article_review`.`publish`='1' ";

        $sQuery = self::GetDefaultQuery($iLanguage, $sFilter);
        $oList = &TdbShopArticleReviewList::GetList($sQuery, $iLanguage);

        return $oList;
    }
173350
public function limit($iLimit, $iOffset = null)
	{
		$this->_iLimit = $iLimit;
		$this->_iOffset = $iOffset;
		return $this;
	}