Esempio n. 1
0
 /**
  * Use the board_highlight_period for the "recently" keyword
  *
  * @access private
  * @param  string    $field
  * @return TaskFilter
  */
 private function filterRecentlyDate($field)
 {
     $duration = $this->config->get('board_highlight_period', 0);
     if ($duration > 0) {
         $this->query->gte($field, time() - $duration);
     }
     return $this;
 }
 /**
  * Filter with an operator
  *
  * @access public
  * @param  string    $field
  * @param  string    $value
  * @param  boolean   $is_date
  * @return ActivityFilter
  */
 private function filterWithOperator($field, $value, $is_date)
 {
     $operators = array('<=' => 'lte', '>=' => 'gte', '<' => 'lt', '>' => 'gt');
     foreach ($operators as $operator => $method) {
         if (strpos($value, $operator) === 0) {
             $value = substr($value, strlen($operator));
             $this->query->{$method}($field, $is_date ? $this->dateParser->getTimestampFromIsoFormat($value) : $value);
             return $this;
         }
     }
     if ($is_date) {
         $timestamp = $this->dateParser->getTimestampFromIsoFormat($value);
         $this->query->gte($field, $timestamp);
         $this->query->lte($field, $timestamp + 86399);
     } else {
         $this->query->eq($field, $value);
     }
     return $this;
 }
Esempio n. 3
0
 /**
  * Filter by due date (range)
  *
  * @access public
  * @param  string  $start
  * @param  string  $end
  * @return TaskFilter
  */
 public function filterByDueDateRange($start, $end)
 {
     $this->query->gte('date_due', $this->dateParser->getTimestampFromIsoFormat($start));
     $this->query->lte('date_due', $this->dateParser->getTimestampFromIsoFormat($end));
     return $this;
 }
 /**
  * Common function to return events
  *
  * @access public
  * @param  \PicoDb\Table   $query           PicoDb Query
  * @param  integer         $start           Timestamp of earliest activity
  * @param  integer         $end             Timestamp of latest activity
  * @return array
  */
 private function getEvents(\PicoDb\Table $query, $start, $end)
 {
     if (!is_null($start)) {
         $query->gte('date_creation', $start);
     }
     if (!is_null($end)) {
         $query->lte('date_creation', $end);
     }
     $events = $query->findAll();
     foreach ($events as &$event) {
         $event += $this->decode($event['data']);
         unset($event['data']);
         $event['author'] = $event['author_name'] ?: $event['author_username'];
         $event['event_title'] = $this->getTitle($event);
         $event['event_content'] = $this->getContent($event);
     }
     return $events;
 }