|
<?php |
|
|
|
namespace Kanboard\Filter; |
|
|
|
use Kanboard\Core\Filter\FilterInterface; |
|
use Kanboard\Model\ProjectModel; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ProjectTypeFilter extends BaseFilter implements FilterInterface |
|
{ |
|
|
|
|
|
|
|
|
|
|
|
|
|
public function getAttributes() |
|
{ |
|
return array('type'); |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function apply() |
|
{ |
|
if (is_int($this->value) || ctype_digit((string) $this->value)) { |
|
$this->query->eq(ProjectModel::TABLE.'.is_private', $this->value); |
|
} elseif ($this->value === 'private') { |
|
$this->query->eq(ProjectModel::TABLE.'.is_private', ProjectModel::TYPE_PRIVATE); |
|
} else { |
|
$this->query->eq(ProjectModel::TABLE.'.is_private', ProjectModel::TYPE_TEAM); |
|
} |
|
|
|
return $this; |
|
} |
|
} |
|
|