Create a list, or update a list.

@param string $list
@param string $list
@param string $type
@param bool $primary
@param array $query
@return array
@link http://docs.sailthru.com/api/list
@link http://docs.sailthru.com/api/query
185117
public function saveList($list, $type = null, $primary = null, $query = [ ], $vars = []) {
        $data = [
            'list' => $list,
            'type' => $type,
            'primary' => $primary ? 1 : 0,
            'query' => $query,
            'vars' => $vars,
        ];
        return $this->apiPost('list', $data);
    }
846160
public function createList($list = null)
    {
        $node = new Item();

        if ($list instanceof Item) {
            $node = $list;
        } elseif ($list instanceof Element) {
            $node->entity->setEntityName($list->entity->getEntityName());
            $node->childNodes->push($list);
        } else {
            if (is_numeric($list)) {
                $node->entity->setEntityName('list-' . $list);
            }

            if (isset($list)) {
                $node->entity->setEntityName($list);
                $node->textContent->push($list);
            }
        }

        $this->pushChildNode($node);

        return $this->childNodes->last();
    }
391414
public function listData($list, $page = 1, $size = 10)
    {
        $reData['totalPages'] = (int)$list->lastPage();
        $reData['totalCount'] = (int)$list->total();
        $reData['page'] = (int)$page;
        $reData['limit'] = (int)$size;
        $reData['count'] = (int)$list->count();

        if ($page == 1) {
            $reData['firstPage'] = true; //是否为首页
            $reData['hasPrePage'] = false; //是否有上一页
            $reData['prePage'] = 0; //上一页的页数
            if ($reData['totalPages'] == 1) {
                $reData['hasNextPage'] = false; //是否有下一页
                $reData['nextPage'] = 0;
            } else {
                $reData['hasNextPage'] = true; //是否有下一页
                $reData['nextPage'] = 2; //下一页的页数
            }
        } else {
            $reData['firstPage'] = false; //是否为首页
            if ($reData['totalPages'] == 1) {
                $reData['hasPrePage'] = false; //是否有上一页
                $reData['hasNextPage'] = false; //是否有下一页
                $reData['prePage'] = 1; //上一页的页数
                $reData['nextPage'] = 0; //下一页的页数
            } elseif ($page < $reData['totalPages']) {
                $reData['hasPrePage'] = true; //是否有上一页
                $reData['hasNextPage'] = true; //是否有下一页
                $reData['prePage'] = $page - 1; //上一页的页数
                $reData['nextPage'] = $page + 1; //下一页的页数
            } else {
                $reData['hasPrePage'] = true; //是否有上一页
                $reData['hasNextPage'] = false; //是否有下一页
                $reData['prePage'] = $page - 1; //上一页的页数
                $reData['nextPage'] = 0; //下一页的页数
            }
        }

        if ($page == $reData['totalPages']) {
            $reData['lastPage'] = true; //是否是最末页
        } else {
            $reData['lastPage'] = false; //是否是最末页
        }

        $reData['data'] = $list->toArray()['data'];

        return $reData;
    }
788672
public function findInListByEmail(MailingList $list, $email)
    {
        return $this->createQueryBuilder('s')
            ->innerjoin('s.mailingList', 'm')
            ->andWhere('m.id = :list_id')
            ->andWhere('s.email = :email')
            ->setParameters([
                'list_id'   => $list->getId(),
                'email'     => $email,
            ])
            ->getQuery()
            ->getOneOrNullResult();
    }
182976
public function listData($query = false, $type = self::TYPE_LEADS)
	{
		$type 		= $this->amoType($type);
		if ($query != false) {
			$query = '?' . http_build_query($query);
		}
		$link			= 'https://' . $this->subdomain . '.amocrm.ru/private/api/v2/json/' . $type . '/list'. $query;
		$postFields = false;
		$result 		= $this->useCurl($link, $postFields, self::HTTP_HEADER);
		return json_decode($result);
	}
1190806
public function import($list)
    {
        if (!is_array($list) && !($list instanceof Iterator)) {
            throw new InvalidArgumentException("Expected a list of properties and types");
        }

        foreach ($list as $name => $type) {
            $this->add($name, $type);
        }

        return $this;
    }
167412
public function updateList(DataList &$list)
    {
        /** @var DataObject $singleton */
        $singleton = Injector::inst()->get($list->dataClass());
        $locale = $list->dataQuery()->getQueryParam('Fluent.Locale') ?: FluentState::singleton()->getLocale();
        if (!$singleton->hasExtension(FluentExtension::class)
            || !$singleton->hasField('SourceLocale')
            || !$locale
        ) {
            return;
        }

        $locale = FluentState::singleton()->getLocale();

        $query = $list->dataQuery();
        $query->having(['"SourceLocale" = ?' => $locale]);

        $list = $list->setDataQuery($query);
    }
591567
public function createList($list = null)
    {
        $node = new Item();

        if ($list instanceof Item) {
            $node = $list;
        } elseif ($list instanceof Element) {
            $node->entity->setEntityName($list->entity->getEntityName());

            if ($list instanceof Dropdown) {
                $list = clone $list;
                $node->attributes->addAttributeClass('dropdown');

                $list->toggle->tagName = 'a';
                $list->toggle->attributes->remove('type');
                $list->toggle->attributes->removeAttributeClass(['btn', 'btn-*']);
                $list->toggle->attributes->addAttribute('role', 'button');

                $node->childNodes->push($list->toggle);
                $node->childNodes->push($list->menu);
            } else {
                $node->childNodes->push($list);
            }

        } else {
            if (is_numeric($list)) {
                $node->entity->setEntityName('list-' . $list);
            } else {
                $node->entity->setEntityName($list);
            }
            $node->textContent->push($list);
        }

        $node->attributes->addAttributeClass('nav-item');
        $node->attributes->addAttribute('role', 'presentation');

        $this->pushChildNode($node);

        return $this->childNodes->last();
    }
1096378
protected function list_folders_update(&$result, $type = null)
    {
        $namespace = $this->get_namespace();
        $search    = array();

        // build list of namespace prefixes
        foreach ((array)$namespace as $ns) {
            if (is_array($ns)) {
                foreach ($ns as $ns_data) {
                    if (strlen($ns_data[0])) {
                        $search[] = $ns_data[0];
                    }
                }
            }
        }

        if (!empty($search)) {
            // go through all folders detecting namespace usage
            foreach ($result as $folder) {
                foreach ($search as $idx => $prefix) {
                    if (strpos($folder, $prefix) === 0) {
                        unset($search[$idx]);
                    }
                }
                if (empty($search)) {
                    break;
                }
            }

            // get folders in hidden namespaces and add to the result
            foreach ($search as $prefix) {
                if ($type == 'ext-subscribed') {
                    $list = $this->conn->listMailboxes('', $prefix . '*', null, array('SUBSCRIBED'));
                }
                else if ($type == 'subscribed') {
                    $list = $this->conn->listSubscribed('', $prefix . '*');
                }
                else {
                    $list = $this->conn->listMailboxes('', $prefix . '*');
                }

                if (!empty($list)) {
                    $result = array_merge($result, $list);
                }
            }
        }
    }
712800
public function setPrefetch(SS_List $list) {
		if(!$list instanceof SS_List) {
			throw new Exception('Prefetch list must be an instance of SS_List');
		}

		$this->prefetch = $list;

		return $this;
	}
161642
public void executeQueriesList(List<String> queriesList) {

        for (String query : queriesList) {
            this.session.execute(query);
        }
    }
516880
public function beforeFind(Event $event, Query $query, ArrayObject $options, $primary)
    {
        $field = $this->getTrashField();
        $addCondition = true;

        $query->traverseExpressions(function ($expression) use (&$addCondition, $field) {
            if (!$addCondition) {
                return;
            }

            if ($expression instanceof IdentifierExpression
                && $expression->getIdentifier() === $field
            ) {
                $addCondition = false;

                return;
            }

            if (($expression instanceof Comparison || $expression instanceof BetweenExpression)
                && $expression->getField() === $field
            ) {
                $addCondition = false;
            }
        });

        if ($addCondition) {
            $query->andWhere($query->newExpr()->isNull($field));
        }
    }
279513
public function prepareList()
    {
        $this->setRequestParameters();

        $this->setPerPage();

        $this->setCurrentPage();

        $this->setTotalCount();

        $this->setPagination();

        $this->setQueryOrder();

        $this->setQueryOffset();

        $this->setResultRows();

        $this->setFinalParameters();
    }
1147309
public function route($route, $query = [], $type = MainRouter::TYPE_PATH)
    {
        $this->route = [
            'route' => $route,
            'query' => (array) $query,
            'type' => $type,
        ];

        return $this;
    }
1032892
protected function execList()
    {
        //check if parent primary key is into route
        if(!empty($this->ancestors)) {
            end($this->ancestors);
            $parentPrimaryKey = current($this->ancestors);
        } else {
            $parentPrimaryKey = [];
        }
        //get records
        $this->templateParameters['records'] = $this->get($parentPrimaryKey);
        // form translations
        $this->loadTranslations('list', sprintf('private/global/locales/%s/list.ini', LANGUAGE));
        //get table filter
        $this->templateParameters['table_filter'] = [];
        $this->templateParameters['table_filter']['field'] = $this->cookies->get(sprintf('table_filter_%s_field', $this->name));
        $this->templateParameters['table_filter']['input'] = $this->cookies->get(sprintf('table_filter_%s_input', $this->name));
        //render
        $this->renderTemplate();
    }
1014697
public function createList(MailingList $list)
		{
			$form_data = array(
				'list_name'    => $list->getListName(),
				'description'  => $list->getDescription(),
				'template_id'  => $list->getTemplate(),
				'from'         => $list->getFromAddress(),
				'reply_to'     => $list->getReplyToAddress(),
				'errors_to'    => $list->getBounceAddress(),
				'track_clicks' => $list->isTrackClicks(),
				'track_opens'  => $list->isTrackOpens(),
				'folder_id'    => $list->getFolderId()
			);
			$this->call('createlist', $form_data);

			return TRUE;
		}
737740
public function listToMap(array $list)
    {
        $map = array();
        for ($i = 0, $n = count($list); $i < $n; $i += 2) {
            $map[$list[$i]] = $list[$i + 1];
        }
        return (object)$map;
    }