Retrieves all items matching the given criteria.

@param \stdClass $params Associative array containing the parameters
@return array List of associative arrays with item properties, total number of items and success property
330618
public function searchItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site' ) );
		$this->setLocale( $params->site );

		$total = 0;
		$search = $this->initCriteria( $this->getManager()->createSearch(), $params );

		if( isset( $params->domain ) && isset( $params->parentid )
			&& ( !isset( $params->options->showall ) || $params->options->showall == false ) )
		{
			$listManager = \Aimeos\MShop\Factory::createManager( $this->getContext(), $params->domain . '/lists' );
			$criteria = $listManager->createSearch();

			$expr = [];
			$expr[] = $criteria->compare( '==', $params->domain . '.lists.parentid', $params->parentid );
			$expr[] = $criteria->compare( '==', $params->domain . '.lists.domain', 'price' );
			$criteria->setConditions( $criteria->combine( '&&', $expr ) );

			$result = $listManager->searchItems( $criteria );

			$ids = [];
			foreach( $result as $items ) {
				$ids[] = $items->getRefId();
			}

			$expr = [];
			$expr[] = $search->compare( '==', 'price.id', $ids );
			$expr[] = $search->getConditions();
			$search->setConditions( $search->combine( '&&', $expr ) );
		}

		$items = $this->getManager()->searchItems( $search, [], $total );

		return array(
			'items' => $this->toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}
690804
private function filterParameters(array $params): array
    {
        return
            array_filter(
                $params,
                function (&$value) {
                    if (is_array($value)) {
                        $value = $this->filterParameters($value);

                        return count($value) > 0;
                    } else {
                        return !is_null($value);
                    }
                }
            );
    }
194409
public function saveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );

		$ids = [];
		$manager = $this->getManager();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$langid = ( isset( $entry->{'order.base.languageid'} ) ? $entry->{'order.base.languageid'} : null );
			$currencyid = ( isset( $entry->{'order.base.currencyid'} ) ? $entry->{'order.base.currencyid'} : null );

			$this->setLocale( $params->site, $langid, $currencyid );

			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$item = $manager->saveItem( $item );
			$ids[] = $item->getId();
		}

		return $this->getItems( $ids, $this->getPrefix() );
	}
631748
public function saveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$ids = $refIds = [];
		$manager = $this->getManager();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$item = $manager->saveItem( $item );

			$refIds[$item->getDomain()][] = $item->getRefId();
			$ids[] = $item->getId();
		}

		if( isset( $refIds['product'] ) )
		{
			$this->rebuildIndex( (array) $refIds['product'] );
			$this->clearCache( (array) $refIds['product'], 'product' );
		}

		return $this->getItems( $ids, $this->getPrefix() );
	}
1220823
public function search($params)
    {
        $searchResult = $this->getRequest()->request(
            'POST',
            $this->getRequestUrl('searches'),
            $this->getSearchQuery($params)
        );

        return $this->getInputsFromSearchResult($searchResult);
    }
201071
public function search($params)
    {
        $query = Item::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        $query->andFilterWhere([
            'id' => $this->id,
            'user_id' => $this->user_id,
            'parent_id' => $this->parent_id,
            'branch_id' => $this->branch_id,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
            'active' => $this->active,
        ]);

        $query->andFilterWhere(['like', 'parent_class', $this->parent_class])
            ->andFilterWhere(['like', 'content', $this->content]);

        return $dataProvider;
    }
200752
public static function fetch($params) {
        $cache = cache::make('core', 'coursecompletion');

        $key = $params['userid'] . '_' . $params['course'];
        if ($hit = $cache->get($key)) {
            return $hit['value'];
        }

        $tocache = self::fetch_helper('course_completions', __CLASS__, $params);
        $cache->set($key, ['value' => $tocache]);
        return $tocache;
    }
181260
public function insertItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'items' ) );

		$manager = $this->getManager();

		$refId = ( isset( $params->refid ) ? $params->refid : null );
		$parentId = ( ( isset( $params->parentid ) && $params->parentid !== 'root' ) ? $params->parentid : null );
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$manager->insertItem( $item, $parentId, $refId );

			$entry->{'locale.site.id'} = $item->getId();
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}
943253
public function all(array $params = array())
    {
        $endpoint = '/admin/events.json';
        $response = $this->request($endpoint, 'GET', $params);
        return $this->createCollection(Event::class, $response['events']);
    }
1061654
public function all(array $params = array())
    {
        $data = $this->request('/admin/application_credits.json', 'GET', $params);
        return $this->createCollection(ApplicationCredit::class, $data['application_credits']);
    }
794357
public function uploadItem( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'domain' ) );
		$this->setLocale( $params->site );

		$context = $this->getContext();
		$manager = \Aimeos\MShop\Factory::createManager( $context, 'media' );
		$typeManager = \Aimeos\MShop\Factory::createManager( $context, 'media/type' );

		$item = $manager->createItem();
		$item->setTypeId( $typeManager->findItem( 'default', [], 'product' )->getId() );
		$item->setDomain( 'product' );
		$item->setStatus( 1 );

		$file = $this->getUploadedFile();

		\Aimeos\Controller\Common\Media\Factory::createController( $context )->add( $item, $file );
		$item = $manager->saveItem( $item );

		return (object) $item->toArray( true );
	}
447491
public function getTree( stdClass $params )
	{
		$this->_checkParams( $params, array( 'items' ) );

		$manager = $this->_getManager();

		$result = array();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			if( $entry == 'root' )
			{
				$search = $this->_manager->createSearch();
				$search->setConditions( $search->compare( '==', 'locale.site.level', 0 ) );

				$item = $this->_manager->createItem();
				$item->setLabel( 'Root' );

				foreach( $this->_manager->searchItems( $search ) as $siteItem ) {
					$item->addChild( $siteItem );
				}
			}
			else
			{
				$item = $manager->getTree( $entry, array(), MW_Tree_Manager_Abstract::LEVEL_LIST );
			}

			$result[] = $this->_createNodeArray( $item );
		}

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $result ) : $result ),
			'success' => true,
		);
	}
782128
public function getAll($params = [])
    {
        $result = $this->connection()->get($this->getEndpoint(), $params, true);

        return $this->collectionFromResult($result);
    }
729966
public function saveItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$ids = [];
		$manager = $this->getManager();
		$items = ( !is_array( $params->items ) ? array( $params->items ) : $params->items );

		foreach( $items as $entry )
		{
			$item = $manager->createItem();
			$item->fromArray( (array) $this->transformValues( $entry ) );
			$item = $manager->saveItem( $item );
			$ids[] = $item->getId();
		}

		$this->clearCache( $ids );

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', 'service.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );
		$result = $manager->searchItems( $search );

		foreach( $result as $item ) {
			$this->checkConfig( $item );
		}

		$items = $this->toArray( $result );

		return array(
			'items' => ( !is_array( $params->items ) ? reset( $items ) : $items ),
			'success' => true,
		);
	}
1173348
public function deleteItems( \stdClass $params )
	{
		$this->checkParams( $params, array( 'site', 'items' ) );
		$this->setLocale( $params->site );

		$refIds = [];
		$ids = (array) $params->items;
		$manager = $this->getManager();

		$search = $manager->createSearch();
		$search->setConditions( $search->compare( '==', $this->getPrefix() . '.id', $ids ) );
		$search->setSlice( 0, count( $ids ) );

		foreach( $manager->searchItems( $search ) as $item ) {
			$refIds[$item->getDomain()][] = $item->getRefId();
		}

		$manager->deleteItems( $ids );

		if( isset( $refIds['product'] ) )
		{
			$this->rebuildIndex( (array) $refIds['product'] );
			$this->clearCache( (array) $refIds['product'], 'product' );
		}

		return array(
			'items' => $params->items,
			'success' => true,
		);
	}
903226
public function search($params)
    {
        $query = Question::find()->orderBy(['created_at' => SORT_DESC]);

        // add conditions that should always apply here

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            // uncomment the following line if you do not want to return any records when validation fails
            // $query->where('0=1');
            return $dataProvider;
        }

        // grid filtering conditions
        $query->andFilterWhere([
            'id' => $this->id,
            'user_id' => $this->user_id,
            'price' => $this->price,
            'hide' => $this->hide,
            'answers' => $this->answers,
            'views' => $this->views,
            'followers' => $this->followers,
            'collections' => $this->collections,
            'comments' => $this->comments,
            'status' => $this->status,
            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ]);

        $query->andFilterWhere(['like', 'title', $this->title])
            ->andFilterWhere(['like', 'alias', $this->alias])
            ->andFilterWhere(['like', 'content', $this->content]);

        return $dataProvider;
    }
328447
public function searchItems( stdClass $params )
	{
		$manager = $this->_getManager();

		$total = 0;
		$search = $manager->createSearch();

		/** controller/extjs/locale/language/default/showall
		 * Displays all available languages in lists instead of only the used ones
		 *
		 * By default, all available languages are shown in the lists displaying
		 * languages in the administration interface, e.g. in text or media panels.
		 * The content of these lists can be limited to the languages used by the
		 * locales created for a site. This can help editors to manage content
		 * faster.
		 *
		 * @param boolean True for all languages, false for only the ones used by existing locales
		 * @since 2014.03
		 * @category Developer
		 * @category User
		 */
		if( !$this->_getContext()->getConfig()->get( 'controller/extjs/locale/language/default/showall', true ) )
		{
			$localeManager = MShop_Locale_Manager_Factory::createManager( $this->_getContext() );

			$langids = array();
			foreach( $localeManager->searchItems( $localeManager->createSearch() ) as $item ) {
				$langids[] = $item->getLanguageId();
			}

			if( !empty( $langids ) ) {
				$search->setConditions( $search->compare( '==', 'locale.language.id', $langids ) );
			}
		}

		$search = $this->_initCriteria( $search, $params );

		$sort = $search->getSortations();
		$sort[] = $search->sort( '+', 'locale.language.label' );
		$search->setSortations( $sort );

		$items = $this->_getManager()->searchItems( $search, array(), $total );

		return array(
			'items' => $this->_toArray( $items ),
			'total' => $total,
			'success' => true,
		);
	}