示例#1
0
 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));
 }
示例#2
0
 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");
     }
 }
示例#3
0
 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() . '%||');
     }
 }
示例#4
0
 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");
     }
 }
示例#5
0
 public function __construct(StickyRequest $req = null)
 {
     $u = new \User();
     if ($u->isSuperUser()) {
         $this->ignorePermissions();
     }
     parent::__construct($req);
 }
示例#6
0
 public function __construct(Entity $entity)
 {
     $this->category = $entity->getAttributeKeyCategory();
     $this->entity = $entity;
     parent::__construct(null);
     if ($entity->supportsCustomDisplayOrder()) {
         $this->setItemsPerPage(-1);
         $this->sortByDisplayOrderAscending();
     }
 }
示例#7
0
 public function filterByAttribute(AttributedItemList $list, $value, $comparison = '=')
 {
     $list->filter('ak_' . $this->attributeKey->getAttributeKeyHandle(), $value, $comparison);
 }
示例#8
0
 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%");
     }
 }
示例#9
0
 public function sortByStatus($dir = "asc")
 {
     $this->sortUserStatus = 1;
     parent::sortBy('uStatus', $dir);
 }
示例#10
0
 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%");
     }
 }