public function setBasicCriteria(array $archives, $sorting = null)
    {
        $archives = $this->parseIds($archives);

        if (0 === \count($archives)) {
            throw new NoNewsException();
        }

        $t = $this->getNewsModelAdapter()->getTable();

        $this->columns[] = "$t.pid IN(".\implode(',', \array_map('intval', $archives)).')';

        // Set the sorting
        switch ($sorting) {
            case 'order_headline_asc':
                $this->options['order'] = "$t.headline";
                break;
            case 'order_headline_desc':
                $this->options['order'] = "$t.headline DESC";
                break;
            case 'order_random':
                $this->options['order'] = 'RAND()';
                break;
            case 'order_date_asc':
                $this->options['order'] = "$t.date";
                break;
            default:
                $this->options['order'] = "$t.date DESC";
                break;
        }

        // Never return unpublished elements in the back end, so they don't end up in the RSS feed
        if (!BE_USER_LOGGED_IN || TL_MODE === 'BE') {
            /** @var Date $dateAdapter */
            $dateAdapter = $this->framework->getAdapter(Date::class);

            $time = $dateAdapter->floorToMinute();
            $this->columns[] = "($t.start=? OR $t.start<=?) AND ($t.stop=? OR $t.stop>?) AND $t.published=?";
            $this->values = \array_merge($this->values, ['', $time, '', ($time + 60), 1]);
        }
    }
public function setBasicCriteria(array $archives, $sorting = null)
    {
        $archives = $this->parseIds($archives);

        if (0 === \count($archives)) {
            throw new NoNewsException();
        }

        $t = $this->getNewsModelAdapter()->getTable();

        $this->columns[] = "$t.pid IN(".\implode(',', \array_map('intval', $archives)).')';

        // Set the sorting
        switch ($sorting) {
            case 'order_headline_asc':
                $this->options['order'] = "$t.headline";
                break;
            case 'order_headline_desc':
                $this->options['order'] = "$t.headline DESC";
                break;
            case 'order_random':
                $this->options['order'] = 'RAND()';
                break;
            case 'order_date_asc':
                $this->options['order'] = "$t.date";
                break;
            default:
                $this->options['order'] = "$t.date DESC";
                break;
        }

        // Never return unpublished elements in the back end, so they don't end up in the RSS feed
        if (!BE_USER_LOGGED_IN || TL_MODE === 'BE') {
            /** @var Date $dateAdapter */
            $dateAdapter = $this->framework->getAdapter(Date::class);

            $time = $dateAdapter->floorToMinute();
            $this->columns[] = "($t.start=? OR $t.start<=?) AND ($t.stop=? OR $t.stop>?) AND $t.published=?";
            $this->values = \array_merge($this->values, ['', $time, '', ($time + 60), 1]);
        }
    }
public function setBasicCriteria ( array $ archives , $ sorting = null ) { $ archives = $ this -> parseIds ( $ archives ) ; if ( 0 === \ count ( $ archives ) ) { throw new NoNewsException ( ) ; } $ t = $ this -> getNewsModelAdapter ( ) -> getTable ( ) ; $ this -> columns [ ] = "$t.pid IN(" . \ implode ( ',' , \ array_map ( 'intval' , $ archives ) ) . ')' ; // Set the sorting switch ( $ sorting ) { case 'order_headline_asc' : $ this -> options [ 'order' ] = "$t.headline" ; break ; case 'order_headline_desc' : $ this -> options [ 'order' ] = "$t.headline DESC" ; break ; case 'order_random' : $ this -> options [ 'order' ] = 'RAND()' ; break ; case 'order_date_asc' : $ this -> options [ 'order' ] = "$t.date" ; break ; default : $ this -> options [ 'order' ] = "$t.date DESC" ; break ; } // Never return unpublished elements in the back end, so they don't end up in the RSS feed if ( ! BE_USER_LOGGED_IN || TL_MODE === 'BE' ) { /** @var Date $dateAdapter */ $ dateAdapter = $ this -> framework -> getAdapter ( Date :: class ) ; $ time = $ dateAdapter -> floorToMinute ( ) ; $ this -> columns [ ] = "($t.start=? OR $t.start<=?) AND ($t.stop=? OR $t.stop>?) AND $t.published=?" ; $ this -> values = \ array_merge ( $ this -> values , [ '' , $ time , '' , ( $ time + 60 ) , 1 ] ) ; } }
Set the basic criteria.

@param array  $archives
@param string $sorting

@throws NoNewsException
Set the basic criteria .