This repository has been archived on 2025-02-26. You can view files and clone it, but cannot push or open issues or pull requests.
szurubooru/src/Models/SearchParsers/UserSearchParser.php
2014-02-28 20:44:35 +01:00

32 lines
748 B
PHP

<?php
use \Chibi\Sql as Sql;
class UserSearchParser extends AbstractSearchParser
{
protected function processSimpleToken($value, $neg)
{
if ($neg)
return false;
if ($value == 'pending')
{
$this->statement->setCriterion((new Sql\DisjunctionFunctor)
->add(new Sql\IsFunctor('staff_confirmed', new Sql\NullFunctor()))
->add(new Sql\EqualsFunctor('staff_confirmed', '0')));
return true;
}
return false;
}
protected function processOrderToken($orderByString, $orderDir)
{
if ($orderByString == 'alpha')
$this->statement->setOrderBy(new Sql\NoCaseFunctor('name'), $orderDir);
elseif ($orderByString == 'date')
$this->statement->setOrderBy('join_date', $orderDir);
else
return false;
return true;
}
}