summaryrefslogtreecommitdiff
path: root/app/Helper/ProjectActivityHelper.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-04-10 15:18:20 -0400
committerFrederic Guillot <fred@kanboard.net>2016-04-10 15:18:20 -0400
commit9f0166502b8b8886156bcb4ad0497cd9ee5a60b2 (patch)
tree425f829d3ace03eec5cbcaddf667d752046d75c6 /app/Helper/ProjectActivityHelper.php
parent2eadfb22912d94e76a479b694070735fbb0298f1 (diff)
Added search in activity stream
Diffstat (limited to 'app/Helper/ProjectActivityHelper.php')
-rw-r--r--app/Helper/ProjectActivityHelper.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/app/Helper/ProjectActivityHelper.php b/app/Helper/ProjectActivityHelper.php
index 738fec66..0638a978 100644
--- a/app/Helper/ProjectActivityHelper.php
+++ b/app/Helper/ProjectActivityHelper.php
@@ -18,6 +18,33 @@ use Kanboard\Model\ProjectActivity;
class ProjectActivityHelper extends Base
{
/**
+ * Search events
+ *
+ * @access public
+ * @param string $search
+ * @return array
+ */
+ public function searchEvents($search)
+ {
+ $projects = $this->projectUserRole->getProjectsByUser($this->userSession->getId());
+ $events = array();
+
+ if ($search !== '') {
+ $queryBuilder = $this->projectActivityLexer->build($search);
+ $queryBuilder
+ ->withFilter(new ProjectActivityProjectIdsFilter(array_keys($projects)))
+ ->getQuery()
+ ->desc(ProjectActivity::TABLE.'.id')
+ ->limit(500)
+ ;
+
+ $events = $queryBuilder->format(new ProjectActivityEventFormatter($this->container));
+ }
+
+ return $events;
+ }
+
+ /**
* Get project activity events
*
* @access public