public function filterByAttribute(AttributedItemList $list, $value, $comparison = '=') { if (is_array($value)) { $topics = $value; } else { $topics = array($value); } $i = 1; $expressions = array(); $qb = $list->getQueryObject(); foreach ($topics as $value) { if ($value instanceof TreeNode) { $topic = $value; } else { $topic = Node::getByID(intval($value)); } if (is_object($topic) && $topic instanceof \Concrete\Core\Tree\Node\Type\Topic) { $column = 'ak_' . $this->attributeKey->getAttributeKeyHandle(); $expressions[] = $qb->expr()->like($column, ':topicPath' . $i); $qb->setParameter('topicPath' . $i, "%||" . $topic->getTreeNodeDisplayPath() . '%||'); } $i++; } $expr = $qb->expr(); $qb->andWhere(call_user_func_array(array($expr, 'orX'), $expressions)); }
public function filterByAttribute(AttributedItemList $list, $boolean) { $qb = $list->getQueryObject(); $column = sprintf('ak_%s', $this->attributeKey->getAttributeKeyHandle()); if ($boolean) { $qb->andWhere("{$column} = 1"); } else { $qb->andWhere("{$column} <> 1 or {$column} is null"); } }
public function filterByAttribute(AttributedItemList $list, $value, $comparison = '=') { if ($value instanceof TreeNode) { $topic = $value; } else { $topic = Node::getByID(intval($value)); } if (is_object($topic) && $topic instanceof \Concrete\Core\Tree\Node\Type\Topic) { $column = 'ak_' . $this->attributeKey->getAttributeKeyHandle(); $qb = $list->getQueryObject(); $qb->andWhere($qb->expr()->like($column, ':topicPath')); $qb->setParameter('topicPath', "%||" . $topic->getTreeNodeDisplayPath() . '%||'); } }
public function filterByAttribute(AttributedItemList $list, $boolean, $comparison = '=') { $qb = $list->getQueryObject(); $column = sprintf('ak_%s', $this->attributeKey->getAttributeKeyHandle()); switch ($comparison) { case '<>': case '!=': $boolean = $boolean ? false : true; break; } if ($boolean) { $qb->andWhere("{$column} = 1"); } else { $qb->andWhere("{$column} <> 1 or {$column} is null"); } }
public function __construct(StickyRequest $req = null) { $u = new \User(); if ($u->isSuperUser()) { $this->ignorePermissions(); } parent::__construct($req); }
public function __construct(Entity $entity) { $this->category = $entity->getAttributeKeyCategory(); $this->entity = $entity; parent::__construct(null); if ($entity->supportsCustomDisplayOrder()) { $this->setItemsPerPage(-1); $this->sortByDisplayOrderAscending(); } }
public function filterByAttribute(AttributedItemList $list, $value, $comparison = '=') { $list->filter('ak_' . $this->attributeKey->getAttributeKeyHandle(), $value, $comparison); }
public function filterByAttribute(AttributedItemList $list, $value, $comparison = '=') { $em = \Database::connection()->getEntityManager(); if ($value instanceof SelectValueOption) { $option = $value; } else { $option = $em->getRepository('\\Concrete\\Core\\Entity\\Attribute\\Value\\Value\\SelectValueOption')->findOneByValue($value); } if (is_object($option)) { $column = 'ak_' . $this->attributeKey->getAttributeKeyHandle(); $qb = $list->getQueryObject(); $qb->andWhere($comparison === '!=' || $comparison === '<>' ? $qb->expr()->notLike($column, ':optionValue_' . $this->attributeKey->getAttributeKeyID()) : $qb->expr()->like($column, ':optionValue_' . $this->attributeKey->getAttributeKeyID())); $qb->setParameter('optionValue_' . $this->attributeKey->getAttributeKeyID(), "%\n" . $option->getSelectAttributeOptionValue(false) . "\n%"); } }
public function sortByStatus($dir = "asc") { $this->sortUserStatus = 1; parent::sortBy('uStatus', $dir); }
public function filterByAttribute(AttributedItemList $list, $value, $comparison = '=') { if ($value instanceof Option) { $option = $value; } else { $option = Option::getByValue($value); } if (is_object($option)) { $column = 'ak_' . $this->attributeKey->getAttributeKeyHandle(); $qb = $list->getQueryObject(); $qb->andWhere($qb->expr()->like($column, ':optionValue')); $qb->setParameter('optionValue', "%\n" . $option->getSelectAttributeOptionValue() . "\n%"); } }