Esempio n. 1
0
 public function getCompletedFeaturesCount($userId, array $features)
 {
     if (empty($userId) || count($features) === 0) {
         return NULL;
     }
     $perDay = OW::getConfig()->getValue('profileprogressbar', 'per_day');
     $example = new OW_Example();
     $example->andFieldEqual(self::USER_ID, $userId);
     $example->andFieldInArray(self::ENTITY_TYPE, $features);
     $example->andFieldBetween(self::TIME_STAMP, strtotime("-{$perDay} day"), time());
     return $this->countByExample($example);
 }
Esempio n. 2
0
 public function countUserPostByPeriod($id, $lb, $ub)
 {
     $ex = new OW_Example();
     $ex->andFieldEqual('authorId', $id);
     $ex->andFieldBetween('timestamp', $lb, $ub);
     $ex->andFieldEqual('isDraft', 0);
     $ex->setOrder('`timestamp` DESC');
     return $this->countByExample($ex);
 }
Esempio n. 3
0
 /**
  * @param OW_Example$example
  * @param array $params
  */
 private function applyDatesBetweenFilter(OW_Example $example, $params)
 {
     if (isset($params['start'], $params['end'])) {
         $start = $params['start'];
         $end = $params['end'];
         if (!is_null($start) && !is_null($end)) {
             $example->andFieldBetween('addDatetime', $start, $end);
         }
     }
 }