Sets the is_sortable variable to the given boolean, sort_default_column to
the given string, and the sort_default_order to the given integer.
@param bool $bool
@param string $defaultcolumn
@param int $defaultorder
@return void
3414
function sortable($bool, $defaultcolumn = NULL, $defaultorder = SORT_ASC) {
        $this->is_sortable = $bool;
        $this->sort_default_column = $defaultcolumn;
        $this->sort_default_order  = $defaultorder;
    }
298217
public function setDefault($column, $value)
    {
        $defaults = $this->getDefaults();

        if(isset($defaults[$column])) {
            $this->_defaults[$column] = $value;
        }

        return $this;
    }
193447
boolean handleSortOrder(final List<SortMeta> sortOrder) {
		boolean changed = false;

		if (sortOrder == null) {
			if (multiSortBy != null) {
				adaptee.clearSorting();
				multiSortBy = null;
				lastSorting = null;
				changed = true;
			}
		} else {
			final List<SortProperty> newSorting = convert2SortProperty(sortOrder);
			if (!newSorting.equals(lastSorting)) {
				adaptee.setSorting(newSorting);
				multiSortBy = sortOrder;
				lastSorting = newSorting;
				changed = true;
			}
		}

		return changed;
	}
1182355
public static function setSimpleBooleanFields(
        array $fields,
        ClassMetadataBuilder $builder,
        $default = null
    ): void {
        if (null !== $default && !\is_bool($default)) {
            throw new \InvalidArgumentException(
                'Invalid default value ' . $default
                . ' with type ' . self::getType($default)
            );
        }
        foreach ($fields as $field) {
            $fieldBuilder = new FieldBuilder(
                $builder,
                [
                    'fieldName' => $field,
                    'type'      => Type::BOOLEAN,
                    'default'   => $default,
                ]
            );
            $fieldBuilder
                ->columnName(self::getColumnNameForField($field))
                ->nullable(null === $default)
                ->build();
        }
    }
730877
public function defaultCommand(bool $yes = false, bool $keepDb = false) : void
    {
        if ($this->defaultPreset === null || $this->defaultPreset === '') {
            $this->renderLine('There is no default preset configured!');
            $this->quit(1);
        }

        $this->presetCommand($this->defaultPreset, $yes, $keepDb);
    }
389416
public function setOrderPType($orderPType)
    {
        if (!is_array($orderPType)) {
            $this->orderPType = null;

            return false;
        }
        $isValid = true;
        $index = 0;
        while ($isValid && $index < count($orderPType)) {
            if (!in_array($orderPType[$index], array('GROSS', 'NET'))) {
                $isValid = false;
            } else {
                $isValid = true;
            }
            $index++;
        }
        if (!$isValid) {
            $this->orderPType = null;

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

        return true;
    }
1121468
private function _checkSwitchDefaultOrder() {
		if ($this->_isActive('switchDefaultOrder')) {
			if ($this->statementStack->getCurrentStackItem()->switchHasDefault) {
				// The default flag is already set, it means that a previous case case a default
				$this->_writeError('switchDefaultOrder', $this->_getMessage('SWITCH_DEFAULT_ORDER'));
			}
		}
	}
1273286
public static function getOrder($sort, $allowField, $mapped = [], $defaultOrder = '')
    {
        $order = $defaultOrder;
        if ($sort) {
            $orders = [];
            $sortData = json_decode($sort, true);
            foreach ($sortData as $item) {
                if (!empty($item) && isset($item['property']) && isset($item['direction'])) {
                    $fieldName = $item['property'];
                    if (isset($mapped[$fieldName])) {
                        $fieldName = $mapped[$fieldName];
                    }
                    if (in_array($fieldName, $allowField)) {
                        $order = $fieldName;
                        if ('DESC' == $item['direction']) {
                            $order .= ' DESC';
                        } else {
                            $order .= ' ASC';
                        }
                        $orders[] = $order;
                    }
                }
            }
            if ($orders) {
                $order = join(',', $orders);
            }
        }

        return $order;
    }
874880
public void setSortedColumn(String sortedColumn) throws CmsIllegalArgumentException {

        // check if the parameter is valid
        if ((getMetadata().getColumnDefinition(sortedColumn) == null)
            || !getMetadata().getColumnDefinition(sortedColumn).isSorteable()) {
            return;
        }
        // reset view
        setCurrentPage(1);
        // only reverse order if the column to sort is already sorted
        if (sortedColumn.equals(m_sortedColumn)) {
            if (m_currentSortOrder == CmsListOrderEnum.ORDER_ASCENDING) {
                m_currentSortOrder = CmsListOrderEnum.ORDER_DESCENDING;
            } else {
                m_currentSortOrder = CmsListOrderEnum.ORDER_ASCENDING;
            }
            if (!m_metadata.isSelfManaged()) {
                if (m_filteredItems == null) {
                    m_filteredItems = new ArrayList<CmsListItem>(getAllContent());
                }
                Collections.reverse(m_filteredItems);
            }
            return;
        }
        // sort new column
        m_sortedColumn = sortedColumn;
        m_currentSortOrder = CmsListOrderEnum.ORDER_ASCENDING;
        if (!m_metadata.isSelfManaged()) {
            if (m_filteredItems == null) {
                m_filteredItems = new ArrayList<CmsListItem>(getAllContent());
            }
            I_CmsListItemComparator c = getMetadata().getColumnDefinition(sortedColumn).getListItemComparator();
            Collections.sort(m_filteredItems, c.getComparator(sortedColumn, getWp().getLocale()));
        }
    }
225252
public void setSortOrder(final java.lang.String sortOrder) {
        // when updating, make sure we store off the original so it may be
        // restored
        final String orig = (String) getStateHelper().get(PropertyKeys.origSortOrder);
        if (orig == null) {
            // do not call getSortOrder as it defaults to ascending, we want
            // null
            // if this is the first call and there is no previous value.
            getStateHelper().put(PropertyKeys.origSortOrder, getStateHelper().eval(PropertyKeys.sortOrder));
        }
        getStateHelper().put(PropertyKeys.sortOrder, sortOrder);
    }
408800
protected function updateDefaultListable(array $contentTypeDefaultListable)
    {
        $defaultListable = $this->getDefaultListableColumns();

        $toKeep = array_intersect_key($contentTypeDefaultListable, $defaultListable);
        $toAdd = array_diff_key($defaultListable, $toKeep);

        return array_merge($toKeep, $toAdd);
    }
1128318
public function setDefaultValue($defaultValue)
    {
        if (!$defaultValue instanceof ColumnDefaultValue) {
            $defaultValue = new ColumnDefaultValue($defaultValue, ColumnDefaultValue::TYPE_VALUE);
        }

        $this->domain->setDefaultValue($defaultValue);
    }
757950
public function setDados($dados = null, $default)
    {
        if (!empty($dados)) {
            if (!$default)
                $default = json_decode(file_get_contents(PATH_HOME . VENDOR . "entity-form/public/entity/input_type.json"), true)['default'];

            foreach (array_replace_recursive($default, $dados) as $dado => $value) {
                switch ($dado) {
                    case 'id':
                        $this->setId($value);
                        break;
                    case 'allow':
                        $this->setAllow($value);
                        break;
                    case 'column':
                        $this->setColumn($value);
                        break;
                    case 'default':
                        $this->setDefault($value);
                        break;
                    case 'update':
                        $this->setUpdate($value);
                        break;
                    case 'filter':
                        $this->setFilter($value);
                        break;
                    case 'form':
                        $this->setForm($value);
                        break;
                    case 'datagrid':
                        $this->setDatagrid($value);
                        break;
                    case 'format':
                        $this->setFormat($value);
                        break;
                    case 'key':
                        $this->setKey($value);
                        break;
                    case 'indice':
                        $this->setIndice($value);
                        break;
                    case 'group':
                        $this->setGroup($value);
                        break;
                    case 'nome':
                        $this->setNome($value);
                        break;
                    case 'relation':
                        $this->setRelation($value);
                        break;
                    case 'select':
                        $this->setSelect($value);
                        break;
                    case 'size':
                        $this->setSize($value);
                        break;
                    case 'type':
                        $this->setType($value);
                        break;
                    case 'unique':
                        $this->setUnique($value);
                        break;
                    case 'value':
                        $this->setValue($value);
                        break;
                }
            }
        }
    }
459346
public function setOrderVer($orderVer)
    {
        if (!is_array($orderVer)) {
            $this->orderVer = null;

            return false;
        }
        $isValid = true;
        $index = 0;
        while ($isValid && $index < count($orderVer)) {
            if (settype($orderVer[$index], "string")) {
                if (strlen($orderVer[$index]) < 51) {
                    $isValid = true;
                } else {
                    $isValid = false;
                }
            } else {
                $isValid = false;
            }
            $index++;
        }
        if (!$isValid) {
            $this->orderVer = null;

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

        return true;
    }
1347325
private function setQueryOrder()
    {
        if ($this->hasInput('column_orders'))
        {
            // before we process the order, we need to check if
            // single order is set.
            // and remove other column_orders keys and method except for the single order
            // specified.
            if ($this->hasInput('single_order') && isset($this->columns[$this->getInput('single_order')]))
            {
                // single_order might empty
                $single_order = $this->getInput('single_order');

                if ( ! empty($single_order))
                {
                    foreach ($this->requestParameters['column_orders'] as $key => $value)
                    {
                        if ($key != $single_order)
                        {
                            unset($this->requestParameters['column_orders'][$key]);
                        }
                    }
                }
            }

            // overide default column_orders keys and methods
            $column_orders_input = $this->getInput('column_orders');
            if (!empty($column_orders_input) && is_array($column_orders_input))
            {
                // $input_orders method
                foreach ($column_orders_input as $order_by => $order_method)
                {
                    if (!array_key_exists($order_by, $this->columns))
                    {
                        unset($column_orders_input[$order_by]);
                    }
                    else
                    {
                        if (!is_string($order_method) || !in_array($order_method, array('asc', 'desc')))
                        {
                            $column_orders_input[$order_by] = 'asc';
                        }
                    }
                }

                // override default order
                $this->columnOrders = $column_orders_input;
            }
        }

        // load default column_orders
        // no need to perform validation since
        // tblist assumes that it is a system generated data
        // not user generated data.
        foreach ($this->columnOrders as $column_key => $order_method)
        {
            // just set the default order query string
            // just like: order by column_name desc
            $table_column = $this->getColumnOption($column_key, self::COLUMN_OPTION_TABLE_COLUMN, $column_key);
            $this->query->orderBy($table_column, $order_method);
        }
    }
107183
protected function setSortingOrder()
    {
        if (null !== $this->info->list->default_sort) {
            return $this;
        }

        if ($this->info->list->orderable && $this->info->list->getOrderableColumn()) {
            $this->info->list->default_sort = $this->info->list->getOrderableColumn();
        } elseif ($this->info->timestamps) {
            $this->info->list->default_sort = $this->info->timestamp_created;
        } elseif ($this->info->incrementing) {
            $this->info->list->default_sort = $this->model->getKeyName();
        }

        return $this;
    }
514920
public static function getOrderDirection($orderName, $defaultOrder = 'ASC')
    {
        $order = ORDER_DIRECTION[$defaultOrder];

        if (StringHelper::startsWith($orderName, '-')) {
            return [str_replace('-', '', $orderName), $order[1]];
        }

        return [$orderName, $order[0]];
    }