Set a new display order for this page (or for another page given its ID).

@param int $displayOrder
@param int|null $cID The page ID to set the display order for (if empty, we'll use this page)
17011
public function updateDisplayOrder($displayOrder, $cID = 0)
    {
        $displayOrder = (int) $displayOrder;

        //this line was added to allow changing the display order of aliases
        if (!intval($cID)) {
            $cID = ($this->getCollectionPointerOriginalID() > 0) ? $this->getCollectionPointerOriginalID() : $this->cID;
        }

        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);

        $oldDisplayOrder = $db->fetchColumn('SELECT cDisplayOrder FROM Pages WHERE cID = ?', [$cID]);

        // Exit out if the display order for this page doesn't change.
        if ($oldDisplayOrder === null || $displayOrder === (int) $oldDisplayOrder) {
            return;
        }

        // Store the new display order.
        $db->executeQuery('update Pages set cDisplayOrder = ? where cID = ?', [$displayOrder, $cID]);

        // Because the display order of another page can be changed,
        // the page object is retrieved first in order to pass it to the event.
        $page = $this;
        if ($cID && (int) $cID !== (int) $this->getCollectionID()) {
            $page = static::getByID($cID);
        }

        if ($page->isError()) {
            return;
        }

        // Fire an event that the page display order has changed.
        $event = new DisplayOrderUpdateEvent($page);
        $event->setOldDisplayOrder($oldDisplayOrder);
        $event->setNewDisplayOrder($displayOrder);
        Events::dispatch('on_page_display_order_update', $event);
    }
782413
public static void orderBy(String orderBy) {
        Page<?> page = getLocalPage();
        if (page != null) {
            page.setOrderBy(orderBy);
        } else {
            page = new Page();
            page.setOrderBy(orderBy);
            page.setOrderByOnly(true);
            setLocalPage(page);
        }
    }
617029
public function channelMove($cid, $pid, $order = null)
  {
    $this->execute("channelmove", array("cid" => $cid, "cpid" => $pid, "order" => $order));
    $this->channelListReset();
  }
707624
public function setOrder(array $order)
    {
        // Check requirements
        if (
            in_array(self::LABEL, $order) === false ||
            in_array(self::COMPONENT, $order) === false ||
            in_array(self::MESSAGE, $order) === false
        ) {
            throw new Doozr_Form_Service_Exception(
                'Alda'
            );
        }

        $this->order = $order;
    }
707300
protected function set_new_sortorder() {
        $search = array('parentid' => $this->get('parentid'), 'competencyframeworkid' => $this->get('competencyframeworkid'));
        $this->raw_set('sortorder', $this->count_records($search));
    }
183602
public function setDisplayName( $displayName )
    {
        if ( empty( $displayName ) )
        {
            $displayName = array();
        }
        else if ( $displayName instanceof Traversable )
        {
            $displayName = ArrayUtils::iteratorToArray( $displayName );
        }
        else if ( ! is_array( $displayName ) )
        {
            $displayName = (array) $displayName;
        }

        if ( ! isset( $displayName[static::FALLBACK_LOCALE] ) )
        {
            reset( $displayName );
            $key = key( $displayName );
            $displayName[static::FALLBACK_LOCALE] = $displayName[$key];
            unset( $displayName[$key] );
        }

        $this->displayName = $displayName;
        return $this;
    }
313562
public function setOrderPInfo($orderPInfo)
    {
        if (!is_array($orderPInfo)) {
            $this->orderPInfo = null;

            return false;
        }
        $this->orderPInfo = $orderPInfo;

        return true;
    }
699645
protected function updateQuantity(ModelOrder $order, $newStatus, EventDispatcherInterface $dispatcher)
    {
        if ($newStatus !== $order->getStatusId()) {
            if (null !== $newStatusModel = OrderStatusQuery::create()->findPk($newStatus)) {
                $operationEvent = new GetStockUpdateOperationOnOrderStatusChangeEvent($order, $newStatusModel);

                $dispatcher->dispatch(
                    TheliaEvents::ORDER_GET_STOCK_UPDATE_OPERATION_ON_ORDER_STATUS_CHANGE,
                    $operationEvent
                );

                if ($operationEvent->getOperation() !== $operationEvent::DO_NOTHING) {
                    $orderProductList = $order->getOrderProducts();

                    /** @var OrderProduct $orderProduct */
                    foreach ($orderProductList as $orderProduct) {
                        $productSaleElementsId = $orderProduct->getProductSaleElementsId();

                        /** @var ProductSaleElements $productSaleElements */
                        if (null !== $productSaleElements = ProductSaleElementsQuery::create()->findPk($productSaleElementsId)) {
                            $offset = 0;

                            if ($operationEvent->getOperation() == $operationEvent::INCREASE_STOCK) {
                                $offset = $orderProduct->getQuantity();
                            } elseif ($operationEvent->getOperation() == $operationEvent::DECREASE_STOCK) {
                                /* Check if we have enough stock */
                                if ($orderProduct->getQuantity() > $productSaleElements->getQuantity() && true === ConfigQuery::checkAvailableStock()) {
                                    throw new TheliaProcessException($productSaleElements->getRef() . " : Not enough stock 2");
                                }

                                $offset = -$orderProduct->getQuantity();
                            }

                            Tlog::getInstance()->addError("Product stock: " . $productSaleElements->getQuantity() . " -> " . ($productSaleElements->getQuantity() + $offset));

                            $productSaleElements
                                ->setQuantity($productSaleElements->getQuantity() + $offset)
                                ->save();
                        }
                    }
                }
            }
        }
    }
1186415
public function setDisplayPayer($displayPayer = true)
    {
        $this->isBool($displayPayer, 'displayPayer');
        $this->displayPayer = $displayPayer;

        return $this;
    }
1361539
protected function _setOrder()
    {
        $order = $this->_sql->getOrder();
        if (!(is_null($order) || empty($order))) {
            $this->_statement .= " ORDER BY {$order}";
        }
        return $this;
    }
464910
protected function setOrderAccountOrder($order_id)
    {
        $this->data_order = $this->order->get($order_id);

        if (empty($this->data_order)) {
            $this->outputHttpStatus(404);
        }

        $this->prepareOrderAccountOrder($this->data_order);
    }
376693
public void setStatusOrder(Status... statusOrder) {
		String[] order = new String[statusOrder.length];
		for (int i = 0; i < statusOrder.length; i++) {
			order[i] = statusOrder[i].getCode();
		}
		setStatusOrder(Arrays.asList(order));
	}
650848
public function setOrder($order)
    {

        if (($order > 5)) {
            throw new \InvalidArgumentException('invalid value for $order when calling GetCharactersCharacterIdPlanetsPlanetIdWaypoint., must be smaller than or equal to 5.');
        }
        if (($order < 1)) {
            throw new \InvalidArgumentException('invalid value for $order when calling GetCharactersCharacterIdPlanetsPlanetIdWaypoint., must be bigger than or equal to 1.');
        }

        $this->container['order'] = $order;

        return $this;
    }
708713
public function indexOrder($order_id)
    {
        $this->setOrder($order_id);
        $this->submitIndexOrder();
        $this->setTitleIndexOrder();
        $this->setBreadcrumbIndexOrder();

        $this->setData('order', $this->data_order);

        $this->setDataPanelLogsIndexOrder();
        $this->setDataPanelSummaryIndexOrder();
        $this->setDataPanelCommentIndexOrder();
        $this->setDataPanelCustomerIndexOrder();
        $this->setDataPanelComponentsIndexOrder();
        $this->setDataPanelPaymentAddressIndexOrder();
        $this->setDataPanelShippingAddressIndexOrder();

        $this->outputIndexOrder();
    }
615893
public function setTemplateId($id, $order = null) {
        if ($order === null) {
            // If no order is provided, append the template ID to the end of the list
            $this->template_ids[] = $id;
        } else {
            $this->template_ids[$order] = $id;
        }
        return $this;
    }
110715
public function setOrder(\Amulen\ShopBundle\Entity\ProductOrder $order = null)
    {
        $this->order = $order;

        return $this;
    }
144939
protected function rescanDisplayOrder()
    {
        $displayOrder = 0;
        $btsID = $this->getBlockTypeSetID();
        $app = Application::getFacadeApplication();
        $db = $app->make(Connection::class);
        $rs = $db->executeQuery('select btID from BlockTypeSetBlockTypes where btsID = ? order by displayOrder asc', [$btsID]);
        while (($btID = $rs->fetchColumn()) !== false) {
            $db->update(
                'BlockTypeSetBlockTypes',
                [
                    'displayOrder' => $displayOrder,
                ],
                [
                    'btID' => $btID,
                    'btsID' => $btsID,
                ]
            );
            ++$displayOrder;
        }
    }